/* ==========================================================================
   mobile.css - שכבת רספונסיביות משותפת לכל האתר הציבורי (אתר, חנות, עגלה, אזור אישי)
   נטענת אחרי ה-CSS של כל עמוד. כל הכללים כאן הם "הגנות" וחוזקות כלליות; התאמות ספציפיות
   לעמוד נמצאות בתוך קובץ העמוד עצמו.
   מחלקות שימושיות: .table-scroll, .embed-16x9, .m-only, .d-only, .stack-mobile, .sticky-submit
   ========================================================================== */

/* ---------- 1. הגנות בסיס ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 96px; }
body { overflow-wrap: break-word; }
/* הערה: html/body overflow-x:hidden מוגדרים ב-head.blade.php וב-style.css. לא להחליף ב-clip: ב-Chrome נייד זה גורם להרחבת ה-viewport. */
html, body { max-width: 100%; }
img, video, canvas, svg, picture { max-width: 100%; }
img { height: auto; }
/* תמונות שמוגדר להן גובה/חיתוך במחלקה משלהן ממשיכות לעבוד: מחלקות העמוד חזקות יותר מ-img */
iframe, embed, object { max-width: 100%; }
select, textarea, input { max-width: 100%; }
pre, code { white-space: pre-wrap; word-break: break-word; }

/* מונע מילים ארוכות (אימייל, קישור) לשבור את הפריסה */
.prose, .post-content, .article-content, .blog-content, .breed-content, .course-description,
.entry-content, .rich-text, .post-body, .breed-article, .ev-modal-body { overflow-wrap: anywhere; }

/* ---------- 2. הטמעות (יוטיוב / מפות / וידאו) ---------- */
.embed-16x9 { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #000; }
.embed-16x9 > iframe, .embed-16x9 > video, .embed-16x9 > object, .embed-16x9 > embed {
    position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"], iframe[src*="youtu.be"], iframe[src*="vimeo.com"] {
    width: 100%; max-width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0;
}
iframe[src*="google.com/maps"], iframe[src*="maps.google"], iframe[src*="waze.com"] { width: 100%; max-width: 100%; border: 0; }

/* ---------- 3. טבלאות ---------- */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { min-width: 520px; }
@media (max-width: 768px) {
    .prose table, .post-content table, .article-content table, .blog-content table,
    .breed-content table, .course-description table, .entry-content table, .rich-text table,
    .post-body table, .breed-article table, .ev-modal-body table {
        display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
}

/* ---------- 4. טפסים ---------- */
/* 16px מונע זום אוטומטי ב-iOS בעת פוקוס; ללא !important כי קבצי העמוד מגדירים גודל קטן יותר */
@media (max-width: 900px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="color"]),
    select, textarea {
        font-size: 16px !important;
    }
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="hidden"]):not([type="color"]),
    select { min-height: 44px; }
    textarea { min-height: 96px; }
    label { line-height: 1.4; }
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary-color, var(--primary, #0069a9)); }
@media (pointer: coarse) {
    input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; flex-shrink: 0; }
}
/* שדות טלפון / אימייל / מספר: תמיד LTR בתוך עמוד RTL כדי שהספרות לא יתהפכו */
input[type="tel"], input[type="email"], input[type="url"] { direction: ltr; text-align: right; }
input[type="tel"]::placeholder, input[type="email"]::placeholder, input[type="url"]::placeholder { direction: rtl; text-align: right; }

/* כפתור שליחה דביק בטפסים ארוכים (מוסיפים class="sticky-submit" על עטיפת הכפתור) */
@media (max-width: 768px) {
    .sticky-submit {
        position: sticky; bottom: 0; z-index: 20; margin-left: -4px; margin-right: -4px;
        padding: 12px 4px calc(12px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, #fff 75%, rgba(255,255,255,0));
    }
}

/* ---------- 5. אזורי לחיצה (מגע) ---------- */
@media (pointer: coarse) {
    button, [role="button"], input[type="submit"], input[type="button"], .btn, .btn-primary, .btn-secondary {
        min-height: 44px;
    }
    .nav-links a, .mobile-nav-links a { min-height: 44px; }
}
button, [role="button"], a, input, select, textarea, summary { touch-action: manipulation; }

/* ---------- 6. פס אנכי בנייד: כותרות נזילות ---------- */
@media (max-width: 576px) {
    .section-header { margin-bottom: 30px; }
    .section-header h2 { font-size: clamp(1.7rem, 7vw, 2.3rem); }
    .btn-large { font-size: 1.1rem; padding: 14px 24px; }
}

/* ---------- 6b. כותרות עמוד (hero) - גובה גמיש במקום גובה קבוע, טקסט נזיל ---------- */
@media (max-width: 768px) {
    .inner-hero, .inner-hero-gallery, .inner-hero-blog, .inner-hero-breeding, .breeds-inner-hero {
        height: auto !important; min-height: 210px !important; padding: 32px 0 !important; box-sizing: border-box;
    }
    .inner-hero h1, .inner-hero-gallery h1, .inner-hero-blog h1, .inner-hero-breeding h1, .breeds-inner-hero h1,
    .contact-hero h1, .accessibility-hero h1, .privacy-hero h1 {
        font-size: clamp(1.7rem, 8vw, 2.4rem) !important; line-height: 1.2 !important;
    }
    .inner-hero p, .inner-hero-gallery p, .inner-hero-blog p, .inner-hero-breeding p, .breeds-inner-hero p,
    .contact-hero p, .accessibility-hero p, .privacy-hero p {
        font-size: 1.05rem !important; line-height: 1.5;
    }
    .contact-hero { padding: 44px 0 !important; }
}

/* ---------- 7. כותרת האתר הראשי (הדר קבוע) ---------- */
@media (max-width: 1310px) {
    .hamburger { width: 44px; height: 44px; align-items: center; justify-content: center; margin: 0 -8px 0 0; transform: none !important; }
}
@media (max-width: 768px) { .logo-container img { max-height: 56px !important; } }
@media (max-width: 380px) { .logo-container img { max-height: 48px !important; } }
.mobile-menu-overlay { height: 100vh; height: 100dvh; }

/* ---------- 8. כותרת / תפריט / עגלה צדית של החנות ---------- */
.mobile-nav { height: 100vh; height: 100dvh; max-width: 88vw; overscroll-behavior: contain; }
.side-cart { height: 100vh; height: 100dvh; overscroll-behavior: contain; }
@media (max-width: 992px) {
    .shop-header { position: sticky; top: 0; padding: 10px 4%; gap: 10px; }
    .mobile-menu-toggle { min-width: 44px; min-height: 44px; font-size: 1.6rem; }
    .shop-logo img { height: 46px; }
    .cart-icon-wrapper { min-width: 44px; min-height: 44px; justify-content: center; }
    .header-account-link { min-height: 44px; padding: 8px 14px; }
    .search-container { margin-top: 0; }
    .search-box { height: 46px; }
    .live-search-results { max-height: 60vh; overflow-y: auto; }
    .mobile-nav-link { min-height: 48px; padding: 12px 0; }
    .mobile-sub-menu > a { padding: 8px 0 !important; min-height: 44px; box-sizing: border-box; align-items: center; }
    .mobile-sub-menu > a.mobile-sub-all { display: flex; }
    .mobile-sub-menu > a > i { margin-top: 0 !important; }
    .mobile-grandchild-link { padding: 11px 0 !important; }
    .close-nav-btn, .close-cart-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .side-cart { width: 100%; max-width: 100%; }
    .side-cart-header { padding: 14px 18px; }
    .side-cart-body { padding: 14px; -webkit-overflow-scrolling: touch; }
    .sc-item { grid-template-columns: 72px 1fr 40px; gap: 12px; padding: 12px; }
    .sc-item-img { height: 72px; }
    .sc-item-details h4 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .sc-qty-controls button { width: 40px; height: 40px; font-size: 1.3rem; }
    .sc-remove { width: 40px; height: 40px; }
    .side-cart-footer { padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
    .btn-checkout-sc { padding: 16px; }
}
@media (max-width: 420px) {
    .header-account-link span, .header-account-link .hide-xs { display: none; }
    .header-actions { gap: 6px; }
}


/* ---------- 8b. כותרת החנות בנייד: שורה אחת קבועה, חיפוש נפתח בלחיצה ---------- */
.m-search-toggle { display: none; }
.mobile-sub-all { color: var(--primary, #0069a9) !important; font-weight: 800 !important; }
@media (max-width: 992px) {
    .header-account-link { display: none !important; }
    .shop-header { padding: 8px 4% !important; gap: 6px !important; flex-wrap: nowrap !important; }
    .shop-logo { margin: 0 auto !important; }
    .shop-logo img { height: 40px; width: auto; }
    .header-actions, .header-left-actions { gap: 0 !important; }
    .shop-header.m-hdr .search-container {
        display: none; position: absolute; top: 100%; left: 0; right: 0; width: auto; max-width: none;
        margin: 0 !important; padding: 8px 4% 14px; background: #fff; box-shadow: 0 12px 20px rgba(0,0,0,.12); z-index: 950;
    }
    .shop-header.m-hdr.search-open .search-container { display: block; }
    .shop-header.m-hdr .m-search-toggle {
        display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
        background: none; border: none; font-size: 1.35rem; color: var(--text-dark, #222); cursor: pointer; padding: 0;
    }
    .shop-header:not(.m-hdr) { flex-wrap: wrap !important; }
    .shop-header:not(.m-hdr) .search-container { order: 4; width: 100%; max-width: 100%; }
    .search-box input { font-size: 16px !important; }
    .live-search-results { max-height: min(60vh, 420px); }
    .search-result-item { min-height: 56px; }
}

/* ---------- 8c. החנות: עמוד ראשי, קטגוריה, מוצר (כרטיסים, מגלילים, סינון) ---------- */
@media (hover: none) {
    .product-card:hover, .cat-card:hover, .related-card:hover { transform: none !important; }
    .product-card:hover .product-img { transform: none !important; }
}
@media (max-width: 768px) {
    /* עמוד החנות הראשי */
    .hero-slider-container { height: min(74svh, 540px) !important; min-height: 380px; touch-action: pan-y; }
    .slide-content { padding: 0 18px !important; }
    .slide-content h2 { font-size: clamp(1.9rem, 8.5vw, 2.7rem) !important; line-height: 1.15; }
    .slide-content p { font-size: 1.1rem !important; margin-bottom: 20px !important; }
    .slide-btn { padding: 13px 30px !important; min-height: 44px; box-sizing: border-box; font-size: 1.1rem !important; }
    .slider-dots { bottom: 14px !important; gap: 4px !important; }
    .slider-dots .dot { position: relative; background-clip: content-box; }
    .slider-dots .dot::after { content: ''; position: absolute; inset: -16px -6px; }
    .trust-bar { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px !important; padding: 16px 3% !important; }
    .trust-bar .trust-item { flex-direction: column; text-align: center; gap: 6px !important; }
    .trust-bar .trust-icon { font-size: 1.7rem !important; }
    .trust-bar .trust-text h4 { font-size: .95rem !important; }
    .trust-bar .trust-text p { font-size: .8rem !important; }
    .categories-section { padding: 36px 4% 8px !important; }
    .categories-section .section-title, .products-section .section-title { font-size: clamp(1.55rem, 7vw, 2.1rem) !important; margin-bottom: 30px !important; }
    .categories-scroll { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 8px !important; justify-items: center; padding-bottom: 8px !important; }
    .cat-card { width: 100% !important; }
    .cat-img-box { width: min(100%, 104px) !important; height: auto !important; aspect-ratio: 1; margin-bottom: 8px !important; border-width: 3px !important; }
    .cat-name { font-size: .95rem !important; line-height: 1.25; }
    .product-slider-wrapper { padding: 0 !important; margin-bottom: 34px !important; }
    .product-slider { gap: 12px !important; padding: 0 4% 16px !important; scroll-padding-inline: 4%; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
    .product-slider .product-card-wrap { flex: 0 0 min(62vw, 240px) !important; min-width: 0 !important; }
    .products-section { padding: 26px 4% 20px !important; }

    /* כרטיס מוצר (משותף: אינדקס / קטגוריה) */
    .product-img-wrapper { height: auto !important; aspect-ratio: 1 / 1; }
    .product-content { padding: 12px 10px !important; }
    .product-category { font-size: .75rem !important; }
    .product-title { font-size: 1rem !important; margin-bottom: 10px !important; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
    .product-price-wrapper { flex-wrap: wrap; gap: 2px 8px !important; margin-bottom: 10px !important; }
    .price-current { font-size: 1.2rem !important; }
    .price-original { font-size: .9rem !important; }
    .product-sale-badge { top: 8px !important; right: 8px !important; padding: 4px 10px !important; font-size: .78rem !important; }
    .btn-add-to-cart-card { padding: 12px 6px !important; font-size: 1rem !important; min-height: 46px; box-sizing: border-box; display: flex !important; align-items: center; justify-content: center; gap: 6px; }
}

/* ---------- 8d. קטגוריה: רשת 2 עמודות + מגירת סינון ---------- */
@media (max-width: 992px) {
    .page-header { padding: 24px 4% !important; margin-bottom: 20px !important; }
    .cat-title { font-size: clamp(1.7rem, 7.5vw, 2.3rem) !important; }
    .cat-desc { font-size: 1rem !important; }
    body > .breadcrumbs { padding: 14px 4% 10px; font-size: .85rem; }
    .page-header .breadcrumbs { padding: 0; margin-bottom: 10px !important; }
    .category-page-layout { padding: 0 4% 32px !important; gap: 0 !important; }
    .products-header { flex-direction: row !important; align-items: center !important; justify-content: space-between; gap: 10px !important; }
    .mobile-filter-btn { min-height: 46px; padding: 10px 18px !important; font-family: inherit; }
    .products-count { font-size: .95rem !important; }
    .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 14px !important; }
    .filter-sidebar { height: 100vh !important; height: 100dvh !important; max-height: 100dvh !important; width: min(340px, 90vw) !important; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
    .filter-sidebar form { padding: 18px 20px !important; flex: 1 0 auto; }
    .filter-header-mobile { position: sticky; top: 0; z-index: 3; padding: 12px 20px !important; }
    .filter-header-mobile button { min-width: 44px; min-height: 44px; }
    .filter-checkbox { min-height: 44px; margin-bottom: 2px !important; }
    .filter-checkbox input { width: 22px !important; height: 22px !important; flex-shrink: 0; }
    .filter-title { padding: 6px 0; min-height: 32px; }
    .filter-select { min-height: 48px; font-size: 16px !important; }
    .filter-apply-mobile { display: block !important; position: sticky; bottom: 0; background: #fff; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border, #eee); box-shadow: 0 -6px 14px rgba(0,0,0,.05); z-index: 3; }
    .filter-apply-mobile button { width: 100%; min-height: 50px; border: none; border-radius: 10px; background: var(--primary, #0069a9); color: #fff; font-family: inherit; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
    .multi-range-slider { height: 28px !important; }
    .multi-range-slider input[type=range] { height: 28px !important; }
    .multi-range-slider input[type=range]::-webkit-slider-thumb { width: 28px !important; height: 28px !important; }
    .multi-range-slider input[type=range]::-moz-range-thumb { pointer-events: all; width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--primary, #0069a9); cursor: pointer; box-shadow: 0 0 5px rgba(0,0,0,.2); }
    .multi-range-slider .slider-track { top: 12px !important; }
}
@media (max-width: 640px) {
    .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
    .product-card { border-radius: 14px !important; }
}
@media (max-width: 340px) {
    .products-grid { gap: 8px !important; }
    .product-content { padding: 10px 8px !important; }
}

/* ---------- 9. כפתורים צפים (נגישות / עוגיות) - שמירה על סדר z ו-safe area ---------- */
@media (max-width: 768px) {
    .a11y-trigger-btn { width: 48px !important; height: 48px !important; font-size: 24px !important;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important; left: 12px !important; }
    .a11y-panel { left: 8px !important; right: 8px !important; width: auto !important;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important; max-height: calc(100dvh - 130px) !important; }
}

/* כשמודאל / מגירה פתוחים (הדף ננעל לגלילה) - מסתירים את כפתור הנגישות הצף כדי שלא יכסה כפתורי שליחה */
body[style*="overflow: hidden"] .a11y-trigger-btn,
body:has(.ev-modal-overlay.active, .payment-overlay.active, .front-modal-overlay.active, .custom-alert-overlay.active, .mobile-nav.open, .side-cart.open, .mobile-menu-overlay.active) .a11y-trigger-btn { display: none !important; }

/* בר תחתון דביק (קורס / מוצר): מרימים את כפתור הנגישות מעליו כדי שלא יכסה את כפתור ההרשמה */
@media (max-width: 992px) {
    body:has(.sticky-course-bar.visible) .a11y-trigger-btn,
    body:has(.mobile-sticky-bar:not(.is-hidden)) .a11y-trigger-btn { bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ---------- 10. כלי עזר ---------- */
.m-only { display: none !important; }
@media (max-width: 768px) {
    .m-only { display: revert !important; }
    .d-only { display: none !important; }
    .stack-mobile { display: flex !important; flex-direction: column !important; align-items: stretch !important; }
    .stack-mobile > * { width: 100% !important; max-width: 100% !important; }
}

/* ---------- 11. נגישות תנועה ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
