/* =============================================================
   KHIDMAT SHOES — MOBILE APP EXPERIENCE CSS
   Premium mobile-first design for a native app feel
   ============================================================= */

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
    --mobile-nav-h: 64px;
    --mobile-header-h: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --app-radius: 16px;
    --app-radius-sm: 10px;
    --app-shadow: 0 2px 16px rgba(0, 0, 0, .10);
    --app-shadow-lg: 0 8px 32px rgba(0, 0, 0, .18);
    --bg-page: #f4f4f6;
}

/* ═══════════════════════════════════════════════════════
   DESKTOP: Hide all mobile-only elements completely
   ═══════════════════════════════════════════════════════ */
@media (min-width: 769px) {

    .mobile-bottom-nav,
    .mobile-drawer,
    .mobile-drawer-overlay,
    .mobile-filter-chips,
    .header-mobile-left {
        display: none !important;
    }
}

/* ── ONLY APPLY ON MOBILE ───────────────────────────────────── */
@media (max-width: 768px) {

    /* BASE */
    html {
        scroll-behavior: smooth;
    }

    body {
        background: var(--bg-page);
        -webkit-tap-highlight-color: transparent;
        overscroll-behavior-y: contain;
    }

    /* Extra bottom padding so content isn't behind bottom nav */
    main {
        padding-bottom: calc(var(--mobile-nav-h) + var(--safe-bottom) + 12px);
    }

    /* ── ANNOUNCEMENT BAR ────────────────────────────────────── */
    .announcement-bar {
        font-size: 0.7rem;
        padding: 5px 0;
        letter-spacing: 0.3px;
    }

    /* ── HEADER (App-style sticky top bar) ──────────────────── */
    .header-boutique {
        position: sticky;
        top: 0;
        z-index: 999;
        background: #fff;
        border-bottom: 1px solid rgba(0, 0, 0, .08);
        box-shadow: 0 1px 8px rgba(0, 0, 0, .08);
        padding: 0;
        height: var(--mobile-header-h);
    }

    .header-boutique-inner {
        position: relative;
        height: var(--mobile-header-h);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        gap: 0;
    }

    /* Hide desktop nav links — we use bottom nav instead */
    .header-nav-left,
    .header-nav-right,
    .hide-mobile {
        display: none !important;
    }

    /* Mobile Left Icons Group */
    .header-mobile-left {
        display: flex;
        align-items: center;
        gap: 16px;
    }

    /* Logo centred */
    .logo-boutique {
        position: absolute;
        left: 50% !important;
        top: 50%;
        transform: translate(-50%, -50%) !important;
        font-size: 1.25rem;
        letter-spacing: 1px;
        margin: 0 !important;
    }

    .logo-boutique img {
        height: 28px !important;
        width: auto;
    }

    /* Header icons group (Right side) */
    .header-icons {
        display: flex;
        align-items: center;
        gap: 16px;
        margin-left: 0;
    }

    .header-icon {
        font-size: 1.1rem;
        color: #222;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-badge {
        width: 15px;
        height: 15px;
        font-size: 0.55rem;
        top: -6px;
        right: -6px;
        background: #e53e3e;
    }

    /* Hamburger toggle — shown on right side now in header-icons group */
    .menu-toggle {
        display: flex;
        width: 28px;
        height: 28px;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }

    .menu-toggle span {
        display: block;
        width: 22px;
        height: 2px;
        background: #222;
        border-radius: 2px;
    }

    /* ── MOBILE SLIDE DRAWER (hamburger menu) ────────────────── */
    .mobile-drawer {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 80vw;
        max-width: 320px;
        background: #fff;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
        overflow-y: auto;
        padding: 72px 0 24px;
        border-radius: 0 var(--app-radius) var(--app-radius) 0;
    }

    .mobile-drawer.active {
        transform: translateX(0);
    }

    .mobile-drawer-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .4);
        z-index: 1099;
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s;
        backdrop-filter: blur(2px);
    }

    .mobile-drawer-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    /* ── BOTTOM NAVIGATION BAR (App-style) ───────────────────── */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: #fff;
        height: calc(var(--mobile-nav-h) + var(--safe-bottom));
        padding-bottom: var(--safe-bottom);
        display: flex;
        align-items: center;
        justify-content: space-around;
        border-top: 1px solid rgba(0, 0, 0, .08);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .10);
    }

    .mobile-bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        gap: 4px;
        font-size: 0.6rem;
        font-weight: 600;
        color: #999;
        text-decoration: none;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        padding: 8px 4px;
        transition: color .2s;
        position: relative;
    }

    .mobile-bottom-nav a i {
        font-size: 1.25rem;
        transition: transform .2s;
    }

    .mobile-bottom-nav a.active,
    .mobile-bottom-nav a:active {
        color: var(--primary, #111);
    }

    .mobile-bottom-nav a.active i {
        transform: scale(1.15);
    }

    /* Cart badge on bottom nav */
    .mobile-bottom-nav .nav-badge {
        position: absolute;
        top: 4px;
        left: calc(50% + 6px);
        background: #e53e3e;
        color: #fff;
        border-radius: 50%;
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
    }

    /* ── HERO SLIDER (Full-bleed, premium app style) ─────────── */
    .hero-editorial {
        min-height: 70vh !important;
        margin: 0;
        border-radius: 0;
        overflow: hidden;
        position: relative;
    }

    .hero-slides {
        height: 70vh !important;
    }

    .hero-slide {
        min-height: 70vh !important;
        min-width: 100% !important;
        border-radius: 0;
        background-size: cover !important;
        background-position: center center !important;
        display: flex;
        align-items: flex-end;
        /* content at bottom */
        justify-content: flex-start;
    }

    /* Hero inner — push content to bottom with good padding */
    .hero-editorial-inner {
        padding: 0 !important;
        width: 100%;
    }

    .hero-editorial-content {
        padding: 0 24px 48px 24px !important;
        max-width: 100%;
    }

    /* Badge / subtitle */
    .hero-editorial-badge {
        font-size: 0.58rem !important;
        letter-spacing: 2px;
        opacity: 0.85;
        margin-bottom: 10px;
        display: block;
    }

    /* The decorative line below badge */
    .hero-editorial-badge::after {
        margin-top: 8px;
        width: 36px;
    }

    /* Main hero title */
    .hero-editorial-title {
        font-size: 2rem !important;
        line-height: 1.1 !important;
        margin-bottom: 20px !important;
        letter-spacing: -0.5px;
    }

    .hero-editorial-title em {
        font-size: 2rem !important;
    }

    .hero-editorial-title span {
        font-size: 1.7rem !important;
        letter-spacing: 4px;
    }

    /* CTA buttons */
    .hero-editorial-ctas {
        display: flex !important;
        flex-direction: row !important;
        gap: 8px !important;
        flex-wrap: wrap;
        /* allow wrap on long-title slides */
        align-items: center;
        margin-top: 16px !important;
    }

    .hero-editorial-ctas .btn {
        padding: 10px 18px !important;
        font-size: 0.7rem !important;
        border-radius: 50px !important;
        font-weight: 700 !important;
        letter-spacing: 0.8px !important;
        white-space: nowrap;
        min-width: auto !important;
        min-height: 38px !important;
        flex: 0 0 auto;
    }

    /* Right-side image cutout — hide on mobile */
    .hero-editorial-image {
        display: none !important;
    }

    /* Move slider arrows to BOTTOM corners (not middle) */
    .hero-arrows {
        position: absolute !important;
        bottom: 16px !important;
        right: 16px !important;
        top: auto !important;
        left: auto !important;
        width: auto !important;
        display: flex !important;
        gap: 8px !important;
        z-index: 10;
        pointer-events: all;
        transform: none !important;
    }

    .hero-arrow {
        width: 32px !important;
        height: 32px !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.5) !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0.7rem !important;
        cursor: pointer;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        box-shadow: none !important;
    }

    /* Slider dots */
    .hero-dots {
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
    }

    .hero-dot {
        width: 20px;
        height: 3px;
        border-radius: 2px;
    }

    /* ── TRUST BAR (Horizontal scroll on mobile) ─────────────── */
    .trust-bar {
        padding: 10px 0;
        background: #fff;
        border-bottom: 1px solid rgba(0, 0, 0, .06);
    }

    .trust-bar-inner {
        display: flex;
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 16px;
    }

    .trust-bar-inner::-webkit-scrollbar {
        display: none;
    }

    .trust-bar-item {
        flex: 0 0 auto;
        min-width: 120px;
        flex-direction: column;
        gap: 4px;
        font-size: 0.65rem;
        padding: 6px 16px;
        border-right: 1px solid rgba(0, 0, 0, .08);
        text-align: center;
    }

    .trust-bar-item:last-child {
        border-right: none;
    }

    .trust-bar-item i {
        font-size: 1rem;
    }

    /* ── SECTION HEADINGS ────────────────────────────────────── */
    .section-heading-luxury {
        margin-bottom: 20px;
        text-align: left;
        padding: 0 4px;
    }

    .section-heading-luxury h2 {
        font-size: 1.4rem;
    }

    .section-heading-luxury p {
        font-size: 0.8rem;
    }

    .section-luxury {
        padding: 24px 0 !important;
    }

    /* ── CATEGORY CARDS (Horizontal scroll, app-style) ───────── */
    /* Fix: container needs overflow:hidden, grid overflows parent */
    .section-luxury {
        overflow: hidden;
        padding: 24px 0 !important;
    }

    .category-lifestyle-grid {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 12px;
        padding: 4px 16px 12px 16px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .category-lifestyle-grid::-webkit-scrollbar {
        display: none;
    }

    /* Override the 4th/5th child rules that break mobile layout */
    .category-lifestyle-grid .category-lifestyle-card:nth-child(4),
    .category-lifestyle-grid .category-lifestyle-card:nth-child(5),
    .category-lifestyle-grid:has(> :nth-child(5)) .category-lifestyle-card:nth-child(4),
    .category-lifestyle-grid:has(> :nth-child(5)) .category-lifestyle-card:nth-child(5) {
        grid-column: unset !important;
        width: unset !important;
        flex: 0 0 140px !important;
    }

    .category-lifestyle-card {
        flex: 0 0 140px !important;
        min-width: 140px !important;
        width: 140px !important;
        height: 175px;
        border-radius: var(--app-radius) !important;
        overflow: hidden;
    }

    .category-lifestyle-img {
        height: 100%;
    }

    .category-lifestyle-img img {
        height: 100%;
        object-fit: cover;
    }

    .category-lifestyle-overlay h3 {
        font-size: 0.85rem;
    }

    .category-lifestyle-cta {
        font-size: 0.65rem;
    }

    /* ── PRODUCT GRID (2-col, app-style cards) ───────────────── */
    .product-grid-editorial,
    .grid-4.product-grid-editorial,
    .grid-3.product-grid-editorial {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 4px;
    }

    /* Premium product grid (shop page) */
    .premium-product-grid,
    .grid-3.premium-product-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .product-card-editorial {
        border-radius: var(--app-radius-sm);
        overflow: hidden;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .07);
        transition: transform .2s, box-shadow .2s;
    }

    .product-card-editorial:active {
        transform: scale(0.97);
        box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    }

    .product-card-media {
        aspect-ratio: 1 / 1;
        overflow: hidden;
    }

    .product-card-media img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .3s;
    }

    .product-card-info {
        padding: 8px 10px 12px;
    }

    .product-card-cat {
        font-size: 0.6rem;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
    }

    .product-card-name a {
        font-size: 0.78rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card-pricing {
        margin-top: 4px;
        gap: 4px;
        flex-wrap: wrap;
    }

    .price-current {
        font-size: 0.9rem !important;
        font-weight: 700;
    }

    .price-was {
        font-size: 0.7rem !important;
    }

    .product-badge-editorial {
        font-size: 0.6rem;
        padding: 2px 7px;
        border-radius: 4px;
    }

    /* ── SHOP PAGE ───────────────────────────────────────────── */
    .page-header {
        padding: 16px 0 12px;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .shop-layout {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        padding: 0 !important;
    }

    /* Filter sidebar becomes a horizontal pill scroll */
    .shop-sidebar {
        display: none;
        /* hidden; replaced by filter chips */
    }

    .shop-toolbar {
        padding: 12px 16px;
        background: #fff;
        border-radius: var(--app-radius-sm);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-shadow: var(--app-shadow);
    }

    .results-count {
        font-size: 0.8rem;
        color: #666;
    }

    .sort-select {
        font-size: 0.8rem;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 6px 10px;
        background: #f8f8f8;
        -webkit-appearance: none;
        appearance: none;
        min-width: 110px;
    }

    /* Mobile category filter chips */
    .mobile-filter-chips {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding: 10px 16px;
        scrollbar-width: none;
        background: #fff;
        margin-bottom: 10px;
    }

    .mobile-filter-chips::-webkit-scrollbar {
        display: none;
    }

    .filter-chip {
        flex: 0 0 auto;
        padding: 6px 14px;
        border-radius: 20px;
        font-size: 0.72rem;
        font-weight: 600;
        border: 1.5px solid #e0e0e0;
        color: #555;
        text-decoration: none;
        background: #fff;
        letter-spacing: 0.3px;
        white-space: nowrap;
        transition: all .15s;
    }

    .filter-chip.active,
    .filter-chip:active {
        background: #111;
        color: #fff;
        border-color: #111;
    }

    /* ── PRODUCT DETAIL PAGE ─────────────────────────────────── */
    .product-detail-layout {
        display: flex !important;
        flex-direction: column;
        gap: 0;
    }

    .product-gallery {
        border-radius: 0;
        margin: 0 -16px;
    }

    .product-gallery img {
        border-radius: 0;
        width: 100%;
        max-height: 360px;
        object-fit: contain;
        background: #f8f8f8;
    }

    .product-info {
        padding: 20px 16px;
        background: #fff;
        border-radius: var(--app-radius) var(--app-radius) 0 0;
        margin-top: -16px;
        position: relative;
        z-index: 2;
    }

    .product-title {
        font-size: 1.1rem;
        line-height: 1.3;
        margin-bottom: 8px;
    }

    .product-price-lg {
        font-size: 1.4rem;
        font-weight: 800;
    }

    /* Size selector */
    .size-options {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin: 16px 0;
    }

    .size-btn {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        border: 2px solid #e0e0e0;
        font-size: 0.85rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all .15s;
        background: #fff;
    }

    .size-btn.selected,
    .size-btn:active {
        border-color: #111;
        background: #111;
        color: #fff;
    }

    /* Add to Cart sticky footer */
    .product-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 900;
        background: #fff;
        padding: 12px 16px calc(12px + var(--safe-bottom));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .12);
        display: flex !important;
        flex-direction: row !important;
        gap: 10px;
        border-top: 1px solid rgba(0, 0, 0, .06);
    }

    .product-actions .btn {
        flex: 1;
        padding: 14px;
        font-size: 0.85rem;
        border-radius: 12px;
        font-weight: 700;
        letter-spacing: 0.3px;
    }

    /* ── CART PAGE ───────────────────────────────────────────── */
    .cart-layout {
        display: flex !important;
        flex-direction: column;
        gap: 0;
    }

    .cart-item {
        border-radius: var(--app-radius-sm);
        background: #fff;
        margin-bottom: 10px;
        padding: 14px;
        box-shadow: var(--app-shadow);
    }

    .cart-item-img {
        width: 80px;
        height: 80px;
        border-radius: 10px;
        object-fit: cover;
    }

    .cart-summary {
        background: #fff;
        border-radius: var(--app-radius);
        padding: 20px 16px;
        box-shadow: var(--app-shadow);
        margin-top: 16px;
    }

    /* ── FOOTER (Simplified on mobile) ──────────────────────── */
    footer {
        padding-bottom: calc(var(--mobile-nav-h) + var(--safe-bottom) + 16px) !important;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 20px;
    }

    .footer-grid>*:first-child {
        grid-column: 1 / -1;
    }

    /* ── CHECKOUT (App-style form) ───────────────────────────── */
    .checkout-layout {
        display: flex !important;
        flex-direction: column;
    }

    .checkout-form {
        padding: 0;
    }

    .form-control {
        height: 48px;
        border-radius: 10px;
        font-size: 0.9rem;
        padding: 0 14px;
    }

    .form-row {
        grid-template-columns: 1fr !important;
    }

    /* ── BREADCRUMB ──────────────────────────────────────────── */
    .breadcrumb {
        font-size: 0.72rem;
    }

    /* ── BUTTONS ─────────────────────────────────────────────── */
    .btn {
        border-radius: 10px;
        min-height: 44px;
        font-size: 0.85rem;
    }

    .btn-lg {
        min-height: 50px;
        font-size: 0.9rem;
        border-radius: 12px;
    }

    /* ── FLASH ALERTS ────────────────────────────────────────── */
    .alert {
        border-radius: var(--app-radius-sm);
        font-size: 0.82rem;
        padding: 12px 16px;
    }

    /* ── EDITORIAL BANNER (Full bleed) ──────────────────────── */
    .editorial-banner {
        min-height: 200px;
        margin: 0 -16px;
        border-radius: 0;
    }

    .editorial-banner-content {
        padding: 32px 20px;
    }

    .editorial-banner-content h2 {
        font-size: 1.4rem;
    }

    /* ── SEARCH OVERLAY ──────────────────────────────────────── */
    .search-overlay {
        padding: 80px 16px 20px;
    }

    .search-overlay-inner input {
        font-size: 1rem;
        height: 52px;
        border-radius: 12px;
        padding: 0 50px 0 18px;
    }

    /* ── ACCOUNT / ORDERS ────────────────────────────────────── */
    .account-layout {
        display: flex !important;
        flex-direction: column;
        gap: 16px;
    }

    .account-sidebar {
        order: -1;
    }

    /* ── PAGINATION ──────────────────────────────────────────── */
    .pagination {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
        padding: 16px 0;
    }

    .page-btn {
        min-width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: 0.82rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ── SECTION CONTAINER ───────────────────────────────────── */
    .container {
        padding: 0 16px;
    }

    /* ── SCROLL TO TOP pill ──────────────────────────────────── */
    #scrollTopBtn {
        bottom: calc(var(--mobile-nav-h) + var(--safe-bottom) + 16px) !important;
        right: 16px !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        font-size: 1rem !important;
    }

}

/* END @media 768px */

/* Very small phones */
@media (max-width: 380px) {
    .hero-editorial-title {
        font-size: 1.5rem !important;
    }

    .category-lifestyle-card {
        flex: 0 0 120px;
        min-width: 120px;
        height: 150px;
    }

    .product-card-name a {
        font-size: 0.72rem;
    }

    .price-current {
        font-size: 0.82rem !important;
    }
}