/* ===== CSS Reset & Variables ===== */
:root {
    --bg-primary: #0f0f13;
    --bg-secondary: #1a1a24;
    --bg-card: #22222e;
    --bg-hover: #2a2a38;
    --bg-input: #181822;
    --border-color: #2e2e3e;
    --text-primary: #e8e8ed;
    --text-secondary: #9898a8;
    --text-muted: #6a6a7a;
    --accent: #6c5ce7;
    --accent-hover: #7d6ff0;
    --accent-light: rgba(108, 92, 231, 0.15);
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --transition: all 0.25s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

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

/* ===== Container ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.site-logo .logo-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
}
.site-nav { display: flex; gap: 24px; align-items: center; }
.site-nav a { color: var(--text-secondary); font-size: 0.95rem; }
.site-nav a:hover { color: var(--text-primary); }
.site-nav .nav-order-query {
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: var(--transition);
}
.site-nav .nav-order-query:hover {
    background: var(--accent);
    color: #fff;
}

/* ===== Hero / Banner ===== */
.hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #1e1e30 100%);
    padding: 48px 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
.hero h1 { font-size: 2rem; margin-bottom: 8px; }
.hero p { color: var(--text-secondary); font-size: 1.05rem; }

/* ===== Category Nav ===== */
.category-nav {
    display: flex;
    gap: 10px;
    padding: 20px 0;
    overflow-x: auto;
    flex-wrap: wrap;
}
.category-nav a {
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    transition: var(--transition);
}
.category-nav a:hover, .category-nav a.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ===== Product Grid ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px 0 40px;
}
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}
.product-card .card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-secondary);
    display: block;
}
.product-card .card-img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2.5rem;
}
.product-card .card-body { padding: 14px; }
.product-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.product-card .card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.product-card .price-now {
    color: var(--danger);
    font-size: 1.15rem;
    font-weight: 700;
}
.product-card .price-original {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: line-through;
}
.product-card .card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.product-card .top-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* ===== Product Detail ===== */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 30px 0 60px;
}
.detail-gallery {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}
.detail-gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.detail-gallery .no-img {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 4rem;
}
.detail-info { padding: 10px 0; }
.detail-info h1 { font-size: 1.6rem; margin-bottom: 16px; line-height: 1.4; }
.detail-price-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}
.detail-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--danger);
}
.detail-price-original {
    font-size: 1rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 12px;
}
.detail-meta {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.detail-desc {
    margin: 20px 0;
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
}
.detail-source {
    margin: 16px 0;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.detail-source a { word-break: break-all; }

/* ===== Order Form ===== */
.order-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 20px;
}
.order-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-warning { background: var(--warning); color: #333; }
.btn-warning:hover { opacity: 0.9; color: #333; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 36px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}
table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
table tr:hover { background: var(--bg-hover); }

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-pending { background: rgba(253,203,110,0.15); color: var(--warning); }
.status-paid { background: rgba(116,185,255,0.15); color: var(--info); }
.status-done { background: rgba(0,184,148,0.15); color: var(--success); }
.status-cancel { background: rgba(106,106,122,0.15); color: var(--text-muted); }
.status-refund { background: rgba(225,112,85,0.15); color: var(--danger); }

/* ===== Admin Layout ===== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
}
.admin-sidebar .sidebar-logo {
    padding: 0 20px 20px;
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-sidebar .sidebar-logo .logo-icon {
    width: 28px; height: 28px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
}
.admin-sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}
.admin-sidebar nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.admin-sidebar nav a.active {
    background: var(--accent-light);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
}
.admin-sidebar nav a .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    min-height: 100vh;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.admin-header h1 { font-size: 1.4rem; }

/* ===== Dashboard Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}
.stat-card:hover { border-color: var(--accent); }
.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}
.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.success { color: var(--success); }
.stat-card .stat-value.warning { color: var(--warning); }
.stat-card .stat-value.danger { color: var(--danger); }

/* ===== Admin Card ===== */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.admin-card h3 {
    font-size: 1.05rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 20px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ===== Footer ===== */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.site-footer .footer-links {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.site-footer .footer-links a { color: var(--text-secondary); font-size: 0.85rem; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-success { background: rgba(0,184,148,0.12); color: var(--success); border: 1px solid rgba(0,184,148,0.2); }
.alert-danger { background: rgba(225,112,85,0.12); color: var(--danger); border: 1px solid rgba(225,112,85,0.2); }
.alert-warning { background: rgba(253,203,110,0.12); color: var(--warning); border: 1px solid rgba(253,203,110,0.2); }
.alert-info { background: rgba(116,185,255,0.12); color: var(--info); border: 1px solid rgba(116,185,255,0.2); }

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}
.login-box h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.4rem;
}

/* ===== Mobile Menu Toggle ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .product-detail { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 768px) {
    .mobile-menu-toggle { display: block; }
    .site-nav { display: none; }
    .site-nav.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-secondary); padding: 16px 20px; border-bottom: 1px solid var(--border-color); }

    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-card .card-body { padding: 10px; }
    .product-card .card-title { font-size: 0.85rem; }
    .product-card .price-now { font-size: 1rem; }

    .hero { padding: 30px 0; }
    .hero h1 { font-size: 1.4rem; }

    .product-detail { grid-template-columns: 1fr; gap: 20px; padding: 20px 0 40px; }
    .detail-info h1 { font-size: 1.2rem; }
    .detail-price { font-size: 1.4rem; }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 1.2rem; }

    .container { padding: 0 12px; }
    table { font-size: 0.8rem; }
    table th, table td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card .card-body { padding: 8px; }
    .product-card .card-title { font-size: 0.8rem; }
    .product-card .price-now { font-size: 0.95rem; }
    .product-card .price-original { font-size: 0.7rem; }
    .product-card .card-meta { font-size: 0.7rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.inline-flex { display: inline-flex; align-items: center; gap: 6px; }

/* ===== Overlay for mobile sidebar ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
}
.sidebar-overlay.open { display: block; }
