/* 
 * Nomadix Games - Global Styles
 * Branding: Tech Blue, Clean, Modern, Responsive
 */

:root {
    --primary-color: #3b82f6; /* Modern Tech Blue */
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --accent-color: #10b981; /* Emerald accent */
    --secondary-color: #64748b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --white: #ffffff;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 16px;
    --container-width: 1300px;
}

* {
    box-sizing: border-box;
}

html, body {
    font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(217, 91%, 60%, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(217, 91%, 60%, 0.05) 0px, transparent 50%);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden !important;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Add staggered entrance animation */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-card {
    animation: fadeInUp 0.6s ease backwards;
}

.game-card:nth-child(n) { animation-delay: calc(0.05s * var(--i, 0)); }

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Nav */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo span {
    color: var(--text-color);
}

nav ul {
    display: flex;
    gap: 25px;
}

nav ul li a {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 15px;
}

nav ul li a:hover, nav ul li a.active {
    color: var(--primary-color);
}

.search-bar {
    position: relative;
    width: 280px;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
    background: #f1f5f9;
}

.search-bar input:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Mobile Menu Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
}

/* Overlay Menu */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 9999; /* Ensure it's always on top */
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box; /* Prevent overflow from padding */
    transform: translateY(-100%);
    transition: var(--transition);
}

.mobile-overlay.active {
    transform: translateY(0);
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
}

.close-overlay {
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text-color);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    z-index: 1;
    line-height: 1;
}

.overlay-search {
    width: 100%;
    margin: 30px 0;
    position: relative;
}

.overlay-search input {
    width: 100%;
    box-sizing: border-box; /* Important for width calculation */
    padding: 14px 20px 14px 45px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    font-size: 15px;
    outline: none;
    background: #f8fafc;
    transition: var(--transition);
}

.overlay-search input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.overlay-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--primary-color);
}

.overlay-nav {
    width: 100%;
    flex-grow: 1;
    overflow-y: auto; /* Allow scrolling if many items */
}

.overlay-nav ul {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.overlay-nav ul li {
    list-style: none;
    width: 100%;
}

.overlay-nav ul li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    background: #f8fafc;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
}

.overlay-nav ul li a::after {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
    color: var(--primary-color);
    flex-shrink: 0; /* Prevent arrow from being squished */
    margin-left: 10px;
}

.overlay-footer {
    margin-top: auto;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.overlay-footer p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Sections */
section {
    padding: 30px 0;
}

.section-title {
    font-size: 24px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title h2 {
    position: relative;
    padding-left: 15px;
    font-size: 24px;
    font-weight: 800;
}

.section-title h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.view-all {
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 700;
}

/* Brand Text Section */
.brand-intro-section {
    padding: 60px 0;
    background: var(--white);
    border-radius: var(--radius);
    margin: 40px 0;
    box-shadow: var(--shadow);
}

.brand-intro-content {
    max-width: 900px;
    margin: 0 auto;
}

.brand-intro-content h2 {
    font-size: 32px;
    margin-bottom: 25px;
    color: var(--primary-color);
}

.brand-intro-content h3 {
    font-size: 24px;
    margin: 35px 0 15px;
    color: var(--text-color);
}

.brand-intro-content p {
    margin-bottom: 20px;
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* Game Cards */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.game-thumb {
    aspect-ratio: 1/1;
    overflow: hidden;
    position: relative;
}

.game-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.game-card:hover .game-thumb img {
    transform: scale(1.1);
}

.game-info {
    padding: 12px;
}

.game-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.game-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #ffc107;
}

.game-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    z-index: 10;
}

.game-badge.new { background: #28a745; }
.game-badge.hot { background: #dc3545; }

/* Hero Slider */
.hero-slider {
    height: 400px;
    margin-bottom: 40px;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
}

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
}

.slide.active {
    opacity: 1;
}

.slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.8), transparent);
}

.slide-content {
    position: relative;
    padding: 0 60px;
    max-width: 600px;
    color: white;
}

.slide-title {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 15px;
}

.slide-desc {
    font-size: 18px;
    margin-bottom: 25px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    padding: 10px 20px;
    background: var(--white);
    border-radius: 30px;
    box-shadow: var(--shadow);
    font-weight: 600;
    white-space: nowrap;
}

.pill:hover, .pill.active {
    background: var(--primary-color);
    color: white;
}

/* Footer */
footer {
    background: #222;
    color: #eee;
    padding: 60px 0 20px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-about h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.footer-links h4 {
    margin-bottom: 20px;
    font-size: 18px;
}

.footer-links ul li {
    margin-bottom: 10px;
}

.footer-links ul li a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #888;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#back-to-top {
    background: var(--primary-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* Game Detail Page Styles */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--white);
    border-radius: 30px;
    font-weight: 700;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    color: var(--primary-color);
}

.back-btn:hover {
    background: var(--primary-color);
    color: white;
}

.external-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-color);
    color: white;
}

.external-btn:hover {
    background: #059669;
    color: white;
}

.detail-sidebar .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.detail-sidebar .game-card .game-title {
    font-size: 14px;
}

.player-container {
    width: 100%;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    aspect-ratio: 16/9;
    position: relative;
}
.player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.detail-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.detail-thumb {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    object-fit: cover;
}
.detail-title-group {
    flex-grow: 1;
}
.detail-title-group h1 {
    font-size: 28px;
    margin-bottom: 8px;
}
.detail-meta {
    display: flex;
    gap: 15px;
    font-weight: 600;
    flex-wrap: wrap;
}
.detail-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}
.badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}
.detail-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}
.desc-section, .how-to-play, .tips-section, .comments-section {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}
.detail-body h2 {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
}
.features-list ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    list-style: none;
    padding: 0;
}
.features-list ul li {
    background: #f8fafc;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
}

/* Responsive tweaks for detail page */
@media (max-width: 992px) {
    .detail-body {
        grid-template-columns: 1fr;
        width: 100%;
        overflow-x: hidden;
    }
    .detail-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
        width: 100%;
        overflow: hidden;
    }
    .detail-meta {
        justify-content: center;
        flex-wrap: wrap;
    }
    .detail-main {
        width: 100%;
        overflow-x: hidden;
    }
    .detail-sidebar {
        width: 100%;
        overflow-x: hidden;
    }
}

@media (max-width: 480px) {
    .detail-title-group h1 { font-size: 22px; }
    .features-list ul { grid-template-columns: 1fr; }
    .player-container {
        border-radius: 8px;
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .header-inner {
        gap: 20px;
    }
    .search-bar {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        height: 70px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        grid-template-areas: none;
    }
    header nav, .header-inner .search-bar {
        display: none;
    }
    .menu-toggle {
        display: block;
    }
    
    .hero-slider {
        height: 250px;
    }
    .slide-content {
        padding: 0 20px;
    }
    .slide-title {
        font-size: 24px;
    }
    .slide-desc {
        display: none;
    }
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 480px) {
    .container { padding: 0 15px; }
    .header-inner {
        grid-template-areas: 
            "logo"
            "search"
            "nav";
    }
    .section-title h2 { font-size: 20px; }
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .hero-slider { height: 200px; }
    .slide-title { font-size: 20px; }
    .btn { padding: 8px 20px; font-size: 14px; }
}
