/**
 * Country Tabs Mobile Layout
 * 2x2x2 grid layout for mobile devices
 */

/* Mobile country nav tabs - 2x2x2 grid */
@media (max-width: 767px) {
    /* Container adjustments */
    .xb-country-nav {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        white-space: normal !important;
        padding: 0 !important;
        margin-bottom: 30px !important;
        width: 100% !important;
        flex-wrap: unset !important;
        justify-content: unset !important;
    }
    
    /* Remove horizontal scroll wrapper if exists */
    .xb-country-nav.nav-tabs {
        overflow-x: visible !important;
        -webkit-overflow-scrolling: unset !important;
        scroll-behavior: unset !important;
    }
    
    /* Tab items */
    .xb-country-nav .nav-item {
        width: 100% !important;
        margin: 0 !important;
        flex: unset !important;
        min-width: unset !important;
    }
    
    /* Tab buttons */
    .xb-country-nav .nav-link {
        width: 100% !important;
        padding: 12px 10px !important;
        font-size: 13px !important;
        text-align: center !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        margin: 0 !important;
        white-space: normal !important;
        min-height: 50px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #f8f9fa !important;
        color: #333 !important;
        font-weight: 500 !important;
        transition: all 0.3s ease !important;
    }
    
    /* Active tab */
    .xb-country-nav .nav-link.active {
        background: var(--color-primary, #FFC107) !important;
        color: #fff !important;
        border-color: var(--color-primary, #FFC107) !important;
        font-weight: 600 !important;
    }
    
    /* Hover state */
    .xb-country-nav .nav-link:not(.active):hover {
        background: #e9ecef !important;
        border-color: #adb5bd !important;
    }
    
    /* Remove Bootstrap default styles that might interfere */
    .xb-country-nav.nav-tabs .nav-item {
        margin-bottom: 0 !important;
    }
    
    .xb-country-nav.nav-tabs .nav-link {
        border-bottom: none !important;
        border-radius: 8px !important;
    }
    
    /* Remove any flex properties that might conflict */
    .xb-country-nav.ul_li_between {
        display: grid !important;
        justify-content: unset !important;
        align-items: unset !important;
    }
}

/* Extra small devices - adjust font size */
@media (max-width: 480px) {
    .xb-country-nav {
        gap: 8px !important;
    }
    
    .xb-country-nav .nav-link {
        font-size: 12px !important;
        padding: 10px 8px !important;
        min-height: 45px !important;
    }
}

/* Landscape mode - 3 columns */
@media (max-width: 767px) and (orientation: landscape) {
    .xb-country-nav {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .xb-country-nav .nav-link {
        font-size: 12px !important;
        padding: 10px 8px !important;
        min-height: 40px !important;
    }
}

/* Ensure tab content is properly positioned */
@media (max-width: 767px) {
    .tab-content {
        margin-top: 20px !important;
    }
}

/* Fix for any parent container that might have overflow hidden */
@media (max-width: 767px) {
    .xb-country-nav::-webkit-scrollbar {
        display: none !important;
    }
    
    .xb-country-nav {
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }
}

/* Accessibility improvements */
@media (max-width: 767px) {
    .xb-country-nav .nav-link:focus {
        outline: 2px solid var(--color-primary, #FFC107) !important;
        outline-offset: 2px !important;
    }
    
    .xb-country-nav .nav-link:active {
        transform: scale(0.98) !important;
    }
}

/* Icon support if tabs have icons */
@media (max-width: 767px) {
    .xb-country-nav .nav-link i,
    .xb-country-nav .nav-link svg {
        margin-right: 5px !important;
        font-size: 14px !important;
    }
}

/* Ensure equal height for all tabs */
@media (max-width: 767px) {
    .xb-country-nav {
        align-items: stretch !important;
    }
    
    .xb-country-nav .nav-item {
        display: flex !important;
    }
    
    .xb-country-nav .nav-link {
        height: 100% !important;
    }
}