/* ===== GLOBAL STYLES ===== */
.gm-container, .gm-category-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== HEADERS ===== */
.gm-container h1, .gm-category-page h1 {
    font-size: 36px;
    color: #2d3748;
    margin-bottom: 15px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 20px 0;
}

.page-description, .category-description {
    text-align: center;
    color: #4a5568;
    font-size: 18px;
    max-width: 800px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* ===== SEARCH BOX ===== */
.gm-search-box, .category-search-box {
    display: flex;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto 40px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.category-filter {
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    min-width: 200px;
    cursor: pointer;
}

.search-btn {
    padding: 15px 30px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    white-space: nowrap;
}

.search-btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

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

.game-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    position: relative;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    border-color: #4299e1;
}

.game-card::before {
    content: 'PLAY';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4299e1;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2;
}

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

.game-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

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

.game-info {
    padding: 15px;
}

.game-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #2d3748;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
}

.game-category {
    display: inline-block;
    background: #edf2f7;
    color: #4a5568;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== GAME PLAYER MODAL ===== */
.gm-player-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 1200px;
    height: 85vh;
    background: white;
    border-radius: 16px;
    z-index: 10001;
    display: none;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.gm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-controls {
    display: flex;
    gap: 10px;
}

.fullscreen-btn, .close-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.fullscreen-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.close-btn {
    background: #fc8181;
    color: white;
}

.close-btn:hover {
    background: #f56565;
}

.game-iframe {
    width: 100%;
    height: calc(100% - 70px);
    border: none;
    background: #000;
}

/* ===== LOADING STATES ===== */
.loading, .loading-spinner {
    text-align: center;
    padding: 50px;
    grid-column: 1 / -1;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== CATEGORY EXTRA CONTENT ===== */
.category-extra-content {
    background: #f7fafc;
    padding: 30px;
    border-radius: 12px;
    margin-top: 40px;
    border-left: 4px solid #4299e1;
}

.category-extra-content h2 {
    color: #2d3748;
    margin-top: 0;
    margin-bottom: 20px;
}

/* ===== AD UNITS ===== */
.ad-unit {
    margin: 30px 0;
    text-align: center;
    position: relative;
}

.ad-label {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f0f0f0;
    padding: 2px 15px;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
}

.ad-placeholder {
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 2px dashed #ddd;
    color: #666;
    font-size: 14px;
}

.ad-unit.leaderboard .ad-placeholder {
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-unit.rectangle .ad-placeholder {
    height: 250px;
    width: 300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== HOMEPAGE STYLES ===== */
.home-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    border-radius: 0 0 20px 20px;
    margin-bottom: 40px;
}

.hero-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    font-weight: 700;
    color: white;
    -webkit-text-fill-color: white;
}

.highlight {
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-content p {
    font-size: 20px;
    margin-bottom: 40px;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat .number {
    display: block;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat .label {
    font-size: 14px;
    opacity: 0.8;
}

.hero-search {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
}

.hero-search input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
}

.hero-search button {
    padding: 15px 30px;
    background: #FFD700;
    color: #333;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
}

.hero-search button:hover {
    transform: translateY(-2px);
}

/* Category Navigation */
.category-navigation {
    margin: 60px 0;
}

.category-navigation h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 32px;
    color: #333;
}

.category-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.category-tile {
    padding: 30px 20px;
    border-radius: 15px;
    color: white;
    text-decoration: none;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.category-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.1);
    z-index: 1;
}

.category-tile:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.category-tile .cat-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.category-tile h3 {
    font-size: 22px;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.category-tile p {
    opacity: 0.9;
    font-size: 14px;
    position: relative;
    z-index: 2;
}

/* Category Colors */
.cat-action { background: linear-gradient(135deg, #FF416C, #FF4B2B); }
.cat-sports { background: linear-gradient(135deg, #00b09b, #96c93d); }
.cat-racing { background: linear-gradient(135deg, #654ea3, #da98b4); }
.cat-puzzle { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.cat-arcade { background: linear-gradient(135deg, #ee9ca7, #ffdde1); color: #333; }
.cat-adventure { background: linear-gradient(135deg, #834d9b, #d04ed6); }

.category-tile.view-all {
    background: #f8f9fa;
    color: #333;
    border: 2px dashed #ddd;
}

.category-tile.view-all:hover {
    background: #e9ecef;
    border-color: #667eea;
}

/* Featured Games */
.featured-games {
    margin: 60px 0;
}

.featured-games h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 28px;
    color: #333;
}

.featured-games .icon {
    font-size: 32px;
}

.featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Home Category Sections */
.home-category-section {
    margin: 60px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 28px;
    color: #333;
    margin: 0;
}

.view-all-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Content Section */
.content-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 60px 20px;
    border-radius: 20px;
    margin: 60px 0;
}

.content-section h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 50px;
    color: #333;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.content-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.content-card:hover {
    transform: translateY(-10px);
}

.content-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.content-card h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: #333;
}

.content-card p {
    color: #666;
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-radius: 20px;
    margin: 60px 0;
}

.cta-section h2 {
    font-size: 42px;
    margin-bottom: 20px;
    color: white;
}

.cta-section p {
    font-size: 20px;
    margin-bottom: 40px;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background: #FFD700;
    color: #333;
}

.btn-primary:hover {
    background: #FFC400;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: #4facfe;
}

/* Footer Links */
.home-footer-links {
    text-align: center;
    padding: 30px 0;
    border-top: 1px solid #eee;
    margin-top: 60px;
}

.home-footer-links a {
    color: #666;
    text-decoration: none;
    margin: 0 15px;
}

.home-footer-links a:hover {
    color: #667eea;
    text-decoration: underline;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }
    
    .hero-content h1 {
        font-size: 40px;
    }
}

@media (max-width: 768px) {
    .gm-container, .gm-category-page {
        padding: 15px;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .game-thumb {
        height: 120px;
    }
    
    .gm-search-box, .category-search-box {
        flex-direction: column;
    }
    
    .search-input, .category-filter {
        width: 100%;
    }
    
    .gm-player-modal {
        width: 98%;
        height: 80vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .modal-controls {
        width: 100%;
        justify-content: center;
    }
    
    /* Homepage Responsive */
    .home-hero {
        padding: 40px 20px;
    }
    
    .hero-content h1 {
        font-size: 32px;
    }
    
    .hero-stats {
        gap: 20px;
    }
    
    .stat .number {
        font-size: 28px;
    }
    
    .hero-search {
        flex-direction: column;
    }
    
    .category-tiles {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cta-section h2 {
        font-size: 32px;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .gm-container h1, .gm-category-page h1 {
        font-size: 28px;
        padding: 15px 0;
    }
    
    .category-tiles {
        grid-template-columns: 1fr;
    }
    
    .games-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .game-thumb {
        height: 110px;
    }
    
    .game-info {
        padding: 12px;
    }
    
    .game-title {
        font-size: 14px;
    }
    
    .hero-content h1 {
        font-size: 28px;
    }
    
    .category-tile {
        min-height: 180px;
        padding: 20px 15px;
    }
    
    .category-tile h3 {
        font-size: 20px;
    }
}

/* Featured Games on Homepage */
.featured-grid .game-card {
    border: 2px solid #FFD700;
}

.featured-grid .game-card:hover {
    border-color: #FFA500;
}