/* ============================================================
   EcoHaven Mobile & Touch UX Enhancements
   ============================================================ */

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    -webkit-tap-highlight-color: rgba(45, 74, 54, 0.12);
}

.page-wraper {
    overflow-x: hidden;
}

@media (max-width: 991.98px) {
    :root {
        --eh-sticky-offset: 60px;
    }
}

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

/* ---- Touch-friendly header controls ---- */
.eh-mobile-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.eh-mobile-toggle span {
    width: 22px;
    height: 2.5px;
}

.eh-action-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    justify-content: center;
}

.eh-mobile-nav-list li a {
    padding: 14px 20px;
    font-size: 15px;
}

.eh-mobile-nav-account a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--eh-primary) !important;
    background: var(--eh-bg-soft);
}

/* ---- Hero: full product photo on phones ---- */
@media (max-width: 575.98px) {
    .eh-hero-slide-media {
        object-position: 65% center;
    }

    .eh-hero-slide-caption h2 {
        font-size: 1.45rem !important;
        line-height: 1.25;
    }

    .eh-hero-slide-caption p {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .eh-btn {
        min-height: 44px;
    }
}

/* ---- Promo bar: respect reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .eh-promo-track {
        animation: none !important;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px 16px;
    }
}

/* ---- Shop: mobile filter drawer ---- */
.eh-shop-toolbar-start {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.eh-shop-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--eh-border);
    border-radius: 10px;
    background: #fff;
    color: var(--eh-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.eh-shop-filter-btn:hover,
.eh-shop-filter-btn:focus {
    border-color: var(--eh-primary);
    background: var(--eh-bg-soft);
}

.eh-shop-filter-btn-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--eh-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.eh-shop-filter-drawer {
    width: min(320px, 88vw);
    border-right: 1px solid var(--eh-border);
}

.eh-shop-filter-drawer .offcanvas-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--eh-border);
}

.eh-shop-filter-drawer .offcanvas-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--eh-secondary);
}

.eh-shop-filter-drawer .offcanvas-body {
    padding: 16px 20px 28px;
}

.eh-shop-filter-drawer .eh-shop-sidebar {
    position: static;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.eh-shop-filter-drawer .eh-shop-check {
    padding: 10px 0;
    min-height: 44px;
}

.eh-shop-filter-drawer .eh-shop-search-input,
.eh-shop-filter-drawer .eh-shop-price-field {
    font-size: 16px;
}

@media (max-width: 767.98px) {
    .eh-shop-toolbar {
        gap: 14px;
    }

    .eh-shop-results {
        font-size: 13px;
        margin: 0;
    }

    .eh-shop-sort {
        width: 100%;
    }

    .eh-shop-sort select {
        min-height: 44px;
        font-size: 16px;
    }

    .eh-shop-filter-tag {
        min-height: 36px;
        padding: 8px 14px;
    }

    .eh-shop-grid {
        --bs-gutter-x: 12px;
        --bs-gutter-y: 12px;
    }
}

/* ---- Product cards: larger touch targets ---- */
@media (max-width: 767.98px) {
    .eh-product-action-icon,
    .eh-product-actions--corner .eh-product-action-cart {
        width: 44px;
        height: 44px;
        font-size: 15px;
    }

    .eh-product-card--shop .eh-product-title {
        font-size: 14px !important;
        line-height: 1.35;
    }
}

/* ---- Product page: no sticky gallery on mobile ---- */
@media (max-width: 991.98px) {
    .eh-product-gallery-wrap.sticky-top {
        position: relative !important;
        top: auto !important;
    }

    .eh-product-page .eh-product-info-table th {
        width: auto;
        min-width: 110px;
    }
}

/* ---- Forms: prevent iOS zoom on focus ---- */
@media (max-width: 767.98px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    input[type="password"],
    select,
    textarea,
    .form-control {
        font-size: 16px !important;
    }
}

/* ---- Cart page mobile ---- */
@media (max-width: 767.98px) {
    .eh-cart-item {
        gap: 14px;
    }

    .eh-cart-update-btn,
    .eh-cart-remove-btn {
        min-height: 44px;
        padding: 10px 14px;
    }

    .eh-cart-summary-card .eh-btn {
        min-height: 48px;
        font-size: 16px;
    }
}

/* ---- Checkout mobile ---- */
@media (max-width: 767.98px) {
    .eh-checkout-mobile-toggle {
        min-height: 48px;
    }

    .eh-checkout-pay-btn {
        min-height: 52px;
        font-size: 16px;
    }

    .eh-checkout-test-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        font-size: 13px;
    }
}

/* ---- Thank-you page ---- */
@media (max-width: 575.98px) {
    .eh-thankyou-order-box {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .eh-thankyou-actions {
        flex-direction: column;
    }

    .eh-thankyou-actions .btn {
        width: 100%;
        min-height: 48px;
    }

    .eh-payment-success-modal__card {
        margin: 16px;
        padding: 28px 22px;
    }
}

/* ---- Footer mobile ---- */
@media (max-width: 767.98px) {
    .eh-newsletter-form {
        flex-direction: column;
        gap: 10px;
    }

    .eh-newsletter-form input {
        min-height: 48px;
        font-size: 16px;
    }

    .eh-newsletter-form .eh-btn {
        width: 100%;
        min-height: 48px;
    }

    .eh-footer-social a {
        width: 44px;
        height: 44px;
    }

    .eh-footer-bottom .d-flex {
        flex-direction: column;
        text-align: center;
    }
}

/* ---- WhatsApp FAB: safe area + avoid overlap ---- */
.eco-whatsapp {
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    right: max(16px, env(safe-area-inset-right, 16px));
    width: 54px;
    height: 54px;
    font-size: 26px;
    z-index: 1040;
}

@media (max-width: 767.98px) {
    .eco-whatsapp {
        bottom: max(16px, env(safe-area-inset-bottom, 16px));
    }

    .page-wraper:has(.eh-product-page) .eco-whatsapp {
        bottom: max(88px, calc(76px + env(safe-area-inset-bottom, 16px)));
    }

    .eh-cart-toast {
        bottom: max(88px, calc(72px + env(safe-area-inset-bottom, 16px)));
        left: 16px;
        right: 16px;
        max-width: none;
    }
}

/* ---- Page hero: compact on mobile ---- */
@media (max-width: 575.98px) {
    .eh-page-hero {
        padding: 28px 0 24px !important;
    }

    .eh-page-hero h1 {
        font-size: 1.5rem !important;
    }
}

/* ---- Product page: sticky add-to-cart bar ---- */
.eh-mobile-product-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1035;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--eh-border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(8px);
}

.eh-mobile-product-bar-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.eh-mobile-product-bar-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--eh-primary);
}

.eh-mobile-product-bar-name {
    font-size: 12px;
    color: var(--eh-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eh-mobile-product-bar-btn {
    flex-shrink: 0;
    min-height: 48px;
    padding: 12px 18px;
    white-space: nowrap;
}

.eh-product-page {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 991.98px) {
    .eh-product-page {
        padding-bottom: 80px;
    }

    .eh-product-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 4px;
        padding-bottom: 4px;
    }

    .eh-product-tabs .nav-link {
        white-space: nowrap;
        min-height: 44px;
        padding: 10px 16px;
        font-size: 14px;
    }

    .eh-product-tabs::-webkit-scrollbar {
        display: none;
    }
}

/* ---- Pagination touch targets ---- */
@media (max-width: 767.98px) {
    .pagination .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}
