/* ============================================
   RESPONSIVE CSS (Tablet & Mobile)
   Organic Roots Project
   ============================================ */

/* ---------- TABLET VIEW (Max 980px) ---------- */
@media (max-width: 980px) {
    /* Navbar */
    .nav-links { display: none; }
    .nav-toggle { display: block; }
    .nav-phone { display: none; }
    .navbar .btn { display: none; }
    .nav-search { width: 160px; }
    .nav-search:focus-within { width: 190px; }
    
    /* Hero */
    .hero .container { grid-template-columns: 1fr; }
    .hero-visual { order: -1; }
    .hero-slider, .hero-slides-track { min-height: 460px; height: 460px; }
    .hero-slide .hero-content h1 { font-size: 32px; }
    .hero-arrow { width: 38px; height: 38px; font-size: 14px; }
    .hero-arrow-prev { left: 14px; }
    .hero-arrow-next { right: 14px; }
    
    /* Layouts */
    .feature-row, .hp-process-row, .process-row { grid-template-columns: repeat(2, 1fr); }
    .hp-process-row { gap: 40px 20px; padding: 30px 20px; }
    .hp-process-arrow, .process-arrow { display: none; }
    
    .cat-dish-grid, .special-banner, .testi-about-grid { grid-template-columns: 1fr; }
    .special-left { flex-direction: column; }
    .special-banner { text-align: center; }
    
    .category-list { grid-template-columns: repeat(4, 1fr); }
    .dish-grid, .hp-dish-row { grid-template-columns: repeat(3, 1fr); }
    .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .hp-about-grid { grid-template-columns: 1fr; gap: 28px; }
    
    .hp-special-banner { grid-template-columns: 80px 1fr; }
    .hp-special-btn { grid-column: 1 / -1; width: 100%; justify-content: center; }
    .hp-cat-item { max-width: 120px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    
    /* Other Grids */
    .cart-grid, .checkout-grid, .product-detail-grid, .product-reviews-grid, .admin-report-grid { grid-template-columns: 1fr !important; }
}

/* ---------- MOBILE VIEW (Max 600px) ---------- */
@media (max-width: 600px) {
    .container { padding: 0 16px; }

    /* Mobile Bottom Navigation Bar — sirf mobile par flex, body me space reserve karo */
    body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
    .mobile-bottom-nav { display: flex; }

    /* Top Bar Mobile */
    .top-bar { position: relative; top: auto; z-index: auto; height: 34px; font-size: 12px; }
    .top-bar-phone { font-size: 12px; }
    .top-bar-socials li a { width: 24px; height: 24px; font-size: 11px; }
    
    /* Navbar Mobile */
    .navbar { top: 0; }
    .navbar .container { height: 68px; }
    
    /* 🔴 MOBILE: Navbar Text Hide & Logo Size */
    .nav-brand-text { display: none !important; } 
    .nav-brand img { height: 65px !important; width: 65px !important; }
    
    /* Nav Search Mobile (Icon to Expand) */
    .nav-search { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; transition: width 0.3s ease, border-radius 0.3s ease; }
    .nav-search.expanded { width: 180px; border-radius: 8px; }
    .nav-search input { display: none; }
    .nav-search.expanded input { display: block; }
    .nav-search-icon { padding: 0 10px; }

    /* Hero Section */
    .hero h1 { font-size: 30px; }
    .hero-slider, .hero-slides-track { min-height: 150px !important; height: 150px !important; }
    .hero-slide .hero-content h1 { font-size: 22px !important; }
    .hero-slide .hero-content .lead, .hero-slide .trust-badges, .hero-arrow { display: none !important; }
    .hero-slide-btn { padding: 10px 18px !important; font-size: 13px !important; margin-top: 2px; }
    .trust-badges { gap: 14px; }

    /* General Sections */
    .section-head h2 { font-size: 24px; }
    .cat-dish-section { padding: 24px 0 40px; }
    .process-section { padding: 32px 0; }
    .testi-about-section { padding: 0 0 40px; }
    
    /* Homepage Categories */
    .hp-categories { padding: 25px 0 20px; }
    .hp-cat-row { gap: 12px; justify-content: space-between; }
    .hp-cat-item { max-width: 60px; min-width: 50px; flex: 0 0 calc(33.33% - 8px); }
    .hp-cat-item h5 { font-size: 11.5px; }
    
    /* Homepage Dishes */
    .hp-dish-row, .dish-grid, .category-list { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .hp-dish-body h4, .dish-body h4 { font-size: 12.5px; }
    .dish-body { padding: 10px 12px 12px; }
    .dish-price { font-size: 14px; }
    .add-cart-btn { font-size: 11.5px; padding: 8px; }

    /* Homepage Special Banner */
    .hp-special-banner, .special-banner { grid-template-columns: 1fr; text-align: center; padding: 16px; gap: 12px; }
    .hp-special-img { width: 70px; height: 70px; margin: 0 auto; }
    .hp-special-title { font-size: 18px; justify-content: center; }
    .special-left { flex-direction: row !important; align-items: center; gap: 12px; }
    .special-thumb { width: 60px; height: 60px; }
    .special-title { font-size: 15px; flex-direction: column; align-items: flex-start; gap: 6px; }
    .off-tag { font-size: 10.5px; padding: 2px 8px; }
    .special-mid { font-size: 12px; margin-bottom: 4px; text-align: center; }
    .special-banner .btn-primary { width: 100%; padding: 10px; font-size: 13px; justify-content: center; }

    /* Homepage Process & Feature Strip */
    .hp-process-row, .process-row, .feature-row { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; padding: 18px 12px; }
    .hp-process-icon { width: 52px; height: 52px; font-size: 20px; }
    .hp-process-step h4 { font-size: 13px; }
    .feature-strip { padding: 20px 0; }
    .feature-card { padding: 12px; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
    .feature-icon, .process-icon { width: 38px; height: 38px; font-size: 16px; }
    .feature-card h4, .process-step h4 { font-size: 12.5px; margin-bottom: 2px; }
    .feature-card p, .process-step p { font-size: 11px; line-height: 1.3; }

    /* Homepage About */
    .hp-script { font-size: 22px; }
    .hp-about-section { padding-bottom: 52px; }
    .hp-about-badge { bottom: -14px; right: 10px; }
    .hp-about-text h2 { font-size: 24px; }
    /*.hp-testi-grid { grid-template-columns: 1fr; }*/

    /* 🔴 MOBILE: Footer Text Hide & Logo Size */
    .site-footer { padding: 36px 0 20px; }
    .footer-grid { display: flex !important; flex-wrap: wrap !important; flex-direction: row !important; gap: 28px 0% !important; text-align: center !important; }
    
    .footer-brand-block { flex: 0 0 100% !important; width: 100% !important; align-items: center !important; margin: 0 auto !important; }
    .footer-brand-block img { height: 110px !important; width: 110px !important; margin-bottom: 0 !important; }
    .footer-brand-block strong, .footer-brand-block span { display: none !important; } /* Text completely hidden */
    
    .footer-grid .footer-col:nth-child(2), .footer-grid .footer-col:nth-child(3) { flex: 0 0 50% !important; width: 50% !important; text-align: left !important; padding-left: 15px !important; }
    .footer-col h5 { font-size: 15px !important; margin-bottom: 12px !important; }
    .footer-col ul li { font-size: 13px !important; }
    .footer-grid .footer-col:nth-child(4) { flex: 0 0 100% !important; width: 100% !important; text-align: center !important; margin-top: 12px !important; padding: 20px 10px 0 !important; border-top: 1px solid rgba(244,238,221,0.12); }
    .footer-grid .footer-col:nth-child(4) h5, .footer-grid .footer-col:nth-child(4) p { justify-content: center !important; text-align: center !important; }
    .social-row, .delivery-badges { justify-content: center !important; }

    /* ===================================================== */
    /* 🛒 CART PAGE (customer/cart.php) — Mobile Layout       */
    /* ===================================================== */

    /* Grid ko 2-column se 1-column stack me badlo (980px wala rule bhi hai,
       yeh extra safety ke liye — agar kahin override ho jaye to bhi kaam kare) */
    .cart-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
    }

    /* Har cart item ko ek clean card jaisa banao — wrap karne do */
    .cart-item-row {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 12px !important;
        position: relative;
    }

    /* Image thoda chhota mobile par */
    .cart-item-img {
        width: 58px !important;
        height: 58px !important;
    }

    /* Naam/price wali info — image ke baad jagah le, full width tak */
    .cart-item-info {
        flex: 1 1 calc(100% - 78px) !important;
        min-width: 0;
    }
    .cart-item-info h4 {
        font-size: 14px !important;
        line-height: 1.3 !important;
    }
    .cart-item-info p {
        font-size: 13px !important;
    }

    /* Remove button — top-right corner me chhota icon, line se bahar */
    .cart-item-remove-form {
        position: absolute !important;
        top: 10px;
        right: 10px;
        margin: 0 !important;
    }
    .cart-item-remove-form button {
        font-size: 16px !important;
    }

    /* Quantity update form — neeche apni poori row me, image ke neeche se shuru */
    .cart-item-qty-form {
        flex: 1 1 100% !important;
        margin-left: 70px !important; /* image width + gap ke barabar, taaki align rahe */
        gap: 6px !important;
    }
    .cart-item-qty-form input[type="number"] {
        width: 46px !important;
        padding: 6px !important;
        font-size: 13px !important;
    }
    .cart-item-qty-form button {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }

    /* Total price — quantity form ke saamne, same row me right-aligned */
    .cart-item-total {
        flex: 0 0 auto !important;
        margin-left: auto !important;
        font-size: 14px !important;
        min-width: 0 !important;
        align-self: center;
    }

    /* Order Summary box — full width, comfortable padding */
    .cart-summary-box {
        padding: 18px !important;
    }
    .cart-summary-box h3 {
        font-size: 16px !important;
    }

    /* ===================================================== */

    /* Misc Pages */
    .profile-grid, .product-detail-grid, .product-reviews-grid { grid-template-columns: 1fr !important; }
    .order-timeline { flex-direction: column !important; align-items: flex-start !important; gap: 0 !important; }
    .timeline-step { flex-direction: row !important; align-items: flex-start !important; min-width: unset !important; width: 100%; gap: 14px; margin-bottom: 0; }
    .timeline-dot { margin-bottom: 0 !important; flex-shrink: 0; }
    .timeline-line { position: absolute; top: 46px; left: 22px; width: 2px !important; height: 100% !important; }
    .timeline-label { text-align: left !important; padding-top: 12px; padding-bottom: 16px; }
    .timeline-label strong { font-size: 13px !important; }
    .btn-block-mobile { width: 100% !important; justify-content: center !important; }
    
    /* Admin Mobile Fixes */
    .admin-content, .admin-card { padding: 16px !important; }
    .admin-form-group input, .admin-form-group select, .admin-form-group textarea { font-size: 16px; }
    .admin-table { min-width: 540px; }
    .admin-card { overflow-x: auto; }
    .admin-card-header { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
    .admin-stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .stat-value { font-size: 20px !important; }
    .order-tabs { gap: 6px; }
    .order-tab { padding: 8px 12px; font-size: 13px; }
    form[method="get"] { flex-direction: column !important; }
    form[method="get"] .admin-form-group { width: 100% !important; }
    form[method="get"] input[type="date"], form[method="get"] input[type="month"], form[method="get"] select { width: 100%; }
}

/* Medium screen admin grids */
@media (max-width: 900px) and (min-width: 601px) {
    .admin-content { padding: 20px; }
    .admin-stats-grid { grid-template-columns: repeat(3, 1fr); }
    div[style*="grid-template-columns:1fr 1fr"], div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ---------- View All button — Mobile fix ---------- */
@media (max-width: 600px) {
    .block-head {
        align-items: center;
    }
    .block-head h3 {
        font-size: 16px;
    }
    .view-all {
        font-size: 12px;
        white-space: nowrap;
        padding: 5px 10px;
        border-radius: 6px;
        background-color: var(--green-pale);
        color: var(--green-deep);
    }
    .view-all i {
        font-size: 10px;
    }
}

/* ============================================
   TESTIMONIALS CAROUSEL
   ============================================ */

.testi-carousel-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.testi-carousel-viewport {
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.testi-carousel-track {
    display: flex;
    /* gap set by JS dynamically (20px desktop, 0px mobile) */
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.testi-carousel-slide {
    flex-shrink: 0;
}

/* Equal height — JS sets this, but card itself needs full height */
.testi-carousel-slide .hp-testi-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Card text fills available space so author sticks to bottom */
.testi-carousel-slide .hp-testi-card p {
    flex: 1;
}

/* Arrow buttons */
.testi-carousel-arrow {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(107,66,38,0.18);
    background-color: var(--white);
    color: var(--green-deep);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(45,80,22,0.08);
}

.testi-carousel-arrow:hover {
    background-color: var(--green-pale);
    box-shadow: 0 4px 14px rgba(45,80,22,0.14);
}

/* Dots */
.testi-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    margin-top: 24px;
}

.tc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: rgba(45,80,22,0.20);
    cursor: pointer;
    transition: background-color 0.2s, width 0.2s;
}

.tc-dot.active {
    background-color: var(--green-deep);
    width: 20px;
    border-radius: 4px;
}

/* Mobile: arrows hidden, swipe se navigate */
@media (max-width: 640px) {
    .testi-carousel-arrow { display: none; }
    .testi-carousel-wrap  { gap: 0; }
}

/* ============================================
   BLOG PAGE — Hero Banner + Card Grid
   (blog.php — moved here from style.css so all
   blog responsive rules live in one place)

   NOTE: !important is used here on purpose —
   .blog-hero needs to win over the base .about-hero
   rule no matter which CSS file loads first.
   ============================================ */

/* Base size (desktop) — shorter banner than the default .about-hero */
.blog-hero {
    min-height: 260px !important;
}

/* Tablet */
@media (max-width: 980px) {
    .blog-hero {
        min-height: 220px !important;
    }
    .blog-hero .about-hero-content h1 {
        font-size: 28px !important;
    }

    .hp-blog-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .blog-hero {
        min-height: 160px !important;
    }
    .blog-hero .about-hero-content {
        padding: 20px 18px !important;
    }
    .blog-hero .about-hero-content h1 {
        font-size: 20px !important;
        margin-bottom: 6px !important;
    }
    .blog-hero .about-hero-sub {
        font-size: 12.5px !important;
        margin-bottom: 0 !important;
    }

    .hp-blog-row {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .hp-blog-card {
        border-radius: 12px !important;
    }

    .hp-blog-img {
        aspect-ratio: 16/10 !important;
        height: auto !important;
    }

    .hp-blog-body {
        padding: 14px !important;
    }

    .hp-blog-body h4 {
        font-size: 15px !important;
        line-height: 1.4 !important;
    }

    .hp-blog-body p {
        font-size: 13px !important;
    }

    .hp-blog-date {
        font-size: 11.5px !important;
    }

    .hp-blog-readmore {
        font-size: 13px !important;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .blog-hero {
        min-height: 140px !important;
    }
    .blog-hero .about-hero-content h1 {
        font-size: 18px !important;
    }
    .blog-hero .about-hero-sub {
        font-size: 12px !important;
    }

    /* Cart page — chhoti screens par qty form ka left margin thoda kam karo */
    .cart-item-qty-form {
        margin-left: 0 !important;
    }
    .cart-item-img {
        width: 50px !important;
        height: 50px !important;
    }
    .cart-item-info {
        flex: 1 1 calc(100% - 66px) !important;
    }
}

/* =====================================================================
   CATERING MENU - PRODUCT IMAGE GRID (2 per row on mobile/tablet)
   Sirf image wale items ko target karta hai (.cat-item-with-img)
===================================================================== */

@media (max-width: 768px) {

    .cat-menu-items-list {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Image wale item ko 2-column grid me le aao */
    .cat-menu-item:has(.cat-item-with-img) {
        width: calc(50% - 6px);
        flex: 0 0 calc(50% - 6px);
    }

    /* Bina image wale plain checkbox items full-width hi rahenge */
    .cat-menu-item:not(:has(.cat-item-with-img)) {
        width: 100%;
        flex: 0 0 100%;
    }

    .cat-item-with-img img {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        border-radius: 8px;
    }

    .cat-item-with-img {
        display: flex;
        flex-direction: column;
    }

    .cat-item-label {
        font-size: 13px;
        text-align: center;
        margin-top: 4px;
    }

    /* "View More" button ko full width rakho */
    .cat-show-more-btn {
        width: 100%;
        flex: 0 0 100%;
    }
}

/* Fallback for browsers without :has() support (older Safari/Firefox) */
@supports not selector(:has(*)) {
    @media (max-width: 768px) {
        .cat-item-with-img {
            width: calc(50% - 6px);
            flex: 0 0 calc(50% - 6px);
            display: inline-flex;
            flex-direction: column;
            vertical-align: top;
        }
        .cat-menu-items-list {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }
    }
}