/* GameVault CMS - Main Stylesheet
   Author: Mr Arslan CEO */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* Light mode */
    --bg: #f8fafc;
    --bg-soft: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,.05), 0 2px 4px -2px rgba(0,0,0,.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.06);
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-accent: linear-gradient(135deg, var(--secondary), var(--accent));

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --transition: .25s cubic-bezier(.4,0,.2,1);
    --header-h: 70px;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-soft: #1e293b;
    --surface: #1e293b;
    --surface-2: #0f172a;
    --text: #f1f5f9;
    --text-muted: #cbd5e1;
    --text-light: #64748b;
    --border: rgba(99,102,241,.15);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.3), 0 2px 4px -2px rgba(0,0,0,.2);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.4), 0 8px 10px -6px rgba(0,0,0,.3);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; }

/* HEADER */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(180%) blur(12px);
    box-shadow: var(--shadow);
}
.header-inner {
    max-width: 1400px; margin: 0 auto; padding: 0 20px;
    height: var(--header-h); display: flex; align-items: center; gap: 20px;
}
.logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 22px; font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    text-decoration: none;
}
.logo-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--gradient);
    display: flex; align-items: center; justify-content: center;
    color: #fff; -webkit-text-fill-color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,.4);
    flex-shrink: 0;
}

.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
    padding: 8px 14px; border-radius: 8px; color: var(--text-muted);
    font-weight: 500; font-size: 14px;
    transition: all var(--transition);
}
.main-nav a:hover, .main-nav a.active { background: var(--surface-2); color: var(--primary); }

.search-box {
    flex: 1; max-width: 400px; position: relative;
}
.search-box input {
    width: 100%; padding: 10px 16px 10px 40px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 50px;
    color: var(--text); font-size: 14px; transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-light); }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; margin-top: 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    max-height: 400px; overflow-y: auto; box-shadow: var(--shadow-lg);
    display: none; z-index: 99;
}
.search-results.active { display: block; }
.search-result-item { display: flex; gap: 12px; padding: 10px 14px; align-items: center; border-radius: 8px; transition: background var(--transition); }
.search-result-item:hover { background: var(--surface-2); }
.search-result-item img { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; }
.search-result-title { font-weight: 600; font-size: 14px; }
.search-result-cat { font-size: 12px; color: var(--text-light); }

.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--surface-2); border: none; color: var(--text);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); position: relative;
}
.icon-btn:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }

/* HERO */
.hero {
    background: var(--gradient);
    padding: 60px 20px; text-align: center; color: #fff;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.15), transparent 60%),
                radial-gradient(circle at 70% 70%, rgba(236,72,153,.3), transparent 60%);
}
.hero-content { position: relative; max-width: 800px; margin: 0 auto; }
.hero h1 {
    font-size: clamp(28px, 5vw, 48px); font-weight: 800;
    margin: 0 0 12px; line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.hero p { font-size: clamp(14px, 2vw, 18px); opacity: .95; margin: 0 0 24px; }

/* CONTAINER */
.container { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }

/* SECTION */
.section { margin-bottom: 40px; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 18px; gap: 16px; flex-wrap: wrap;
}
.section-title {
    font-size: 22px; font-weight: 700; margin: 0;
    display: flex; align-items: center; gap: 10px;
}
.section-title .icon-wrap {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--gradient); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.section-link { font-size: 13px; color: var(--primary); font-weight: 600; }

/* CATEGORIES BAR */
.categories-bar {
    display: flex; gap: 10px; overflow-x: auto;
    padding: 8px 0; scrollbar-width: none;
    margin-bottom: 24px;
}
.categories-bar::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0; padding: 10px 18px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 50px; color: var(--text-muted); font-weight: 500; font-size: 14px;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all var(--transition); white-space: nowrap;
}
.cat-chip:hover, .cat-chip.active {
    background: var(--gradient); color: #fff; border-color: transparent;
    box-shadow: 0 6px 16px rgba(99,102,241,.3); transform: translateY(-2px);
}
.cat-chip svg, .cat-chip i { width: 16px; height: 16px; }

/* GAME GRID */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}
.game-card {
    background: var(--surface); border-radius: var(--radius);
    overflow: hidden; transition: all var(--transition);
    border: 1px solid var(--border); cursor: pointer; position: relative;
    box-shadow: var(--shadow);
}
.game-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.game-thumb {
    width: 100%; aspect-ratio: 1/1; object-fit: cover;
    background: var(--surface-2);
    transition: transform .4s ease;
}
.game-card:hover .game-thumb { transform: scale(1.05); }
.game-thumb-wrap { position: relative; overflow: hidden; }
.game-thumb-wrap::after {
    content: '\f04b'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 50px; height: 50px; background: var(--gradient); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: #fff;
    opacity: 0; transition: opacity var(--transition);
    box-shadow: 0 8px 20px rgba(99,102,241,.5);
    pointer-events: none;
}
.game-card:hover .game-thumb-wrap::after { opacity: 1; }
.game-info { padding: 12px; }
.game-title {
    font-weight: 600; font-size: 14px; margin: 0 0 6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--text);
}
.game-meta {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--text-light);
}
.game-meta i { color: var(--warning); }
.badge {
    position: absolute; top: 8px; left: 8px;
    background: var(--gradient-accent); color: #fff;
    padding: 4px 10px; border-radius: 50px; font-size: 11px; font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,.2); z-index: 2;
}
.badge-trending { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.badge-new { background: linear-gradient(135deg, #10b981, #06b6d4); }

/* GAME PAGE */
.game-page { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
@media (max-width: 1024px) { .game-page { grid-template-columns: 1fr; } }

.game-player-wrap {
    background: #000; border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative; aspect-ratio: 16/10;
}
.game-player-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.game-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; color: #fff; backdrop-filter: blur(10px); z-index: 5;
}
.game-overlay img { width: 120px; height: 120px; border-radius: 16px; object-fit: cover; box-shadow: var(--shadow-lg); }
.btn-play {
    padding: 14px 36px; background: var(--gradient); color: #fff;
    border: none; border-radius: 50px; font-size: 16px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 10px;
    box-shadow: 0 10px 30px rgba(99,102,241,.5);
    transition: var(--transition);
}
.btn-play:hover { transform: scale(1.05); box-shadow: 0 15px 40px rgba(99,102,241,.6); }

.game-toolbar {
    display: flex; align-items: center; gap: 8px; padding: 14px;
    background: var(--surface); border-radius: var(--radius);
    margin-top: 12px; flex-wrap: wrap;
}
.tool-btn {
    padding: 8px 14px; background: var(--surface-2); border: none;
    border-radius: 8px; color: var(--text); font-size: 13px; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px; transition: var(--transition);
}
.tool-btn:hover { background: var(--primary); color: #fff; }
.tool-btn.active { background: var(--accent); color: #fff; }

.game-details {
    background: var(--surface); padding: 24px; border-radius: var(--radius);
    margin-top: 16px; border: 1px solid var(--border);
}
.game-details h1 { margin: 0 0 8px; font-size: 26px; }

.sidebar-widget {
    background: var(--surface); border-radius: var(--radius);
    padding: 18px; margin-bottom: 16px; border: 1px solid var(--border);
}
.widget-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

/* COMMENTS */
.comment {
    display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--gradient);
    display: flex; align-items: center; justify-content: center; color: #fff;
    font-weight: 600; flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-author { font-weight: 600; font-size: 14px; }
.comment-time { font-size: 12px; color: var(--text-light); margin-left: 8px; }
.comment-text { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.comment-form textarea {
    width: 100%; padding: 12px; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); resize: vertical; font-family: inherit;
}

/* RATING STARS */
.stars { color: var(--warning); display: inline-flex; gap: 2px; }
.rate-stars { display: inline-flex; gap: 4px; cursor: pointer; }
.rate-stars i { color: var(--text-light); transition: color var(--transition); cursor: pointer; }
.rate-stars i.active, .rate-stars i.hover { color: var(--warning); }

/* FOOTER */
.site-footer {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 40px 20px 80px; margin-top: 60px;
}
.footer-inner {
    max-width: 1400px; margin: 0 auto;
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px;
}
.footer-col h4 { font-size: 14px; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .5px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a { color: var(--text-muted); font-size: 14px; }
.footer-col a:hover { color: var(--primary); }
.footer-bottom {
    text-align: center; padding-top: 24px; border-top: 1px solid var(--border);
    margin-top: 24px; color: var(--text-light); font-size: 13px;
}
@media (max-width: 768px) { .footer-inner { grid-template-columns: 1fr 1fr; } }

/* MOBILE BOTTOM NAV */
.mobile-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 8px 0; backdrop-filter: blur(20px);
    box-shadow: 0 -4px 20px rgba(0,0,0,.05);
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav-inner { display: flex; justify-content: space-around; max-width: 600px; margin: 0 auto; }
.mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 12px; color: var(--text-muted); font-size: 11px; font-weight: 500;
    transition: var(--transition); position: relative;
}
.mobile-nav-item i { font-size: 20px; }
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item.active::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 30px; height: 3px; background: var(--gradient); border-radius: 0 0 4px 4px;
}
@media (max-width: 768px) {
    .mobile-nav { display: block; }
    .main-nav { display: none; }
    body { padding-bottom: 80px; }
    .header-inner { gap: 8px; padding: 0 12px; }
    .logo span { display: none; }
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .container { padding: 16px 12px; }
    .hero { padding: 40px 16px; }
}

/* ADS */
.ad-zone { margin: 16px 0; text-align: center; }
.ad-zone-header, .ad-zone-footer { margin: 0 0 16px; }
.ad-unit { display: inline-block; max-width: 100%; }
.ad-unit img { border-radius: var(--radius); max-width: 100%; height: auto; }
.ad-sticky-wrapper {
    position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
    z-index: 99; background: var(--surface); padding: 8px;
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border); max-width: 95vw;
}
.ad-close {
    position: absolute; top: -10px; right: -10px;
    width: 26px; height: 26px; border-radius: 50%; border: none;
    background: var(--danger); color: #fff; font-size: 16px; line-height: 1;
    cursor: pointer; box-shadow: var(--shadow);
}
.ad-popup-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 9999;
    display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px);
}
.ad-popup-overlay.active { display: flex; }
.ad-popup-content {
    background: var(--surface); padding: 24px; border-radius: var(--radius-lg);
    max-width: 500px; max-height: 80vh; overflow: auto; position: relative;
}

/* PAGINATION */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 24px 0; flex-wrap: wrap; }
.page-btn {
    min-width: 38px; height: 38px; padding: 0 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--text); font-weight: 500; transition: var(--transition);
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: transparent; }
.page-btn.active { background: var(--gradient); color: #fff; border-color: transparent; }
.page-btn.disabled { opacity: .4; pointer-events: none; }
.page-dots { padding: 0 4px; align-self: center; color: var(--text-light); }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; background: var(--gradient); color: #fff;
    border: none; border-radius: 10px; font-weight: 600; font-size: 14px;
    transition: var(--transition); text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99,102,241,.4); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-secondary:hover { background: var(--primary); color: #fff; }

/* EMPTY STATE */
.empty {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty i { font-size: 48px; color: var(--text-light); margin-bottom: 12px; }

/* TOAST */
.toast {
    position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: var(--surface); padding: 12px 20px; border-radius: 50px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px; z-index: 9999;
    opacity: 0; transition: all .3s ease;
    font-size: 14px; font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* LOADER */
.loader {
    width: 40px; height: 40px; border: 3px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin .8s linear infinite; margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SCROLLBAR */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--text-light); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* PWA Install Banner */
.pwa-install {
    position: fixed; bottom: 80px; left: 16px; right: 16px;
    background: var(--surface); border-radius: var(--radius);
    padding: 14px; display: none; align-items: center; gap: 12px;
    box-shadow: var(--shadow-lg); border: 1px solid var(--border);
    z-index: 99; max-width: 400px; margin: 0 auto;
}
.pwa-install.show { display: flex; }
.pwa-install-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--gradient); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; flex-shrink: 0; }
.pwa-install-text { flex: 1; }
.pwa-install-text strong { display: block; font-size: 14px; }
.pwa-install-text small { color: var(--text-light); font-size: 12px; }

/* FORMS */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: var(--text-muted); }
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-family: inherit; font-size: 14px;
    transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

/* ANIMATIONS */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeInUp .5s ease both; }
.fade-up:nth-child(1) { animation-delay: .05s; }
.fade-up:nth-child(2) { animation-delay: .1s; }
.fade-up:nth-child(3) { animation-delay: .15s; }
.fade-up:nth-child(4) { animation-delay: .2s; }
