/* ============================================
   MOBILE ENHANCEMENTS
   Mobile-specific optimizations for HerbonNaturals
   ============================================ */

/* Premium Mobile Bottom Navigation */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08) !important;
        padding: 10px 10px 12px !important;
        z-index: 999999 !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
        border-radius: 24px 24px 0 0 !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        will-change: transform;
    }

    .mobile-bottom-nav.nav-hidden {
        transform: translateY(110%) !important;
    }

    .nav-items {
        display: flex !important;
        justify-content: space-evenly !important;
        align-items: center !important;
        width: 100% !important;
        max-width: 600px !important;
        margin: 0 auto !important;
    }

    .nav-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-decoration: none !important;
        color: #94a3b8 !important;
        /* Premium Slate color */
        padding: 4px 0 !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        position: relative !important;
        flex: 1 !important;
    }

    .nav-item svg {
        width: 24px !important;
        height: 24px !important;
        margin-bottom: 5px !important;
        stroke-width: 2 !important;
        transition: all 0.3s ease !important;
    }

    .nav-item span {
        font-size: 10px !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
        transition: all 0.3s ease !important;
    }

    /* Active State Enhancement */
    .nav-item.active {
        color: #2D5016 !important;
    }

    .nav-item.active svg {
        color: #2D5016 !important;
        transform: translateY(-2px) !important;
        stroke-width: 2.5 !important;
        filter: drop-shadow(0 2px 4px rgba(45, 80, 22, 0.15)) !important;
    }

    /* Active Indicator Line */
    .nav-item.active::before {
        content: '' !important;
        position: absolute !important;
        top: -10px !important;
        width: 20px !important;
        height: 3px !important;
        background: #2D5016 !important;
        border-radius: 0 0 4px 4px !important;
        box-shadow: 0 2px 6px rgba(45, 80, 22, 0.3) !important;
    }

    .nav-item:active {
        transform: scale(0.92) !important;
        transition: transform 0.1s ease !important;
    }
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

/* Hamburger Menu Button */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: relative;
    z-index: 1001;
}

.hamburger-icon {
    width: 24px;
    height: 18px;
    position: relative;
    transform: rotate(0deg);
    transition: 0.3s ease;
}

.hamburger-icon span {
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: #2c2c2c;
    border-radius: 3px;
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: 0.25s ease-in-out;
}

.hamburger-icon span:nth-child(1) {
    top: 0px;
}

.hamburger-icon span:nth-child(2) {
    top: 7px;
}

.hamburger-icon span:nth-child(3) {
    top: 14px;
}

/* Active Hamburger Animation */
.mobile-menu-toggle.active .hamburger-icon span:nth-child(1) {
    top: 7px;
    transform: rotate(135deg);
}

.mobile-menu-toggle.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
    left: -60px;
}

.mobile-menu-toggle.active .hamburger-icon span:nth-child(3) {
    top: 7px;
    transform: rotate(-135deg);
}

/* Mobile Menu Drawer */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: #fff;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
}

.mobile-menu-drawer.active {
    left: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* MOBILE: Keep hamburger hidden, use bottom nav instead */
@media (max-width: 768px) {

    .mobile-menu-toggle {
        display: none !important;
        /* User wants bottom nav, not hamburger */
    }

    .mobile-menu-drawer {
        display: none !important;
        /* Hide drawer completely */
    }

    .mobile-menu-overlay {
        display: none !important;
        /* Hide overlay */
    }

    /* Keep desktop navigation visible but optimized */
    .main-navigation {
        display: none !important;
        /* Hide top nav, bottom nav will handle it */
    }

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    .action-text-desktop {
        display: none !important;
    }

    /* Adjust header layout for mobile - REDUCE SIZES */
    .header-main-row {
        gap: 4px;
        padding: 8px 10px !important;
        /* Reduce header padding */
    }

    .brand-logo img {
        height: 32px !important;
        /* Smaller logo */
    }

    /* Make search smaller on mobile */
    .search-container {
        flex: 1;
        max-width: none;
    }

    .search-container input {
        font-size: 13px !important;
        /* Smaller search text */
        padding: 6px 10px !important;
    }

    .search-button {
        padding: 6px 10px;
        font-size: 0;
        /* Hide text, show icon only */
    }

    .search-button svg {
        margin: 0;
        width: 16px !important;
        /* Smaller icon */
        height: 16px !important;
    }

    /* Reduce header icons size */
    .header-actions a svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* CRITICAL: Show mobile bottom navigation */
    .mobile-bottom-nav {
        display: block !important;
        /* Override inline display:none */
    }

    /* Hero banner mobile optimization - COMPACT LIKE KAPIVA */
    .hero-slider-section,
    .hero-slider-container,
    .hero-slides,
    .hero-slider,
    .hero-banner {
        max-height: 180px !important;
        min-height: 160px !important;
        height: 180px !important;
        overflow: hidden !important;
    }

    .hero-slide,
    .hero-image,
    .hero-slide img {
        position: static !important;
        /* Override position: absolute */
        aspect-ratio: 16/9 !important;
        max-height: 180px !important;
        min-height: 160px !important;
        height: 180px !important;
        width: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        background-size: cover !important;
        background-position: center !important;
    }

}

.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-logo img {
    height: 40px;
}

.mobile-menu-close {
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.mobile-menu-links {
    padding: 20px 0;
}

.mobile-menu-links a {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: #2c2c2c;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.2s ease;
}

.mobile-menu-links a:active {
    background: #f8f8f8;
}

.mobile-menu-links a svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* ============================================
   TOUCH-FRIENDLY IMPROVEMENTS
   ============================================ */

/* Minimum Touch Target Size: 44x44px */
@media (max-width: 768px) {

    button,
    .btn,
    a.button,
    input[type="submit"],
    input[type="button"],
    .add-to-cart-btn,
    .buy-now-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Action Links */
    .action-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
    }

    /* Checkbox and Radio */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        margin: 12px;
    }

    /* Select Dropdowns */
    select {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 40px 12px 16px;
    }
}

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: none;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px 5px;
        min-height: 56px;
        color: #666;
        font-size: 11px;
        font-weight: 600;
        text-decoration: none;
        transition: color 0.2s ease;
        position: relative;
    }

    .mobile-bottom-nav .nav-item svg {
        width: 24px;
        height: 24px;
        margin-bottom: 4px;
        stroke: currentColor;
    }

    .mobile-bottom-nav .nav-item.active {
        color: #2D5016;
    }

    .mobile-bottom-nav .nav-item:active {
        background: #f8f8f8;
    }

    /* Badge for cart count */
    .mobile-bottom-nav .nav-item .badge {
        position: absolute;
        top: 6px;
        right: calc(50% - 20px);
        background: #ff5722;
        color: white;
        font-size: 10px;
        font-weight: 700;
        padding: 2px 6px;
        border-radius: 10px;
        min-width: 18px;
        text-align: center;
    }
}

/* ============================================
   SWIPE GESTURES
   ============================================ */

/* Horizontal Scroll with Snap */
.horizontal-scroll-snap {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.horizontal-scroll-snap::-webkit-scrollbar {
    display: none;
}

.horizontal-scroll-snap>* {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Scroll Indicators */
.scroll-indicator {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@media (min-width: 769px) {
    .scroll-indicator {
        display: flex;
    }
}

.scroll-indicator.left {
    left: 10px;
}

.scroll-indicator.right {
    right: 10px;
}

/* ============================================
   MOBILE FORMS
   ============================================ */

@media (max-width: 768px) {

    /* Form Inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    textarea {
        min-height: 48px;
        font-size: 16px !important;
        /* Prevent iOS zoom */
        padding: 12px 16px;
        border-radius: 8px;
        border: 2px solid #e0e0e0;
        transition: border-color 0.2s ease;
    }

    input:focus,
    textarea:focus,
    select:focus {
        border-color: #2D5016;
        outline: none;
    }

    /* Form Labels */
    label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        display: block;
        color: #2c2c2c;
    }

    /* Form Groups */
    .form-group {
        margin-bottom: 20px;
    }

    /* Error States */
    input.error,
    textarea.error,
    select.error {
        border-color: #f44336;
    }

    .error-message {
        color: #f44336;
        font-size: 13px;
        margin-top: 4px;
        display: block;
    }

    /* Success States */
    input.success,
    textarea.success,
    select.success {
        border-color: #4caf50;
    }
}

/* ============================================
   MOBILE MODALS & DRAWERS
   ============================================ */

@media (max-width: 768px) {

    /* Full-screen modals on mobile */
    .modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
    }

    .modal-content {
        border-radius: 0;
        max-height: 100vh;
        overflow-y: auto;
    }

    /* Drawer from bottom */
    .drawer-bottom {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 90vh;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        background: #fff;
        border-radius: 16px 16px 0 0;
        z-index: 1001;
    }

    .drawer-bottom.active {
        transform: translateY(0);
    }

    /* Drawer Handle */
    .drawer-handle {
        width: 40px;
        height: 4px;
        background: #d0d0d0;
        border-radius: 2px;
        margin: 12px auto;
    }
}

/* ============================================
   MOBILE IMAGES
   ============================================ */

@media (max-width: 768px) {

    /* Responsive Images */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Image Gallery Touch Swipe */
    .image-gallery-mobile {
        position: relative;
        overflow: hidden;
        touch-action: pan-y;
    }

    .image-slides {
        display: flex;
        transition: transform 0.3s ease;
    }

    .image-slide {
        flex-shrink: 0;
        width: 100%;
    }

    /* Pinch Zoom */
    .pinch-zoom-container {
        touch-action: none;
        overflow: hidden;
        position: relative;
    }
}

/* ============================================
   MOBILE PRODUCT GRID (2-Column)
   ============================================ */

@media (max-width: 768px) {

    .product-grid,
    .products-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 4px;
    }

    /* Override for Horizontal Scroll Sections */
    .horizontal-scroll-snap.products-row {
        display: flex;
        grid-template-columns: none;
        overflow-x: auto;
        padding-bottom: 20px;
        gap: 16px;
    }

    .horizontal-scroll-snap.products-row .product-card {
        min-width: 160px;
        max-width: 160px;
        flex-shrink: 0;
    }

    /* Handle grid items */
    .product-card {
        width: 100%;
        margin: 0;
        min-height: 320px;
        display: flex;
        flex-direction: column;
    }

    .product-image-wrapper {
        height: 160px;
        /* Reduced height for mobile */
    }

    .product-info {
        padding: 10px;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .product-title {
        font-size: 14px;
        line-height: 1.3;
        height: 36px;
        /* Limit to 2 lines */
        overflow: hidden;
        margin-bottom: 4px;
    }

    .product-usp {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .product-rating {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .price-row {
        margin-top: auto;
        margin-bottom: 8px;
    }

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

    .product-price-old {
        font-size: 12px;
    }

    .add-to-cart-btn {
        font-size: 12px;
        padding: 8px;
        min-height: 36px;
    }
}

@media (max-width: 768px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    section {
        padding: 32px 0;
    }

    h1 {
        font-size: 24px;
        line-height: 1.3;
    }

    h2 {
        font-size: 20px;
        line-height: 1.3;
    }

    h3 {
        font-size: 18px;
        line-height: 1.3;
    }

    p {
        font-size: 15px;
        line-height: 1.6;
    }
}

/* ============================================
   TOUCH FEEDBACK
   ============================================ */

@media (max-width: 768px) {

    /* Active State Feedback */
    button:active,
    .btn:active,
    a.button:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    /* Card Press */
    .product-card:active,
    .story-card:active {
        transform: scale(0.98);
    }

    /* Remove hover states on mobile */
    .product-card:hover,
    .nav-link:hover,
    button:hover {
        transform: none;
    }
}

/* ============================================
   MOBILE PERFORMANCE
   ============================================ */

/* GPU Acceleration */
.mobile-optimized {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Will-change for animations */
.animated-element {
    will-change: transform, opacity;
}

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

/* ============================================
   SAFE AREA INSETS (iOS Notch Support)
   ============================================ */

@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }

    body {
        padding-top: env(safe-area-inset-top);
    }
}

/* ============================================
   MOBILE PRODUCT DETAIL PAGE
   ============================================ */

@media (max-width: 768px) {
    .product-detail-3col {
        display: block;
        /* Stack columns */
    }

    .product-gallery-col,
    .product-info-col,
    .product-purchase-col {
        width: 100%;
        margin-bottom: 24px;
    }

    /* hide desktop purchase column since we have sticky bar, OR style it inline */
    .product-purchase-col {
        background: #f9f9f9;
        padding: 20px;
        border-radius: 12px;
    }

    /* Sticky Add Bar Optimization */
    .sticky-add-bar {
        display: flex !important;
        /* Force show on mobile */
        padding: 10px 16px;
        bottom: 56px;
        /* Above bottom nav */
        z-index: 999;
    }

    .sticky-info {
        display: none;
        /* Hide info to save space, just show price maybe? */
    }

    /* Show improved sticky content */
    .sticky-add-bar {
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }

    .sticky-add-bar .price-display {
        display: flex;
        flex-direction: column;
    }

    .sticky-add-bar .final-price {
        font-size: 18px;
        font-weight: 700;
        color: #000;
    }

    .sticky-add-bar .mrp-price {
        font-size: 12px;
        text-decoration: line-through;
        color: #888;
    }

    .sticky-btn {
        flex: 1;
        height: 44px;
        font-size: 14px;
    }
}

/* ============================================
   MOBILE CART & CHECKOUT PAGES
   ============================================ */

@media (max-width: 768px) {
    .cart-layout {
        display: block;
        /* Stack cart items and summary */
    }

    .cart-items {
        width: 100%;
        margin-bottom: 24px;
    }

    .order-summary {
        width: 100%;
        position: static;
        /* Remove sticky on mobile */
        margin-bottom: 80px;
        /* Space for bottom nav */
    }

    /* Cart item cards */
    .cart-item {
        padding: 16px;
        margin-bottom: 12px;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
    }

    .cart-item-details {
        flex: 1;
        padding-left: 12px;
    }

    .cart-item-name {
        font-size: 14px;
        line-height: 1.3;
        margin-bottom: 4px;
    }

    .cart-item-price {
        font-size: 15px;
        font-weight: 700;
        color: #2D5016;
    }

    /* Optimization for very narrow screens (<360px) */
    @media (max-width: 360px) {
        .cart-item {
            flex-direction: column !important;
            align-items: flex-start !important;
            gap: 12px !important;
        }

        .cart-item-image {
            width: 60px !important;
            height: 60px !important;
        }

        .cart-item-details {
            padding-left: 0 !important;
        }

        .cart-item-quantity {
            margin-top: 10px !important;
        }

        .cart-item-total {
            min-width: unset !important;
            text-align: left !important;
            margin-top: 5px !important;
        }
    }

    /* Quantity controls */
    .quantity-selector {
        gap: 8px;
    }

    .qty-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    /* Checkout button */
    .checkout-btn {
        width: 100%;
        height: 50px;
        font-size: 16px;
        margin-top: 16px;
    }
}