/* Mobile app layout — phones and small tablets */
:root {
    --app-header-h: 48px;
    --app-tabbar-h: 64px;
    --app-toolbar-h: 44px;
    --app-radius: 16px;
    --app-radius-sm: 12px;
    --app-surface: #ffffff;
    --app-muted: #8b8b9a;
    --app-border: #eceaf2;
    --app-shadow: 0 8px 24px rgba(74, 74, 92, 0.08);
}

/* Desktop: hide mobile-only app chrome; keep navbar fixed */
@media (min-width: 992px) {
    .mobile-app-tabbar,
    .app-page-toolbar,
    .app-filter-sheet-trigger,
    .d-app-only {
        display: none !important;
    }

    body.app-mobile {
        padding-top: var(--desktop-header-h, 70px) !important;
        padding-bottom: 0 !important;
        background: #fff !important;
    }

    .main-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        z-index: 1030 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .main-header > .container,
    .main-header .navbar {
        height: auto !important;
        overflow: visible !important;
    }

    body.app-mobile .main-content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

@media (max-width: 991.98px) {
    html {
        -webkit-text-size-adjust: 100%;
    }

    body.app-mobile {
        padding-top: calc(var(--app-header-h) + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px)) !important;
        background: #f4f3f8 !important;
    }

    body.app-mobile .main-content {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .corano-topbar,
    .top-bar {
        display: none !important;
    }

    .main-header {
        min-height: var(--app-header-h) !important;
        height: calc(var(--app-header-h) + env(safe-area-inset-top, 0px)) !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-bottom: 0 !important;
        border-bottom: 0 !important;
        box-shadow: 0 1px 0 rgba(139, 123, 168, 0.12) !important;
        background: #fff !important;
        overflow: hidden !important;
    }

    .main-header > .container {
        height: var(--app-header-h);
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .main-header .navbar,
    .main-header .navbar.py-3,
    .main-header .navbar.py-0 {
        min-height: var(--app-header-h) !important;
        height: var(--app-header-h) !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
    }

    .main-content {
        padding-bottom: 12px;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    .container,
    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Hide bulky desktop page headers / breadcrumbs on mobile app */
    .page-header,
    .breadcrumb,
    nav[aria-label="breadcrumb"] {
        display: none !important;
    }

    .footer {
        margin-top: 1.5rem !important;
        padding-bottom: 8px;
        border-radius: 20px 20px 0 0;
        overflow: hidden;
    }

    .footer.py-5,
    .footer .py-5 {
        padding-top: 1.75rem !important;
        padding-bottom: 1rem !important;
    }

    /* Center payment icons on mobile only */
    .footer-bottom .row {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .footer-bottom .col-md-6 {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
        text-align: center !important;
    }

    .footer-bottom .payment-methods {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .footer-bottom .payment-methods i {
        margin: 0 !important;
        font-size: 1.6rem;
    }

    .whatsapp-chat-btn {
        right: 16px !important;
        bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 12px) !important;
        width: 50px !important;
        height: 50px !important;
        z-index: 1040 !important;
    }

    /* Bottom tab bar */
    .mobile-app-tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1050;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        height: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid var(--app-border);
        box-shadow: 0 -8px 24px rgba(74, 74, 92, 0.08);
    }

    .mobile-app-tabbar a,
    .mobile-app-tabbar button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 48px;
        border: 0;
        background: transparent;
        color: var(--app-muted);
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-app-tabbar a i,
    .mobile-app-tabbar button i {
        font-size: 1.15rem;
        line-height: 1;
    }

    .mobile-app-tabbar a.active,
    .mobile-app-tabbar button.active,
    .mobile-app-tabbar a:active,
    .mobile-app-tabbar button:active {
        color: var(--primary-color, #8B7BA8);
    }

    .mobile-app-tabbar .tab-badge {
        position: absolute;
        top: 6px;
        right: calc(50% - 18px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--primary-color, #8B7BA8);
        color: #fff;
        font-size: 0.62rem;
        line-height: 16px;
        text-align: center;
    }

    .mobile-app-tabbar .tab-item {
        position: relative;
    }

    /* Sticky Filter/Sort — tight under header, gap below to products */
    .app-page-toolbar {
        position: sticky;
        top: calc(var(--app-header-h) + env(safe-area-inset-top, 0px));
        z-index: 1020;
        display: flex;
        align-items: center;
        gap: 8px;
        min-height: var(--app-toolbar-h);
        width: 100%;
        margin: 0 0 20px !important;
        padding: 6px 12px 10px !important;
        background: #fff;
        border-top: 0 !important;
        border-bottom: 1px solid #e5e3eb !important;
        box-shadow: none !important;
    }

    /* This marked white gap was leftover offset above Filter — remove it */
    .app-listing-wrap {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .app-listing-wrap > .page-header {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
    }

    .app-listing-wrap > .container {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .app-listing-wrap .app-page-toolbar {
        margin-top: 0 !important;
        margin-bottom: 20px !important;
    }

    /* Space between filter bottom line and product grid */
    .app-listing-wrap .products-grid,
    .app-listing-wrap .products-container,
    .app-listing-wrap #productsList,
    .app-listing-wrap #productsGrid {
        margin-top: 0 !important;
        padding-top: 4px !important;
    }

    .app-page-toolbar .app-toolbar-btn {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 38px;
        border: 1px solid var(--app-border);
        border-radius: 999px;
        background: #fff;
        color: #4A4A5C;
        font-size: 0.84rem;
        font-weight: 600;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }

    .app-page-toolbar .app-toolbar-btn i {
        color: var(--primary-color, #8B7BA8);
    }

    .app-page-toolbar .app-toolbar-count {
        margin-left: auto;
        color: var(--app-muted);
        font-size: 0.78rem;
        font-weight: 600;
        white-space: nowrap;
        padding-left: 4px;
    }

    /* Hide desktop sidebar filters on mobile — use sheet instead */
    .filters-sidebar-desktop {
        display: none !important;
    }

    /* Full-width listing column on mobile (sidebar is hidden) */
    .app-listing-wrap .row > .col-lg-9,
    .app-listing-wrap .row > .col-md-8,
    .app-listing-wrap .row > [class*="col-"]:has(.products-grid),
    .app-listing-wrap .row > [class*="col-"]:has(.products-container),
    .app-listing-wrap .row > [class*="col-"]:has(#productsList),
    .app-listing-wrap .row > [class*="col-"]:has(#productsGrid) {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .products-grid,
    .products-container,
    #productsList,
    #productsGrid {
        width: 100%;
        max-width: 100%;
    }

    .products-toolbar,
    .view-options {
        display: none !important;
    }

    /* Filter / Sort bottom sheets */
    .app-sheet.offcanvas-bottom {
        height: auto;
        max-height: 82vh;
        border-radius: 22px 22px 0 0;
        border: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #121212;
        color: #fff;
    }

    .app-sheet .offcanvas-header {
        padding: 14px 16px 8px;
        border-bottom: 1px solid rgba(255,255,255,.1);
        background: #121212;
    }

    .app-sheet .offcanvas-title {
        font-size: 1.05rem;
        font-weight: 700;
        color: #fff;
    }

    .app-sheet .offcanvas-body {
        padding: 12px 16px 20px;
        overflow-y: auto;
        background: #121212;
        color: #fff;
    }

    .app-sheet-handle {
        width: 42px;
        height: 4px;
        border-radius: 999px;
        background: rgba(255,255,255,.35);
        margin: 0 auto 10px;
    }

    .app-filter-section {
        background: #1a1a1a;
        border: 1px solid rgba(255,255,255,.1);
        border-radius: var(--app-radius);
        padding: 14px;
        margin-bottom: 12px;
    }

    .app-filter-section .filter-title {
        font-size: 0.92rem;
        font-weight: 700;
        margin-bottom: 10px;
        padding-bottom: 0;
        border: 0;
        color: #fff;
    }

    .app-filter-section .form-check {
        min-height: 42px;
        display: flex !important;
        align-items: center !important;
        gap: 0.7rem;
        padding-left: 0 !important;
        margin-bottom: 4px;
    }

    .app-filter-section .form-check-input {
        float: none !important;
        position: static !important;
        margin: 0 !important;
        margin-top: 0 !important;
        width: 1.15rem !important;
        height: 1.15rem !important;
        flex: 0 0 auto;
    }

    .app-filter-section .form-check-label {
        font-size: 0.9rem;
        color: rgba(255,255,255,.85);
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1.35;
        display: inline-flex;
        align-items: center;
    }

    .app-sheet-actions {
        display: flex;
        gap: 10px;
        position: sticky;
        bottom: 0;
        background: #121212;
        padding-top: 10px;
    }

    .app-sheet-actions .btn {
        flex: 1;
        border-radius: 999px;
        min-height: 46px;
        font-weight: 600;
    }

    .app-sort-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .app-sort-list button {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 48px;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: var(--app-radius-sm);
        background: #1a1a1a;
        padding: 0 14px;
        font-weight: 600;
        color: #fff;
        text-align: left;
    }

    .app-sort-list button.active {
        border-color: var(--primary-color, #c9a84c);
        background: rgba(var(--primary-color-rgb, 201, 168, 76), 0.12);
        color: var(--primary-color, #c9a84c);
    }

    /* Shared surfaces */
    .product-card,
    .fashion-product-card,
    .card {
        border-radius: var(--app-radius) !important;
        overflow: hidden;
        box-shadow: var(--app-shadow);
        border-color: transparent !important;
        background: var(--app-surface);
    }

    .product-card .product-info,
    .fashion-product-card .product-info {
        padding: 10px 10px 12px !important;
    }

    .product-title,
    .fashion-product-name {
        font-size: 0.86rem !important;
        line-height: 1.3 !important;
        margin-bottom: 4px !important;
    }

    .product-price,
    .fashion-product-price {
        font-size: 0.88rem !important;
        font-weight: 700 !important;
    }

    .wishlist-btn {
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .btn,
    .form-control,
    .form-select {
        border-radius: var(--app-radius-sm);
        min-height: 44px;
    }

    .product-add-to-cart.btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 40px;
        line-height: 1 !important;
        gap: 6px;
    }

    .product-add-to-cart.btn i,
    .product-add-to-cart.btn span {
        display: inline-flex;
        align-items: center;
        line-height: 1;
        margin: 0;
    }

    .alert {
        border-radius: var(--app-radius-sm);
        margin-left: 4px;
        margin-right: 4px;
    }

    .nav.nav-pills .nav-link.active,
    .nav-pills .nav-link.active {
        color: #ffffff !important;
        background-color: var(--primary-color, #8B7BA8) !important;
    }

    .nav.nav-pills .nav-link.active i,
    .nav-pills .nav-link.active i {
        color: #ffffff !important;
    }

    #mobileMenu.app-mobile-menu.offcanvas {
        border-radius: 0 18px 18px 0;
        max-width: 86%;
        background: #0f0f0f !important;
        color: #fff !important;
        padding-bottom: 0;
        z-index: 1080;
    }

    #mobileMenu .app-menu-body {
        padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
    }

    /* Category banner — full width, no 100vw shift */
    .category-banner-hero {
        width: 100% !important;
        max-width: 100% !important;
        left: auto !important;
        right: auto !important;
        margin: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .category-listing .category-banner-hero {
        margin-bottom: 0 !important;
    }

    .category-banner-image-wrapper {
        width: 100% !important;
        height: 160px !important;
        min-height: 160px !important;
        max-height: 160px !important;
    }

    .category-banner-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }

    .category-banner-title {
        font-size: 1.35rem !important;
        letter-spacing: 1px !important;
        margin-bottom: 4px !important;
    }

    .category-banner-description {
        font-size: 0.82rem !important;
        margin: 0 !important;
        opacity: 0.92;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .category-listing .app-page-toolbar {
        margin-top: 0 !important;
        margin-bottom: 16px !important;
    }

    .category-listing .container {
        padding-top: 0 !important;
    }

    .category-empty {
        padding-top: 1.25rem !important;
        padding-bottom: 1.25rem !important;
    }

    .section-title {
        font-size: 1.2rem !important;
        margin-bottom: 12px !important;
    }

    .pagination-wrapper {
        margin-top: 16px;
        margin-bottom: calc(var(--app-tabbar-h) * 0.2);
    }

    .pagination .page-link {
        border-radius: 10px !important;
        margin: 0 2px;
        min-width: 38px;
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Cart / checkout / profile cards */
    .card-header {
        background: transparent !important;
        border-bottom: 1px solid var(--app-border) !important;
        padding: 14px 16px !important;
    }

    .card-header h5,
    .card-header h4 {
        font-size: 1.05rem !important;
        font-weight: 700 !important;
    }

    .card-body {
        padding: 14px 16px !important;
    }

    /* Hide desktop-only columns on listing when using full-width app grid */
    .app-listing-wrap .filters-sidebar-desktop,
    .app-listing-wrap .row > .col-lg-3.filters-sidebar-desktop,
    .app-listing-wrap .row > .col-md-4.filters-sidebar-desktop {
        display: none !important;
    }

    .app-sort-list button .fa-check {
        opacity: 0;
        color: var(--primary-color, #8B7BA8);
    }

    .app-sort-list button.active .fa-check {
        opacity: 1;
    }

    /* Cart / checkout stacked full-width app cards */
    .card {
        margin-bottom: 12px;
    }

    #cart-items .cart-item,
    .cart-item-row {
        display: block;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--app-border);
    }

    #cart-items .cart-item-actions {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px;
        width: 100%;
    }

    #cart-items .quantity-controls {
        display: flex !important;
        align-items: center !important;
    }

    #cart-items .remove-item-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    .brand-header {
        padding: 20px 12px !important;
        border-radius: 16px !important;
        margin-bottom: 16px !important;
    }

    .brand-title {
        font-size: 1.45rem !important;
    }

    .brand-logo img {
        max-height: 64px !important;
    }
}

@media (max-width: 576px) {
    .shop-by-category-section {
        padding: 28px 0 !important;
    }

    .shop-by-category-title,
    .section-title {
        font-size: 1.35rem !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 18px !important;
    }

    .category-panel-container {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        align-items: stretch !important;
    }

    .category-panel-link {
        flex: 0 0 calc(50% - 5px) !important;
        width: calc(50% - 5px) !important;
        max-width: none !important;
    }

    .category-panel {
        border-width: 0 !important;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
        aspect-ratio: 1 / 1 !important;
    }

    .category-panel-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .hero-content h1 {
        font-size: 1.7rem !important;
    }

    .video-hero-section,
    .video-container {
        height: calc(
            100dvh
            - var(--mobile-header-offset, calc(var(--app-header-h, 48px) + env(safe-area-inset-top, 0px)))
            - var(--app-tabbar-h, 64px)
            - env(safe-area-inset-bottom, 0px)
        ) !important;
        min-height: 380px !important;
        max-height: none !important;
    }

    .hero-video {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-width: 100% !important;
        min-height: 100% !important;
        object-fit: cover !important;
        object-position: center 30% !important;
    }

    #productsList > .product-item,
    #productsGrid > .product-item,
    .products-grid > .row > .product-item,
    .products-container > .row > .product-item {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
        padding-left: 6px;
        padding-right: 6px;
    }

    #productsList > .product-item .product-card,
    #productsGrid > .product-item .product-card,
    .products-grid .product-card,
    .products-container .product-card {
        width: 100%;
        max-width: 100%;
    }

    .product-info {
        text-align: left !important;
    }

    .row.g-3,
    .row.g-4 {
        --bs-gutter-x: 0.7rem;
        --bs-gutter-y: 0.7rem;
    }

    /* Open search panel sits below fixed header */
    .app-search-sheet.offcanvas-top {
        top: calc(var(--app-header-h, 56px) + env(safe-area-inset-top, 0px) + 12px) !important;
    }

    .app-search-sheet .offcanvas-header {
        padding-top: 16px !important;
        padding-bottom: 8px !important;
    }

    .app-search-sheet .offcanvas-body {
        padding-top: 6px !important;
        padding-bottom: 20px !important;
    }

    .app-search-input-wrap {
        margin-top: 4px !important;
    }
}
