/*--------------------------------------------------------------
>>> RESPONSIVE
>>> Base breakpoint: 991px (synced with Customizer default)
>>> Dynamic overrides generated by css-schema.php
--------------------------------------------------------------*/


/* Mobile Header (Hidden by default on Desktop) */
.site-mobile-header {
    display: none;
}

.mobile-nav-overlay {
    display: none;
}


/* Mobile Bottom Nav (Default Hidden) */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 991px) {


    /* Mobile Bottom Navigation Bar Styles */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--abr-mobile-nav-bg, var(--abr-color-white));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        padding: 8px 0 env(safe-area-inset-bottom, 8px);
        z-index: var(--z-overlay);
        justify-content: space-around;
        border-radius: var(--abr-mobile-nav-radius, 20px 20px 0 0);
    }

    .mobile-bottom-nav .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--abr-color-gray);
        font-size: 10px;
        padding: 8px 12px;
        border-radius: 12px;
        transition: all 0.3s ease;
        min-width: 60px;
    }

    .mobile-bottom-nav .nav-item:hover,
    .mobile-bottom-nav .nav-item.active {
        color: var(--abr-color-primary);
        background: rgba(99, 102, 241, 0.1);
    }

    .mobile-bottom-nav .nav-icon-wrapper {
        font-size: 20px;
        margin-bottom: 4px;
        transition: transform 0.3s ease;
    }

    .mobile-bottom-nav .nav-item.active .nav-icon-wrapper {
        transform: scale(1.1);
    }

    .mobile-bottom-nav .nav-label {
        font-weight: 500;
        white-space: nowrap;
    }

    /* Body padding when bottom nav is active */
    body.has-mobile-bottom-nav {
        padding-bottom: 80px;
    }

    /* RTL Support for bottom nav */
    body.rtl .mobile-bottom-nav {
        direction: rtl;
    }

    /* Hide Desktop Headers with Specificity */
    #page .site-topbar,
    #page .site-header,
    #page .site-header-bottom {
        display: none;
    }

    /* Show Mobile Header */
    #page .site-mobile-header {
        display: block;
        width: 100%;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
        position: sticky;
        top: 0;
        z-index: var(--z-mobile-header, 999);
        background: var(--abr-color-white, #ffffff);
    }

    /* Mobile Header Container - Edge-to-edge layout & no drift */
    #page .site-mobile-header .mobile-header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-inline: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        min-width: 0;
        gap: 10px;
    }

    .mobile-header-column {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .mobile-header-column.mobile-header-left {
        flex: 1;
        justify-content: flex-start;
    }

    .mobile-header-column.mobile-header-center {
        flex: 0 1 auto;
        justify-content: center;
    }

    .mobile-header-column.mobile-header-right {
        flex: 1;
        justify-content: flex-end;
    }

    .mobile-header-widget {
        display: flex;
        align-items: center;
        min-width: 0;
    }

    .mobile-header-widget img {
        max-height: 40px;
        width: auto;
        display: block;
    }

    .mobile-menu-toggle {
        flex: 0 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        background: none;
        border: none;
        padding: 5px;
        cursor: pointer;
        color: inherit;
    }

    body.rtl .mobile-header-column.mobile-header-left {
        justify-content: flex-start;
    }

    body.rtl .mobile-header-column.mobile-header-right {
        justify-content: flex-end;
    }

    /* Toggle Button Styles moved up to container distribution */

    .hamburger-icon {
        width: 24px;
        height: 18px;
        position: relative;
    }

    .hamburger-icon span {
        display: block;
        position: absolute;
        height: 2px;
        width: 100%;
        background: currentColor;
        border-radius: 2px;
        left: 0;
        transition: .25s ease-in-out;
    }

    .hamburger-icon span:nth-child(1) {
        top: 0;
    }

    .hamburger-icon span:nth-child(2) {
        top: 8px;
    }

    .hamburger-icon span:nth-child(3) {
        top: 16px;
    }

    /* Overlay Navigation — high-performance transform sliding */
    .mobile-nav-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: var(--z-overlay);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0s 0.3s;
    }

    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease, visibility 0s 0s;
    }

    .mobile-nav-content {
        width: 80%;
        max-width: 320px;
        height: 100%;
        background: var(--abr-color-white);
        margin-inline-start: auto;
        padding: 20px 20px 100px;
        /* Increased bottom padding to 100px */
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        /* Enable scrolling for long content */
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling for iOS */
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-nav-overlay.active .mobile-nav-content {
        transform: translateX(0);
    }

    .mobile-nav-header {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 20px;
    }

    .mobile-menu-close {
        background: none;
        border: none;
        font-size: 2rem;
        cursor: pointer;
        line-height: 1;
        color: var(--abr-color-dark);
    }

    .mobile-navigation ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .mobile-navigation li {
        border-bottom: 1px solid var(--abr-color-light);
    }

    .mobile-navigation li a {
        display: block;
        padding: 12px 0;
        color: var(--abr-color-dark);
        font-weight: 500;
        text-decoration: none;
        transition: color 0.2s;
    }

    .mobile-navigation li a:hover {
        color: var(--abr-color-primary);
    }

    /* Sub-menus — JS-controlled state */
    .mobile-navigation li .sub-menu {
        display: none;
        padding-inline-start: 15px;
        background: rgba(0, 0, 0, 0.01);
        list-style: none;
        margin: 0;
    }

    /* JS adds .is-open to toggle visibility */
    .mobile-navigation li.is-open > .sub-menu {
        display: block;
    }

    /* Toggle button dynamically injected by JS */
    .mobile-submenu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        color: inherit;
        font-size: 1rem;
        line-height: 1;
        transition: transform 0.3s ease;
        min-width: 44px;
        min-height: 44px;
        flex-shrink: 0;
    }

    .mobile-submenu-toggle[aria-expanded="true"] {
        transform: rotate(180deg);
    }

    /* Parent link gets flex layout for toggle placement */
    .mobile-navigation li.menu-item-has-children {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    .mobile-navigation li.menu-item-has-children > a {
        flex: 1;
        display: flex;
        align-items: center;
    }

    .mobile-navigation li.menu-item-has-children > .sub-menu {
        width: 100%;
    }

    /* Prevent scrolling when active */
    body.mobile-menu-open {
        overflow: hidden;
    }

    /* --- RTL SUPPORT --- */
    body.rtl .mobile-nav-overlay {
        right: auto;
        left: 0;
    }

    body.rtl .mobile-nav-content {
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
    }

    body.rtl .mobile-nav-overlay.active .mobile-nav-content {
        transform: translateX(0);
    }

    body.rtl .mobile-nav-header {
        justify-content: flex-start;
    }

    body.rtl .mobile-navigation ul {
        text-align: right;
    }

    body.rtl .mobile-navigation li ul {
        padding-left: 0;
        padding-right: 20px;
    }
}