/* ============================================================
   华货源 LOSEVI - 主样式表
   Mobile-First B2B Platform
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --primary: #D4380D;
    --primary-dark: #AD2E0A;
    --primary-light: #FF6B3D;
    --secondary: #1A1A2E;
    --accent: #E8A317;
    --success: #28A745;
    --warning: #FFC107;
    --danger: #DC3545;
    --info: #17A2B8;

    --bg-body: #F5F5F5;
    --bg-white: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-dark: #1A1A2E;

    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-white: #FFFFFF;

    --border-color: #E0E0E0;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-zh: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;

    --header-height: 60px;
    --container-max: 1200px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
}

/* ---- Layout ---- */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

.main-content {
    flex: 1;
    padding: 20px 0;
}

/* ---- Header ---- */
.site-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.logo img {
    height: 36px;
    width: auto;
}

.logo-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
}

/* ---- Search Bar ---- */
.search-bar {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-bar input:focus {
    border-color: var(--primary);
}

.search-bar button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-bar button:hover {
    background: var(--primary-dark);
}

/* ---- Navigation ---- */
.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(212, 56, 13, 0.08);
    color: var(--primary);
}

/* Mobile menu button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    color: var(--text-primary);
}

/* ---- Category Bar ---- */
.category-bar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-list {
    display: flex;
    gap: 0;
    list-style: none;
    padding: 0;
    white-space: nowrap;
}

.category-list a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.category-list a:hover,
.category-list a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.category-list i {
    font-size: 1rem;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f0f0f0;
}

.card-body {
    padding: 12px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 6px;
}

.card-merchant {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-price {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 6px;
}

.card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* ---- Product Grid ---- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 576px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ---- Merchant Card ---- */
.merchant-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.merchant-card:hover {
    box-shadow: var(--shadow-md);
}

.merchant-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.merchant-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.merchant-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--success);
    font-size: 0.75rem;
}

/* ---- Banner/Swiper ---- */
.banner-section {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.banner-section img {
    width: 100%;
    aspect-ratio: 21/9;
    object-fit: cover;
}

/* ---- Section Headers ---- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--primary);
}

.section-more {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}
.btn-whatsapp:hover {
    background: #1DA851;
    color: white;
}

.btn-wechat {
    background: #07C160;
    color: white;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 32px;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ---- Contact Buttons ---- */
.contact-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- Footer ---- */
.site-footer {
    background: var(--bg-dark);
    color: var(--text-white);
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.footer-col h4 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: var(--accent);
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 6px;
}

.footer-col a {
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

.footer-disclaimer {
    background: rgba(255,255,255,0.05);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ---- Tags ---- */
.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    background: rgba(212, 56, 13, 0.08);
    color: var(--primary);
}

.tag-new {
    background: var(--accent);
    color: white;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
}

/* ---- Loading ---- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: 16px;
        z-index: 999;
        gap: 4px;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .search-bar {
        display: none;
    }

    .search-bar.mobile-open {
        display: block;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        padding: 8px 16px;
        background: var(--bg-white);
        box-shadow: var(--shadow-sm);
        max-width: 100%;
        z-index: 998;
    }

    .logo span:not(.logo-sub) {
        font-size: 1rem;
    }
}

@media (min-width: 769px) {
    .search-bar {
        display: block !important;
    }
}

/* ---- Detail Page ---- */
.detail-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.detail-main-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #f8f8f8;
    border-radius: var(--border-radius);
}

.detail-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.detail-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.detail-thumb.active,
.detail-thumb:hover {
    border-color: var(--primary);
}

.detail-info {
    padding: 20px 0;
}

.detail-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-specs {
    margin-top: 20px;
}

.detail-specs table {
    width: 100%;
    border-collapse: collapse;
}

.detail-specs td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.detail-specs td:first-child {
    color: var(--text-muted);
    width: 120px;
}

@media (min-width: 768px) {
    .detail-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

/* ---- Report Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-box h3 {
    margin-bottom: 16px;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(212, 56, 13, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.invalid-feedback {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 2px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}
