/* ============================================
   NEXUS VAULT - 二次元科技风格
   ============================================ */

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f2a;
    --bg-card: #12122aee;
    --bg-card-hover: #1a1a3a;
    --border-color: #00f0ff15;
    --border-glow: #00f0ff30;
    --text-primary: #e8e8ff;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --accent-cyan: #00f0ff;
    --accent-purple: #b400ff;
    --accent-pink: #ff00aa;
    --accent-error: #ff4466;
    --accent-success: #00ff88;
    --glow-cyan: 0 0 20px #00f0ff40, 0 0 40px #00f0ff20;
    --glow-purple: 0 0 20px #b400ff40, 0 0 40px #b400ff20;
    --font-display: 'Orbitron', 'Noto Sans SC', sans-serif;
    --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
}

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

html { scroll-behavior: smooth; }

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

/* 粒子画布 */
#particleCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* 网格叠加层 */
.grid-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

/* 主容器 */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ HEADER ============ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 0 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hex-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    display: flex; align-items: center; justify-content: center;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    font-size: 28px;
    animation: hexPulse 3s ease-in-out infinite;
}

@keyframes hexPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.header-stats {
    display: flex; gap: 24px;
}

.stat-item {
    text-align: center;
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 240, 255, 0.03);
}

.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-cyan);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.admin-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
}
.admin-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
}

.header-actions {
    display: flex; gap: 12px;
}

/* ============ PASSWORD GATE ============ */
.password-gate {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.gate-card {
    text-align: center;
    padding: 48px 40px;
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--glow-cyan);
    animation: gateAppear 0.6s ease-out;
}

@keyframes gateAppear {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.gate-icon {
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.gate-card h2 {
    font-family: var(--font-display);
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 8px;
    color: var(--accent-cyan);
}

.gate-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.gate-form { width: 100%; }

.input-group {
    display: flex;
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-group:focus-within {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px #00f0ff20;
}

.input-group input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    font-family: var(--font-body);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group button {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border: none;
    padding: 14px 18px;
    color: white;
    cursor: pointer;
    transition: opacity 0.3s;
}

.input-group button:hover { opacity: 0.85; }

.error-msg {
    background: #ff446615;
    border: 1px solid #ff446640;
    color: var(--accent-error);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.success-msg {
    background: #00ff8815;
    border: 1px solid #00ff8840;
    color: var(--accent-success);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============ CATEGORY SECTION ============ */
.category-section {
    margin-bottom: 40px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.category-title {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 4px;
    color: var(--accent-purple);
    white-space: nowrap;
    text-transform: uppercase;
}

.category-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-purple)40, transparent);
}

/* ============ PROGRAM CARDS ============ */
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.program-card {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(20px);
}

.program-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.program-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px);
    box-shadow: var(--glow-cyan);
}

.card-glow {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(0, 240, 255, 0.08), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.program-card:hover .card-glow { opacity: 1; }

.card-content {
    position: relative;
    z-index: 1;
    padding: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.card-icon {
    font-size: 36px;
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 240, 255, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.card-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.version-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: linear-gradient(90deg, #00f0ff15, #b400ff15);
    color: var(--accent-cyan);
    border: 1px solid #00f0ff20;
    font-family: var(--font-display);
    letter-spacing: 1px;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
    min-height: 40px;
}

.card-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-password {
    flex: 1;
}

.pwd-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.3s;
    font-family: var(--font-body);
}

.pwd-input:focus {
    border-color: var(--accent-cyan);
}

.pwd-input::placeholder {
    color: var(--text-muted);
}

.download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.download-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: var(--glow-cyan);
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glow);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--glow-cyan);
    animation: gateAppear 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--accent-error); }

.modal-body { padding: 20px 24px; }

.modal-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
    font-family: var(--font-body);
}

.modal-input:focus { border-color: var(--accent-cyan); }

.modal-error {
    color: var(--accent-error);
    font-size: 13px;
    margin-top: 8px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 0 24px 24px;
    justify-content: flex-end;
}

/* ============ GLOW BUTTONS ============ */
.glow-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-family: var(--font-body);
    color: white;
}

.glow-btn.primary {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
}

.glow-btn.secondary {
    background: transparent;
    border: 1px solid var(--border-glow);
    color: var(--text-secondary);
}

.glow-btn.secondary:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.glow-btn.danger {
    background: transparent;
    border: 1px solid #ff446640;
    color: var(--accent-error);
}

.glow-btn.danger:hover {
    background: #ff446615;
}

.glow-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.glow-btn.full-width {
    width: 100%;
    justify-content: center;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ============ FOOTER ============ */
.footer {
    text-align: center;
    padding: 40px 0 24px;
}

.footer-line {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan)30, var(--accent-purple)30, transparent);
    margin-bottom: 20px;
}

.footer p {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 3px;
}

/* ============ ADMIN ============ */
.admin-body {
    min-height: 100vh;
}

.admin-container {
    padding-bottom: 40px;
}

.admin-section {
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    background: var(--bg-card);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--accent-cyan);
}

/* Admin Form */
.admin-form { }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group small {
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: var(--font-body);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent-cyan);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

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

/* File Upload Zone */
.file-upload-zone {
    position: relative;
    border: 2px dashed var(--border-glow);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.file-upload-zone:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.03);
}

.file-upload-zone input[type="file"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.file-zone-content svg {
    color: var(--accent-cyan);
    opacity: 0.5;
}

.file-zone-content span {
    font-size: 13px;
}

/* Admin Table */
.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(0, 240, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    vertical-align: middle;
}

.admin-table tr.inactive {
    opacity: 0.5;
}

.admin-table tr:hover {
    background: rgba(0, 240, 255, 0.02);
}

.table-program {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-icon {
    font-size: 24px;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 240, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
}

.table-program small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: #00ff8815;
    color: var(--accent-success);
    border: 1px solid #00ff8830;
}

.status-badge.inactive {
    background: #ff446615;
    color: var(--accent-error);
    border: 1px solid #ff446630;
}

.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.action-btn.toggle:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.05);
}

.action-btn.delete:hover {
    border-color: var(--accent-error);
    background: rgba(255, 68, 102, 0.05);
}

.admin-msg {
    margin-bottom: 20px;
}

/* ============ TOAST ============ */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: #00ff8818;
    border: 1px solid #00ff8850;
    color: var(--accent-success);
    box-shadow: 0 0 20px #00ff8820;
}

.toast-error {
    background: #ff446618;
    border: 1px solid #ff446650;
    color: var(--accent-error);
    box-shadow: 0 0 20px #ff446620;
}

.toast-info {
    background: #00f0ff18;
    border: 1px solid #00f0ff50;
    color: var(--accent-cyan);
    box-shadow: 0 0 20px #00f0ff20;
}

/* ============ DOWNLOAD PROGRESS ============ */
.dl-progress-card {
    text-align: center;
    padding: 40px 32px;
}

.dl-progress-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
}

.dl-ring {
    position: absolute;
    width: 72px;
    height: 72px;
    border: 3px solid transparent;
    border-top-color: var(--accent-cyan);
    border-right-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dl-progress-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.dl-progress-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.dl-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.dl-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 12px #00f0ff40;
}

/* ============ SPINNER ============ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .logo-text h1 {
        font-size: 22px;
        letter-spacing: 2px;
    }
    
    .programs-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .gate-card {
        padding: 32px 24px;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .download-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .header-stats {
        gap: 12px;
    }
    
    .stat-item {
        padding: 6px 14px;
    }
    
    .stat-number {
        font-size: 18px;
    }
}
