* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f5f5f5; color: #333; line-height: 1.6; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* 登录页广告语 */
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 12px 0;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.navbar .container { display: flex; justify-content: space-between; align-items: center; }
.logo { color: #fff; font-size: 18px; font-weight: bold; text-decoration: none; white-space: nowrap; display: flex; align-items: center; }
.logo-img { height: 36px; width: auto; display: block; }

/* 跑马灯文字 */
.marquee-wrap {
    flex: 1; overflow: hidden; margin: 0 12px; position: relative; display: flex; align-items: center;
}
.marquee-text {
    display: inline-block; white-space: nowrap;
    font-size: 15px; font-weight: bold; color: #FFD700;
    text-shadow: 0 0 8px rgba(255,215,0,0.4);
    animation: marquee 10s linear infinite;
    padding-right: 50px;
}
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
.marquee-text:hover { animation-play-state: paused; color: #FF4444; text-shadow: 0 0 10px rgba(255,68,68,0.5); }
.nav-right { display: flex; gap: 8px; align-items: center; }
.whatsapp-link, .nav-link {
    color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 13px; white-space: nowrap; flex-shrink: 0;
}
.whatsapp-link { background: #25D366; }
.whatsapp-link:hover { background: #1da851; }
.nav-link:hover { background: rgba(255,255,255,0.1); }

/* 联系方式按钮 */
.contact-link {
    color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; font-size: 13px; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0;
}
.contact-link.wa { background: #25D366; }
.contact-link.wa:hover { background: #1da851; }
.contact-link.wx { background: #07C160; }
.contact-link.wx:hover { background: #06ad56; }

/* SVG 图标 */
.icon { width: 16px; height: 16px; display: inline-block; vertical-align: middle; margin-right: 2px; }
.contact-link .icon { width: 18px; height: 18px; }
.btn-contact .icon { width: 20px; height: 20px; margin-right: 4px; }

/* 搜索框 */
.search-form { margin-right: 6px; }
.search-input {
    padding: 6px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1); color: #fff; font-size: 13px; width: 140px;
    transition: all 0.2s;
}
.search-input::placeholder { color: rgba(255,255,255,0.5); }
.search-input:focus { outline: none; background: rgba(255,255,255,0.2); width: 180px; }

/* 闪光消息 */
.flash {
    background: #d4edda; color: #155724; padding: 12px 20px; border-radius: 8px; margin: 20px 0;
    border: 1px solid #c3e6cb; font-size: 14px;
}

/* 登录页 */
.login-box {
    max-width: 400px; margin: 60px auto; background: #fff; padding: 32px 24px; border-radius: 12px;
    text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-box h1 { font-size: 30px; margin-bottom: 8px; color: #1a1a2e; font-family: "华文行楷", "STXingkai", "KaiTi", "楷体", cursive; font-weight: normal; }
.login-logo { margin-bottom: 12px; }
.login-logo-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.login-desc { color: #666; margin-bottom: 20px; font-size: 14px; }
.login-box input {
    width: 100%; padding: 14px 16px; border: 2px solid #e0e0e0; border-radius: 8px;
    font-size: 16px; transition: border-color 0.2s; -webkit-appearance: none;
}
.login-box input:focus { outline: none; border-color: #1a1a2e; }
.login-box button {
    width: 100%; padding: 14px; margin-top: 12px; background: #1a1a2e; color: #fff;
    border: none; border-radius: 8px; font-size: 16px; cursor: pointer; transition: background 0.2s; -webkit-appearance: none;
}
.login-box button:hover { background: #16213e; }

/* QR 码 */
.qr-section { margin-top: 20px; }
.qr-divider {
    display: flex; align-items: center; color: #ccc; font-size: 13px; margin-bottom: 12px;
}
.qr-divider::before, .qr-divider::after { content: ''; flex: 1; height: 1px; background: #eee; }
.qr-divider span { padding: 0 12px; }
.qr-hint { color: #999; font-size: 13px; margin-bottom: 10px; }
.qr-img { width: 160px; height: 160px; display: block; margin: 0 auto; border-radius: 8px; }
.qr-url { color: #bbb; font-size: 11px; margin-top: 6px; word-break: break-all; }

/* 首页 hero */
.hero {
    text-align: center; padding: 40px 0 30px;
}
.hero h1 { font-size: 36px; color: #1a1a2e; margin-bottom: 8px; font-family: "华文行楷", "STXingkai", "KaiTi", "楷体", cursive; font-weight: normal; }
.hero p { font-size: 16px; color: #666; }

/* 分类网格 */
.categories-grid { display: flex; flex-direction: column; gap: 20px; padding-bottom: 40px; }

.category-card {
    background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.category-card h2 { font-size: 18px; margin-bottom: 12px; }
.category-card h2 a { color: #1a1a2e; text-decoration: none; }

.preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.preview-item a {
    display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: #333;
    padding: 8px; border-radius: 8px; transition: background 0.2s;
}
.preview-item a:hover { background: #f8f8f8; }
.preview-item img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; }
.preview-name { font-size: 12px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.preview-price { font-size: 13px; color: #e63946; font-weight: 600; }

.view-all {
    display: inline-block; margin-top: 10px; color: #1a1a2e; text-decoration: none;
    font-weight: 500; font-size: 13px;
}
.view-all:hover { text-decoration: underline; }

/* 产品网格页 */
.breadcrumb { padding: 16px 0; font-size: 13px; color: #666; }
.breadcrumb a { color: #1a1a2e; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.page-title { font-size: 22px; margin-bottom: 16px; }

.product-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding-bottom: 40px;
}
.product-card {
    background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.product-card a { text-decoration: none; color: #333; }
.product-card img { width: 100%; height: 150px; object-fit: cover; }
.product-info { padding: 12px; }
.product-info h3 { font-size: 14px; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-size: 18px; color: #e63946; font-weight: 700; }
.specs { font-size: 11px; color: #888; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 产品详情 */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding-bottom: 40px; }
.product-detail-image img { width: 100%; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.product-detail-info h1 { font-size: 24px; margin-bottom: 12px; }
.price-tag { font-size: 28px; color: #e63946; font-weight: 700; margin-bottom: 16px; }
.desc { color: #555; margin-bottom: 16px; line-height: 1.8; font-size: 14px; }
.specs-box { background: #f9f9f9; padding: 14px; border-radius: 8px; margin-bottom: 20px; }
.specs-box h3 { font-size: 13px; color: #666; margin-bottom: 6px; }
.specs-box pre { font-family: inherit; white-space: pre-wrap; font-size: 13px; color: #444; line-height: 1.8; }
.btn-whatsapp {
    display: inline-block; background: #25D366; color: #fff; padding: 12px 24px;
    border-radius: 8px; text-decoration: none; font-size: 15px; font-weight: 500;
    transition: background 0.2s; text-align: center;
}
.btn-whatsapp:hover { background: #1da851; }

/* 产品页联系按钮组 */
.contact-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-contact {
    flex: 1; display: inline-block; padding: 12px 20px; border-radius: 8px; text-decoration: none;
    font-size: 15px; font-weight: 500; text-align: center; transition: opacity 0.2s; min-width: 140px;
}
.btn-contact:hover { opacity: 0.9; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wx { background: #07C160; color: #fff; }

/* 微信弹窗 */
.overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 200;
}
.overlay.show { display: block; }
.wechat-popup {
    display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff; border-radius: 12px; padding: 30px; text-align: center;
    z-index: 201; box-shadow: 0 8px 30px rgba(0,0,0,0.2); min-width: 260px;
}
.wechat-popup.show { display: block; }
.popup-close {
    position: absolute; top: 8px; right: 12px; border: none; background: none;
    font-size: 20px; color: #999; cursor: pointer;
}
.popup-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #333; }
.wechat-qr { width: 180px; height: 180px; margin: 0 auto 12px; border-radius: 8px; }
.popup-id { font-size: 14px; color: #666; }
.popup-id strong { color: #333; }
.popup-icon { width: 48px; height: 48px; margin: 0 auto 12px; display: block; }
.popup-tip { font-size: 12px; color: #999; margin: 8px 0 16px; }
.popup-copy {
    background: #07C160; color: #fff; border: none; border-radius: 8px;
    padding: 10px 24px; font-size: 14px; cursor: pointer; transition: background 0.2s;
}
.popup-copy:hover { background: #06ad56; }
.popup-copy:active { background: #05964c; }
.popup-hidden-input { position: absolute; left: -9999px; }

/* 返回主页按钮（手机端浮动） */
.back-home {
    display: none; position: fixed; bottom: 20px; right: 20px;
    background: #1a1a2e; color: #FFD700; padding: 10px 18px; border-radius: 25px;
    text-decoration: none; font-size: 13px; font-weight: 600; z-index: 100;
    box-shadow: 0 3px 12px rgba(0,0,0,0.25); transition: opacity 0.3s;
    align-items: center; gap: 4px; border: 1px solid rgba(255,215,0,0.3);
}
.back-home:hover { opacity: 0.9; }
@media (max-width: 768px) {
    .back-home { display: inline-flex; }
}

/* 后台管理 */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin: 24px 0 16px; flex-wrap: wrap; gap: 10px; }
.admin-header h1 { font-size: 20px; }
.admin-actions { display: flex; gap: 10px; }
.btn-primary {
    background: #1a1a2e; color: #fff; padding: 10px 18px; border-radius: 8px;
    text-decoration: none; font-weight: 500; border: none; cursor: pointer; display: inline-block; font-size: 14px;
}
.btn-primary:hover { background: #16213e; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 24px; }
.stat-card { background: #fff; padding: 14px; border-radius: 8px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.stat-name { display: block; font-size: 13px; color: #666; }
.stat-count { display: block; font-size: 22px; font-weight: 700; color: #1a1a2e; margin-top: 4px; }

.admin-table-wrap { background: #fff; border-radius: 10px; overflow-x: auto; margin-bottom: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.admin-table th { background: #f8f8f8; text-align: left; padding: 10px 14px; font-size: 13px; color: #666; white-space: nowrap; }
.admin-table td { padding: 10px 14px; border-top: 1px solid #eee; font-size: 13px; }
.admin-table tr:hover { background: #fafafa; }
.thumb { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; }
.no-thumb { color: #ccc; font-size: 11px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-sm {
    display: inline-block; padding: 5px 12px; border-radius: 6px; text-decoration: none;
    font-size: 12px; background: #e8e8e8; color: #333; border: none; cursor: pointer;
}
.btn-sm:hover { background: #ddd; }
.btn-danger { background: #fee; color: #c0392b; }
.btn-danger:hover { background: #fdd; }
.btn-move { display: inline-block; padding: 2px 6px; border-radius: 4px; text-decoration: none; font-size: 13px; color: #666; background: #f0f0f0; }
.btn-move:hover { background: #ddd; }
.btn-cancel { display: inline-block; padding: 10px 18px; border-radius: 8px; text-decoration: none; background: #e0e0e0; color: #333; font-size: 14px; }

.admin-section { background: #fff; padding: 18px; border-radius: 10px; margin-bottom: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.admin-section h2 { font-size: 16px; margin-bottom: 10px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.inline-form input:focus { outline: none; border-color: #1a1a2e; }

/* 产品编辑表单 */
.product-form { background: #fff; padding: 24px; border-radius: 12px; margin-bottom: 40px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 5px; font-size: 13px; color: #555; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px;
    transition: border-color 0.2s; -webkit-appearance: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #1a1a2e; }
.form-group textarea { resize: vertical; font-family: inherit; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.current-image { margin-top: 6px; }
.current-image p { font-size: 12px; color: #666; margin-bottom: 4px; }

.empty, .empty-hint { color: #999; padding: 20px; text-align: center; }
.no-img {
    width: 100%; height: 100px; background: #f0f0f0; display: flex; align-items: center;
    justify-content: center; color: #ccc; font-size: 12px; border-radius: 6px;
}
.no-img.large { height: 200px; font-size: 16px; }

/* 登录页广告语 */
.login-ads { text-align: center; margin: 40px auto 20px; max-width: 400px; }
.ads-text { font-size: 16px; color: #e63946; font-weight: 600; margin-bottom: 6px; }
.ads-sub { font-size: 13px; color: #888; }
.footer {
    background: #1a1a2e; color: #999; text-align: center; padding: 0 0 16px 0; font-size: 12px;
}
.footer .marquee-wrap { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }

/* 首页顶部跑马灯 */
.page-marquee {
    background: #1a1a2e; margin: 0 -20px 20px; padding: 0;
    border-bottom: 2px solid #FFD700; display: flex;
    position: sticky; top: 60px; z-index: 99;
}
.page-marquee .marquee-wrap { flex: 1; padding: 10px 20px; }
.page-marquee .marquee-text { font-size: 18px; }
.footer a { color: #25D366; text-decoration: none; }

/* ====== 手机响应式 ====== */
@media (max-width: 768px) {
    .container { padding: 0 14px; }
    body { font-size: 16px; }
    .login-box { max-width: 94%; margin: 40px auto; padding: 28px 20px; }
    .logo { font-size: 16px; }
    .logo-img { height: 28px; }
    .search-form { display: none; }
    .marquee-text { font-size: 12px; animation-duration: 8s; }
    .page-marquee { margin: 0 -14px 14px; top: 50px; }
    .page-marquee .marquee-text { font-size: 14px; }
    .navbar { padding: 10px 0; }
    .whatsapp-link, .nav-link { font-size: 12px; padding: 5px 10px; }
    .whatsapp-icon { font-size: 14px; }
    
    .login-box { margin: 40px 14px; padding: 28px 20px; }
    .login-box h1 { font-size: 20px; }
    .qr-img { width: 140px; height: 140px; }
    
    .hero { padding: 28px 0 20px; }
    .hero h1 { font-size: 22px; }
    .hero p { font-size: 14px; }
    
    .preview-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .preview-item img { height: 80px; }
    .preview-name { font-size: 11px; }
    .preview-price { font-size: 12px; }
    
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card img { height: 120px; }
    .product-info { padding: 10px; }
    .product-info h3 { font-size: 13px; }
    .price { font-size: 16px; }
    
    .product-detail { grid-template-columns: 1fr; gap: 20px; }
    .product-detail-info h1 { font-size: 20px; }
    .price-tag { font-size: 24px; }
    .btn-whatsapp { display: block; text-align: center; }
    
    .contact-btns { flex-direction: column; }
    .btn-contact { min-width: auto; }
    
    .admin-stats { grid-template-columns: repeat(3, 1fr); }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .category-card { padding: 14px; }
    .category-card h2 { font-size: 16px; }
    
    .page-title { font-size: 18px; }
    .admin-header h1 { font-size: 18px; }
}

@media (max-width: 380px) {
    .product-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .preview-grid { grid-template-columns: 1fr 1fr; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .search-form { display: none; }
}

/* 华为鸿蒙等手机极小屏幕适配 */
@media (max-width: 360px), (max-height: 700px) {
    .navbar { padding: 8px 0; }
    .navbar .container { gap: 4px; }
    .logo-img { height: 24px; }
    .contact-link { font-size: 11px; padding: 4px 8px; }
    .contact-link .icon { width: 14px; height: 14px; }
    .nav-right { gap: 4px; }
    .whatsapp-link, .nav-link { font-size: 11px; padding: 4px 8px; }
}
