/* =====================================================================
   AMAJED GLOBAL MOBILE RESPONSIVE UPGRADE V1
   Loaded AFTER responsive.css.
   Scope: public frontend only, max-width 991px.
   Desktop design is intentionally untouched.
   ===================================================================== */

/* ---------------------------------------------------------------------
   TABLET + MOBILE FOUNDATIONS
   --------------------------------------------------------------------- */
@media (max-width: 991px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    body {
        overscroll-behavior-x: none;
    }

    main,
    section,
    article,
    aside,
    nav,
    header,
    footer,
    .container {
        min-width: 0;
    }

    a,
    button,
    [role="button"],
    input,
    select,
    textarea {
        touch-action: manipulation;
    }

    img,
    video,
    iframe,
    canvas,
    svg {
        max-width: 100%;
    }

    /* Horizontal rails/tables should scroll inside themselves instead of
       widening the entire viewport. */
    .filters,
    .subcat-scroll,
    .product-v2-thumbs,
    .product-v2-model-selector,
    .product-v2-table-wrap,
    .technical-table-wrap,
    .family-table-wrap,
    .cr-choice-list {
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-inline: contain;
    }

    .filters,
    .subcat-scroll,
    .product-v2-thumbs,
    .product-v2-model-selector {
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .filters::-webkit-scrollbar,
    .subcat-scroll::-webkit-scrollbar,
    .product-v2-thumbs::-webkit-scrollbar,
    .product-v2-model-selector::-webkit-scrollbar {
        display: none;
    }

    .filter,
    .product-v2-thumb,
    .product-v2-model-selector .model-selector-btn {
        scroll-snap-align: start;
    }

    /* Avoid sticky hover transforms on touch screens. */
    @media (hover: none), (pointer: coarse) {
        .product-card:hover,
        .cat:hover,
        .solution-card:hover,
        .integrated-feature:hover,
        .project-bundle-card:hover,
        .project-bundles-card:hover,
        .project-bundle-product-card:hover,
        .home-category-card:hover {
            transform: none !important;
        }
    }
}


/* ---------------------------------------------------------------------
   PHONE / SMALL TABLET
   --------------------------------------------------------------------- */
@media (max-width: 767px) {
    :root {
        --amajed-mobile-edge: 12px;
    }

    /* --------------------------- HEADER --------------------------- */
    .site-header {
        width: 100%;
        max-width: 100vw;
    }

    .nav {
        min-width: 0;
    }

    .brand,
    .brand a,
    .nav-actions {
        min-width: 0;
    }

    .mobile-menu {
        width: 100vw !important;
        max-width: 100vw !important;
        height: calc(100dvh - 68px);
        max-height: calc(100dvh - 68px);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(28px + env(safe-area-inset-bottom)) !important;
    }

    .mobile-menu a,
    .mobile-menu button {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* --------------------------- TYPE ----------------------------- */
    h1,
    h2,
    h3,
    h4,
    .display,
    .h2 {
        max-width: 100%;
        text-wrap: balance;
    }

    p,
    .lede {
        text-wrap: pretty;
    }

    body[dir="rtl"] h1,
    body[dir="rtl"] h2,
    body[dir="rtl"] h3 {
        line-height: 1.28;
    }

    /* --------------------------- BUTTONS -------------------------- */
    .btn,
    .cr-btn,
    .careers-btn,
    .career-detail-btn {
        min-height: 44px;
    }

    /* --------------------------- FORMS ---------------------------- */
    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    select,
    textarea {
        width: 100%;
        max-width: 100%;
        font-size: 16px !important;
    }

    textarea {
        resize: vertical;
    }

    .form-grid,
    .quotation-form,
    .careers-form-grid,
    .career-detail-form-row,
    .cr-dimensions-grid,
    .cr-config-grid,
    .cr-config-summary-grid {
        min-width: 0;
    }

    /* --------------------------- CATALOG -------------------------- */
    .catalog-toolbar,
    .catalog-search-panel,
    .category-search-panel {
        max-width: 100%;
    }

    .catalog-search,
    .catalog-search input,
    .category-search-box,
    .category-search-box input {
        min-width: 0;
        width: 100%;
    }

    .filters {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .filter {
        flex: 0 0 auto;
        min-height: 40px;
    }

    .product-card,
    .product-body,
    .product-meta,
    .product-meta > * {
        min-width: 0;
    }

    .product-body h3,
    .product-body p,
    .product-meta {
        overflow-wrap: anywhere;
    }

    /* ------------------------ PRODUCT DETAIL ---------------------- */
    .product-v2-page,
    .product-page-v2,
    .product-v2-cockpit,
    .product-v2-info-card,
    .product-v2-gallery,
    .product-v2-side-rail,
    .product-v2-project-card,
    .product-v2-brand-card {
        min-width: 0;
        max-width: 100%;
    }

    .product-v2-thumbs {
        padding-inline: 1px;
        scroll-padding-inline: 1px;
    }

    .product-v2-thumb {
        flex-basis: clamp(82px, 24vw, 100px);
    }

    .product-v2-model-preview-row,
    .mobile-model-head,
    .mobile-model-specs > div {
        min-width: 0;
    }

    .product-v2-model-preview-row small,
    .mobile-model-head h3,
    .mobile-model-specs strong {
        overflow-wrap: anywhere;
    }

    .product-v2-bottom-dock {
        max-width: 100%;
    }

    /* ----------------------- PROJECT BUNDLES ---------------------- */
    .project-bundles-page,
    .project-bundles-hero,
    .project-bundles-hero-grid,
    .project-bundles-grid,
    .project-bundles-flow-grid,
    .project-bundle-detail-grid,
    .project-bundle-equipment-layout,
    .project-bundle-catalog-grid {
        min-width: 0;
        max-width: 100%;
    }

    .project-bundle-card,
    .project-bundles-card,
    .project-bundle-product-card,
    .project-bundle-detail-copy,
    .project-bundle-equipment-copy {
        min-width: 0;
    }

    .project-bundles-title,
    .project-bundle-detail-title,
    .project-bundle-card-body h3,
    .project-bundles-card-body h3,
    .project-bundle-product-body h3 {
        overflow-wrap: anywhere;
    }

    /* --------------------------- CAREERS -------------------------- */
    .careers-hero-inner,
    .careers-hero-content,
    .careers-job-card,
    .career-detail-layout,
    .career-detail-content,
    .career-detail-form-column,
    .career-detail-form-card {
        min-width: 0;
        max-width: 100%;
    }

    .careers-job-meta,
    .career-detail-meta {
        flex-wrap: wrap;
    }

    .careers-job-card h3,
    .career-detail-heading,
    .career-detail-field,
    .careers-field {
        overflow-wrap: anywhere;
    }

    /* ------------------------- COLD ROOMS ------------------------- */
    .cr-page,
    .cr-hero-inner,
    .cr-config-grid,
    .cr-app-grid,
    .cr-operation-grid,
    .cr-project-grid,
    .cr-config-summary,
    .cr-config-contact-card {
        min-width: 0;
        max-width: 100%;
    }

    .cr-dimension-field,
    .cr-dimension-input-wrap,
    .cr-config-summary-item,
    .cr-config-contact-copy {
        min-width: 0;
    }

    /* ----------------------- CONTACT / QUOTE ---------------------- */
    .contact-grid,
    .contact-form-card,
    .contact-info,
    .quotation-dialog,
    .quotation-form,
    .quotation-channel {
        min-width: 0;
        max-width: 100%;
    }

    .contact-method strong,
    .contact-method span,
    .quotation-channel-copy strong,
    .quotation-channel-copy small {
        overflow-wrap: anywhere;
    }

    /* --------------------------- FOOTER --------------------------- */
    .footer,
    .footer-grid,
    .footer-social,
    .copyright {
        min-width: 0;
        max-width: 100%;
    }

    .footer a,
    .footer p,
    .copyright {
        overflow-wrap: anywhere;
    }

    /* ---------------------- FLOATING CONTROLS --------------------- */
    .whatsapp {
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    .floating-cart {
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }

    body[dir="rtl"] .whatsapp,
    body[dir="rtl"] .floating-cart {
        /* Keep the RTL mirror while preserving safe-area spacing. */
        bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    }

    body[dir="rtl"] .floating-cart {
        bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    }

    .cart-toast {
        max-width: calc(100vw - 24px) !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .cart-drawer,
    .quotation-dialog {
        padding-bottom: env(safe-area-inset-bottom);
    }
}


/* ---------------------------------------------------------------------
   SMALL PHONES
   --------------------------------------------------------------------- */
@media (max-width: 575px) {
    :root {
        --amajed-mobile-edge: 10px;
    }

    /* Keep the established Home category-card composition unchanged.
       Only improve surrounding spacing and touch behavior. */
    .home-product-families .container,
    .home-project-bundles .container {
        min-width: 0;
    }

    .hero-actions,
    .home-final-actions,
    .about-hero-actions,
    .about-final-actions,
    .careers-hero-actions,
    .cr-hero-actions,
    .cr-final-actions,
    .project-bundles-hero-actions,
    .project-bundle-detail-actions,
    .career-detail-actions {
        width: 100%;
        max-width: 100%;
    }

    .hero-actions .btn,
    .home-final-actions .btn,
    .about-hero-actions .btn,
    .about-final-actions .btn,
    .careers-hero-actions .careers-btn,
    .cr-hero-actions .cr-btn,
    .cr-final-actions .cr-btn,
    .project-bundles-hero-actions .btn,
    .project-bundle-detail-actions .btn,
    .career-detail-actions .career-detail-btn {
        min-width: 0;
    }

    .product-v2-media-label {
        gap: 8px;
    }

    .product-v2-media-label > * {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .product-v2-panel-title {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .project-bundle-card-meta,
    .project-bundle-product-meta,
    .project-bundles-card-footer {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    .careers-job-footer,
    .careers-job-meta {
        gap: 8px;
    }

    .contact-method {
        min-width: 0;
    }

    /* Buttons/forms should not collide with the iPhone home indicator. */
    .mobile-menu,
    .cart-foot,
    .quotation-dialog {
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
}


/* ---------------------------------------------------------------------
   EXTRA-SMALL PHONES
   --------------------------------------------------------------------- */
@media (max-width: 390px) {
    .brand img {
        max-width: 96px !important;
    }

    .nav-actions {
        gap: 2px !important;
    }

    .product-v2-thumb {
        flex-basis: 80px;
    }

    .product-v2-thumb img {
        height: 56px;
    }

    .product-v2-info-card h1,
    .project-bundles-title,
    .project-bundle-detail-title,
    .careers-hero-title,
    .career-detail-heading {
        overflow-wrap: anywhere;
    }

    .project-bundle-card-body,
    .project-bundles-card-body,
    .project-bundle-product-body {
        padding-inline: 14px !important;
    }

    .floating-cart {
        right: 10px !important;
    }

    .whatsapp {
        right: 10px !important;
    }

    body[dir="rtl"] .floating-cart,
    body[dir="rtl"] .whatsapp {
        right: auto !important;
        left: 10px !important;
    }
}


/* ---------------------------------------------------------------------
   SHORT LANDSCAPE PHONES
   --------------------------------------------------------------------- */
@media (max-width: 920px) and (max-height: 560px) and (orientation: landscape) {
    .mobile-menu {
        height: calc(100dvh - 64px) !important;
        max-height: calc(100dvh - 64px) !important;
    }

    .quotation-dialog,
    .cart-drawer {
        max-height: 100dvh !important;
    }

    .whatsapp {
        bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    }

    .floating-cart {
        bottom: calc(62px + env(safe-area-inset-bottom)) !important;
    }
}


/* ---------------------------------------------------------------------
   ACCESSIBILITY / REDUCED MOTION
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .cat,
    .solution-card,
    .integrated-feature,
    .project-bundle-card,
    .project-bundles-card,
    .project-bundle-product-card {
        transition: none !important;
    }
}


/* =====================================================================
   V1.1 - SCREENSHOT REVIEW REFINEMENTS
   Targets the remaining mobile issues visible in the 29/09 review:
   - duplicate floating cart covering content although cart exists in header/menu
   - floating controls visible above the open mobile menu
   - WhatsApp control too large over cards on small phones
   ===================================================================== */

@media (max-width: 767px) {
    /* The public mobile header already exposes the cart icon, and the open
       mobile menu contains Inquiry cart + Request a Quote. Keeping a second
       floating cart over product cards obscures content, so remove it only
       on phone widths. Desktop/tablet behavior is unchanged. */
    .floating-cart {
        display: none !important;
    }

    /* Keep WhatsApp available, but reduce the visual footprint so it does not
       cover headings, Project Bundle cards, or product imagery. */
    .whatsapp {
        width: 44px !important;
        height: 44px !important;
        right: 10px !important;
        bottom: calc(10px + env(safe-area-inset-bottom)) !important;
        font-size: 11px !important;
        box-shadow: 0 9px 22px rgba(0, 0, 0, .18) !important;
    }

    body[dir="rtl"] .whatsapp {
        right: auto !important;
        left: 10px !important;
    }

    /* When the full mobile navigation is open, no page-level floating action
       should sit on top of its navigation/CTA buttons. */
    body:has(.mobile-menu.open) .whatsapp,
    body:has(.mobile-menu.open) .floating-cart {
        display: none !important;
    }

    /* Make the mobile menu CTA area read as one intentional control group. */
    .mobile-menu .mobile-cart {
        margin-top: 20px !important;
    }

    .mobile-menu .mobile-cart + .btn {
        margin-top: 10px !important;
    }
}

@media (max-width: 575px) {
    .whatsapp {
        width: 40px !important;
        height: 40px !important;
        right: 8px !important;
        bottom: calc(8px + env(safe-area-inset-bottom)) !important;
        font-size: 10px !important;
    }

    body[dir="rtl"] .whatsapp {
        right: auto !important;
        left: 8px !important;
    }
}

@media (max-width: 390px) {
    /* V1 had generic extra-small floating-cart positioning. The cart is now
       intentionally hidden on phones, so prevent any lower-priority rule from
       restoring or positioning it. */
    .floating-cart {
        display: none !important;
    }
}
