/**
 * Bottom Navigation Bar Styles
 * Figma Design: node 109:18701
 * Visible on Mobile and Tablet only
 */

/* Hide on desktop */
.meercato-bottom-nav {
    display: none;
}

/* Show on mobile and tablet */
@media (max-width: 1024px) {
    /* Prevent horizontal scroll on mobile */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .meercato-bottom-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
        z-index: 999;
        direction: rtl;
        overflow: visible;
    }

    .bottom-nav-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 9px 0;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4.7px;
        flex: 1;
        padding: 0 12px;
        text-decoration: none;
        /* Figma inactive: icon #6f6f6f, label #9c9c9c — use #9c9c9c as base, icon overrides below */
        color: #6f6f6f;
        transition: color 0.2s ease;
    }

    .bottom-nav-item:hover {
        color: #6f6f6f;
        text-decoration: none;
    }

    button.bottom-nav-item {
        background: none;
        border: none;
        cursor: pointer;
        outline: none;
    }

    /* Inactive label — slightly lighter than icon per Figma (#9c9c9c) */
    .bottom-nav-item .nav-label {
        color: #9c9c9c;
    }

    /* Active item — Figma: #EE3E54 for both icon and label */
    .bottom-nav-item.active {
        color: #ee3e54;
    }

    .bottom-nav-item.active .nav-label {
        color: #ee3e54;
    }

    .nav-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
    }

    /* SVG icons — use currentColor for both fill and stroke */
    .nav-icon svg {
        width: 30px;
        height: 30px;
    }

    /* Offers static SVG asset */
    .nav-offers-svg {
        width: 30px;
        height: 30px;
        object-fit: contain;
        display: block;
    }

    .nav-label {
        font-family: 'Readex Pro', 'Almarai', sans-serif;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.25em;
        text-align: center;
        white-space: nowrap;
    }

    /* Cart badge — Figma: 15x15, #6f6f6f bg, white text, top-right */
    .cart-icon {
        position: relative;
    }

    .cart-count {
        position: absolute;
        top: 0;
        left: 0;
        min-width: 15px;
        height: 15px;
        background-color: #6f6f6f;
        border-radius: 7.5px;
        font-family: 'Poppins', sans-serif;
        font-size: 9.375px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        padding: 0 3px;
    }

    /* Add padding to body to prevent content being hidden behind nav */
    body {
        padding-bottom: 70px;
    }

    /* Adjust footer padding when bottom nav is present */
    .meercato-footer {
        padding-bottom: 0;
    }
}

/* Tablet specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .bottom-nav-container {
        max-width: 600px;
        margin: 0 auto;
    }

    .bottom-nav-item {
        padding: 0 20px;
    }

    .nav-label {
        font-size: 14px;
    }
}

/* Very small mobile */
@media (max-width: 374px) {
    .bottom-nav-item {
        padding: 0 8px;
    }

    .nav-label {
        font-size: 12px;
    }

    .nav-icon svg {
        width: 22px;
        height: 22px;
    }
}

/* ===========================================
   Categories Screen Styles
   =========================================== */
@media (max-width: 1024px) {
    .categories-screen {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 70px;
        display: flex;
        flex-direction: column;
        background: #fff;
        z-index: 1000;
        overflow: hidden;
    }

    .categories-screen-header {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        min-height: 64px;
        padding: calc(env(safe-area-inset-top, 0px) + 10px) 18px 10px;
        background: #fff;
        box-shadow: 0 4.48px 8.96px rgba(0, 0, 0, 0.1);
    }

    .categories-screen-back {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: none;
        background: transparent;
        color: #ee3e54;
        cursor: pointer;
    }

    .categories-screen-title {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        max-width: calc(100% - 120px);
        overflow: hidden;
        color: #ee3e54;
        font-family: 'Almarai', sans-serif;
        font-size: 22px;
        font-weight: 700;
        letter-spacing: -0.04em;
        line-height: 1.36;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .categories-screen-content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
    }

    .categories-list {
        list-style: none;
        margin: 24px 0 0;
        padding: 0;
    }

    .category-item {
        border-bottom: 1px solid #cfcfcf;
    }

    .category-item-subitem {
        border-bottom: 0;
    }

    .category-link,
    .category-link-button {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        min-height: 68px;
        padding: 8px 22px;
        border: none;
        background: transparent;
        color: #0e0d0d;
        text-align: right;
        text-decoration: none;
        font-family: 'Almarai', sans-serif;
        font-size: 18px;
        font-weight: 600;
        line-height: 1.36;
        cursor: pointer;
    }

    .category-link-label {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .category-link-subitem {
        min-height: 0;
        padding: 12px 58px 12px 22px;
        font-size: 19px;
        font-weight: 400;
        border-bottom: 0;
    }

    .category-link-expanded {
        cursor: default;
    }

    .category-link-arrow {
        flex-shrink: 0;
        color: #0e0d0d;
    }

    .category-link-arrow-open {
        width: 22px;
        height: 4px;
    }

    .category-link:hover,
    .category-link-button:hover {
        color: #0e0d0d;
        text-decoration: none;
        background: #fafafa;
    }

    .transition {
        transition-property: opacity, transform;
    }

    .ease-out {
        transition-timing-function: ease-out;
    }

    .ease-in {
        transition-timing-function: ease-in;
    }

    .duration-300 {
        transition-duration: 300ms;
    }

    .duration-200 {
        transition-duration: 200ms;
    }

    .opacity-0 {
        opacity: 0;
    }

    .opacity-100 {
        opacity: 1;
    }

    .translate-y-4 {
        transform: translateY(16px);
    }

    .translate-y-0 {
        transform: translateY(0);
    }
}

/* ===========================================
   Sticky Add to Cart Bar - Figma 63-910
   Shows above bottom navigation on product pages
   =========================================== */

/* Hide on desktop */
.sticky-addtocart-bar {
    display: none;
}

@media (max-width: 1024px) {
    .sticky-addtocart-bar {
        display: block;
        position: fixed;
        bottom: 70px; /* Above bottom nav */
        left: 0;
        right: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
        z-index: 998; /* Below bottom nav (999) */
        direction: rtl;
        padding: 12px 16px;
        box-sizing: border-box;
        border-top: 1px solid #f0f0f0;
    }
    
    .sticky-addtocart-container {
        display: flex;
        flex-direction: row-reverse;
        align-items: center;
        gap: 12px;
        width: 100%;
        max-width: 100%;
    }
    
    /* Add to Cart Button */
    .sticky-addtocart-btn {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        height: 48px;
        background: #ee3a54;
        color: #fff;
        border: none;
        border-radius: 4px;
        font-family: 'Noto Sans Arabic', 'Almarai', sans-serif;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }
    
    .sticky-addtocart-btn:hover {
        background: #d32f4a;
    }
    
    .sticky-addtocart-btn:disabled {
        background: #ccc;
        cursor: not-allowed;
    }
    
    .sticky-addtocart-btn svg {
        width: 20px;
        height: 20px;
        stroke: #fff;
    }
    
    /* Quantity Selector */
    .sticky-qty-selector {
        display: flex;
        align-items: center;
        height: 48px;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        background: #fff;
        overflow: hidden;
    }
    
    .sticky-qty-selector .qty-btn {
        width: 40px;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        font-size: 20px;
        color: #666;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }
    
    .sticky-qty-selector .qty-btn:hover:not(:disabled) {
        background: #f5f5f5;
    }
    
    .sticky-qty-selector .qty-btn:disabled {
        color: #ccc;
        cursor: not-allowed;
    }
    
    .sticky-qty-selector .qty-input {
        width: 40px;
        height: 100%;
        text-align: center;
        font-family: 'Open Sans', sans-serif;
        font-size: 16px;
        font-weight: 600;
        color: #333;
        border: none;
        border-left: 1px solid #e0e0e0;
        border-right: 1px solid #e0e0e0;
        background: transparent;
        -moz-appearance: textfield;
    }
    
    .sticky-qty-selector .qty-input::-webkit-outer-spin-button,
    .sticky-qty-selector .qty-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    /* Adjust body padding to account for sticky bar */
    body.catalog-product-view {
        padding-bottom: 130px; /* 70px bottom nav + 60px sticky bar */
    }
}
