/* ========== 红包封面商城 - 科技风 ========== */

:root {
    --primary: #00d4ff;
    --primary-glow: rgba(0,212,255,0.4);
    --accent: #7c3aed;
    --accent-glow: rgba(124,58,237,0.4);
    --bg: #0a0e17;
    --bg-card: rgba(15,23,42,0.85);
    --bg-card-hover: rgba(20,30,55,0.9);
    --text: #e2e8f0;
    --text-light: #94a3b8;
    --border: rgba(0,212,255,0.15);
    --border-glow: rgba(0,212,255,0.3);
    --radius: 12px;
    --shadow: 0 0 30px rgba(0,212,255,0.08);
    --shadow-lg: 0 0 60px rgba(0,212,255,0.1);
    --glass: rgba(15,23,42,0.6);
    --gradient: linear-gradient(135deg, #00d4ff, #7c3aed);
    --gradient-bg: linear-gradient(135deg, rgba(0,212,255,0.05), rgba(124,58,237,0.05));
}

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

@font-face {
    font-family: 'Tech';
    src: local('Orbitron'), local('Arial');
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 背景网格动画 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 60px 60px, 60px 60px; }
}

/* 背景光晕 */
body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(0,212,255,0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 80%, rgba(124,58,237,0.06) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
    animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.02); }
}

/* 粒子光点 */
.particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary);
    border-radius: 50%;
    animation: floatUp linear infinite;
    opacity: 0;
}
@keyframes floatUp {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.2; }
    100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* 鼠标光晕跟随 */
.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle, rgba(0,212,255,0.06) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    opacity: 0;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* Header */
.header {
    background: rgba(10,14,23,0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header .container { display: flex; align-items: center; justify-content: space-between; }
.logo {
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: 1px;
}
.nav-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.3s;
}
.nav-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s;
}
.btn-primary {
    background: linear-gradient(135deg, #00d4ff, #0098ff);
    color: #000;
    border: none;
    font-weight: 600;
}
.btn-primary:hover {
    box-shadow: 0 0 25px var(--primary-glow);
    transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}
.btn-danger {
    background: transparent;
    color: #ff4444;
    border: 1px solid rgba(255,68,68,0.3);
}
.btn-danger:hover {
    background: rgba(255,68,68,0.1);
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255,68,68,0.3);
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; text-align: center; }

/* Page Header */
.page-header { text-align: center; padding: 60px 0 40px; }
.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}
.subtitle { color: var(--text-light); margin-top: 8px; font-size: 15px; letter-spacing: 1px; }

/* ===== 科技风装饰线 ===== */
.section-divider {
    width: 80px;
    height: 3px;
    background: var(--gradient);
    margin: 0 auto 24px;
    border-radius: 2px;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding-bottom: 60px;
}
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.4s;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.product-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.4s;
    box-shadow: inset 0 0 0 1px var(--primary);
    pointer-events: none;
}
.product-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-glow);
    box-shadow: 0 0 40px rgba(0,212,255,0.15);
}
.product-card:hover::after { opacity: 1; }
.product-image {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(0,212,255,0.05), rgba(124,58,237,0.05));
}
.product-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.product-card:hover .product-image img { transform: scale(1.05); }
.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #ff6b6b;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid rgba(255,107,107,0.3);
    backdrop-filter: blur(10px);
}
.product-info { padding: 20px; }
.product-category {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    color: var(--primary);
    background: rgba(0,212,255,0.05);
    letter-spacing: 1px;
}
.product-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.product-no { font-size: 12px; color: var(--text-light); margin-bottom: 10px; font-family: 'SF Mono', 'Menlo', monospace; }
.product-price { margin-bottom: 10px; }
.current-price { font-size: 22px; font-weight: 700; color: var(--primary); }
.original-price { font-size: 13px; color: var(--text-light); text-decoration: line-through; margin-left: 8px; }
.product-stock { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }
.btn-buy { width: 100%; }

/* Category Filter */
.category-filter { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; justify-content: center; }
.cat-btn {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
    transition: all 0.3s;
}
.cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.cat-btn.active {
    background: var(--gradient);
    color: #000;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 90%;
    max-width: 420px;
    position: relative;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 0 60px rgba(0,212,255,0.1);
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s;
}
.modal-close:hover { color: var(--primary); }
.modal h2 { font-size: 18px; margin-bottom: 4px; }
.modal-price { color: var(--primary); font-size: 14px; margin-bottom: 20px; }
.modal-total {
    text-align: right;
    padding: 14px 0;
    font-size: 16px;
    border-top: 1px solid var(--border);
    margin-top: 14px;
}
.modal-total strong { color: var(--primary); font-size: 24px; }

/* Form */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-light);
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    outline: none;
    background: rgba(15,23,42,0.5);
    color: var(--text);
}
.form-input::placeholder { color: rgba(148,163,184,0.4); }
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(15,23,42,0.8);
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.hint { color: var(--text-light); font-weight: 400; font-size: 12px; }
textarea.form-input { resize: vertical; }

/* Quantity Control */
.quantity-control { display: flex; align-items: center; }
.qty-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    color: var(--text);
    transition: all 0.3s;
}
.qty-btn:first-child { border-radius: 8px 0 0 8px; }
.qty-btn:last-child { border-radius: 0 8px 8px 0; }
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.quantity-control input {
    width: 60px;
    text-align: center;
    border: 1px solid var(--border);
    border-left: none;
    border-right: none;
    height: 42px;
    font-size: 16px;
    background: rgba(15,23,42,0.5);
    color: var(--text);
}

/* Pay Page */
.pay-page { display: flex; justify-content: center; padding: 60px 0; }
.pay-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    width: 100%;
    max-width: 480px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.pay-card h2 { text-align: center; margin-bottom: 28px; font-size: 20px; }
.pay-info { margin-bottom: 28px; }
.pay-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.pay-amount { font-size: 24px; font-weight: 700; color: var(--primary); }
.mono { font-family: "SF Mono", "Menlo", "Consolas", monospace; font-size: 13px; }
.pay-tip { text-align: center; color: var(--text-light); font-size: 13px; margin: 18px 0; }
.qrcode-container { text-align: center; margin: 24px 0; }
.pay-error { color: #ff6b6b; text-align: center; }
.pay-error-detail { font-size: 12px; color: var(--text-light); text-align: center; }

/* Result Page */
.result-page { display: flex; justify-content: center; padding: 60px 0; }
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 540px;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.result-icon { font-size: 56px; margin-bottom: 16px; }
.result-card h2 { margin-bottom: 8px; font-size: 20px; }
.result-order { font-size: 13px; color: var(--text-light); }
.result-product { font-size: 15px; margin: 10px 0 4px; }
.result-amount { font-size: 28px; font-weight: 700; color: var(--primary); margin: 10px 0 24px; }

/* Card Keys */
.card-keys-section { text-align: left; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.card-keys-section h3 { margin-bottom: 14px; font-size: 16px; }
.card-keys-list { margin-bottom: 18px; }
.card-key-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.3s;
}
.card-key-item:hover { border-color: var(--border-glow); }
.card-key-index { font-size: 12px; color: var(--text-light); min-width: 24px; }
.card-key-value {
    flex: 1;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 13px;
    background: rgba(0,212,255,0.05);
    padding: 6px 10px;
    border-radius: 4px;
    word-break: break-all;
    color: var(--primary);
}
.btn-copy { white-space: nowrap; }

/* Usage */
.usage-section { text-align: left; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.usage-section h3 { margin-bottom: 14px; font-size: 16px; }
.usage-content {
    background: rgba(15,23,42,0.5);
    border: 1px solid var(--border);
    padding: 18px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-light);
}

/* Empty */
.empty { text-align: center; padding: 100px 0; color: var(--text-light); }
.empty p { font-size: 16px; letter-spacing: 1px; }

/* Alert */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: rgba(255,68,68,0.1); color: #ff6b6b; border: 1px solid rgba(255,68,68,0.2); }
.alert-success { background: rgba(0,212,255,0.08); color: var(--primary); border: 1px solid var(--border); }

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid var(--border);
    margin-top: 60px;
    position: relative;
    z-index: 1;
}
.footer p { color: var(--text-light); font-size: 13px; margin-bottom: 4px; }
.footer .beian {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 6px;
}
.footer .beian a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s;
}
.footer .beian a:hover { color: var(--primary); }

/* ========== Admin Login ========== */
.admin-login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #0d1117; }
.login-container { width: 100%; max-width: 400px; padding: 20px; position: relative; z-index: 1; }
.login-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
}
.login-card h1 { font-size: 24px; margin-bottom: 28px; color: #00d4ff; }

/* ========== Admin Layout ========== */
.admin-page { background: #0d1117; }
.admin-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.admin-sidebar {
    width: 230px;
    background: #161b22;
    border-right: 1px solid #30363d;
    padding: 24px 0;
    flex-shrink: 0;
}
.admin-sidebar h2 {
    padding: 0 20px 20px;
    font-size: 16px;
    border-bottom: 1px solid #30363d;
    color: #f0f6fc;
}
.admin-nav { padding: 12px 0; }
.admin-nav a {
    display: block;
    padding: 10px 20px;
    color: #8b949e;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    border-left: 2px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
    background: rgba(0,212,255,0.08);
    color: #00d4ff;
    border-left-color: #00d4ff;
}
.admin-main { flex: 1; padding: 30px; overflow-x: auto; }
.admin-main h1 { font-size: 22px; margin-bottom: 20px; color: #f0f6fc; }
.admin-main h2 { font-size: 18px; margin: 30px 0 16px; color: #c9d1d9; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.3s;
}
.stat-card:hover { border-color: #00d4ff; box-shadow: 0 0 20px rgba(0,212,255,0.15); }
.stat-value { font-size: 32px; font-weight: 700; color: #00d4ff; }
.stat-label { font-size: 13px; color: #8b949e; margin-top: 6px; }

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #161b22;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid #30363d;
    margin-bottom: 20px;
}
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; font-size: 14px; border-bottom: 1px solid #30363d; color: #c9d1d9; }
.admin-table th { background: #1c2129; font-weight: 600; color: #f0f6fc; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(0,212,255,0.04); }
.warning-row td { background: rgba(255,107,107,0.08); }
.text-danger { color: #ff6b6b; font-weight: 600; }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 4px; }

/* Admin Form */
.admin-form {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: var(--radius);
    padding: 28px;
    max-width: 700px;
}
.admin-form hr { border: none; border-top: 1px solid #30363d; }
.admin-form label { color: #c9d1d9; }

/* Search Form */
.search-form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-form .form-input { max-width: 300px; }

/* Pagination */
.pagination { display: flex; gap: 8px; margin-top: 18px; }
.page-btn {
    padding: 8px 16px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #161b22;
    font-size: 13px;
    text-decoration: none;
    color: #c9d1d9;
    transition: all 0.3s;
}
.page-btn.active { background: linear-gradient(135deg, #00d4ff, #0098ff); color: #000; border-color: transparent; }
.page-btn:hover:not(.active) { border-color: #00d4ff; color: #00d4ff; }

/* Current Image */
.current-image { margin-top: 10px; }

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge-0 { background: rgba(255,180,0,0.15); color: #ffb400; }
.badge-1 { background: rgba(0,212,255,0.15); color: #00d4ff; }
.badge-2 { background: rgba(255,107,107,0.15); color: #ff6b6b; }

/* Sidebar Brand */
.sidebar-brand {
    padding: 0 20px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #00d4ff;
    border-bottom: 1px solid #30363d;
    margin-bottom: 8px;
}

/* Page Header Bar */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-header-bar h1 { margin-bottom: 0 !important; }

/* Section Card */
.section-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.section-card h2 { margin-top: 0 !important; }

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .admin-grid { grid-template-columns: 1fr; }
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Stat Card Icon */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon { font-size: 28px; flex-shrink: 0; }
.stat-body { flex: 1; }

/* Responsive */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; padding: 12px 0; }
    .admin-sidebar h2 { padding: 0 16px 12px; }
    .admin-nav { display: flex; flex-wrap: wrap; gap: 0; padding: 0; }
    .admin-nav a { padding: 8px 14px; font-size: 12px; border-left: none; border-bottom: 2px solid transparent; }
    .admin-nav a:hover, .admin-nav a.active { border-left: none; border-bottom-color: var(--primary); }
    .admin-main { padding: 16px; }
    .form-row { flex-direction: column; gap: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .page-header { padding: 30px 0 20px; }
    .page-header h1 { font-size: 22px; }
    .container { padding: 0 12px; }
    .header { padding: 10px 0; }
    .logo { font-size: 17px; }
    .product-card { border-radius: 10px; }
    .product-image { height: 100px; }
    .product-info { padding: 14px; }
    .product-name { font-size: 14px; }
    .current-price { font-size: 18px; }
    .modal { padding: 24px; width: 95%; }
    .pay-card { padding: 24px; }
    .result-card { padding: 24px; }
}