/* ================================================
   MOBILE FIX CSS - HOLYWINGS77
   Memperbaiki masalah responsive di mode mobile
   ================================================ */

/* 0. NAVBAR LOGO FIX - Ukuran lebih kecil */
.navbar-fixed .logo-img {
    max-height: 44px !important;
    width: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: block !important;
    object-fit: contain !important;
}

@media (max-width: 600px) {
    .navbar-fixed .logo-img {
        max-height: 36px !important;
    }
}

@media (max-width: 400px) {
    .navbar-fixed .logo-img {
        max-height: 32px !important;
    }
}

/* 1. GLOBAL BOX-SIZING (Safe for all breakpoints) */
* {
    box-sizing: border-box;
}

/* 2. MOBILE-ONLY OVERFLOW PREVENTION */
@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        position: relative;
    }

    /* CONTAINER & WRAPPER FIXES - Mobile only */
    .container,
    .wrapper,
    .main-content,
    [class*="container"],
    [class*="wrapper"] {
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* 3. MOBILE-ONLY IMAGE & LAYOUT FIXES */
@media (max-width: 768px) {
    /* IMAGE RESPONSIVE FIXES */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Owl Carousel Image Fix */
    .owl-carousel .item img,
    .owl-carousel img,
    .home-slider img,
    .slider-container img {
        width: 100%;
        max-width: 100%;
        height: auto;
        object-fit: cover;
    }

    /* GRID LAYOUT FIXES */
    .games-grid,
    [class*="grid"],
    [class*="-grid"] {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* ROW & COLUMN FIXES */
    .row,
    [class*="row"] {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .col,
    [class*="col-"] {
        padding-left: 5px;
        padding-right: 5px;
        max-width: 100%;
    }
}

/* 6. MOBILE BREAKPOINTS - RESPONSIVE */

/* Extra Small Devices (320px and up) */
@media (max-width: 360px) {
    body {
        font-size: 13px;
    }
    
    .container {
        padding: 0 8px;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 5px !important;
    }
    
    .game-image {
        height: 70px !important;
    }
    
    .payment-btn,
    .action-buttons button,
    .category-item {
        font-size: 9px !important;
        padding: 6px 4px !important;
    }
}

/* Small Devices (360px - 480px) */
@media (min-width: 360px) and (max-width: 480px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
    
    .game-image {
        height: 85px !important;
    }
}

/* Medium Small Devices (480px - 768px) */
@media (min-width: 480px) and (max-width: 768px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px;
    }
    
    .game-image {
        height: 100px !important;
    }
}

/* 7. SLIDER FIXES FOR MOBILE */
@media (max-width: 768px) {
    .slider-container,
    .home-slider-wrapper,
    .image-slider {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }
    
    .slider-container {
        height: auto !important;
        min-height: 150px;
        max-height: 220px;
    }
    
    .owl-carousel .owl-stage-outer {
        overflow: hidden !important;
    }
    
    .owl-carousel .owl-stage {
        display: flex !important;
    }
    
    .owl-carousel .owl-item {
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .slider-container {
        height: auto !important;
        min-height: 120px;
        max-height: 180px;
    }
}

@media (max-width: 360px) {
    .slider-container {
        height: auto !important;
        min-height: 100px;
        max-height: 150px;
    }
}

/* 8. BUTTON & TOUCH TARGET FIXES */
@media (max-width: 768px) {
    button,
    a.btn,
    .btn,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 15px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .nav-item {
        min-height: 50px;
        min-width: 50px;
    }
}

/* 9. TEXT & FONT RESPONSIVE */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.3rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    p, span, div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
}

/* 10. PAYMENT METHODS FIX */
@media (max-width: 768px) {
    .payment-methods,
    .payment-grid,
    .payment-row {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .payment-item {
        flex-shrink: 0;
        min-width: 80px;
    }
}

/* 11. CATEGORIES NAVIGATION FIX */
@media (max-width: 768px) {
    .categories-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        padding: 10px 5px;
        gap: 8px;
    }
    
    .category-item {
        flex: 0 0 auto;
        min-width: 60px;
        max-width: 80px;
    }
}

/* 12. JACKPOT DISPLAY FIX */
@media (max-width: 768px) {
    .progressive-jackpot,
    .jackpot-wrapper {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 10px;
    }
    
    .jackpot-amount {
        font-size: 1.2rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* 13. BOTTOM NAVIGATION FIX */
@media (max-width: 768px) {
    .bottom-nav,
    .bottom-navigation,
    [class*="bottom-nav"] {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Only add padding to body when bottom nav exists */
    body.has-bottom-nav {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
}

/* 14. FORM ELEMENTS FIX */
@media (max-width: 768px) {
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    select,
    textarea {
        width: 100%;
        max-width: 100%;
        font-size: 16px;
        padding: 12px;
        border-radius: 6px;
    }
    
    .form-group,
    .input-group {
        width: 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }
}

/* 15. TABLE RESPONSIVE */
@media (max-width: 768px) {
    table {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        display: block;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 16. MODAL & POPUP FIX */
@media (max-width: 768px) {
    .modal,
    .popup,
    [class*="modal"],
    [class*="popup"] {
        max-width: 95%;
        margin: 10px auto;
    }
    
    .modal-content,
    .popup-content {
        padding: 15px;
    }
}

/* 17. SIDEBAR & MENU FIX */
@media (max-width: 768px) {
    .sidebar,
    .side-menu,
    [class*="sidebar"] {
        max-width: 280px;
        width: 80%;
    }
}

/* 18. PREVENT ZOOM ON INPUT FOCUS (iOS Safari) */
@media (max-width: 768px) {
    input[type="text"]:focus,
    input[type="password"]:focus,
    input[type="email"]:focus,
    input[type="number"]:focus,
    input[type="tel"]:focus,
    select:focus,
    textarea:focus {
        font-size: 16px;
    }
}

/* 19. SAFE AREA FOR NOTCH DEVICES */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        body {
            padding-top: env(safe-area-inset-top);
        }
        
        body.has-bottom-nav {
            padding-bottom: calc(60px + env(safe-area-inset-bottom));
        }
        
        .bottom-nav {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* 20. SMOOTH SCROLLING - Mobile Only */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* 21. FIX FOR SPINNING/ROTATING ELEMENTS */
@media (max-width: 768px) {
    .spinning,
    .rotating,
    [class*="spin"],
    [class*="rotate"] {
        transform-origin: center center;
        will-change: transform;
    }
    
    @keyframes spin {
        from {
            transform: rotate(0deg);
        }
        to {
            transform: rotate(360deg);
        }
    }
}

/* 22. PERFORMANCE OPTIMIZATION */
@media (max-width: 768px) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    img,
    video {
        will-change: auto;
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* 23. ACCESSIBILITY IMPROVEMENTS */
@media (max-width: 768px) {
    :focus {
        outline: 2px solid #f4d172;
        outline-offset: 2px;
    }
    
    :focus:not(:focus-visible) {
        outline: none;
    }
}

/* 24. LANDSCAPE ORIENTATION FIX */
@media (max-width: 768px) and (orientation: landscape) {
    .slider-container {
        height: auto !important;
        max-height: 180px;
    }
    
    .bottom-nav {
        height: 50px;
    }
    
    .nav-item {
        min-height: 40px;
    }
    
    body.has-bottom-nav {
        padding-bottom: calc(50px + env(safe-area-inset-bottom));
    }
}

/* 25. REMOVE ANIMATION ON SLOW DEVICES */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
