/**
 * GameHube Custom Styles
 * 
 * Custom CSS styles for the GameHube gaming website.
 * Built on top of Bootstrap 5 framework.
 * 
 * @author GameHube Development Team
 * @version 1.0
 * @created 2025-08-19
 */

/* =============================================
   GLOBAL STYLES
   ============================================= */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --game-card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --game-card-hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.main-content {
    min-height: calc(100vh - 200px);
}

/* =============================================
   NAVIGATION STYLES
   ============================================= */

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: var(--transition);
    border-radius: 4px;
    margin: 0 2px;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* =============================================
   GAME CARD STYLES
   ============================================= */

.game-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    transition: var(--transition);
    overflow: hidden;
    height: 100%;
}

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

.game-card .card-img-top {
    height: 200px;
    object-fit: cover;
    transition: var(--transition);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.game-card .card-img-top::before {
    content: "🎮 Game Image";
    display: none;
}

.game-card .card-img-top[src*="game-placeholder.jpg"]::before,
.game-card .card-img-top:not([src])::before {
    display: block;
}

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

.game-card .card-body {
    padding: 1.25rem;
}

.game-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.game-card .card-text {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.game-card .play-btn {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    border: none;
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 500;
    transition: var(--transition);
}

.game-card .play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* =============================================
   CATEGORY STYLES
   ============================================= */

.category-card {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    text-decoration: none;
    display: block;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--game-card-hover-shadow);
    color: white;
    text-decoration: none;
}

.category-card .category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.category-card .category-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.category-card .category-count {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* =============================================
   HERO SECTION
   ============================================= */

.hero-section {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    padding: 4rem 0;
    margin-bottom: 3rem;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.hero-section .btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
}

/* =============================================
   GAME PAGE STYLES
   ============================================= */

.game-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    overflow: hidden;
    margin-bottom: 2rem;
    position: relative;
    min-height: 400px;
}

.game-iframe {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
    transition: opacity 0.5s ease;
}

.game-iframe-container {
    position: relative;
    width: 100%;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* =============================================
   GAME LOADING SYSTEM
   ============================================= */

.game-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.game-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.game-loading-placeholder {
    text-align: center;
    color: white;
    padding: 2rem;
}

.game-loading-placeholder .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
    margin-bottom: 1rem;
}

.game-loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 1rem auto;
    overflow: hidden;
}

.game-loading-progress-bar {
    height: 100%;
    background: white;
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: progressPulse 2s infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.game-loading-tips {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.game-loading-dots {
    display: inline-block;
}

.game-loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* =============================================
   GAME ERROR HANDLING
   ============================================= */

.game-error-fallback {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    border-radius: var(--border-radius);
}

.game-error-animation {
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.game-retry-button {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
}

.game-retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.game-retry-button:active {
    transform: translateY(0);
}

/* =============================================
   GAME PERFORMANCE INDICATORS
   ============================================= */

.game-performance-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    z-index: 15;
    display: none;
}

.game-performance-indicator.show {
    display: block;
}

.game-performance-indicator.good {
    background: rgba(40, 167, 69, 0.8);
}

.game-performance-indicator.warning {
    background: rgba(255, 193, 7, 0.8);
}

.game-performance-indicator.error {
    background: rgba(220, 53, 69, 0.8);
}

/* =============================================
   GAME FULLSCREEN ENHANCEMENTS
   ============================================= */

.game-container:-webkit-full-screen {
    background: black;
}

.game-container:-moz-full-screen {
    background: black;
}

.game-container:fullscreen {
    background: black;
}

.game-container:-webkit-full-screen .game-iframe {
    width: 100vw;
    height: 100vh;
}

.game-container:-moz-full-screen .game-iframe {
    width: 100vw;
    height: 100vh;
}

.game-container:fullscreen .game-iframe {
    width: 100vw;
    height: 100vh;
}

/* =============================================
   GAME LOADING SKELETON
   ============================================= */

.game-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--border-radius);
    height: 400px;
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.game-skeleton-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.game-skeleton-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.game-skeleton-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.game-skeleton-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* =============================================
   RESPONSIVE GAME LOADING
   ============================================= */

@media (max-width: 768px) {
    .game-loading-placeholder {
        padding: 1rem;
    }

    .game-loading-placeholder h5 {
        font-size: 1.2rem;
    }

    .game-loading-progress {
        width: 150px;
    }

    .game-loading-tips {
        font-size: 0.8rem;
        max-width: 250px;
    }

    .game-skeleton {
        height: 300px;
    }

    .game-skeleton-icon {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .game-loading-placeholder {
        padding: 0.5rem;
    }

    .game-loading-placeholder .spinner-border {
        width: 2rem;
        height: 2rem;
    }

    .game-skeleton {
        height: 250px;
    }
}

.game-info {
    padding: 2rem;
}

.game-title {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1rem;
}

.game-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.game-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #555;
}

/* =============================================
   PAGINATION STYLES
   ============================================= */

.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.pagination .page-link {
    border-radius: 50px;
    margin: 0 2px;
    border: none;
    color: var(--primary-color);
    font-weight: 500;
}

.pagination .page-link:hover {
    background-color: var(--primary-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* =============================================
   SEARCH STYLES
   ============================================= */

.search-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.search-form .form-control {
    border-radius: 25px;
    padding: 12px 20px;
    border: 2px solid #e9ecef;
    font-size: 1rem;
}

.search-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-form .btn {
    border-radius: 25px;
    padding: 12px 25px;
}

/* =============================================
   FOOTER STYLES
   ============================================= */

footer {
    margin-top: auto;
}

footer .social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

footer .social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Footer link styles */
footer .footer-link {
    transition: all 0.3s ease;
}

footer .footer-link:hover {
    color: var(--primary-color) !important;
    text-decoration: underline !important;
}

footer .social-link {
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 50%;
}

footer .social-link:hover {
    background-color: var(--primary-color);
    color: white !important;
    transform: translateY(-2px);
}

/* =============================================
   BACK TO TOP BUTTON
   ============================================= */

#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    transition: var(--transition);
}

#btn-back-to-top:hover {
    background: #0056b3;
    transform: scale(1.1);
}

/* =============================================
   LOADING ANIMATIONS
   ============================================= */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.game-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

/* =============================================
   RESPONSIVE STYLES
   ============================================= */

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .game-iframe {
        height: 400px;
    }
    
    .game-info {
        padding: 1rem;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .game-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .game-iframe {
        height: 300px;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    .category-card .category-icon {
        font-size: 2rem;
    }
}

/* =============================================
   UTILITY CLASSES
   ============================================= */

.text-gradient {
    background: linear-gradient(45deg, var(--primary-color), #0056b3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: var(--game-card-shadow);
}

.shadow-hover:hover {
    box-shadow: var(--game-card-hover-shadow);
}

.border-radius-custom {
    border-radius: var(--border-radius);
}

.transition-custom {
    transition: var(--transition);
}

/* =============================================
   ADVANCED GAME GRID LAYOUTS
   ============================================= */

.games-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.games-grid-large {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.games-grid-small {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.game-card-featured {
    grid-column: span 2;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.game-card-featured .card-title {
    color: white;
    font-size: 1.5rem;
}

.game-card-featured .card-text {
    color: rgba(255, 255, 255, 0.9);
}

/* =============================================
   FILTER AND SORT COMPONENTS
   ============================================= */

.filter-sidebar {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1.5rem;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.filter-group {
    margin-bottom: 2rem;
}

.filter-group h6 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.filter-checkbox {
    margin-bottom: 0.5rem;
}

.filter-checkbox input[type="checkbox"] {
    margin-right: 0.5rem;
}

.filter-checkbox label {
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filter-count {
    background: #e9ecef;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.sort-controls {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.sort-controls .form-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
}

.sort-controls .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* =============================================
   BREADCRUMB ENHANCEMENTS
   ============================================= */

.breadcrumb {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-weight: bold;
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: #666;
    font-weight: 500;
}

/* =============================================
   GAME DETAIL PAGE STYLES
   ============================================= */

.game-header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.game-header .game-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.game-header .meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.game-controls {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-controls .btn-group .btn {
    border-radius: 6px;
    margin: 0 2px;
}

.fullscreen-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: var(--transition);
}

.fullscreen-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.game-sidebar {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1.5rem;
}

.game-sidebar h5 {
    color: #333;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.game-tag {
    background: #e9ecef;
    color: #666;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    text-decoration: none;
    transition: var(--transition);
}

.game-tag:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
}

/* =============================================
   SEARCH PAGE STYLES
   ============================================= */

.search-header {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.search-header h1 {
    color: #333;
    margin-bottom: 1rem;
}

.search-form-advanced {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.search-form-advanced .form-control,
.search-form-advanced .form-select {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.search-form-advanced .form-control:focus,
.search-form-advanced .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-results-count {
    color: #666;
    font-size: 0.9rem;
}

.search-suggestions {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.search-suggestions h6 {
    margin-bottom: 0.5rem;
    color: #333;
}

.search-suggestions .badge {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* =============================================
   CATEGORY PAGE STYLES
   ============================================= */

.category-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.category-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.category-header .category-description {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.category-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.category-stat {
    text-align: center;
}

.category-stat .stat-number {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.category-stat .stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.subcategories {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--game-card-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.subcategory-link {
    display: inline-block;
    background: #e9ecef;
    color: #666;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    margin: 0 0.5rem 0.5rem 0;
    transition: var(--transition);
    font-size: 0.9rem;
}

.subcategory-link:hover {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

/* =============================================
   ENHANCED RESPONSIVE STYLES
   ============================================= */

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

    .game-card-featured {
        grid-column: span 1;
    }
}

@media (max-width: 992px) {
    .filter-sidebar {
        position: static;
        margin-bottom: 2rem;
        max-height: none;
    }

    .game-header h1 {
        font-size: 2rem;
    }

    .category-header h1 {
        font-size: 2rem;
    }

    .category-stats {
        justify-content: center;
    }
}

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

    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .game-controls .btn-group {
        justify-content: center;
    }

    .search-results-header {
        flex-direction: column;
        align-items: stretch;
    }

    .category-stats {
        gap: 1rem;
    }

    .game-header .game-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .games-grid {
        grid-template-columns: 1fr;
    }

    .search-header {
        padding: 1rem;
    }

    .search-form-advanced {
        padding: 1rem;
    }

    .game-header {
        padding: 2rem 0;
    }

    .category-header {
        padding: 2rem 0;
    }

    .game-sidebar {
        padding: 1rem;
    }

    .filter-sidebar {
        padding: 1rem;
    }
}

/* =============================================
   MOBILE-OPTIMIZED NAVIGATION
   ============================================= */

@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(0, 123, 255, 0.95);
        margin-top: 1rem;
        border-radius: var(--border-radius);
        padding: 1rem;
        backdrop-filter: blur(10px);
    }

    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
        border-radius: 6px;
        font-size: 1.1rem;
    }

    .navbar-nav .dropdown-menu {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        margin-top: 0.5rem;
    }

    .navbar-nav .dropdown-item {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* =============================================
   TOUCH-FRIENDLY ELEMENTS
   ============================================= */

/* Minimum touch target size of 44px */
.btn, .nav-link, .dropdown-item, .page-link, .form-control, .form-select {
    min-height: 44px;
    display: flex;
    align-items: center;
}

.btn-sm {
    min-height: 38px;
}

.btn-lg {
    min-height: 50px;
}

/* Touch-friendly game cards */
.game-card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.game-card:active {
    transform: scale(0.98);
}

/* Touch-friendly category cards */
.category-card {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.category-card:active {
    transform: scale(0.95);
}

/* Swipe indicators for mobile */
.swipe-indicator {
    display: none;
}

@media (max-width: 768px) {
    .swipe-indicator {
        display: block;
        text-align: center;
        color: #666;
        font-size: 0.8rem;
        margin-top: 1rem;
    }

    .swipe-indicator::before {
        content: "← Swipe to see more →";
    }
}

/* =============================================
   MOBILE SEARCH ENHANCEMENTS
   ============================================= */

@media (max-width: 768px) {
    .navbar .d-flex {
        width: 100%;
        margin-top: 1rem;
    }

    .navbar .input-group {
        width: 100%;
    }

    .search-form-advanced .row {
        margin: 0;
    }

    .search-form-advanced .col-md-4,
    .search-form-advanced .col-md-3,
    .search-form-advanced .col-md-2 {
        padding: 0 0.5rem;
        margin-bottom: 1rem;
    }
}

/* =============================================
   MOBILE GAME CONTROLS
   ============================================= */

.mobile-game-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 25px;
    padding: 10px 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .mobile-game-controls {
        display: flex;
        gap: 15px;
    }

    .mobile-game-controls .btn {
        background: transparent;
        border: 2px solid rgba(255, 255, 255, 0.3);
        color: white;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
    }

    .mobile-game-controls .btn:hover,
    .mobile-game-controls .btn:active {
        background: rgba(255, 255, 255, 0.2);
        border-color: rgba(255, 255, 255, 0.5);
    }
}

/* =============================================
   PULL-TO-REFRESH INDICATOR
   ============================================= */

.pull-to-refresh {
    display: none;
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

.pull-to-refresh.active {
    display: block;
}

.pull-to-refresh .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
}

/* =============================================
   MOBILE MODAL ENHANCEMENTS
   ============================================= */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .modal-content {
        border-radius: var(--border-radius);
    }

    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #e9ecef;
    }

    .modal-body {
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
    }

    .modal-footer {
        padding: 1rem;
        border-top: 1px solid #e9ecef;
    }
}

/* =============================================
   MOBILE TOAST NOTIFICATIONS
   ============================================= */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1055;
}

@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        right: 10px;
    }

    .toast {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* =============================================
   MOBILE STICKY ELEMENTS
   ============================================= */

@media (max-width: 768px) {
    .sticky-mobile {
        position: sticky;
        top: 70px; /* Account for navbar height */
        z-index: 100;
        background: white;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        margin-bottom: 1rem;
    }
}

/* =============================================
   MOBILE HORIZONTAL SCROLL
   ============================================= */

.horizontal-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.horizontal-scroll::-webkit-scrollbar {
    display: none;
}

.horizontal-scroll > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

@media (max-width: 768px) {
    .mobile-horizontal {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
        margin-bottom: 1rem;
    }

    .mobile-horizontal .game-card,
    .mobile-horizontal .category-card {
        flex: 0 0 280px;
        margin-right: 1rem;
        scroll-snap-align: start;
    }

    .mobile-horizontal .category-card {
        flex: 0 0 200px;
    }
}

/* =============================================
   MOBILE BOTTOM NAVIGATION
   ============================================= */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #666;
        font-size: 0.8rem;
        padding: 5px 10px;
        border-radius: 8px;
        transition: var(--transition);
        min-width: 60px;
    }

    .bottom-nav-item:hover,
    .bottom-nav-item.active {
        color: var(--primary-color);
        background: rgba(0, 123, 255, 0.1);
        text-decoration: none;
    }

    .bottom-nav-item i {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    /* Add bottom padding to body when bottom nav is present */
    body.has-bottom-nav {
        padding-bottom: 70px;
    }
}

/* =============================================
   MOBILE GESTURES
   ============================================= */

.swipe-area {
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

.swipe-left,
.swipe-right {
    transition: transform 0.3s ease;
}

.swipe-left.swiping {
    transform: translateX(-20px);
}

.swipe-right.swiping {
    transform: translateX(20px);
}

/* =============================================
   MOBILE ACCESSIBILITY
   ============================================= */

@media (max-width: 768px) {
    /* Larger text for better readability */
    .mobile-large-text {
        font-size: 1.1rem;
        line-height: 1.5;
    }

    /* Better contrast for mobile */
    .mobile-high-contrast {
        color: #000;
        background: #fff;
    }

    /* Focus indicators for mobile */
    .btn:focus,
    .form-control:focus,
    .nav-link:focus {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* =============================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   ============================================= */

@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .reduce-motion * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Optimize images for mobile */
    .mobile-optimized-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Hardware acceleration for smooth scrolling */
    .smooth-scroll {
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0);
        will-change: scroll-position;
    }
}

/* =============================================
   MOBILE GAME IFRAME OPTIMIZATIONS
   ============================================= */

@media (max-width: 768px) {
    .game-iframe-container {
        border-radius: 8px;
        margin: 0 -15px; /* Full width on mobile */
        width: calc(100% + 30px);
    }

    .game-iframe {
        height: 300px;
        border-radius: 8px;
    }

    /* Portrait orientation */
    @media (orientation: portrait) {
        .game-iframe {
            height: 250px;
        }
    }

    /* Landscape orientation */
    @media (orientation: landscape) {
        .game-iframe {
            height: 350px;
        }
    }
}

@media (max-width: 576px) {
    .game-iframe {
        height: 220px;
    }

    @media (orientation: portrait) {
        .game-iframe {
            height: 200px;
        }
    }

    @media (orientation: landscape) {
        .game-iframe {
            height: 300px;
        }
    }
}

/* =============================================
   MOBILE OPTIMIZATION ENHANCEMENTS
   ============================================= */

@media (max-width: 768px) {
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Better text sizing on mobile */
    .display-4 {
        font-size: 2rem;
    }

    .h1, h1 {
        font-size: 1.75rem;
    }

    .h2, h2 {
        font-size: 1.5rem;
    }

    .h3, h3 {
        font-size: 1.25rem;
    }

    /* Improve button sizes for touch */
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .btn-sm {
        min-height: 38px;
        padding: 0.375rem 0.75rem;
    }

    .btn-lg {
        min-height: 48px;
        padding: 0.625rem 1.25rem;
    }

    /* Better form controls for mobile */
    .form-control, .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Improve card spacing */
    .card {
        margin-bottom: 1rem;
    }

    /* Better list spacing */
    .list-group-item {
        padding: 0.75rem 1rem;
    }

    /* Optimize navigation spacing */
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }

    /* Footer responsive adjustments */
    footer {
        padding: 2rem 0 1rem;
    }

    footer .col-lg-4,
    footer .col-lg-2,
    footer .col-lg-3 {
        margin-bottom: 2rem;
    }

    footer h5,
    footer h6 {
        margin-bottom: 1rem;
    }

    footer .social-links {
        margin-top: 1rem;
    }

    footer .list-inline-item {
        margin-right: 0.5rem;
        margin-left: 0.5rem;
    }

    /* Touch-friendly improvements */
    .game-card, .category-card {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* Better touch targets for dropdowns */
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
    }

    /* Improve modal touch experience */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    /* Better scrollable areas */
    .modal-body {
        -webkit-overflow-scrolling: touch;
        max-height: 60vh;
        overflow-y: auto;
    }
}
