/* ========== Reset & Variables ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --primary-cyan: #22d3ee;
    --primary-green: #4ade80;
    --accent-gold: #fbbf24;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-card: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --error: #f87171;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, "PingFang SC", sans-serif;
    min-height: 100vh;
}

/* ========== Background Orbs ========== */
.orb {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--primary-cyan) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.1;
    z-index: 0;
    animation: float 12s infinite alternate ease-in-out;
    pointer-events: none;
}
.orb-2 {
    background: radial-gradient(circle, var(--primary-green) 0%, transparent 70%);
    animation-delay: -5s;
    animation-duration: 15s;
    bottom: 0;
    right: 0;
    top: auto;
    left: auto;
}
@keyframes float {
    0% { transform: translate(-20%, -20%); opacity: 0.08; }
    100% { transform: translate(20%, 20%); opacity: 0.15; }
}

/* ========== App Container ========== */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    padding: 16px;
}

/* ========== Header ========== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 20px;
}
.header h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--primary-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.header a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    background: var(--glass);
    border-radius: 20px;
    transition: all 0.2s;
}

/* ========== Section Cards ========== */
.section {
    background: var(--glass-card);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-header h2 {
    font-size: 16px;
    font-weight: 600;
}
.section-header a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
}

/* ========== Count Badge ========== */
.count-badge {
    display: inline-block;
    background: var(--primary-cyan);
    color: #0f172a;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

/* ========== Bottom Navigation ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    display: flex;
    border-top: 1px solid var(--border);
    padding: 8px 8px 6px;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
    gap: 2px;
}
.bottom-nav a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 4px;
    font-size: 21px;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
}
.bottom-nav a.active {
    color: var(--primary-cyan);
    background: rgba(34, 211, 238, 0.12);
}

/* ========== Flash Messages ========== */
.flash-message {
    background: rgba(34, 211, 238, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.3);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--primary-cyan);
    text-align: center;
}
.flash-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--danger);
    text-align: center;
    animation: fadeOutDown 3s ease forwards;
}
.flash, .flash-msg {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--success);
    text-align: center;
    animation: fadeOutDown 3s ease forwards;
}

@keyframes fadeOutDown {
    0% { opacity: 1; max-height: 60px; margin-bottom: 16px; padding: 12px 16px; }
    70% { opacity: 1; max-height: 60px; margin-bottom: 16px; padding: 12px 16px; }
    100% { opacity: 0; max-height: 0; margin-bottom: 0; padding: 0 16px; overflow: hidden; }
}

/* ========== Auth Pages (Login / Register) ========== */
.auth-fullscreen {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}
.logo-area {
    text-align: center;
    margin-bottom: 48px;
}
.logo-icon {
    font-size: 56px;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 20px rgba(34, 211, 238, 0.4));
}
.logo-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 0%, var(--primary-cyan) 50%, #fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}
.logo-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
    letter-spacing: 1px;
}
.auth-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 32px 24px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.input-group {
    margin-bottom: 20px;
}
.input-group label {
    display: block;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 8px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
}
.input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
    font-weight: 500;
}
.input-group input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1);
}
.input-group input::placeholder {
    color: rgba(148, 163, 184, 0.5);
    font-weight: 400;
}
.auth-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 13px;
    color: var(--text-dim);
}
.auth-footer a {
    color: var(--primary-cyan);
    text-decoration: none;
    font-weight: 600;
}
.error-msg {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--error);
    text-align: center;
}
.auth-card .btn-submit {
    width: 100%;
    padding: 16px;
    margin-top: 12px;
    background: linear-gradient(90deg, var(--primary-cyan), var(--primary-green));
    border: none;
    border-radius: 16px;
    color: #0f172a;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.2);
}
.auth-card .btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(34, 211, 238, 0.3);
}
.auth-card .btn-submit:active {
    transform: translateY(1px) scale(0.98);
}

/* ========== Status Badges ========== */
.status {
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
    font-weight: 500;
}
.status-0 { background: rgba(34, 211, 238, 0.15); color: var(--primary-cyan); }
.status-1 { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-2 { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-3 { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-4 { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-5 { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ========== Toast Notification ========== */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    color: var(--text-main);
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 14px;
    z-index: 9999;
    border: 1px solid var(--border);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast-success { border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.2); }
.toast-error { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.2); }
.toast-info { border-color: rgba(34, 211, 238, 0.3); background: rgba(34, 211, 238, 0.15); }

/* ========== Loading Spinner ========== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-cyan);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.btn-loading {
    opacity: 0.7;
    cursor: wait !important;
    pointer-events: none;
}

/* ========== Modal Overlay ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show {
    display: flex;
}
.modal-box {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    width: 90%;
    max-width: 340px;
    border: 1px solid var(--border);
}
.modal-box h3 {
    font-size: 16px;
    margin-bottom: 16px;
}
.modal-box input, .modal-box select {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    margin-bottom: 10px;
    outline: none;
}
.modal-box button {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    margin-top: 6px;
}

/* ========== Button Primary ========== */
.btn-save, .btn-primary {
    background: linear-gradient(90deg, var(--primary-cyan), var(--primary-green));
    color: #0f172a;
    border: none;
    border-radius: 14px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-save:hover, .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3);
}
.btn-save:active, .btn-primary:active {
    transform: scale(0.97);
}
