/* ============================================================
   JustCook — Mobile App Experience CSS
   Makes the site look & feel like a native app on phones
   ============================================================ */

/* ── Safe Area & Base ─────────────────────────────────────── */
@media (max-width: 768px) {

    /* Smooth scrolling like native app */
    html {
        scroll-behavior: smooth;
        -webkit-tap-highlight-color: transparent;
        -webkit-text-size-adjust: 100%;
        overflow-x: hidden; /* Fix white shade */
    }

    body {
        overscroll-behavior-y: none;
        overflow-x: hidden; /* Fix white shade */
        /* Prevent pull-to-refresh */
    }

    /* ── Hide top navbar hamburger, show bottom nav instead ── */
    .navbar {
        height: 58px !important;
        padding: 0 1rem !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        background: rgba(255, 255, 255, 0.95) !important;
    }

    .nav-links {
        display: none !important;
    }

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

    .nav-actions {
        gap: 0.5rem !important;
    }

    .icon-btn {
        width: 40px !important;
        height: 40px !important;
    }

    /* ── Bottom Navigation Bar (App Style) ───────────────────── */
    .mobile-taskbar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 68px;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        z-index: 1000;
        padding: 0 0 env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);
    }

    .dark-theme .mobile-taskbar,
    body:not(.light-theme) .mobile-taskbar {
        background: rgba(15, 23, 42, 0.97);
        border-top-color: rgba(255, 255, 255, 0.08);
    }

    .taskbar-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        cursor: pointer;
        transition: all 0.2s ease;
        text-decoration: none;
        color: var(--text);
        opacity: 0.45;
        padding: 8px 0;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }

    .taskbar-item.active {
        opacity: 1;
        color: var(--primary);
    }

    .taskbar-item.active i {
        transform: scale(1.1);
    }

    .taskbar-item i {
        transition: transform 0.2s ease;
    }

    .taskbar-item span:not(.taskbar-badge) {
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.3px;
    }

    .taskbar-badge {
        position: absolute;
        top: 4px;
        right: calc(50% - 18px);
        background: var(--primary);
        color: white;
        font-size: 9px;
        font-weight: 800;
        min-width: 16px;
        height: 16px;
        border-radius: 99px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
    }

    /* ── App Root Padding (for bottom nav) ───────────────────── */
    #app-root {
        margin-top: 58px !important;
        padding-bottom: 80px !important;
        /* Space for bottom nav */
    }

    footer.footer {
        margin-bottom: 68px !important;
    }

    /* ── Typography Scaling ───────────────────────────────────── */
    .jc-big-title {
        font-size: clamp(1.8rem, 7vw, 2.5rem) !important;
        line-height: 1.15 !important;
    }

    h1 { font-size: clamp(1.5rem, 6vw, 2rem) !important; }
    h2 { font-size: clamp(1.25rem, 5vw, 1.75rem) !important; }
    h3 { font-size: clamp(1rem, 4vw, 1.25rem) !important; }

    /* ── Touch-Friendly Buttons ───────────────────────────────── */
    .btn {
        min-height: 52px !important;
        padding: 0.9rem 1.5rem !important;
        font-size: 0.95rem !important;
        border-radius: 16px !important;
        width: 100% !important;
        letter-spacing: 0.5px !important;
        transition: transform 0.1s ease, box-shadow 0.1s ease !important;
    }

    .btn:active {
        transform: scale(0.97) !important;
    }

    .btn:hover {
        transform: none !important;
    }

    .btn-secondary {
        min-height: 48px !important;
    }

    /* ── Container Padding ────────────────────────────────────── */
    .container,
    .jc-wrapper {
        padding: 0 1rem !important;
    }

    /* ── Product Cards (App Style) ────────────────────────────── */
    .products-grid,
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 !important;
    }

    .product-card {
        border-radius: 20px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    }

    .product-card img,
    .product-card .product-img,
    .prod-img {
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        object-fit: cover !important;
        border-radius: 0 !important;
        height: auto !important;
        max-height: none !important;
    }

    .product-card .product-info,
    .prod-info {
        padding: 12px !important;
    }

    .product-card .product-name,
    .prod-name {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        margin-bottom: 6px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .product-card .product-price,
    .prod-price {
        font-size: 1rem !important;
        font-weight: 800 !important;
    }

    .product-card .btn,
    .prod-btn {
        min-height: 40px !important;
        font-size: 0.78rem !important;
        border-radius: 12px !important;
        padding: 0.5rem !important;
        letter-spacing: 0 !important;
    }

    /* ── Form Inputs (App Style) ──────────────────────────────── */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        min-height: 52px !important;
        font-size: 16px !important;
        /* Prevents iOS zoom on focus */
        border-radius: 14px !important;
        padding: 0.8rem 1rem !important;
        width: 100% !important;
    }

    /* ── Cart Page ────────────────────────────────────────────── */
    .cart-item {
        flex-direction: row !important;
        gap: 12px !important;
        padding: 12px !important;
        border-radius: 16px !important;
    }

    .cart-item-img,
    .cart-img {
        width: 80px !important;
        height: 80px !important;
        min-width: 80px !important;
        border-radius: 12px !important;
        object-fit: cover !important;
    }

    /* ── Checkout Page ────────────────────────────────────────── */
    .checkout-steps {
        flex-direction: row !important;
        gap: 4px !important;
    }

    .checkout-step-label {
        font-size: 0.7rem !important;
    }

    .checkout-form-group {
        margin-bottom: 1rem !important;
    }

    /* ── Order Tracker ────────────────────────────────────────── */
    .tracker-timeline {
        padding-left: 1rem !important;
    }

    /* ── Login / Signup Page ──────────────────────────────────── */
    .auth-card,
    .login-card,
    .signup-card {
        border-radius: 28px !important;
        padding: 2rem 1.5rem !important;
        margin: 1rem !important;
    }

    /* ── Modals ───────────────────────────────────────────────── */
    .modal,
    .modal-content,
    [class*="modal"] {
        border-radius: 28px 28px 0 0 !important;
        position: fixed !important;
        bottom: 68px !important;
        left: 0 !important;
        right: 0 !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
    }

    /* ── Tables (make scrollable) ─────────────────────────────── */
    .sheet-table-wrap,
    table {
        overflow-x: auto !important;
        display: block !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* ── Hero Section ─────────────────────────────────────────── */
    .hero,
    .jc-hero,
    [class*="hero"] {
        padding: 1.5rem 1rem !important;
        text-align: center !important;
        min-height: 50vh !important;
    }

    /* ── Swiper/Carousel ──────────────────────────────────────── */
    .swiper-slide img {
        border-radius: 16px !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 4/3 !important;
        object-fit: cover !important;
    }

    /* ── KPI Cards (Admin) ────────────────────────────────────── */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .kpi-card {
        border-radius: 18px !important;
        padding: 1.2rem !important;
    }

    .kpi-value {
        font-size: 1.6rem !important;
    }

    /* ── Section Padding ──────────────────────────────────────── */
    section,
    .section {
        padding: 2rem 0 !important;
    }

    /* ── Scrollbar hiding (app-like) ──────────────────────────── */
    ::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
    }

    /* ── Page Transitions (app-like) ─────────────────────────── */
    #app-root > * {
        animation: pageSlideIn 0.25s ease-out;
    }

    @keyframes pageSlideIn {
        from {
            opacity: 0;
            transform: translateY(12px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* ── Very small phones (< 380px) ─────────────────────────── */
@media (max-width: 380px) {
    .products-grid,
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .product-card .product-name,
    .prod-name {
        font-size: 0.78rem !important;
    }

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

    .mob-nav-label {
        font-size: 9px !important;
    }
}
