/* =====================================================
   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: 767px) {
    .announcement-bar {
        padding: 6px 0;
        font-size: 12px;
    }
    .announcement-slide p {
        font-size: 12px;
        margin: 0;
    }
    .announcement-slide .icon {
        font-size: 12px;
    }
}

/* ── MAIN HEADER — mobile ── */
@media (max-width: 1023px) {
    .header-inner {
        padding: 10px 16px;
        min-height: 60px;
    }

    .logo img {
        max-height: 44px;
        width: auto;
    }

    /* Bigger touch targets for header icons */
    .header-icons {
        gap: 14px;
    }

    .header-icons .fa-magnifying-glass,
    .header-icons .user-icon,
    .cart {
        font-size: 18px;
        min-width: var(--touch-target);
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-count {
        min-width: 18px;
        min-height: 18px;
        font-size: 10px;
        top: 4px;
        right: 4px;
    }

    /* Hamburger button */
    .mobile-menu-btn {
        padding: 8px;
        min-width: var(--touch-target);
        min-height: var(--touch-target);
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
    }
}

/* ── MOBILE DRAWER — better UX ── */
@media (max-width: 1023px) {
    .mobile-panels {
        width: min(320px, 85vw);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-menu-list li {
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
        border-bottom: 1px solid #f0f0f0;
        padding: 4px 0;
    }

    .mobile-menu-list .nav-item,
    .mobile-menu-list a {
        font-size: 15px;
        padding: 10px 16px;
        width: 100%;
        display: flex;
        align-items: center;
    }

    .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: var(--mobile-radius);
    }

    .product-card .product-img {
        border-radius: var(--mobile-radius) var(--mobile-radius) 0 0;
    }

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

    .product-card .product-title {
        font-size: 13px;
        line-height: 1.4;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-card .product-price {
        font-size: 15px;
        font-weight: 700;
    }

    .product-card .btn,
    .product-card button {
        width: 100%;
        min-height: 40px;
        font-size: 13px;
        margin-top: 8px;
    }

    /* 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 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;
    }
}
