/*
 * ═══════════════════════════════════════════════════
 *  GLOBAL MOBISTAR — UNIFIED RESPONSIVE STYLESHEET
 *  Mobile‑first responsive design system
 *  Breakpoints: 640px · 768px · 1024px · 1440px
 * ═══════════════════════════════════════════════════
 */

/* ─────────────────────────────────────
   1. BASE RESET & FOUNDATION
   ───────────────────────────────────── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    -webkit-overflow-scrolling: touch;
}



/* Prevent iOS zoom on form inputs */
@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}


/* ─────────────────────────────────────
   2. TYPOGRAPHY — FLUID SCALE
   ───────────────────────────────────── */

@media (max-width: 767px) {
    h1 { font-size: 1.5rem !important; line-height: 1.3 !important; }
    h2 { font-size: 1.25rem !important; line-height: 1.35 !important; }
    h3 { font-size: 1.1rem !important; line-height: 1.4 !important; }

    /* Intentionally not forcing text size on p/li/span/a — it breaks icon labels etc. */

    /* Footer giant text */
    footer h1[class*="text-["] {
        font-size: 2.5rem !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
}


/* ─────────────────────────────────────
   3. NAVIGATION
   ───────────────────────────────────── */

/* === Top yellow banner === */
@media (max-width: 1023px) {
    nav .bg-\[\#FFBF00\] {
        padding-top: 0.375rem;
        padding-bottom: 0.375rem;
    }

    /* Mobile banner text */
    nav .bg-\[\#FFBF00\] .lg\:hidden h3 {
        font-size: 0.75rem;
    }
}

/* === Main nav bar === */
nav.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 40;
}

/* Search & hamburger buttons — touch-friendly */
@media (max-width: 1023px) {
    button[aria-label="Open search"],
    button[aria-label="Toggle menu"] {
        min-width: 44px;
        min-height: 44px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        -webkit-tap-highlight-color: transparent;
    }
}

/* === Categories dropdown — hide on mobile === */
@media (max-width: 1023px) {
    /* Hide the categories button parent block */
    .hidden.lg\:block {
        display: none !important;
    }

    /* Hide any button with dropdown popup */
    button[aria-haspopup="true"] {
        display: none !important;
    }

    button[aria-haspopup="true"] + div,
    button[aria-haspopup="true"] ~ div {
        display: none !important;
    }
}

/* Desktop — ensure desktop nav items appear */
@media (min-width: 1024px) {
    button[aria-label="Toggle menu"] {
        display: none !important;
    }
}

/* === Mobile menu overlay === */
@media (max-width: 1023px) {
    .mobile-menu-overlay {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        background: white !important;
        z-index: 99999 !important;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-menu-overlay.open {
        transform: translateX(0);
    }

    /* Close button — touch-friendly */
    .mobile-menu-overlay .close-menu {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    /* Menu links — tall tap areas */
    .mobile-menu-overlay a {
        min-height: 48px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1.25rem;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid #f3f4f6;
        font-size: 0.95rem;
        color: #1f2937;
        transition: background-color 0.15s ease;
    }

    .mobile-menu-overlay a:hover,
    .mobile-menu-overlay a:active {
        background-color: #f9fafb;
    }

    /* Prevent body scroll when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
    }
}

@media (min-width: 1024px) {
    .mobile-menu-overlay {
        display: none !important;
    }
}


/* ─────────────────────────────────────
   4. LOGO — GLOBAL SIZE CONSTRAINT
   ───────────────────────────────────── */

/* GLOBAL logo cap — catches ALL logos by src AND alt, no matter what page */
img[src*="logo"],
img[alt*="Logo"],
img[alt*="logo"],
img[alt*="Mobistar"] {
    object-fit: contain !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Mobile — strict cap */
@media (max-width: 640px) {
    img[src*="logo"],
    img[alt*="Logo"],
    img[alt*="logo"],
    img[alt*="Mobistar"],
    nav img[alt*="Logo"],
    header img[alt*="Logo"],
    img.svelte-1vp6alu[alt*="Logo"] {
        height: 44px !important;
        max-height: 44px !important;
        width: auto !important;
        max-width: 180px !important;
        object-fit: contain !important;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1023px) {
    img[src*="logo"],
    img[alt*="Logo"],
    img[alt*="logo"],
    img[alt*="Mobistar"],
    nav img[alt*="Logo"],
    header img[alt*="Logo"] {
        height: 52px !important;
        max-height: 52px !important;
        width: auto !important;
        max-width: 220px !important;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    img[src*="logo"],
    img[alt*="Logo"],
    img[alt*="logo"],
    img[alt*="Mobistar"],
    nav img[alt*="Logo"],
    header img[alt*="Logo"] {
        height: 64px !important;
        max-height: 64px !important;
        width: auto !important;
        max-width: 260px !important;
    }
}

/* Footer logo always larger */
footer img[alt*="Logo"],
footer img[src*="logo"] {
    height: 64px !important;
    max-height: 80px !important;
    width: auto !important;
}

@media (min-width: 768px) {
    footer img[alt*="Logo"],
    footer img[src*="logo"] {
        height: 80px !important;
    }
}


/* ─────────────────────────────────────
   4b. GLOBAL IMAGE SIZE SAFETY NET
   ───────────────────────────────────── */

/* Prevent ANY image from blowing out wider than its container */
img {
    max-width: 100% !important;
    height: auto;
}

/* Product images — bounded inside their cards */
.aspect-square img,
[class*="aspect-"] img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Category icon images — keep small */
.grid a img:not([alt*="Logo"]):not([src*="logo"]) {
    max-height: 300px;
}


/* ─────────────────────────────────────
   5. HERO SECTION
   ───────────────────────────────────── */

/* Mobile */
@media (max-width: 767px) {
    .hero-container,
    .hero-container > div {
        height: 220px !important;
        min-height: 220px !important;
    }

    .hero-container h1 {
        font-size: 1.25rem !important;
    }

    .hero-container p {
        font-size: 0.8rem !important;
    }

    .hero-container button,
    .hero-container .inline-block {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.8rem !important;
    }
}

/* Landscape mobile — even shorter */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-container,
    .hero-container > div {
        height: 160px !important;
        min-height: 160px !important;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero-container,
    .hero-container > div {
        height: 380px !important;
        min-height: 380px !important;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .hero-container,
    .hero-container > div {
        height: 600px !important;
        min-height: 600px !important;
    }
}

/* Hero images always cover */
.hero-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ─────────────────────────────────────
   6. CATEGORY GRID (icon circles)
   ───────────────────────────────────── */

@media (max-width: 639px) {
    /* 4 columns on small mobile */
    .grid.grid-cols-4 {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.5rem !important;
    }

    .grid.grid-cols-4 .w-16 {
        width: 3.5rem !important;
        height: 3.5rem !important;
    }

    .grid.grid-cols-4 span {
        font-size: 0.65rem !important;
    }

    /* Tighter gap in the category section */
    section .grid.grid-cols-4 a {
        gap: 0.5rem !important;
    }
}


/* ─────────────────────────────────────
   7. PRODUCT GRID
   ───────────────────────────────────── */

/* Mobile — 2 columns */
@media (max-width: 767px) {
    .products-grid,
    section .grid.grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Product card images */
    .products-grid .aspect-square img,
    .grid.grid-cols-2 .aspect-square img {
        object-fit: contain;
    }

    /* Card text */
    .products-grid h3,
    .grid.grid-cols-2 h3 {
        font-size: 0.7rem !important;
        line-height: 1.25 !important;
    }

    /* Price */
    .products-grid span[class*="text-[#064B67]"] {
        font-size: 0.75rem !important;
    }

    /* Add-to-cart button — compact but tappable */
    .products-grid button[class*="border-orange"],
    .grid.grid-cols-2 button[class*="border-orange"] {
        padding: 0.4rem 0.5rem !important;
        min-height: 36px;
        font-size: 0.7rem !important;
    }

    .products-grid button div[class*="text-[10px]"] {
        font-size: 0.65rem !important;
    }

    /* Card padding */
    .products-grid a > div:last-child {
        padding: 0.4rem !important;
    }
    .products-grid a > div:last-child > div {
        padding-bottom: 0.25rem !important;
    }
}

/* Tablet — 3 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.75rem !important;
    }
}

/* Desktop — keep as-is (6 cols with lg:grid-cols-6) */


/* ─────────────────────────────────────
   8. PROMO BANNER IMAGES
   ───────────────────────────────────── */

/* Mobile-only promo banner */
@media (max-width: 767px) {
    .w-full.md\:hidden {
        border-radius: 0.5rem;
        overflow: hidden;
        max-height: 200px;
    }

    .w-full.md\:hidden img {
        object-fit: cover;
        max-height: 200px;
    }
}

/* 4-column promo grid */
@media (max-width: 767px) {
    section .grid.grid-cols-2.lg\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    section .grid.grid-cols-2.lg\:grid-cols-4 .aspect-\[2\/3\] {
        border-radius: 0.5rem;
    }
}


/* ─────────────────────────────────────
   9. TESTIMONIALS SECTION
   ───────────────────────────────────── */

@media (max-width: 767px) {
    /* Scrolling card container */
    .flex.overflow-x-scroll {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }

    .flex.overflow-x-scroll > div {
        scroll-snap-align: start;
        flex: 0 0 85%;
        max-width: 85%;
    }

    /* Card text */
    .flex.overflow-x-scroll p[class*="text-gray-700"] {
        font-size: 0.8rem !important;
    }
}


/* ─────────────────────────────────────
   10. STAFF & EVENTS CAROUSEL
   ───────────────────────────────────── */

/* Mobile — fill viewport width with good height */
@media (max-width: 639px) {
    .staff-slide {
        min-height: 280px;
    }

    .staff-slide > div {
        min-height: 280px;
        height: 280px;
        aspect-ratio: unset !important;
        width: 100%;
    }

    .staff-slide img {
        width: 100% !important;
        height: 100% !important;
        min-height: 280px;
        object-fit: cover !important;
        object-position: center;
    }

    .staff-carousel-track {
        min-height: 280px;
    }

    /* Override Tailwind aspect ratio classes */
    .staff-slide .aspect-\[4\/3\],
    .staff-slide .aspect-\[16\/9\],
    .staff-slide [class*="aspect-"] {
        aspect-ratio: unset !important;
        min-height: 280px;
        height: 280px;
    }
}

/* Medium phones */
@media (min-width: 375px) and (max-width: 639px) {
    .staff-slide,
    .staff-slide > div,
    .staff-slide img {
        min-height: 320px;
        height: 320px;
    }

    .staff-carousel-track {
        min-height: 320px;
    }

    .staff-slide .aspect-\[4\/3\],
    .staff-slide .aspect-\[16\/9\],
    .staff-slide [class*="aspect-"] {
        min-height: 320px;
        height: 320px;
    }
}

/* Tablets */
@media (min-width: 640px) and (max-width: 1023px) {
    .staff-slide > div {
        min-height: 350px;
        aspect-ratio: 16/9;
    }

    .staff-slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* Carousel nav buttons */
.staff-prev,
.staff-next {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.staff-carousel-track {
    width: 100%;
}

.staff-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ─────────────────────────────────────
   11. PARTNERS MARQUEE
   ───────────────────────────────────── */

@media (max-width: 767px) {
    section[aria-label="Trusted Partners"] .flex.items-center.justify-center {
        width: 6rem;
        height: 3rem;
        margin-left: 0.25rem;
        margin-right: 0.25rem;
    }

    section[aria-label="Trusted Partners"] img {
        max-height: 2rem !important;
    }
}


/* ─────────────────────────────────────
   12. FOOTER
   ───────────────────────────────────── */

@media (max-width: 767px) {
    footer {
        padding: 2rem 1rem !important;
    }

    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    footer .grid > div > span {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        display: block;
    }

    /* Reduce the text description */
    footer p.text-gray-100.text-lg {
        font-size: 0.875rem !important;
        line-height: 1.6;
    }

    /* Social icons row */
    footer .flex.space-x-4 a {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Copyright bar */
    footer .pt-8 {
        flex-direction: column !important;
        text-align: center;
        gap: 1rem;
    }

    footer .pt-8 .flex.space-x-4 {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* Tablet footer — 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    footer .grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 2rem !important;
    }
}


/* ─────────────────────────────────────
   13. BOTTOM MOBILE NAV BAR
   ───────────────────────────────────── */

@media (max-width: 767px) {
    /* Bottom nav — ensure it sits above content */
    nav.fixed.bottom-0 {
        z-index: 50;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Nav buttons — proper sizing for thumbs */
    nav.fixed.bottom-0 button {
        min-width: 0;
        min-height: auto;
        padding: 0.25rem 0.5rem !important;
    }

    nav.fixed.bottom-0 button span {
        font-size: 0.625rem;
    }

    nav.fixed.bottom-0 button svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* Spacer for bottom nav */
    .md\:hidden.h-20 {
        height: 4.5rem;
    }
}

/* Hide bottom nav on desktop */
@media (min-width: 768px) {
    nav.fixed.bottom-0 {
        display: none !important;
    }
}


/* ─────────────────────────────────────
   14. CART BUTTON & ICON
   ───────────────────────────────────── */

button[aria-label="Cart"] svg {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 24px;
    height: 24px;
    stroke: #064b67;
    fill: none;
    stroke-width: 2;
    vertical-align: middle;
}

button[aria-label="Cart"] svg path,
button[aria-label="Cart"] svg circle {
    stroke: #064b67;
    stroke-width: 2;
    fill: none;
}

button[aria-label="Cart"] {
    position: relative;
    cursor: pointer;
}

button[aria-label="Cart"]:hover {
    background-color: rgba(6, 75, 103, 0.1);
}

@media (max-width: 640px) {
    button[aria-label="Cart"] {
        width: 40px;
        height: 40px;
        padding: 0.5rem;
    }
    button[aria-label="Cart"] span {
        display: none !important;
    }
}


/* ─────────────────────────────────────
   15. MODALS & OVERLAYS
   ───────────────────────────────────── */

@media (max-width: 1023px) {
    /* Generic modal sizing */
    [role="dialog"],
    .modal,
    [class*="modal"]:not(.mobile-menu-overlay) {
        max-height: 90vh !important;
        overflow-y: auto !important;
        width: 92% !important;
        max-width: 480px !important;
        z-index: 9999;
    }

    /* Backdrop / overlay clickable */
    [class*="backdrop"],
    [class*="overlay"]:not(.mobile-menu-overlay):not([class*="menu"]) {
        cursor: pointer;
        z-index: 9998;
    }

    /* Cart sidebar/drawer */
    [class*="cart"][class*="sidebar"],
    [class*="cart"][class*="drawer"] {
        position: fixed !important;
        right: 0;
        top: 0;
        bottom: 0;
        width: 88% !important;
        max-width: 400px !important;
        height: 100vh;
        overflow-y: auto;
        z-index: 9999;
    }

    /* Close buttons — visible & tappable */
    [role="dialog"] button[aria-label*="close"],
    [role="dialog"] button[aria-label*="Close"],
    .modal .close,
    .modal [class*="close"] {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10000;
    }

    /* Notifications / toasts */
    [role="alert"],
    [class*="notification"],
    [class*="toast"] {
        position: fixed !important;
        top: 1rem;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
        z-index: 10000;
    }
}


/* ─────────────────────────────────────
   16. CATEGORIES DROPDOWN PRODUCTION FIX
   ───────────────────────────────────── */

@media (max-width: 1023px) {
    .categories-dropdown,
    .mobile-categories-overlay,
    .categories-menu-mobile,
    [data-categories-menu],
    .nav-categories-dropdown {
        display: none !important;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .categories-dropdown.active,
    .categories-dropdown.open,
    .categories-dropdown.show,
    .mobile-categories-overlay.active,
    .categories-menu-mobile.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
    }

    /* Force hide any stuck overlays */
    div[class*="categories"]:not(.active):not(.open):not(.show),
    div[class*="Categories"]:not(.active):not(.open):not(.show) {
        display: none !important;
    }
}

/* Desktop: categories dropdown uses its own default styles — no overrides needed */


/* ─────────────────────────────────────
   17. CONTAINER SPACING
   ───────────────────────────────────── */

@media (max-width: 767px) {
    .max-w-screen-4xl {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .px-3 {
        padding-left: 0.625rem !important;
        padding-right: 0.625rem !important;
    }
}


/* ─────────────────────────────────────
   18. SEARCH OVERLAY
   ───────────────────────────────────── */

@media (max-width: 1023px) {
    [class*="search"][class*="overlay"],
    [class*="search"][class*="modal"] {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 80vh;
        overflow-y: auto;
        z-index: 9999;
        background: white;
    }
}


/* ─────────────────────────────────────
   19. Z-INDEX HIERARCHY
   ───────────────────────────────────── */

@media (max-width: 1023px) {
    nav.sticky-nav                            { z-index: 40 !important; }
    [class*="dropdown"]                       { z-index: 1001; }
    [class*="modal"], [role="dialog"]         { z-index: 9999; }
    [class*="backdrop"], [class*="overlay"]   { z-index: 9998; }
    .mobile-menu-overlay                      { z-index: 99999 !important; }
    nav.fixed.bottom-0                        { z-index: 50; }
}


/* ─────────────────────────────────────
   20. UTILITY CLASSES
   ───────────────────────────────────── */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
}

/* Show only mobile */
@media (min-width: 768px) {
    .show-mobile-only { display: none !important; }
}

/* Touch-friendly hit target */
.touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* ─────────────────────────────────────
   21. SMOOTH ANIMATIONS (performance-safe)
   ───────────────────────────────────── */

/* Only apply smooth transitions to interactive elements, NOT * selector */
a, button, input, select, textarea,
[role="button"],
.transition-colors,
.transition-all {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ─────────────────────────────────────
   22. PRINT STYLES
   ───────────────────────────────────── */

@media print {
    nav.sticky-nav,
    nav.fixed.bottom-0,
    .mobile-menu-overlay,
    button[aria-label="Toggle menu"],
    button[aria-label="Open search"] {
        display: none !important;
    }
}
