:root {
    --primary: #c41e3a;
    --primary-dark: #a01830;
    --primary-light: #e85d75;
    --accent: #1a56db;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e8eaed;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 28px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 68px;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}
.logo span { color: var(--primary); }

.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}
.main-nav a:hover {
    color: var(--primary);
    background: rgba(196, 30, 58, 0.05);
}

/* Hero */
.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    padding: 80px 0 100px;
    text-align: center;
    border-radius: 0 0 var(--radius) var(--radius);
    margin: 0 0 40px;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(196,30,58,0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(26,86,219,0.12) 0%, transparent 50%);
}
.hero h1 { font-size: 44px; margin-bottom: 16px; font-weight: 800; position: relative; letter-spacing: -1px; }
.hero p { font-size: 18px; opacity: 0.75; margin-bottom: 32px; position: relative; font-weight: 400; }
.hero .btn {
    font-size: 15px;
    padding: 13px 32px;
    border-radius: 50px;
    background: var(--primary);
    position: relative;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: rgba(196,30,58,0.03); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }

/* Section */
.section-title {
    margin: 48px 0 22px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Category list */
.category-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.category-list a {
    padding: 10px 22px;
    background: var(--surface);
    border-radius: 50px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}
.category-list a:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.category-list a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 22px;
}
.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(196, 30, 58, 0.15);
}
.product-card .img-wrap {
    height: 220px;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    overflow: hidden;
    position: relative;
}
.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.product-card:hover img { transform: scale(1.05); }
.product-card .info { padding: 18px; }
.product-card h3 {
    font-size: 15px;
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.45;
    height: 44px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-card h3 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}
.product-card h3 a:hover { color: var(--primary); }
.product-card .price {
    color: var(--primary);
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 14px;
}
.product-card .actions {
    display: flex;
    gap: 8px;
}

/* Product detail */
.product-detail {
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.product-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}
.product-detail .img-wrap {
    aspect-ratio: 1 / 1;
    max-height: 460px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
    border: 1px solid var(--border);
}
.product-detail .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.product-summary {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.product-detail h1 { font-size: 26px; margin: 0; font-weight: 700; line-height: 1.35; }
.product-detail .price {
    font-size: 32px;
    color: var(--primary);
    font-weight: 800;
    margin: 0;
}
.product-detail .meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.product-detail .meta span {
    background: #f8f9fa;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.product-desc-section {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}
.product-desc-section h2 {
    font-size: 20px;
    margin-bottom: 18px;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
}
.product-detail .desc {
    color: var(--text-secondary);
    line-height: 1.8;
    padding: 24px;
    background: #fafafa;
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.product-detail .desc p { margin: 0 0 12px; white-space: pre-line; }
.product-detail .desc img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px 0;
    border-radius: var(--radius-sm);
}
.product-detail .desc hr {
    border: none;
    border-top: 1px dashed #ddd;
    margin: 18px 0;
}

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
    background: var(--surface);
    color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.08);
}

/* Tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: #fafafa; font-weight: 700; color: var(--text-secondary); font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: #fafafa; }

/* Cart */
.cart-table td, .cart-table th { vertical-align: middle; }
.cart-qty {
    width: 70px;
    text-align: center;
    padding: 9px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 14px;
}
.cart-total {
    text-align: right;
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0;
    padding: 18px 22px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.cart-total strong { color: var(--primary); font-size: 24px; margin-left: 8px; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin: 18px 0;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-success { background: #f0fdf4; color: #15803d; border-left: 3px solid #22c55e; }
.alert-error { background: #fef2f2; color: #b91c1c; border-left: 3px solid #ef4444; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
}
.pagination a, .pagination span {
    padding: 9px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Footer */
.site-footer {
    background: #1a1a2e;
    color: var(--text-muted);
    padding: 45px 0;
    margin-top: 60px;
    text-align: center;
    font-size: 14px;
}
.site-footer p { margin: 0; }

/* Auth pages */
.auth-box {
    max-width: 400px;
    margin: 70px auto;
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}
.auth-box h2 {
    text-align: center;
    margin-bottom: 28px;
    font-size: 24px;
    font-weight: 700;
}
.auth-box .btn { width: 100%; padding: 12px; font-size: 15px; }
.auth-box p { text-align: center; margin-top: 20px; color: var(--text-secondary); font-size: 14px; }
.auth-box p a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
}
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-green { background: #f0fdf4; color: #15803d; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-yellow { background: #fefce8; color: #a16207; }

/* Member center */
.member-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 28px;
    align-items: start;
}
.member-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.member-sidebar .profile {
    padding: 30px 24px;
    text-align: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
}
.member-sidebar .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 14px;
    backdrop-filter: blur(10px);
}
.member-sidebar .username { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.member-sidebar .email { font-size: 13px; opacity: 0.75; }
.member-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s;
}
.member-menu a:hover, .member-menu a.active {
    color: var(--primary);
    background: #fafafa;
    padding-left: 28px;
}
.member-menu a:last-child { border-bottom: none; color: #dc2626; }
.member-menu a:last-child:hover { background: #fef2f2; }

.member-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    margin-bottom: 24px;
}
.member-card h3 {
    margin: 0 0 22px;
    font-size: 18px;
    font-weight: 700;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.member-card .btn { margin-top: 6px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.empty-state h3 { font-size: 18px; margin-bottom: 10px; color: var(--text); }

/* Responsive */
@media (max-width: 768px) {
    .nav { flex-direction: column; height: auto; padding: 14px 0; gap: 12px; }
    .main-nav { flex-wrap: wrap; justify-content: center; }
    .hero { padding: 50px 20px 70px; }
    .hero h1 { font-size: 30px; }
    .hero p { font-size: 15px; }
    .product-detail { padding: 20px; }
    .product-top { grid-template-columns: 1fr; gap: 24px; }
    .product-detail .img-wrap { max-height: 320px; }
    .product-detail h1 { font-size: 20px; }
    .product-detail .price { font-size: 26px; }
    .product-detail .desc { padding: 16px; }
    .product-desc-section { margin-top: 24px; padding-top: 20px; }
    .member-layout { grid-template-columns: 1fr; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .product-card .img-wrap { height: 160px; }
    .product-card .info { padding: 14px; }
    .product-card h3 { height: 40px; font-size: 13px; }
    .product-card .price { font-size: 17px; }
}
