/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --bg: #0f0f1a;
    --bg-light: #1a1a2e;
    --bg-lighter: #252542;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --radius: 16px;
    --radius-sm: 8px;
}

.light-theme {
    --bg: #f8fafc;
    --bg-light: #ffffff;
    --bg-lighter: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
}

.blue-theme {
    --bg: #0c1220;
    --bg-light: #151b2d;
    --bg-lighter: #1e2541;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #06b6d4;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-light);
    border-right: 1px solid var(--bg-lighter);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 20px;
    border-bottom: 1px solid var(--bg-lighter);
    margin-bottom: 16px;
}

.logo i {
    font-size: 28px;
    color: var(--primary);
}

.logo span {
    font-size: 22px;
    font-weight: 700;
    background: var(--gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    padding: 0 12px;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.nav-links li:hover {
    background: var(--bg-lighter);
    color: var(--text);
}

.nav-links li.active {
    background: var(--gradient);
    color: white;
}

.nav-links li i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-links li span {
    font-size: 14px;
    font-weight: 500;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.section-shell {
    width: min(100%, 1240px);
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    padding: 10px 18px;
    border-radius: 50px;
    width: 400px;
    max-width: 100%;
    border: 1px solid var(--bg-lighter);
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-bar i {
    color: var(--text-muted);
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    width: 100%;
}

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

.content-section {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 18px;
    flex-wrap: wrap;
}

.results-meta {
    color: var(--text-muted);
    font-size: 13px;
}

.source-stats,
.chip-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-chip,
.suggestion-chip {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--bg-lighter);
    background: var(--bg-light);
    color: var(--text);
    font-size: 12px;
}

.stat-chip.muted {
    color: var(--text-muted);
}

.featured-searches {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ad-panel {
    background: var(--bg-light);
    border: 1px solid var(--bg-lighter);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.ad-panel-inline {
    margin-bottom: 24px;
}

.ad-panel-footer,
.ad-panel-sidebar {
    margin-top: 28px;
}

.ad-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--bg-lighter);
    background: rgba(255, 255, 255, 0.02);
}

.ad-panel-header span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ad-panel-header small {
    color: var(--text-muted);
    font-size: 11px;
}

.ad-slot {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    width: 100%;
    overflow: hidden;
}

.ad-slot-banner {
    min-height: 130px;
}

.ad-slot-native {
    min-height: 160px;
}

.ad-slot-rail {
    min-height: 140px;
}

.ad-slot > div,
.ad-slot iframe,
.ad-slot script + div {
    width: 100%;
    max-width: 100%;
}

.featured-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--bg-lighter);
    background: var(--bg-light);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--text);
}

.filter-btn.active {
    background: var(--gradient);
    border-color: transparent;
    color: white;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    background: var(--bg-light);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--bg-lighter);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.game-thumbnail {
    position: relative;
    height: 160px;
    overflow: hidden;
}

.game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: flex-end;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.play-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 13px;
}

.game-info {
    padding: 16px;
}

.game-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.favorite-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.favorite-btn:hover, .favorite-btn.active {
    color: var(--accent);
}

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

.game-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-meta {
    flex-wrap: wrap;
}

.game-genre {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-lighter);
    border-radius: 50px;
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    margin-top: 10px;
}

.game-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

.game-badge.plugplay {
    background: #22c55e;
    color: white;
}

.game-badge.monetized {
    background: #f59e0b;
    color: white;
}

.game-badge.distribution {
    background: #ec4899;
    color: white;
}

.game-badge.free {
    background: #3b82f6;
    color: white;
}

.game-badge.embed {
    background: #8b5cf6;
    color: white;
}

/* Loading State */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.loading i {
    font-size: 40px;
    margin-bottom: 16px;
    color: var(--primary);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--bg-lighter);
}

.small-note,
.small {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 28px 0 10px;
}

.load-more-btn {
    border: 1px solid var(--bg-lighter);
    background: var(--bg-light);
    color: var(--text);
    border-radius: 999px;
    padding: 12px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: white;
    background: var(--primary);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    padding: 40px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    background: var(--bg-light);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-lighter);
    border-bottom: 1px solid var(--bg-lighter);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

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

.modal-actions button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-actions button:hover {
    background: var(--primary);
    color: white;
}

.modal-body {
    flex: 1;
    overflow: hidden;
}

#gameFrame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Branded Video Modal */
.video-modal .modal-content {
    background: #000;
    max-width: 90vw;
    height: 90vh;
    padding-top: 50px; 
}

.suggestion-chip:hover {
    border-color: var(--primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.setting-card {
    background: var(--bg-light);
    border: 1px solid var(--bg-lighter);
    border-radius: var(--radius);
    padding: 20px;
}

.setting-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 18px;
}

.setting-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.theme-buttons {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.theme-btn {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--bg-lighter);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}

.theme-btn.active,
.theme-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

@media (max-width: 1100px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--bg-lighter);
        padding: 14px 0 10px;
        position: sticky;
        top: 0;
        z-index: 20;
        backdrop-filter: blur(12px);
    }

    .logo {
        padding: 0 16px 14px;
        margin-bottom: 10px;
    }

    .nav-links {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 0 14px;
        flex: 0;
    }

    .nav-links li {
        justify-content: center;
        padding: 12px 10px;
        margin-bottom: 0;
        gap: 8px;
    }

    .nav-links li span {
        font-size: 13px;
    }

    .search-bar {
        width: 100%;
    }

    .content-section {
        padding: 18px 16px 26px;
    }

    .ad-slot {
        padding: 12px;
    }

    .catalog-toolbar {
        align-items: flex-start;
    }

    .featured-searches {
        align-items: flex-start;
    }

    .games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .game-thumbnail {
        height: 148px;
    }

    .modal {
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .modal-header {
        padding: 14px 16px;
    }
}

@media (max-width: 640px) {
    .logo span {
        font-size: 20px;
    }

    .section-header {
        margin-bottom: 18px;
    }

    .section-header h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 13px;
        line-height: 1.5;
    }

    .games-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .game-thumbnail {
        height: 172px;
    }

    .game-info {
        padding: 14px;
    }

    .load-more-wrap {
        padding-top: 22px;
    }

    .load-more-btn {
        width: 100%;
    }

    .nav-links li {
        flex-direction: column;
        gap: 6px;
        padding: 10px 8px;
    }

    .nav-links li i {
        width: auto;
    }

    .nav-links li span {
        font-size: 12px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-lighter);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
