/* ============================================
   ABSC Pet-First v2 - Mobile Navigation Styles
   Bottom bar, hamburger accordion, sticky ATC,
   mobile menu overlay, and all mobile-specific
   navigation components.
   ============================================ */

/* ===========================
   MOBILE BOTTOM BAR
   Fixed to bottom, 56px height, 4-item grid.
   Hides on scroll-down, reappears on scroll-up.
   Hidden on checkout. Hidden when sticky ATC visible.
   =========================== */
.mobile-bottom-bar {
    display: none; /* shown via media query on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #fff;
    border-top: 1px solid var(--border, #E8E8E8);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 997;
    transition: transform 0.3s ease;
}

.mobile-bottom-bar.hidden {
    transform: translateY(100%);
}

.mobile-bottom-bar.atc-override {
    transform: translateY(100%);
    pointer-events: none;
}

/* 4-item grid inside bottom bar */
.mobile-bottom-bar {
    display: none; /* activated at 768px */
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    justify-items: center;
}

.bottom-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: var(--text-light, #666);
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-size: 10px;
    font-weight: 600;
    transition: color 0.2s ease;
    position: relative;
    padding: 6px 0;
}

.bottom-bar-item svg {
    flex-shrink: 0;
}

.bottom-bar-item.active {
    color: var(--blue, #3D7EC7);
}

.bottom-bar-item.active svg {
    stroke: var(--blue, #3D7EC7);
}

.bottom-bar-item:hover {
    color: var(--blue, #3D7EC7);
}

/* Cart badge on bottom bar */
.bottom-bar-item .cart-count {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    background: var(--coral, #E8785F);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bottom-bar-item .cart-count:empty,
.bottom-bar-item .cart-count[data-count="0"] {
    display: none;
}

/* ===========================
   MOBILE MENU OVERLAY
   Full-screen, white background, slides in from left.
   Triggered by hamburger toggle.
   =========================== */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.99);
    z-index: 998;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 80px;
}

.mobile-menu-overlay.active {
    transform: translateX(0);
    visibility: visible;
}

/* Close button */
.mobile-menu-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text, #333);
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    z-index: 2;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.mobile-menu-close:hover {
    background: var(--blue-light, #EBF3FC);
}

/* ===========================
   MOBILE NAV LIST (inside overlay)
   Accordion-based menu from walker
   =========================== */
.mobile-nav {
    flex: 1;
    padding: 0 20px 16px;
    text-align: left;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li {
    border-bottom: 1px solid var(--border, #E8E8E8);
}

.mobile-nav-list li:last-child {
    border-bottom: none;
}

.mobile-nav-list > li > a {
    display: block;
    padding: 16px 0;
    font-family: var(--font-heading, 'Nunito', sans-serif);
    font-weight: 700;
    font-size: 17px;
    color: var(--text, #333);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mobile-nav-list > li > a:hover {
    color: var(--blue, #3D7EC7);
}

.mobile-nav-list .current-menu-item > a {
    color: var(--blue, #3D7EC7);
}

/* ===========================
   MOBILE ACCORDION
   Collapsible sections with chevron toggles.
   One-section-open-at-a-time behavior.
   200ms slide animation.
   =========================== */

/* Top-level accordion header (e.g., "Shop CBD", "Science & Results") */
.mobile-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading, 'Nunito', sans-serif);
    font-weight: 700;
    font-size: 17px;
    color: var(--text, #333);
    text-align: left;
    transition: color 0.2s ease;
}

.mobile-accordion-header:hover {
    color: var(--blue, #3D7EC7);
}

/* Chevron icon */
.mobile-accordion-header::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--text-light, #666);
    border-bottom: 2px solid var(--text-light, #666);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.mobile-accordion-header[aria-expanded="true"]::after {
    transform: rotate(-135deg);
}

.mobile-accordion-header[aria-expanded="true"] {
    color: var(--blue, #3D7EC7);
}

/* Accordion content panel */
.mobile-accordion-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.2s ease;
    padding-left: 16px;
}

.mobile-accordion-content[hidden] {
    display: block; /* override default hidden to allow animation */
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
}

.mobile-accordion-content:not([hidden]) {
    max-height: 800px; /* generous max for content */
    visibility: visible;
}

/* Sub-items inside accordion */
.mobile-accordion-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
    padding-bottom: 8px;
}

.mobile-accordion-content li {
    margin: 0;
    border-bottom: none;
}

.mobile-accordion-content a {
    display: block;
    padding: 10px 0;
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-light, #666);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mobile-accordion-content a:hover {
    color: var(--blue, #3D7EC7);
}

/* Nested sub-accordion (e.g., "CBD Oil for Dogs" inside "Shop CBD") */
.mobile-accordion-sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-light, #666);
    text-align: left;
    transition: color 0.2s ease;
}

.mobile-accordion-sub-header:hover {
    color: var(--blue, #3D7EC7);
}

.mobile-accordion-sub-header::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-light, #666);
    border-bottom: 2px solid var(--text-light, #666);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.mobile-accordion-sub-header[aria-expanded="true"]::after {
    transform: rotate(-135deg);
}

.mobile-accordion-sub-header[aria-expanded="true"] {
    color: var(--blue, #3D7EC7);
}

/* Nested accordion content (level 2) */
.mobile-accordion-sub-content {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.2s ease;
    padding-left: 16px;
}

.mobile-accordion-sub-content[hidden] {
    display: block;
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
}

.mobile-accordion-sub-content:not([hidden]) {
    max-height: 500px;
    visibility: visible;
}

.mobile-accordion-sub-content a {
    font-size: 14px;
    padding: 8px 0;
    color: var(--text-light, #666);
}

.mobile-accordion-sub-content a:hover {
    color: var(--blue, #3D7EC7);
}

/* Shop All link inside accordion */
.mobile-accordion-content .shop-all-link {
    display: block;
    padding: 12px 0;
    font-weight: 700;
    color: var(--blue, #3D7EC7);
    font-size: 15px;
    text-decoration: none;
    border-top: 1px solid var(--border, #E8E8E8);
    margin-top: 8px;
}

.mobile-accordion-content .shop-all-link:hover {
    color: var(--coral, #E8785F);
}

/* ===========================
   MOBILE MENU BOTTOM SECTION
   Account, Affiliate links at bottom of overlay
   =========================== */
.mobile-menu-bottom {
    border-top: 1px solid var(--border, #E8E8E8);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-weight: 600;
    font-size: 15px;
    color: var(--text, #333);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mobile-menu-link:hover {
    color: var(--blue, #3D7EC7);
}

.mobile-menu-link svg {
    flex-shrink: 0;
    color: var(--text-light, #666);
}

/* ===========================
   MOBILE MENU TRUST STRIP
   Trust badges at bottom of mobile overlay
   =========================== */
.mobile-menu-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--blue-light, #EBF3FC);
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-size: 12px;
    font-weight: 600;
    color: var(--text, #333);
}

.mobile-menu-trust .trust-separator {
    color: var(--border, #E8E8E8);
}

/* ===========================
   MOBILE MENU SOCIAL ICONS
   =========================== */
.mobile-menu-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px 24px;
}

.mobile-menu-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--blue-light, #EBF3FC);
    color: var(--blue, #3D7EC7);
    transition: all 0.2s ease;
}

.mobile-menu-social a:hover {
    background: var(--blue, #3D7EC7);
    color: #fff;
}

/* ===========================
   STICKY ADD-TO-CART BAR
   Product pages only. Fixed to bottom, 60px.
   Replaces bottom bar when visible. z-index 999.
   =========================== */
.sticky-atc-bar {
    display: none; /* shown via media query on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--border, #E8E8E8);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.sticky-atc-bar.visible {
    transform: translateY(0);
}

.sticky-atc-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 16px;
    max-width: 100%;
}

.sticky-atc-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* allow text truncation */
    flex: 1;
    margin-right: 12px;
}

.sticky-atc-name {
    font-family: var(--font-heading, 'Nunito', sans-serif);
    font-weight: 700;
    font-size: 14px;
    color: var(--text, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-atc-price {
    font-family: var(--font-body, 'Nunito Sans', sans-serif);
    font-weight: 700;
    font-size: 15px;
    color: var(--coral, #E8785F);
}

.sticky-atc-price del {
    font-size: 12px;
    color: var(--text-light, #666);
    font-weight: 400;
    opacity: 0.7;
}

.sticky-atc-price ins {
    text-decoration: none;
}

.sticky-atc-button {
    flex-shrink: 0;
    padding: 10px 24px;
    background: var(--blue, #3D7EC7);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill, 50px);
    font-family: var(--font-heading, 'Nunito', sans-serif);
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.sticky-atc-button:hover {
    background: var(--blue-dark, #2D6AB3);
}

/* ===========================
   HAMBURGER TOGGLE ANIMATION
   Transforms 3 lines into X when active
   =========================== */
.mobile-toggle {
    display: none; /* shown via media query */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text, #333);
    width: 44px;
    height: 44px;
    position: relative;
    z-index: 999;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text, #333);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===========================
   MOBILE BOTTOM BAR — RESPONSIVE ACTIVATION
   Only display as grid on mobile
   =========================== */
@media (max-width: 768px) {
    .mobile-bottom-bar {
        display: grid;
    }

    .sticky-atc-bar {
        display: block;
    }

    .mobile-toggle {
        display: flex;
    }

    /* Add bottom padding to body for bottom bar */
    body:not(.woocommerce-checkout) {
        padding-bottom: 56px;
    }

    /* When sticky ATC is visible on product pages */
    body.single-product {
        padding-bottom: 60px;
    }
}

/* Hide bottom bar and sticky ATC on desktop */
@media (min-width: 769px) {
    .mobile-bottom-bar {
        display: none !important;
    }

    .sticky-atc-bar {
        display: none !important;
    }

    .mobile-toggle {
        display: none !important;
    }

    .mobile-menu-overlay {
        display: none !important;
    }
}

/* ===========================
   ADMIN BAR OFFSETS
   Adjust fixed bottom elements when WP admin bar is present
   =========================== */
.admin-bar .mobile-bottom-bar {
    /* admin bar does not affect bottom-fixed elements */
}

.admin-bar .mobile-menu-overlay {
    padding-top: 112px; /* 80px + 32px admin bar */
}

@media screen and (max-width: 782px) {
    .admin-bar .mobile-menu-overlay {
        padding-top: 126px; /* 80px + 46px mobile admin bar */
    }
}
