* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c2c2c;
    --accent: #e74c3c;
    --accent-hover: #c0392b;
    --bg: #fafafa;
    --text: #333;
    --text-light: #888;
    --border: #eee;
    --white: #fff;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }

/* Header */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0;
    white-space: nowrap;
}

.logo span { color: var(--accent); }

.nav {
    display: flex;
    gap: 32px;
}

.nav a {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav a:hover, .nav a.active { color: var(--accent); }

.nav a.active::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-btn, .cart-btn {
    font-size: 20px;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    position: relative;
}

.search-btn:hover, .cart-btn:hover { background: #f5f5f5; }

.cart-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--accent);
    color: white;
    font-size: 11px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Main */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Hero */
.hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius);
    padding: 60px 40px;
    color: white;
    margin-bottom: 48px;
    position: relative;
    overflow: hidden;
}

.hero-content { position: relative; z-index: 1; max-width: 500px; }

.hero h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero p {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 24px;
}

.hero-btn {
    display: inline-block;
    padding: 12px 32px;
    background: white;
    color: var(--primary);
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.2s;
}

.hero-btn:hover { transform: translateY(-2px); }

.hero-bg {
    position: absolute;
    right: -50px;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* Categories */
.section-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

.category-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.category-tab {
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    background: white;
    transition: all 0.2s;
}

.category-tab:hover { color: var(--text); }

.category-tab.active {
    background: var(--primary);
    color: white;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.product-img {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8f8f8;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.product-card:hover .product-img img { transform: scale(1.05); }

.product-info { padding: 16px; }

.product-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.product-price::before {
    content: '¥';
    font-size: 14px;
    font-weight: 500;
}

.add-cart {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}

.add-cart:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

/* Product Detail */
.detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

.detail-img {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
}

.detail-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.3;
}

.detail-price {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 24px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.detail-price::before {
    content: '¥';
    font-size: 24px;
}

.detail-desc {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.8;
    margin-bottom: 32px;
}

.detail-options { margin-bottom: 32px; }

.option-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.option-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.option-item {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.option-item:hover { border-color: var(--primary); }

.option-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.quantity {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 18px;
}

.quantity-btn:hover { background: #f5f5f5; }

.quantity-input {
    width: 60px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    height: 36px;
    font-size: 16px;
}

.detail-actions { display: flex; gap: 16px; }

.btn {
    padding: 14px 32px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--primary);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
}

/* Cart */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-header h1 { font-size: 28px; font-weight: 700; }

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

.cart-list {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}

.cart-item {
    display: grid;
    grid-template-columns: 100px 1fr auto auto;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-img {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
}

.cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-info h4 {
    font-size: 15px;
    margin-bottom: 8px;
}

.cart-item-spec {
    font-size: 13px;
    color: var(--text-light);
}

.cart-item-price {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
}

.cart-item-total {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin-right: 16px;
}

.cart-item-remove {
    color: var(--text-light);
    font-size: 18px;
    transition: color 0.2s;
}

.cart-item-remove:hover { color: var(--accent); }

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-right: 16px;
}

.quantity-control button {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.quantity-control span {
    width: 40px;
    text-align: center;
    font-size: 14px;
}

.cart-summary {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.cart-summary h3 {
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-top: 2px solid var(--border);
    margin-top: 8px;
}

.summary-total strong {
    font-size: 24px;
    color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: var(--radius);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    margin-top: 60px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px 24px;
}

.footer-text {
    font-size: 13px;
    color: var(--text-light);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-light);
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }

.footer-filing {
    flex-basis: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.footer-filing a {
    font-size: 12px;
    color: var(--text-light);
    transition: color 0.2s;
}

.footer-filing a:hover { color: var(--accent); }

.footer-filing .beian-logo {
    height: 16px;
    width: auto;
    margin-right: -14px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 999;
    animation: fadeInUp 0.3s;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* User Entry */
.user-entry {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Auth Page */
.auth-page {
    max-width: 420px;
    margin: 60px auto;
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 32px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form.hidden { display: none; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.form-input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
}

.form-error {
    font-size: 13px;
    color: var(--accent);
    display: none;
}

.form-error.show { display: block; }

.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
}

.auth-footer a {
    color: var(--accent);
    cursor: pointer;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
}

.search-overlay.show { display: flex; }

.search-box-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    padding: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box-modal input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px 16px;
    background: transparent;
}

.search-box-modal button {
    padding: 10px 24px;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.search-box-modal button:hover { background: var(--accent-hover); }

/* Responsive */
@media (max-width: 1024px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .detail { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .cart-layout { grid-template-columns: 1fr; }
    .hero { padding: 40px 24px; }
    .hero h1 { font-size: 32px; }
    .nav { gap: 20px; }
    .nav a { font-size: 14px; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
    .cart-item {
        grid-template-columns: 80px 1fr;
        grid-template-rows: auto auto;
    }
    .cart-item-img { width: 80px; height: 80px; }
    .header-inner { padding: 12px 16px; }
    .main { padding: 24px 16px; }
}
