/* ============================================================
   Neon Nights — styles.css
   ============================================================ */

/* --- CSS VARIABLES & THEME SYSTEM --- */
:root {
    --font-display: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
    --trans-fast: 0.2s ease;
    --trans-med: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body.theme-neon {
    --bg-body: #090910;
    --bg-panel: #13131f;
    --bg-card: #1c1c2e;
    --bg-card-hover: #252540;
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --accent: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.6);
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-gold: rgba(245, 158, 11, 0.3);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 15px var(--primary-glow);
    --grad-overlay: linear-gradient(180deg, rgba(9,9,16,0) 0%, #090910 100%);
}

body.theme-minimal {
    --bg-body: #121212;
    --bg-panel: #1e1e1e;
    --bg-card: #2c2c2c;
    --bg-card-hover: #3a3a3a;
    --primary: #ffffff;
    --primary-glow: transparent;
    --accent: #d4af37;
    --accent-glow: transparent;
    --text-main: #eeeeee;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --border-gold: #d4af37;
    --shadow-card: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-glow: none;
    --grad-overlay: linear-gradient(180deg, rgba(18,18,18,0) 0%, #121212 100%);
}

/* --- RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.5s ease;
}
h1, h2, h3, h4 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 1px; }
a { text-decoration: none; color: inherit; cursor: pointer; }
button { cursor: pointer; border: none; font-family: inherit; }

/* --- UTILITIES --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.text-accent { color: var(--accent); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.hidden { display: none !important; }

/* --- PARTICLES CANVAS --- */
#particles-canvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 0;
}

/* --- AUTH / LOGIN PAGE --- */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.login-bg-effects { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

/* Lanterns */
.lantern { position: absolute; animation: lanternFloat 5s ease-in-out infinite; }
.lantern-1 { top: 8%; left: 10%; animation-delay: 0s; }
.lantern-2 { top: 15%; right: 12%; animation-delay: 1.5s; }
.lantern-3 { top: 5%; right: 35%; animation-delay: 0.8s; }
@keyframes lanternFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

/* Garland */
.garland-string {
    position: absolute; top: 0; left: 0; width: 100%;
    display: flex; justify-content: space-around; padding: 10px 5%;
}
.garland-light {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--color); box-shadow: 0 0 10px var(--color), 0 0 20px var(--color);
    animation: garlandPulse 2s ease-in-out infinite; animation-delay: var(--delay);
}
@keyframes garlandPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.login-content {
    text-align: center; max-width: 480px; padding: 2rem; width: 100%;
    animation: fadeIn 1s ease; position: relative; z-index: 2;
}
.crescent-deco { margin-bottom: 1rem; animation: floatSlow 4s ease-in-out infinite; }
@keyframes floatSlow { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(5deg); } }

.login-title {
    font-size: 3.5rem; margin-bottom: 0.5rem; color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(245,158,11,0.2);
    animation: titleGlow 3s ease-in-out infinite alternate;
}
@keyframes titleGlow {
    0% { text-shadow: 0 0 30px var(--accent-glow); }
    100% { text-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(245,158,11,0.3); }
}
.login-subtitle { font-size: 1.1rem; margin-bottom: 2.5rem; color: var(--text-muted); }

.auth-form {
    background: var(--bg-card); padding: 2rem; border-radius: 12px;
    border: 1px solid var(--border-color); box-shadow: var(--shadow-glow);
}
.input-group { margin-bottom: 1.5rem; text-align: left; }
.input-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.input-field {
    width: 100%; padding: 0.8rem; background: var(--bg-body);
    border: 1px solid var(--border-color); color: var(--text-main);
    border-radius: 6px; font-size: 1rem; transition: var(--trans-fast);
}
.input-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,158,11,0.1); }
.login-footer-text {
    margin-top: 2rem; color: var(--text-muted); font-size: 0.8rem;
    display: flex; align-items: center; justify-content: center; gap: 8px; opacity: 0.7;
}
.dot-sep { opacity: 0.4; }
.login-error { color: #ef4444; font-size: 0.85rem; margin-bottom: 1rem; display: none; }

/* --- LAYOUT GRID (all authenticated pages) --- */
.app-layout {
    display: grid; grid-template-columns: 260px 1fr; min-height: 100vh;
    position: relative; z-index: 1;
}
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}

/* --- SIDEBAR --- */
.sidebar {
    background: var(--bg-panel); border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem; display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    z-index: 10;
}
.logo-area { margin-bottom: 2.5rem; display: flex; align-items: center; gap: 10px; }
.logo-icon {
    width: 40px; height: 40px; background: var(--accent);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 15px var(--accent-glow); color: #000; font-weight: bold; font-size: 24px;
    flex-shrink: 0;
}
.nav-links { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-links li { list-style: none; }
.nav-item {
    padding: 0.85rem 1rem; border-radius: 8px; color: var(--text-muted);
    transition: var(--trans-fast); display: flex; align-items: center; gap: 12px;
    font-weight: 500; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(245,158,11,0.1), transparent);
    color: var(--text-main); border-left-color: var(--accent);
}
.theme-toggle {
    display: flex; align-items: center; gap: 10px;
    padding: 0.7rem 1rem; border-radius: 8px;
    color: var(--text-muted); cursor: pointer; transition: var(--trans-fast);
    margin-top: 1rem; font-size: 0.85rem;
}
.theme-toggle:hover { background: rgba(255,255,255,0.05); color: var(--text-main); }
.user-widget {
    margin-top: auto; padding-top: 1.5rem; border-top: 1px solid var(--border-color);
    display: flex; align-items: center; gap: 10px;
}
.user-avatar { width: 35px; height: 35px; border-radius: 50%; background: #333; overflow: hidden; flex-shrink: 0; }
.user-info small { display: block; color: var(--text-muted); font-size: 0.7rem; }

/* --- MAIN CONTENT --- */
.main-content {
    padding: 2rem; overflow-y: auto; position: relative;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.03) 0%, transparent 20%);
}

/* --- COMPONENTS --- */
.btn {
    padding: 0.8rem 1.5rem; border-radius: 6px; font-weight: 600;
    font-family: var(--font-display); letter-spacing: 0.5px;
    transition: var(--trans-fast); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: white; box-shadow: 0 4px 15px var(--primary-glow);
    border: 1px solid rgba(255,255,255,0.1); width: 100%;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--primary-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 0.5rem; }
.btn-ghost:hover { color: var(--accent); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }

.card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 1.5rem; transition: var(--trans-med);
}
.card:hover { border-color: rgba(245,158,11,0.2); }

.badge { padding: 0.25rem 0.6rem; border-radius: 4px; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; }
.badge-gold { background: rgba(245, 158, 11, 0.2); color: var(--accent); border: 1px solid rgba(245, 158, 11, 0.3); }

.progress-track { background: var(--bg-body); height: 8px; border-radius: 4px; overflow: hidden; margin-top: 0.5rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #fcd34d); width: 0%; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 10px var(--accent); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* --- HEADER TOP (shared) --- */
.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.timer-badge {
    display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.3);
    padding: 0.5rem 1rem; border-radius: 20px; border: 1px solid var(--border-color);
    font-family: var(--font-display); font-size: 1.1rem;
}

/* --- HOME: HERO --- */
.hero-section { margin-bottom: 2rem; display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
@media(max-width: 900px) { .hero-section { grid-template-columns: 1fr; } }
.hero-card {
    background: linear-gradient(120deg, var(--bg-card) 0%, #2a2a40 100%);
    border: 1px solid var(--border-gold); padding: 2.5rem; border-radius: 16px;
    position: relative; overflow: hidden;
}
.hero-card-glow {
    position: absolute; top: -50%; right: -30%; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(245,158,11,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.hero-title { font-size: 2.5rem; margin-bottom: 0.5rem; text-shadow: 0 0 20px rgba(0,0,0,0.5); position: relative; }

.stats-sidebar { display: flex; flex-direction: column; gap: 0.75rem; }
.stat-card-mini { display: flex; align-items: center; gap: 1rem; padding: 1rem !important; }
.stat-card-mini:hover { transform: none; }
.stat-icon-wrap {
    width: 40px; height: 40px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon-wrap.gold { background: rgba(245,158,11,0.15); color: var(--accent); }
.stat-icon-wrap.purple { background: rgba(139,92,246,0.15); color: var(--primary); }
.stat-icon-wrap.green { background: rgba(34,197,94,0.15); color: #22c55e; }
.stat-value { font-size: 1.5rem; margin: 0; color: var(--text-main); }

/* --- DAILY GRID --- */
.daily-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 0.5rem; }
.game-tile {
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: 10px; padding: 1.2rem; display: flex; flex-direction: column; justify-content: space-between;
    height: 170px; transition: var(--trans-med); position: relative; overflow: hidden;
}
.game-tile::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0; transition: opacity 0.3s;
}
.game-tile:hover::before { opacity: 1; }
.game-tile.locked { opacity: 0.4; pointer-events: none; filter: grayscale(1); }
.game-tile.locked::before { display: none; }
.game-tile.completed { border-color: var(--primary); box-shadow: 0 0 10px rgba(139, 92, 246, 0.15); }
.game-tile.completed::before { background: linear-gradient(90deg, transparent, var(--primary), transparent); opacity: 1; }
.game-tile.ready { border-color: rgba(245,158,11,0.3); }
.game-tile.ready:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.3); }
.tier-badge { position: absolute; top: 10px; right: 10px; font-size: 0.8rem; }
.game-tile-name { font-size: 0.85rem; }
.attempt-info { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* --- LEADERBOARD --- */
.leaderboard-container { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; }
@media(max-width: 900px) { .leaderboard-container { grid-template-columns: 1fr; } }
.leaderboard-side { display: flex; flex-direction: column; gap: 1rem; }
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th { text-align: left; color: var(--text-muted); padding: 1rem; border-bottom: 1px solid var(--border-color); font-size: 0.85rem; text-transform: uppercase; }
.rank-table td { padding: 1rem; border-bottom: 1px solid var(--border-color); transition: background 0.2s; }
.rank-1-row { background: linear-gradient(90deg, rgba(255, 215, 0, 0.15), transparent); border-left: 4px solid #FFD700; }
.rank-2-row { background: linear-gradient(90deg, rgba(192, 192, 192, 0.15), transparent); border-left: 4px solid #C0C0C0; }
.rank-3-row { background: linear-gradient(90deg, rgba(205, 127, 50, 0.15), transparent); border-left: 4px solid #CD7F32; }
.rank-table tr:hover td { background: rgba(255,255,255,0.02); }
.rank-medal { font-size: 1.2rem; margin-right: 6px; }
.my-rank-card {
    background: var(--bg-card); border: 1px solid var(--accent); padding: 1.5rem;
    border-radius: 12px; position: sticky; top: 0;
}
.my-rank-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 0.25rem; }
.rank-divider { height: 1px; background: var(--border-color); margin: 1rem 0; }
.rank-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; text-align: center; }
.rank-meta strong { display: block; font-size: 1.1rem; margin-top: 2px; }
.rank-me-row { background: rgba(245,158,11,0.08) !important; }

/* --- PROFILE --- */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 800px; }
@media(max-width: 768px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-main-card { grid-column: 1 / -1; }
.profile-header { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2rem; }
.profile-avatar {
    width: 70px; height: 70px; border-radius: 50%;
    background: var(--bg-panel); display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--accent); overflow: hidden; flex-shrink: 0;
}
.profile-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media(max-width: 600px) { .profile-stats-grid { grid-template-columns: 1fr 1fr; } }
.profile-stat-box {
    text-align: center; padding: 1rem; background: var(--bg-panel);
    border-radius: 8px; border: 1px solid var(--border-color);
}
.badges-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
@media(max-width: 500px) { .badges-grid { grid-template-columns: 1fr 1fr; } }
.achievement-badge {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 1rem 0.5rem; border-radius: 8px; background: var(--bg-panel);
    border: 1px solid var(--border-color); font-size: 0.8rem; transition: var(--trans-fast);
}
.achievement-badge.earned { border-color: rgba(245,158,11,0.3); }
.achievement-badge.earned:hover { border-color: var(--accent); transform: translateY(-2px); }
.achievement-badge.locked { opacity: 0.4; filter: grayscale(1); }
.achievement-icon { font-size: 1.5rem; }

/* mini chart bar */
.chart-bar-wrap { display: flex; align-items: flex-end; gap: 6px; height: 80px; margin-top: 1rem; }
.chart-bar {
    flex: 1; background: linear-gradient(to top, var(--accent), rgba(245,158,11,0.3));
    border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.6s ease;
    position: relative;
}
.chart-bar-label { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; color: var(--text-muted); white-space: nowrap; }

/* --- RULES --- */
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; max-width: 800px; }
@media(max-width: 600px) { .rules-grid { grid-template-columns: 1fr; } }
.rule-card { position: relative; padding-top: 2rem; }
.rule-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* --- GAME MODAL --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); z-index: 100;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
    background: var(--bg-panel); border: 1px solid var(--accent); width: 90%; max-width: 440px;
    padding: 2.5rem 2rem; border-radius: 16px; text-align: center;
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.15);
    transform: scale(0.9); transition: transform 0.3s; position: relative;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-close-btn {
    position: absolute; top: 12px; right: 12px; background: none;
    color: var(--text-muted); padding: 4px; border-radius: 4px; transition: var(--trans-fast);
}
.modal-close-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.modal-ready-visual {
    position: relative; width: 80px; height: 80px; margin: 0 auto 1.5rem;
    display: flex; align-items: center; justify-content: center;
}
.modal-pulse-ring {
    position: absolute; width: 80px; height: 80px; border-radius: 50%;
    border: 2px solid var(--accent); opacity: 0.3;
    animation: pulseRing 2s ease-out infinite;
}
@keyframes pulseRing { 0% { transform: scale(0.8); opacity: 0.5; } 100% { transform: scale(1.5); opacity: 0; } }
.modal-play-icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
    display: flex; align-items: center; justify-content: center;
}
.spinner-ring {
    width: 50px; height: 50px; border: 3px solid var(--border-color);
    border-top-color: var(--accent); border-radius: 50%;
    margin: 0 auto; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-emoji { font-size: 3.5rem; display: inline-block; animation: bounceIn 0.5s ease; }
@keyframes bounceIn { 0% { transform: scale(0); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
.result-points-display {
    font-family: var(--font-display); font-size: 2rem; font-weight: 700;
    color: var(--primary); margin-top: 0.25rem; text-shadow: 0 0 20px var(--primary-glow);
}

/* --- TOAST --- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--bg-panel); border-left: 4px solid var(--accent);
    padding: 1rem 1.5rem; border-radius: 8px; box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    color: var(--text-main); animation: slideIn 0.3s ease-out forwards;
    display: flex; align-items: center; gap: 10px; font-size: 0.9rem; max-width: 350px;
}
.toast-success { border-left-color: #22c55e; }
.toast-points { border-left-color: var(--primary); }

/* --- ANIMATIONS --- */
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- SVG ICONS --- */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- SCROLLBAR --- */
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* --- LOADING SKELETON --- */
.skeleton { background: var(--bg-panel); border-radius: 8px; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .login-title { font-size: 2.8rem; }
    .hero-title { font-size: 1.8rem; }
    .hero-card { padding: 1.5rem; }
    .sidebar { padding: 1rem; position: relative; height: auto; }
    .main-content { padding: 1.25rem; }
    .garland-string { padding: 10px 2%; }
    .lantern-2 { display: none; }
}
