/* ============================================
   MOBILE RESPONSIVE FIX - CasinoUyTin 2026
   Comprehensive mobile layout fixes for all pages
   ============================================ */

/* === GLOBAL OVERFLOW SAFETY === */
* {
    -webkit-tap-highlight-color: transparent;
}
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* === TABLET: max-width 992px === */
@media (max-width: 992px) {
    .main-layout {
        grid-template-columns: 1fr !important;
    }
    /* CRITICAL: CSS Grid items default min-width:auto — must be 0 to allow shrinking */
    .main-layout > * {
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .profile-layout {
        grid-template-columns: 1fr !important;
    }
    .profile-layout > * {
        min-width: 0 !important;
    }
    .sidebar {
        position: static !important;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    .hero h1 {
        font-size: 2.5rem !important;
    }
}

/* === MOBILE: max-width 768px === */
@media (max-width: 768px) {

    /* --- GLOBAL GRID/FLEX SHRINK FIX --- */
    * {
        min-width: 0;
    }
    /* overflow-x: hidden trên các block content (KHÔNG dùng cho header/container vì sẽ clip nav dropdown) */
    main, .casino-list, .casino-card,
    .article-content, .sidebar-widget, .sidebar, aside {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* --- CONTAINER --- */
    .container {
        padding: 0 1rem !important;
        max-width: 100% !important;
        /* NO overflow-x here — header-content dùng class container, overflow sẽ clip dropdown nav */
    }

    /* --- HEADER & NAVIGATION --- */
    header {
        padding: 0.75rem 0 !important;
        overflow: visible !important;
    }
    .header-content {
        position: relative !important;
        width: 100% !important;
        overflow: visible !important;
    }
    .logo {
        font-size: 1.35rem !important;
        flex-shrink: 0;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    .mobile-menu-btn.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-btn.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: -1rem;
        right: -1rem;
        background-color: var(--bg-secondary);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding: 1rem 1.5rem;
        gap: 0.5rem;
        z-index: 9999;
        width: calc(100% + 2rem);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    }
    .nav-links.active {
        display: flex !important;
    }
    .nav-links li {
        width: 100%;
    }
    .nav-links a {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.8rem 0 !important;
        font-size: 1.05rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }
    .dropdown-menu {
        position: static !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        box-shadow: none !important;
        background-color: rgba(0, 0, 0, 0.2) !important;
        border: none !important;
        padding: 0.5rem 1rem !important;
        margin-top: 0.5rem !important;
        display: none !important;
        width: 100% !important;
        min-width: unset !important;
    }
    .dropdown-menu.active {
        display: block !important;
    }
    .dropdown-menu a {
        font-size: 0.95rem !important;
        padding: 0.5rem 0 !important;
        border-bottom: none !important;
    }
    .nav-item:hover .dropdown-menu {
        display: none !important;
    }
    .nav-item.open .dropdown-menu {
        display: block !important;
    }

    /* --- BREADCRUMBS --- */
    .breadcrumbs {
        padding: 1rem 0 0.5rem !important;
        font-size: 0.82rem !important;
    }

    /* --- HERO SECTION --- */
    .hero {
        padding: 3rem 0 2rem !important;
    }
    .hero h1 {
        font-size: 1.8rem !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    .hero-desc {
        font-size: 0.95rem !important;
    }
    .badge-update {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.8rem !important;
        letter-spacing: 1px !important;
    }

    /* --- FILTER BUTTONS --- */
    .filter-buttons {
        gap: 0.4rem !important;
    }
    .filter-btn {
        padding: 0.45rem 0.8rem !important;
        font-size: 0.8rem !important;
    }

    /* --- TOC --- */
    .toc-list {
        grid-template-columns: 1fr !important;
    }
    .toc-box {
        padding: 1rem !important;
    }

    /* =============================================
       CASINO CARDS - MOBILE LAYOUT
       Row 1: rank badge (50px) + logo (1fr)
       Row 2: casino-info full width
       Row 3: casino-action full width
       ============================================= */
    .casino-card {
        grid-template-columns: 50px 1fr !important;
        text-align: left !important;
        gap: 0.75rem 1rem !important;
        padding: 1.25rem 1rem !important;
        overflow: hidden !important;
    }
    .rank-badge {
        grid-column: 1 !important;
        grid-row: 1 !important;
        margin: 0 !important;
        align-self: center !important;
    }
    .logo-box {
        grid-column: 2 !important;
        grid-row: 1 !important;
        margin: 0 !important;
        width: 100px !important;
        height: 48px !important;
        justify-self: start !important;
    }
    .casino-info {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-align: left !important;
    }
    .casino-info h3 {
        font-size: 1.15rem !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        max-width: 100% !important;
    }
    .casino-rating {
        justify-content: flex-start !important;
    }
    .pros-list {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0 !important;
    }
    .pros-list li {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
        max-width: 100% !important;
        font-size: 0.85rem !important;
    }
    .tag-list {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        max-width: 100% !important;
    }
    .tag-item {
        white-space: nowrap !important;
        font-size: 0.72rem !important;
    }
    .casino-action {
        grid-column: 1 / -1 !important;
        grid-row: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .promo-box {
        width: 100% !important;
        overflow: hidden !important;
    }
    .promo-value {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        font-size: 0.9rem !important;
    }
    .action-buttons {
        flex-direction: column !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    .btn-cta {
        width: 100% !important;
        font-size: 0.95rem !important;
    }
    .btn-review {
        width: 100% !important;
        font-size: 0.85rem !important;
    }

    /* --- ARTICLE CONTENT --- */
    .article-content {
        padding: 1.5rem !important;
        border-radius: 12px !important;
        overflow: hidden !important;
    }
    .article-content h1 {
        font-size: 1.7rem !important;
        line-height: 1.3 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    .article-content h2 {
        font-size: 1.35rem !important;
    }
    .article-content h3 {
        font-size: 1.1rem !important;
    }
    .article-content p,
    .article-content li {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    .article-meta {
        flex-wrap: wrap !important;
        gap: 0.4rem 1rem !important;
        font-size: 0.8rem !important;
    }

    /* --- TABLES --- */
    .detailed-table,
    .info-table {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
        min-width: 0 !important;
        width: 100% !important;
    }
    /* Override inline min-width:600px on table */
    table.detailed-table {
        min-width: 0 !important;
        width: max-content !important;
    }
    /* Ensure the table's wrapper div scrolls properly */
    .article-content div[style*="overflow-x"] {
        max-width: 100% !important;
        overflow-x: auto !important;
    }

    /* --- LISTING HEADER --- */
    .listing-header {
        max-width: 100% !important;
        overflow: hidden !important;
    }
    .listing-header h2 {
        font-size: 1.3rem !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
    }

    /* --- AUTHOR CARD --- */
    .author-card {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 1.2rem !important;
        gap: 0.8rem !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }
    .author-avatar {
        width: 64px !important;
        height: 64px !important;
        font-size: 1.6rem !important;
        margin: 0 auto !important;
        flex-shrink: 0 !important;
    }
    .author-info-box {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        word-break: break-word !important;
    }
    .author-bio {
        text-align: left !important;
    }
    .author-role {
        white-space: normal !important;
        word-break: break-word !important;
    }
    .author-socials {
        justify-content: center !important;
    }

    /* --- ACCORDION FAQ --- */
    .accordion-header {
        padding: 1rem 0 !important;
    }
    .accordion-question {
        font-size: 0.92rem !important;
        gap: 0.5rem !important;
        text-align: left !important;
    }
    .accordion-content p {
        padding-left: 0 !important;
        font-size: 0.88rem !important;
    }
    .accordion-item.active .accordion-content {
        max-height: 500px !important;
    }

    /* --- SIDEBAR --- */
    .sidebar-widget {
        padding: 1.2rem !important;
        max-width: 100% !important;
        overflow: hidden !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }
    .quick-tips-list li {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        white-space: normal !important;
    }

    /* --- MODAL --- */
    .modal-box {
        width: 95% !important;
        padding: 1.5rem !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    .modal-spec-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    .modal-title {
        font-size: 1.2rem !important;
    }

    /* --- FOOTER --- */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    .footer-col {
        text-align: left !important;
    }
    footer {
        padding: 2.5rem 0 1.5rem !important;
    }
    .disclaimer-box {
        font-size: 0.75rem !important;
        padding: 1rem !important;
    }

    /* --- PROFILE PAGE --- */
    .profile-hero {
        padding: 2.5rem 0 1.5rem !important;
    }
    .profile-hero h1 {
        font-size: 1.8rem !important;
    }
    .big-avatar {
        width: 90px !important;
        height: 90px !important;
        font-size: 2.2rem !important;
    }
    .profile-card {
        padding: 1.5rem !important;
    }
    .social-row {
        flex-wrap: wrap !important;
        gap: 0.75rem !important;
    }
    .pub-item {
        padding: 1rem !important;
    }
    .pub-item h3 {
        font-size: 1.05rem !important;
    }

    /* --- ALERT/INFO BOXES --- */
    .alert-box,
    .info-box {
        padding: 1rem !important;
        font-size: 0.85rem !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* --- GLOBAL OVERFLOW PREVENT --- */
    body, .container, main, article, section, aside, .casino-card, .casino-info {
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }
}

/* === SMALL MOBILE: max-width 576px === */
@media (max-width: 576px) {
    .profile-card,
    .article-content {
        padding: 1rem !important;
    }
    .casino-card {
        padding: 1.2rem 0.8rem !important;
    }
    .promo-box {
        padding: 0.5rem 0.6rem !important;
    }
    .promo-value {
        font-size: 0.82rem !important;
    }
    .btn-cta {
        font-size: 0.88rem !important;
        padding: 0.6rem 0.8rem !important;
    }
    .btn-review {
        font-size: 0.78rem !important;
        padding: 0.45rem 0.6rem !important;
    }
    .hot-casino-item {
        gap: 0.6rem !important;
    }
    .footer-bottom p {
        font-size: 0.78rem !important;
    }
    .casino-info h3 {
        font-size: 1.05rem !important;
    }
    .pros-list li {
        font-size: 0.82rem !important;
    }
    .article-content h1 {
        font-size: 1.5rem !important;
    }
}

/* === EXTRA SMALL MOBILE: max-width 480px === */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem !important;
    }
    .logo {
        font-size: 1.15rem !important;
    }
    .hero h1,
    .profile-hero h1 {
        font-size: 1.5rem !important;
    }
    h1, .article-content h1 {
        font-size: 1.4rem !important;
    }
    h2, .article-content h2 {
        font-size: 1.2rem !important;
    }
    h3, .article-content h3 {
        font-size: 1.05rem !important;
    }
    .tag-list {
        gap: 0.2rem !important;
    }
    .tag-item {
        font-size: 0.68rem !important;
        padding: 0.1rem 0.3rem !important;
    }
    .filter-btn {
        padding: 0.35rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
    .casino-card {
        padding: 1rem 0.6rem !important;
    }
    .casino-info h3 {
        font-size: 1rem !important;
    }
    .rating-score {
        font-size: 0.75rem !important;
    }
    .stars {
        font-size: 0.88rem !important;
    }
    .toc-title {
        font-size: 0.95rem !important;
    }
    .accordion-question::before {
        width: 22px !important;
        height: 22px !important;
        font-size: 0.75rem !important;
        flex-shrink: 0 !important;
    }
    .accordion-question {
        font-size: 0.85rem !important;
    }
    .widget-title {
        font-size: 0.92rem !important;
    }
    .hero-desc {
        font-size: 0.88rem !important;
    }
    .badge-update {
        font-size: 0.7rem !important;
    }
}

/* === ULTRA SMALL: max-width 360px === */
@media (max-width: 360px) {
    .hero h1,
    .profile-hero h1 {
        font-size: 1.3rem !important;
    }
    .article-content h1 {
        font-size: 1.25rem !important;
    }
    .logo {
        font-size: 1.05rem !important;
    }
    .container {
        padding: 0 0.5rem !important;
    }
    .casino-card {
        padding: 0.8rem 0.5rem !important;
    }
    .badge-update {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }
    .pros-list li {
        font-size: 0.78rem !important;
    }
    .filter-btn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.72rem !important;
    }
}
