/* ========================================
   Shared Header Styles
   ======================================== */

.docs-page-header {
    background: #fff;
    border-bottom: 2px solid rgb(255, 106, 36);
    box-shadow: 0 6px 24px rgba(4, 38, 89, 0.04);
}

/* ========================================
   Desktop/Tablet Header
   ======================================== */

.docs-header-desktop {
    display: none; /* Hidden on mobile by default */
}

/* Top bar (courier, phone, login) */
.docs-header-top {
    background: rgb(28, 36, 48);
    border-bottom: 1px solid rgba(4, 38, 89, 0.4);
    padding: 5px 0;
}

.docs-header-top .container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 24px;
}

.docs-header-top-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 18px;
}

.docs-header-top-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    position: relative;
    padding-left: 24px;
}

.docs-header-top-link:hover,
.docs-header-top-link:focus-visible {
    color: #fff;
    transform: translateX(-2px);
}

.docs-header-top-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    border-radius: 4px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: brightness(0) invert(1);
}

.docs-header-top-link--courier::before {
    background-image: url('https://abttrans.kz/local/templates/abttrade_new/img/icons/trav.svg');
}

.docs-header-top-link--phone::before {
    border-radius: 50%;
    background-image: url('https://abttrans.kz/local/templates/abttrade_new/img/icons/phone.svg');
}

.docs-header-top-link--login::before {
    background-image: url('https://abttrans.kz/local/templates/abttrade_new/img/icons/key.svg');
}

/* Main navigation bar */
.docs-header-nav {
    padding: 24px 0 26px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.docs-header-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.docs-header-brand {
    flex: 0 0 auto;
}

.docs-header-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 0;
    background: transparent;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.docs-header-logo:hover {
    opacity: 0.8;
}

.docs-header-logo-img {
    display: block;
    height: 66px;
    width: auto;
}

.docs-header-menu-nav {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.docs-header-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2px;
}

.docs-header-menu-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 0;
    background: rgba(255, 255, 255);
    color: rgba(4, 38, 89, 0.85);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.docs-header-menu-link:hover,
.docs-header-menu-link:focus-visible {
    background: rgba(13, 103, 177, 0.14);
    text-decoration: none;
}

.docs-header-menu-link.is-active,
.docs-header-menu-link[aria-current="page"] {
    background: rgba(13, 103, 177, 1);
    color: #fff;
}

/* ========================================
   Mobile Header
   ======================================== */

.docs-header-mobile {
    display: block; /* Visible on mobile by default */
}

.docs-header-mobile--sticky {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
}

body.docs-mobile-menu-open {
    position: fixed;
    overflow: hidden;
    width: 100%;
}

.docs-mobile-nav {
    padding: 10px 0 12px;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.docs-mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.docs-mobile-logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.docs-mobile-logo-img {
    display: block;
    height: 40px;
    width: auto;
}

.docs-mobile-phone {
    color: rgba(4, 38, 89, 0.9);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-left: auto;
    margin-right: 12px;
}

.docs-mobile-phone:hover {
    color: rgba(13, 103, 177, 1);
}

.docs-mobile-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation; /* Ensures immediate touch response */
    text-decoration: none;
    position: relative;
    /* Increase the actual button size to account for padding */
    width: 64px;
    height: 64px;
    /* Compensate with negative margin to maintain layout */
    margin: -10px -10px -10px 0;
    z-index: 10; /* Ensure button is above other elements */
}

/* Create larger invisible touch target */
.docs-mobile-hamburger::before {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    bottom: -10px;
    left: -10px;
    /* Invisible but touchable area */
    border-radius: 8px;
    transition: background-color 0.15s ease;
    z-index: 1;
}

/* Visual feedback on touch/hover */
.docs-mobile-hamburger:active::before,
.docs-mobile-hamburger:hover::before,
.docs-mobile-hamburger.pressed::before {
    background-color: rgba(13, 103, 177, 0.08);
}

/* Additional feedback for pressed state */
.docs-mobile-hamburger.pressed span {
    background-color: rgba(13, 103, 177, 0.9);
}

.docs-mobile-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: rgba(4, 38, 89, 0.8);
    border-radius: 1px;
    pointer-events: none; /* Ensure spans don't interfere with touch */
    position: relative;
    z-index: 2; /* Above the ::before element */
    transition: background-color 0.15s ease;
}

/* Mobile menu - hidden by default, controlled by JS */
.docs-mobile-menu-nav {
    background: #fff;
    box-shadow: 0 6px 24px rgba(4, 38, 89, 0.1);
    position: relative;
}

.docs-mobile-menu-nav[hidden] {
    display: none !important;
}

/* Full-screen mobile menu on small screens */
@media (max-width: 639px) {
    .docs-mobile-menu-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 9999 !important;
        background: #fff !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

    /* When menu is shown, ensure it's visible */
    .docs-mobile-menu-nav:not([hidden]) {
        left: 0 !important;
        display: block !important;
    }
}

/* Close button styling - simple × symbol */
.docs-mobile-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 40px;  /* Aligned with logo height */
    right: 15px;
    width: 54px;
    height: 54px;
    font-size: 2.5rem;
    line-height: 1;
    color: rgba(4, 38, 89, 0.8);
    font-weight: 400;  /* Thicker × symbol */
    background: transparent;
    border: 0;
    padding: 5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.docs-mobile-menu-close span {
    pointer-events: none;
}

/* Subtle feedback on interaction */
.docs-mobile-menu-close:hover,
.docs-mobile-menu-close:active,
.docs-mobile-menu-close:focus {
    color: rgba(4, 38, 89, 1);
    outline: none;
}

/* Container padding for full-screen menu */
.docs-mobile-menu-nav .container {
    padding-top: 20px;
    padding-bottom: 40px;
    min-height: 100%;
}

/* Menu header with logo */
.docs-mobile-menu-header {
    display: block;
    padding: 20px 0 30px;
    border-bottom: 2px solid rgb(255, 106, 36);
    margin-bottom: 20px;
}

.docs-mobile-menu-logo {
    display: block;
    height: 50px;
    width: auto;
}

.docs-mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Enhanced mobile menu links for full-screen layout */
@media (max-width: 639px) {
    .docs-mobile-menu {
        gap: 8px;
    }

    .docs-mobile-menu-link {
        padding: 16px 20px;
        font-size: 1.05rem;
        border-bottom: 1px solid rgba(4, 38, 89, 0.08);
    }
}

.docs-mobile-menu-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 16px;
    border-radius: 0;
    background: rgba(255, 255, 255);
    color: rgba(4, 38, 89, 0.85);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.docs-mobile-menu-link:hover,
.docs-mobile-menu-link:focus-visible {
    background: rgba(13, 103, 177, 0.14);
}

.docs-mobile-menu-link.is-active,
.docs-mobile-menu-link[aria-current="page"] {
    background: rgba(13, 103, 177, 1);
    color: #fff;
}

/* Icons for courier/login links on mobile */
.docs-mobile-menu-link--courier,
.docs-mobile-menu-link--login {
    position: relative;
    padding-left: 42px;
}

.docs-mobile-menu-link--courier::before,
.docs-mobile-menu-link--login::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.7;
}

.docs-mobile-menu-link--courier::before {
    background-image: url('https://abttrans.kz/local/templates/abttrade_new/img/icons/trav.svg');
}

.docs-mobile-menu-link--login::before {
    background-image: url('https://abttrans.kz/local/templates/abttrade_new/img/icons/key.svg');
}

/* ========================================
   Focus States (Shared)
   ======================================== */

:where(.docs-header-menu-link, .docs-header-top-link, .docs-mobile-menu-link, .docs-mobile-hamburger):focus-visible {
    outline: 2px solid rgba(13, 103, 177, 0.45);
    outline-offset: 2px;
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Tablet & Desktop: ≥640px */
@media (min-width: 640px) {
    /* Show desktop header, hide mobile header */
    .docs-header-desktop {
        display: block;
    }

    .docs-header-mobile {
        display: none;
    }
}

/* Desktop: ≥960px */
@media (min-width: 960px) {
    .docs-header-nav {
        padding: 28px 0 30px;
    }

    .docs-header-top-list {
        gap: 24px;
    }

    .docs-header-nav .container {
        gap: 42px;
    }

    .docs-header-logo-img {
        height: 66px;
    }
}
