/* ============================================
   Game Hopper Central - Global Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&family=Inter:wght@300;400;500;600&display=swap');

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0a0a14;
    --bg-secondary: #12122a;
    --bg-card: rgba(20, 20, 50, 0.6);
    --bg-card-hover: rgba(30, 30, 70, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    --text-primary: #e8e8f0;
    --text-secondary: #9090b8;
    --text-muted: #606088;

    --accent-cyan: #00e5ff;
    --accent-magenta: #ff2ecb;
    --accent-lime: #7dff3a;
    --accent-orange: #ff8a2e;
    --accent-purple: #a855f7;

    --glow-cyan: 0 0 20px rgba(0, 229, 255, 0.3);
    --glow-magenta: 0 0 20px rgba(255, 46, 203, 0.3);
    --glow-lime: 0 0 20px rgba(125, 255, 58, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition-fast: 0.15s ease;
    --transition-med: 0.3s ease;
    --transition-slow: 0.5s ease;
}

[data-theme="light"] {
    --bg-primary: #f0f0f8;
    --bg-secondary: #e0e0f0;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(0, 0, 0, 0.03);
    --bg-glass-hover: rgba(0, 0, 0, 0.06);
    --border-glass: rgba(0, 0, 0, 0.08);
    --border-glass-hover: rgba(0, 0, 0, 0.15);
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8080a0;
    --accent-cyan: #0099cc;
    --accent-magenta: #cc0099;
    --accent-lime: #44aa00;
    --glow-cyan: 0 0 20px rgba(0, 153, 204, 0.15);
    --glow-magenta: 0 0 20px rgba(204, 0, 153, 0.15);
    --glow-lime: 0 0 20px rgba(68, 170, 0, 0.15);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

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

/* --- Animated Background --- */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 229, 255, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 46, 203, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 80%, rgba(125, 255, 58, 0.04) 0%, transparent 60%),
        var(--bg-primary);
}

.bg-animation::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: 
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.15), transparent),
        radial-gradient(2px 2px at 40% 70%, rgba(255, 255, 255, 0.1), transparent),
        radial-gradient(1px 1px at 60% 20%, rgba(255, 255, 255, 0.12), transparent),
        radial-gradient(1px 1px at 80% 60%, rgba(255, 255, 255, 0.08), transparent),
        radial-gradient(1.5px 1.5px at 10% 80%, rgba(0, 229, 255, 0.15), transparent),
        radial-gradient(1.5px 1.5px at 70% 40%, rgba(255, 46, 203, 0.12), transparent),
        radial-gradient(1px 1px at 90% 90%, rgba(125, 255, 58, 0.1), transparent);
    background-size: 200% 200%;
    animation: starsFloat 60s linear infinite;
}

@keyframes starsFloat {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-5%, -5%); }
    100% { transform: translate(0, 0); }
}

/* --- Grid Pattern Overlay --- */
.bg-animation::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* --- Navigation --- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0.75rem 1.5rem;
    background: rgba(10, 10, 20, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    transition: var(--transition-med);
}

[data-theme="light"] .site-nav {
    background: rgba(240, 240, 248, 0.85);
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    font-weight: 800;
    font-family: var(--font-heading);
}

.nav-brand-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.nav-brand-text span {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-links a.active {
    color: var(--accent-cyan);
}

.nav-links a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.45rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--accent-orange);
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.sound-toggle {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.45rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-toggle:hover {
    color: var(--accent-lime);
    background: var(--bg-glass-hover);
}

.sound-toggle svg { width: 18px; height: 18px; }

/* Mobile nav toggle */
.nav-menu-btn {
    display: none;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.45rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.nav-menu-btn svg { width: 20px; height: 20px; }

@media (max-width: 768px) {
    .nav-menu-btn { display: flex; }
    .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 20, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-glass);
        transform: translateY(-120%);
        transition: var(--transition-med);
        gap: 0.25rem;
    }
    [data-theme="light"] .nav-links {
        background: rgba(240, 240, 248, 0.95);
    }
    .nav-links.open {
        transform: translateY(0);
    }
    .nav-links a {
        padding: 0.75rem 1rem;
        width: 100%;
        border-radius: var(--radius-sm);
    }
}

/* --- Main Content --- */
.main-content {
    padding-top: 80px;
    min-height: 100vh;
}

/* --- Section Container --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* --- Page Header --- */
.page-header {
    text-align: center;
    padding: 3rem 0 2rem;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.page-header .subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta), var(--accent-lime));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition-med);
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glass-hover);
    transform: translateY(-2px);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan), #0090cc);
    color: #fff;
    box-shadow: var(--glow-cyan);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.5);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-magenta), var(--accent-purple));
    color: #fff;
    box-shadow: var(--glow-magenta);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 46, 203, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-lime), #33aa00);
    color: #111;
    box-shadow: var(--glow-lime);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(125, 255, 58, 0.5);
}

.btn-lg {
    padding: 0.9rem 2rem;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Input Fields --- */
.input-field {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.92rem;
    transition: var(--transition-fast);
    outline: none;
}

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

.input-field:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.1);
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group .input-field {
    flex: 1;
}

/* --- Game Card Grid --- */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.game-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 460 / 215;
    cursor: pointer;
    transition: var(--transition-med);
    border: 1px solid var(--border-glass);
}

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

.game-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.game-card:hover img {
    transform: scale(1.08);
}

.game-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.8rem;
    opacity: 0;
    transition: var(--transition-med);
}

.game-card:hover .game-card-overlay {
    opacity: 1;
}

.game-card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    line-height: 1.2;
}

.game-card-meta {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.2rem;
}

/* --- Tags / Chips --- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.tag:hover, .tag.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.tag.active-magenta {
    background: rgba(255, 46, 203, 0.15);
    border-color: var(--accent-magenta);
    color: var(--accent-magenta);
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-glass);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

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

.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-secondary);
}

/* --- Toast / Notification --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    font-size: 0.88rem;
    color: var(--text-primary);
    animation: toastIn 0.3s ease;
    max-width: 360px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.toast.success { border-color: var(--accent-lime); }
.toast.error { border-color: var(--accent-magenta); }
.toast.info { border-color: var(--accent-cyan); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-med);
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-med);
}

.modal-backdrop.open .modal {
    transform: scale(1) translateY(0);
}

.modal h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

/* --- Confetti Overlay --- */
#confetti-canvas {
    position: fixed;
    inset: 0;
    z-index: 8000;
    pointer-events: none;
}

/* --- Utility --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-secondary); }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 0.82rem;
}

.site-footer a {
    color: var(--accent-cyan);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Selection --- */
::selection {
    background: rgba(0, 229, 255, 0.25);
    color: #fff;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .page-header { padding: 2rem 0 1.5rem; }
    .glass-card { padding: 1rem; }
}
