:root {
    --primary: #dc2626;
    --primary-hover: #b91c1c;

    /* Light Theme (Default) */
    --bg-dark: #ffffff;
    --bg-card: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg-sidebar: #ffffff;
}

[data-theme="dark"] {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --bg-sidebar: #0f172a;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    /* Cleaner font */
    margin: 0;
    overflow-x: hidden;
    width: 100%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    width: 100%;
}

/* Header (Mobile Only) */
header {
    background: var(--bg-dark);
    opacity: 0.9;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 0;
    display: none;
    /* Hidden on Desktop by default */
}

@media (max-width: 768px) {
    header {
        display: block;
        /* Show on Mobile */
    }
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.logo img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: radial-gradient(circle at center, rgba(220, 38, 38, 0.05) 0%, transparent 70%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-main);
}


.hero p {
    color: var(--text-muted);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.search-container,
.category-container {
    position: relative;
    flex: 1;
    min-width: 150px;
    /* Reduced from 250px */
}

.search-container i,
.category-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.category-container i {
    left: auto;
    right: 1rem;
}

.search-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    padding-left: 2.75rem;
    border-radius: 0.75rem;
    width: 100%;
    outline: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.2);
}

.category-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    border-radius: 0.75rem;
    outline: none;
    cursor: pointer;
    width: 100%;
    font-size: 0.95rem;
    appearance: none;
    -webkit-appearance: none;
}

/* Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -10px rgba(225, 29, 72, 0.3);
}

.card-image {
    height: 200px;
    /* Force consistent height */
    width: 100%;
    object-fit: cover;
    background: #333;
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Card Badge */
.card-badge {
    display: inline-block;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 99px;
    margin-bottom: 0.5rem;
    align-self: flex-start;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.price {
    font-weight: 700;
    color: var(--text-main);
}

.btn-sm {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.2s;
}

/* Buttons */
.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    margin-bottom: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
    gap: 0.5rem;
    font-size: 1rem;
}

.download-btn:hover {
    background: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.4);
}

.download-btn:active {
    transform: translateY(0);
}

.loader-container {
    padding: 4rem;
    text-align: center;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Navigation Layout */

/* DESKTOP: Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding-left: 1rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.25rem;
    text-transform: uppercase;
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.sidebar-link i {
    width: 24px;
    text-align: center;
    font-size: 1.25rem;
}

.sidebar-link:hover {
    background: var(--bg-card);
    color: var(--primary);
}

.sidebar-link.active {
    background: var(--bg-card);
    color: var(--primary);
    border-right: 4px solid var(--primary);
}

/* Adjust Main Content for Desktop Sidebar */
body {
    padding-left: 250px;
    /* Space for sidebar */
    padding-bottom: 0;
}

/* Hide Bottom Nav on Desktop */
.bottom-nav {
    display: none;
}

/* Mobile */
@media (max-width: 768px) {

    /* Hide Sidebar */
    .sidebar {
        display: none;
    }

    /* Reset Body Padding for Mobile */
    body {
        padding-left: 0;
        padding-bottom: 80px;
        /* Space for bottom nav */
    }

    /* Show Bottom Nav */
    .bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--bg-dark);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding: 0.5rem 0;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .bottom-nav-items {
        display: flex;
        justify-content: space-around;
        align-items: center;
        max-width: 600px;
        margin: 0 auto;
    }

    .bottom-nav-link {
        color: var(--text-muted);
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 0.75rem;
        gap: 0.25rem;
        width: 100%;
        padding: 0.5rem 0;
        transition: all 0.2s;
        font-weight: 600;
    }

    .bottom-nav-link i {
        font-size: 1.25rem;
        margin-bottom: 2px;
    }

    .bottom-nav-link:hover {
        color: var(--primary);
        /* Red on hover */
        background: var(--bg-card);
        border-radius: 8px;
    }

    .bottom-nav-link.active {
        color: var(--primary);
        /* Red */
        font-weight: 800;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .search-input {
        width: 100%;
    }

    /* Hide Desktop Nav if it existed (removed now) */
    .nav-links {
        display: none;
    }
}

/* Game Details Page Styles */
.details-hero {
    position: relative;
    height: 300px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.details-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.4);
}

.details-header {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 2rem;
    background: linear-gradient(to top, var(--bg-dark), transparent);
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    color: var(--text-main);
}

.game-poster {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border);
}

.game-meta h1 {
    margin: 0;
    font-size: 2.5rem;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.meta-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    backdrop-filter: blur(5px);
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.section-title {
    color: var(--text-main);
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.download-btn {
    display: block;
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    transition: background 0.2s;
    margin-bottom: 1rem;
}

.download-btn:hover {
    background: var(--primary-hover);
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 1rem;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Screenshots */
.screenshots-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
    scroll-behavior: smooth;
}

.screenshots-container img {
    height: 200px;
    width: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.screenshots-container img:hover {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .filters {
        display: flex;
        justify-content: center;
        /* Center the group */
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        width: 100%;
        margin: 0;
    }

    .search-container,
    .category-container {
        flex: 0 0 145px;
        /* Fixed small width for both */
        min-width: 0;
    }

    .category-select {
        padding: 0.6rem 2rem 0.6rem 0.75rem;
        font-size: 0.75rem;
        text-align: center;
    }

    .search-input {
        padding: 0.6rem 0.5rem;
        font-size: 0.75rem;
        text-align: center;
        /* Center text like requested */
    }

    /* Hide search icon on mobile to make it look exactly like category box */
    .search-container i {
        display: none;
    }

    .category-container i {
        right: 0.5rem;
        font-size: 0.75rem;
    }
}