/* ============================================
   FreeGameHub - Estilos Principales
   Versión: 2.0 - Estático puro (sin frameworks)
   ============================================ */

/* Variables CSS */
:root {
    --color-primary: #8b5cf6;
    --color-primary-dark: #7c3aed;
    --color-secondary: #f97316;
    --color-bg: #faf5ff;
    --color-card: #ffffff;
    --color-text: #1f2937;
    --color-text-secondary: #6b7280;
    --color-border: #e5e7eb;
    --color-success: #22c55e;
    --font-bubble: 'Bungee', cursive;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Reset básico */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

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

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
    cursor: pointer;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: var(--color-text);
    border-radius: 8px;
    transition: background 0.2s;
}

.menu-btn:hover {
    background: var(--color-border);
}

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

.logo-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}

.logo-text {
    font-family: var(--font-bubble);
    font-size: 1rem;
    color: var(--color-secondary);
    text-shadow: 1px 1px 0 white;
}

.header-center {
    flex: 1;
    max-width: 400px;
    padding: 0 1rem;
}

.search-form {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 1px solid var(--color-border);
    border-radius: 50px;
    background: var(--color-bg);
    font-size: 0.875rem;
    color: var(--color-text);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-selector {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-card);
    font-size: 0.875rem;
    cursor: pointer;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-card);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 90;
    overflow: hidden;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-logo img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.sidebar-logo span {
    font-family: var(--font-bubble);
    font-size: 1.1rem;
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-url {
    font-size: 0.75rem;
    color: var(--color-secondary);
    margin-top: 0.25rem;
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--color-text);
    border-radius: 8px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--color-primary);
}

.sidebar-link.active {
    background: var(--color-primary);
    color: white;
}

.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-border), transparent);
    margin: 0.75rem;
}

.sidebar-legal {
    padding: 0.5rem;
}

.sidebar-link-small {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    transition: color 0.2s;
}

.sidebar-link-small:hover {
    color: var(--color-primary);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 85;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
    padding: 1.5rem;
    padding-bottom: 100px;
}

.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.section-subtitle {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

/* ============================================
   GAMES GRID
   ============================================ */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.game-card {
    background: var(--color-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.game-card-thumb {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #f3f4f6;
}

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

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

.game-card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s;
}

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

.play-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.game-card-info {
    padding: 0.75rem;
}

.game-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-card-category {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

/* Loading */
.loading-spinner {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--color-text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Load More Button */
.load-more-container {
    text-align: center;
    margin: 2rem 0;
}

.btn-load-more {
    padding: 0.75rem 2rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background: var(--color-primary-dark);
    transform: scale(1.02);
}

.btn-load-more:disabled {
    background: var(--color-border);
    cursor: not-allowed;
}

/* ============================================
   ADS
   ============================================ */
.ad-banner {
    background: var(--color-card);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.ad-leaderboard {
    height: 90px;
}

.ad-rectangle {
    height: 250px;
    max-width: 300px;
    margin: 1.5rem auto;
}

/* Banner grande entre secciones */
.ad-rectangle-large {
    height: 90px;
    max-width: 728px;
    margin: 2rem auto;
}

/* Banner inline entre filas de juegos */
.ad-inline {
    grid-column: 1 / -1;
    height: 90px;
    margin: 1rem 0;
    background: var(--color-card);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .ad-inline {
        height: 60px;
    }
    
    .ad-rectangle-large {
        height: 60px;
        max-width: 100%;
    }
}

.ad-placeholder {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.ad-sticky-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 60px;
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 80;
}

.ad-sticky-footer.hidden {
    display: none;
}

.sticky-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-border);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
}

/* ============================================
   MOBILE NOTICE
   ============================================ */
.mobile-notice {
    display: none;
    position: fixed;
    bottom: 70px;
    left: 1rem;
    right: 1rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: #92400e;
    z-index: 75;
    align-items: center;
    gap: 0.5rem;
}

.mobile-notice.show {
    display: flex;
}

.notice-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--color-card);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
    margin-top: 2rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .ad-sticky-footer {
        left: 0;
    }
    
    .menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .header-center {
        display: none;
    }
    
    .logo-text {
        display: none;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .main-content {
        padding: 1rem;
        padding-bottom: 80px;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .mobile-notice.show {
        display: flex;
    }
}

@media (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .game-card-info {
        padding: 0.5rem;
    }
    
    .game-card-title {
        font-size: 0.75rem;
    }
}

/* ============================================
   LEGAL PAGES
   ============================================ */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
}

.legal-page h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.legal-page h2 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--color-text);
}

.legal-page p, .legal-page li {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    line-height: 1.8;
}

.legal-page ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.legal-content {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 2rem;
    border: 1px solid var(--color-border);
}

/* ============================================
   CATEGORY SEO TEXT
   ============================================ */
.category-seo-text {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border: 1px solid var(--color-border);
    line-height: 1.8;
}

.category-seo-text h1 {
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    font-weight: 700;
}

.category-seo-text p {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.category-seo-text p:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .category-seo-text {
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .category-seo-text h1 {
        font-size: 1.15rem;
    }
    
    .category-seo-text p {
        font-size: 0.85rem;
    }
}

/* ============================================
   APP DOWNLOAD LINK (Mobile Notice)
   ============================================ */
.app-download-link {
    display: none;
    color: #1d4ed8;
    font-weight: 600;
    text-decoration: underline;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

@media (max-width: 1024px) {
    .app-download-link {
        display: block;
    }
}

.mobile-notice {
    flex-direction: column;
    align-items: flex-start;
}
