/* =====================================================
   MOBILE-FIRST RESPONSIVE IMPROVEMENTS
   Bhagat Ayurveda — Priority: Mobile Experience
   ===================================================== */

/* ── ROOT TOKENS ── */
:root {
    --mobile-padding: 12px;
    --mobile-radius: 10px;
    --touch-target: 44px;
}

/* ── GLOBAL MOBILE BASE ── */
*, *::before, *::after { box-sizing: border-box; }

body {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Smooth scrolling */
html { scroll-behavior: smooth; }

/* Touch-friendly links & buttons */
a, button, [role="button"], label {
    -webkit-tap-highlight-color: transparent;
}

/* ── ANNOUNCEMENT BAR — mobile ── */
@media (max-width: 991px) {
    .announcement-bar {
        padding: 6px 0 !important;
        font-size: 12px !important;
        background: linear-gradient(90deg, var(--color-primary-start, #143526), var(--color-primary-end, #1f513f)) !important;
    }

    .announcement-inner {
        padding: 0 10px !important;
        justify-content: center !important;
    }

    .announcement-social {
        display: none !important;
    }

    .announcement-slide {
        min-width: 100% !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 0 10px !important;
        text-align: center !important;
    }

    .announcement-slide p {
        font-size: 12px !important;
        margin: 0 !important;
        color: #ffffff !important;
        display: inline-flex !important;
        align-items: center !important;
        white-space: nowrap !important;
    }

    .announcement-slide .icon {
        font-size: 12px !important;
        color: #ffffff !important;
    }
}

/* ── MAIN HEADER — mobile ── */
@media (max-width: 1023px) {
    .main-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
        background: #ffffff !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
        border-bottom: 1px solid #eef0f2 !important;
    }

    .header-inner {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 6px 12px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        box-sizing: border-box !important;
    }

    /* Hamburger button */
    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 38px !important;
        height: 38px !important;
        padding: 6px !important;
        background: none !important;
        border: none !important;
        cursor: pointer !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    .mobile-menu-btn span {
        display: block !important;
        width: 22px !important;
        height: 2.5px !important;
        background-color: #1b4332 !important;
        margin: 2px 0 !important;
        border-radius: 2px !important;
        transition: all 0.25s ease !important;
    }

    .logo {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-grow: 1 !important;
        margin: 0 10px !important;
    }

    .logo a {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .logo img {
        height: 36px !important;
        max-height: 36px !important;
        max-width: 150px !important;
        width: auto !important;
        object-fit: contain !important;
    }

    /* Header action icons */
    .header-icons {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        font-size: 18px !important;
        color: #1b4332 !important;
        flex-shrink: 0 !important;
    }

    .header-icons .fa-magnifying-glass,
    .header-icons .user-icon,
    .cart {
        font-size: 18px !important;
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        color: #1b4332 !important;
    }

    .cart {
        position: relative !important;
    }

    .cart-count {
        position: absolute !important;
        top: 0px !important;
        right: -4px !important;
        background: #f59e0b !important;
        color: #000000 !important;
        font-size: 10px !important;
        font-weight: 700 !important;
        min-width: 17px !important;
        height: 17px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        padding: 0 3px !important;
    }
}

/* ── MOBILE DRAWER & PANELS ── */
.mobile-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(2px) !important;
    z-index: 9998 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

.mobile-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-panels {
    position: fixed !important;
    top: 0 !important;
    left: -100% !important;
    width: min(320px, 85vw) !important;
    max-width: 320px !important;
    height: 100vh !important;
    background: #ffffff !important;
    z-index: 9999 !important;
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15) !important;
}

.mobile-panels.active {
    left: 0 !important;
}

.mobile-panel {
    position: absolute !important;
    top: 0 !important;
    left: 100% !important;
    width: 100% !important;
    height: 100% !important;
    background: #ffffff !important;
    transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: flex !important;
    flex-direction: column !important;
}

.mobile-panel.active {
    left: 0 !important;
}

.mobile-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    background: #fbfbfb !important;
    min-height: 54px !important;
}

.mobile-header img {
    max-height: 36px !important;
    width: auto !important;
}

.mobile-close-btn,
.nav-back-btn {
    background: none !important;
    border: none !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    color: #444 !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.mobile-menu-list,
.mobile-submenu {
    list-style: none !important;
    padding: 6px 0 !important;
    margin: 0 !important;
}

.mobile-menu-list li,
.mobile-submenu li {
    padding: 12px 18px !important;
    border-bottom: 1px solid #f4f4f4 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #1f2937 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    cursor: pointer !important;
    transition: background 0.15s ease !important;
}

.mobile-menu-list li a,
.mobile-submenu li a {
    color: inherit !important;
    text-decoration: none !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
}

.mobile-menu-list li:active,
.mobile-submenu li:active {
    background: #f0fdf4 !important;
    color: #15803d !important;
}

    .mobile-submenu li {
        min-height: var(--touch-target);
    }

    .mobile-submenu a {
        padding: 12px 16px;
        font-size: 14px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid #f5f5f5;
    }

    .mobile-header {
        padding: 14px 16px;
        border-bottom: 2px solid #f0f0f0;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 10;
    }
}

/* ── SEARCH MODAL — mobile ── */
@media (max-width: 767px) {
    .search-modal {
        padding: 16px;
        top: 0;
        align-items: flex-start;
        padding-top: 70px;
    }

    .search-container {
        border-radius: var(--mobile-radius);
        padding: 16px;
        width: 100%;
    }

    #searchInput {
        font-size: 16px; /* prevents iOS zoom */
        padding: 12px 14px;
        min-height: var(--touch-target);
    }

    .mic-btn, .search-btn {
        min-width: var(--touch-target);
        min-height: var(--touch-target);
    }
}

/* ── HOMEPAGE HERO — mobile ── */
@media (max-width: 767px) {
    .hero-section,
    .banner-section {
        min-height: 55vw;
        max-height: 85vh;
    }

    .hero-content h1,
    .banner-content h1 {
        font-size: clamp(20px, 6vw, 36px);
        line-height: 1.2;
    }

    .hero-content p,
    .banner-content p {
        font-size: 14px;
    }

    .hero-content .btn,
    .banner-content .btn {
        font-size: 14px;
        padding: 10px 20px;
        min-height: var(--touch-target);
    }
}

/* ── PRODUCT CARD — mobile ── */
@media (max-width: 767px) {
    .product-card {
        border-radius: 12px;
        padding: 10px;
        margin-bottom: 12px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        box-sizing: border-box;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    }

    .product-card .image-box {
        aspect-ratio: 1 / 1;
        width: 100%;
        border-radius: 8px;
        background: #fafafa;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .product-card .image-box a {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .product-card .image-box img,
    .product-card .image-box .img-main {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .product-card h3,
    .product-card .product-title {
        font-size: 13px !important;
        font-weight: 600 !important;
        line-height: 1.35 !important;
        height: 2.7em !important;
        min-height: 2.7em !important;
        max-height: 2.7em !important;
        margin: 8px 0 4px !important;
        text-align: center !important;
        -webkit-line-clamp: 2 !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        color: #1a1a1a !important;
    }

    .product-card .rating {
        font-size: 11px !important;
        margin-bottom: 2px !important;
        line-height: 1.2 !important;
        text-align: center !important;
    }

    .product-card .price,
    .product-card .product-price {
        font-size: 14px !important;
        margin: 2px 0 8px !important;
        line-height: 1.3 !important;
        text-align: center !important;
    }

    .product-card .price .old {
        font-size: 12px !important;
        margin-left: 4px !important;
    }

    .product-card .cart-action {
        margin-top: auto !important;
        width: 100% !important;
    }

    .product-card .add-cart-btn,
    .product-card button.add-cart-btn {
        width: 100% !important;
        height: 36px !important;
        min-height: 36px !important;
        font-size: 13px !important;
        padding: 0 !important;
        margin-top: 0 !important;
        border-radius: 8px !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 600 !important;
    }

    .product-card .add-cart-btn:not(.d-none) {
        display: flex !important;
    }

    .product-card .qty-box {
        width: 100% !important;
        height: 36px !important;
    }

    .product-card .qty-box:not(.d-none) {
        display: block !important;
    }

    .product-card .d-none,
    .product-card .add-cart-btn.d-none,
    .product-card .qty-box.d-none {
        display: none !important;
    }

    .product-card .qty-box .qty {
        width: 100% !important;
        height: 36px !important;
        padding: 3px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        box-sizing: border-box !important;
        background: var(--color-primary-start, #1f513f) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    }

    .product-card .qty-box .qty button {
        width: 30px !important;
        height: 30px !important;
        min-height: 30px !important;
        max-height: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        border-radius: 6px !important;
        background: rgba(255, 255, 255, 0.22) !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        line-height: 1 !important;
        user-select: none !important;
        transition: background 0.15s ease, transform 0.1s ease !important;
    }

    .product-card .qty-box .qty button:active {
        transform: scale(0.92) !important;
        background: rgba(255, 255, 255, 0.45) !important;
    }

    .product-card .qty-box .qty-count {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #fff !important;
        min-width: 20px !important;
        text-align: center !important;
        user-select: none !important;
    }

    .product-card .badge {
        top: 6px !important;
        left: 6px !important;
        font-size: 10px !important;
        padding: 2px 6px !important;
    }

    /* Equal height columns across product grids */
    .row > [class*="col-6"],
    .row > [class*="col-"] {
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 14px !important;
    }

    .swiper-slide {
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .swiper-slide .product-card {
        height: 100% !important;
    }

    /* 2-column product grid on mobile */
    .products-grid,
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 var(--mobile-padding) !important;
    }

    .row.product-row > [class*="col-"] {
        padding-left: 6px;
        padding-right: 6px;
    }
}

@media (max-width: 375px) {
    .products-grid,
    .product-grid {
        gap: 8px !important;
    }

    .product-card {
        padding: 8px;
    }

    .product-card h3,
    .product-card .product-title {
        font-size: 12px !important;
    }
}

/* ── PRODUCT DETAIL PAGE — mobile ── */
@media (max-width: 767px) {
    .product-detail-section .product-images {
        margin-bottom: 16px;
    }

    .product-detail-section .product-main-img {
        border-radius: var(--mobile-radius);
        max-height: 350px;
        object-fit: contain;
    }

    .product-detail-section .product-thumbnails {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .product-detail-section .product-thumbnails::-webkit-scrollbar {
        display: none;
    }

    .product-detail-section .thumb-img {
        min-width: 64px;
        width: 64px;
        height: 64px;
        flex-shrink: 0;
        border-radius: 8px;
    }

    .product-detail-section h1.product-title {
        font-size: clamp(18px, 5vw, 26px);
        margin-bottom: 10px;
    }

    .product-detail-section .price-block {
        font-size: 20px;
    }

    .product-detail-section .btn-add-cart,
    .product-detail-section .btn-buy-now {
        min-height: var(--touch-target);
        font-size: 15px;
        border-radius: var(--mobile-radius);
        width: 100%;
    }

    .product-detail-section .qty-control {
        min-height: var(--touch-target);
    }

    .product-detail-section .qty-control button {
        min-width: var(--touch-target);
        min-height: var(--touch-target);
        font-size: 18px;
    }

    /* Sticky add-to-cart bar */
    .product-sticky-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: #fff;
        padding: 10px 16px;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
        display: flex;
        gap: 10px;
    }

    .product-sticky-bar .btn {
        flex: 1;
        min-height: var(--touch-target);
    }
}

/* ── CHECKOUT PAGE — mobile ── */
@media (max-width: 767px) {
    .checkout-section {
        padding: var(--mobile-padding);
    }

    .checkout-section .form-control,
    .checkout-section .form-select,
    .checkout-section input,
    .checkout-section select,
    .checkout-section textarea {
        font-size: 16px; /* prevents iOS zoom */
        min-height: var(--touch-target);
        border-radius: 8px;
        padding: 10px 14px;
    }

    .checkout-section label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
    }

    .checkout-section .payment-methods {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .checkout-section .payment-option {
        padding: 14px;
        border-radius: var(--mobile-radius);
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;
    }

    .checkout-section .order-summary {
        border-radius: var(--mobile-radius);
        padding: 16px;
        margin-top: 16px;
    }

    .checkout-section .btn-place-order,
    .checkout-section .btn[type="submit"] {
        width: 100%;
        min-height: var(--touch-target);
        font-size: 16px;
        border-radius: var(--mobile-radius);
        font-weight: 700;
    }

    /* Reorder: form on top, summary below on mobile */
    .checkout-section .checkout-row {
        flex-direction: column !important;
    }
}

/* ── CART SIDEBAR — mobile ── */
@media (max-width: 767px) {
    .cart-sidebar,
    .cart-offcanvas {
        width: 100% !important;
        max-width: 100vw;
        border-radius: 16px 16px 0 0;
        bottom: 0;
        top: auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .cart-item {
        padding: 12px 0;
        gap: 10px;
    }

    .cart-item img {
        width: 64px;
        height: 64px;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .cart-item-name {
        font-size: 13px;
        line-height: 1.4;
    }

    .cart-qty-btn {
        min-width: 32px;
        min-height: 32px;
        font-size: 16px;
    }

    .cart-footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 12px 16px;
        border-top: 1px solid #eee;
    }

    .cart-footer .btn-checkout {
        width: 100%;
        min-height: var(--touch-target);
        font-size: 16px;
        border-radius: var(--mobile-radius);
    }
}

/* ── FOOTER — mobile ── */
@media (max-width: 767px) {
    .modern-footer .footer-main {
        padding: 30px 0 20px !important;
    }

    .modern-footer .footer-main .row > div {
        padding-bottom: 20px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        margin-bottom: 4px;
    }

    .modern-footer .footer-main .row > div:last-child {
        border-bottom: none;
    }

    .modern-footer h5.footer-title {
        font-size: 15px;
        margin-bottom: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
    }

    .modern-footer .footer-links li {
        margin-bottom: 6px;
    }

    .modern-footer .footer-links a {
        font-size: 13px;
        padding: 4px 0;
        display: inline-block;
    }

    .newsletter-modern {
        padding: 24px 16px !important;
    }

    .newsletter-modern h2 {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .newsletter-form-modern {
        flex-direction: column !important;
        gap: 10px;
    }

    .newsletter-form-modern .form-control {
        width: 100%;
        min-height: var(--touch-target);
        font-size: 16px;
        border-radius: var(--mobile-radius);
    }

    .newsletter-form-modern .btn {
        width: 100%;
        min-height: var(--touch-target);
        border-radius: var(--mobile-radius);
    }

    .footer-social {
        gap: 14px;
        flex-wrap: wrap;
    }

    .footer-social a {
        min-width: var(--touch-target);
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .footer-bottom {
        padding: 14px 0 !important;
        font-size: 12px;
    }
}

/* ── SECTION SPACING — mobile ── */
@media (max-width: 767px) {
    section, .section {
        padding-top: 28px !important;
        padding-bottom: 28px !important;
    }

    .section-title,
    .section-header h2,
    h2.section-heading {
        font-size: clamp(18px, 5.5vw, 26px) !important;
        margin-bottom: 16px !important;
    }

    .container {
        padding-left: var(--mobile-padding) !important;
        padding-right: var(--mobile-padding) !important;
    }
}

/* ── SWIPER / SLIDER — mobile ── */
@media (max-width: 767px) {
    .swiper-slide {
        border-radius: var(--mobile-radius);
    }

    .product-swiper .swiper-slide {
        width: calc(50vw - 20px) !important;
        min-width: 140px;
    }

    .product-swiper-wide .swiper-slide {
        width: calc(80vw) !important;
    }
}

/* ── TESTIMONIALS / REVIEWS — mobile ── */
@media (max-width: 767px) {
    .review-card,
    .testimonial-card {
        padding: 14px;
        border-radius: var(--mobile-radius);
    }

    .review-card p {
        font-size: 13px;
        line-height: 1.6;
    }
}

/* ── LOGIN/REGISTER MODAL — mobile ── */
@media (max-width: 767px) {
    .login-modal,
    .login-drawer {
        padding: 20px 16px;
        border-radius: 16px 16px 0 0;
    }

    .login-modal input,
    .login-drawer input {
        font-size: 16px;
        min-height: var(--touch-target);
    }

    .login-modal .btn,
    .login-drawer .btn {
        width: 100%;
        min-height: var(--touch-target);
        font-size: 16px;
    }
}

/* ── CONTACT / COMPLAINT FORM — mobile ── */
@media (max-width: 767px) {
    .contact-form-section input,
    .contact-form-section textarea,
    .contact-form-section select,
    .complaint-form input,
    .complaint-form textarea,
    .complaint-form select {
        font-size: 16px;
        min-height: var(--touch-target);
        border-radius: 8px;
    }

    .contact-form-section .btn,
    .complaint-form .btn {
        width: 100%;
        min-height: var(--touch-target);
    }
}

/* ── ABOUT PAGE — mobile ── */
@media (max-width: 767px) {
    .about-section .about-img {
        margin-bottom: 20px;
        border-radius: var(--mobile-radius);
    }

    .about-section h1, .about-section h2 {
        font-size: clamp(20px, 6vw, 32px);
    }
}

/* ── ORDER TRACKING / ORDER LIST — mobile ── */
@media (max-width: 767px) {
    .order-card {
        padding: 14px;
        border-radius: var(--mobile-radius);
        margin-bottom: 12px;
    }

    .order-card .order-meta {
        flex-direction: column;
        gap: 6px;
    }

    .order-card .order-items {
        gap: 8px;
    }

    .order-card .order-item-img {
        width: 56px;
        height: 56px;
        border-radius: 8px;
    }

    .order-track-form {
        flex-direction: column;
        gap: 10px;
    }

    .order-track-form input,
    .order-track-form .btn {
        width: 100%;
        min-height: var(--touch-target);
        font-size: 16px;
    }
}

/* ── MOBILE BOTTOM NAVIGATION BAR (optional enhancement) ── */
@media (max-width: 767px) {
    /* Add padding to body to prevent content hiding behind sticky bar if added */
    body.has-sticky-bar {
        padding-bottom: 60px;
    }
}

/* ── UTILITY — prevent horizontal overflow ── */
@media (max-width: 767px) {
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }

    .row > * {
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Fix tables on mobile */
    .table-responsive-mobile {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--mobile-radius);
    }

    table {
        min-width: 320px;
    }
}

/* ── TYPOGRAPHY — fluid sizing ── */
@media (max-width: 767px) {
    h1 { font-size: clamp(22px, 6vw, 36px); }
    h2 { font-size: clamp(18px, 5vw, 30px); }
    h3 { font-size: clamp(16px, 4.5vw, 24px); }
    h4 { font-size: clamp(15px, 4vw, 20px); }
    p  { font-size: 14px; line-height: 1.65; }
}

/* ── PERFORMANCE — reduce motion for accessibility ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
