/* ═══════════════════════════════════════════════════════════
   YS Trade Partners — MOBILE / TABLET FIX ONLY
   Loads AFTER lang-switcher.css. Desktop (>1024px) is untouched.

   STACKING ORDER (mobile, bottom to top):
     0    → announcement-bar         (moved here from top)
     40   → mobile-deals-bar         (sits directly above banner)
     104  → whatsapp-btn / float-cal-btn / mobile-lang-switcher
     170+ → cookie-bar (when visible; pushes above items up)
═══════════════════════════════════════════════════════════ */

/* ─── 0. DEFENSIVE: KILL DESKTOP NAV LEAKAGE ON MOBILE ─── */
@media (max-width: 900px) {
  nav .nav-links,
  nav .nav-cta-btn,
  nav .nav-deals-btn {
    display: none !important;
  }
  nav .nav-toggle { display: flex !important; }
  nav .lang-switcher { display: none !important; }
}

/* ─── A. TOP BANNER → MOVED TO BOTTOM ON MOBILE ─── */
@media (max-width: 900px) {
  .announcement-bar {
    top: auto !important;
    bottom: 0 !important;
    z-index: 840 !important;
    border-top: 1px solid rgba(184,146,42,.25) !important;
    border-bottom: none !important;
    padding: 10px 40px 10px 16px !important;
    font-size: 12px !important;
    min-height: 40px;
    line-height: 1.25;
    gap: 10px !important;
  }
  .announcement-bar-inner {
    gap: 10px !important;
    flex-wrap: nowrap !important;
    overflow: hidden;
    align-items: center;
    max-width: 100%;
  }
  .announcement-text {
    font-size: 11.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1 1 auto;
  }
  .announcement-cta {
    font-size: 10px !important;
    letter-spacing: .8px !important;
    padding: 4px 10px !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .announcement-dot { display: none !important; }
  .announcement-close {
    right: 10px !important;
    left: auto !important;
    font-size: 20px !important;
    padding: 0 6px !important;
    z-index: 2;
  }

  /* Nav goes back to top 0 on mobile — banner no longer lives up there */
  nav { top: 0 !important; }
  nav.ann-gone { top: 0 !important; }

  /* Hero no longer needs top-padding for banner */
  .hero { padding-top: 0 !important; }

  /* Reserve bottom space so nothing is hidden under the banner */
  body { padding-bottom: 48px; }
  /* When user dismisses banner via × → release the reserved space */
  body.ann-gone-mobile { padding-bottom: 0; }

  /* RTL: flip close button to left */
  [dir="rtl"] .announcement-close {
    right: auto !important;
    left: 10px !important;
  }
  [dir="rtl"] .announcement-text { text-align: right; }
}

/* ─── B. LANGUAGE SWITCHER → HEADER (mobile / tablet only) ─── */
.mobile-lang-switcher {
  display: none;
  position: fixed;
  top: 18px;                  /* vertically inside the nav bar */
  right: 62px;                /* clears hamburger + padding */
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 860;               /* above nav(500), below mobile-menu(950) */
  background: rgba(26,21,16,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(184,146,42,.35);
  border-radius: 999px;
  padding: 2px;                /* ⇣ SHRUNK */
  gap: 1px;
  box-shadow: 0 3px 12px rgba(0,0,0,.28);
  direction: ltr;
}
.mobile-lang-switcher .lang-btn {
  background: transparent;
  border: none;
  color: rgba(247,243,236,.72);
  font-family: 'Outfit', sans-serif;
  font-size: 9px;              /* ⇣ SHRUNK */
  font-weight: 700;
  letter-spacing: .5px;
  padding: 3px 6px;            /* ⇣ SHRUNK */
  min-width: 24px;             /* ⇣ SHRUNK */
  min-height: auto;            /* override the global 40px min-height */
  cursor: pointer;
  border-radius: 999px;
  transition: background .2s, color .2s;
  text-transform: uppercase;
}
.mobile-lang-switcher .lang-btn:hover { color: #D4A843; }
.mobile-lang-switcher .lang-btn.lang-active {
  background: linear-gradient(135deg, #D4A843, #B8922A);
  color: #1A1510;
  pointer-events: none;
}
@media (max-width: 900px) {
  .mobile-lang-switcher { display: flex !important; align-items: center; }
}
/* RTL pages: hamburger flips to the left, so pill moves to the opposite side */
@media (max-width: 900px) {
  [dir="rtl"] .mobile-lang-switcher {
    right: auto !important;
    left: 62px !important;
  }
}

/* ─── C. WHATSAPP / CALENDLY — above banner + deals-bar ─── */
@media (max-width: 900px) {
  .whatsapp-btn {
    bottom: 104px !important;
    left: 16px !important;
    width: 52px !important; height: 52px !important;
    z-index: 700;
  }
  .whatsapp-btn svg { width: 24px !important; height: 24px !important; }
  .float-cal-btn {
    bottom: 104px !important;
    right: 16px !important;
    width: 52px !important; height: 52px !important;
    z-index: 700;
  }
  .whatsapp-tooltip, .float-cal-tooltip { display: none !important; }

  body.no-deals-bar .whatsapp-btn,
  body.no-deals-bar .float-cal-btn { bottom: 60px !important; }
  body.ann-gone-mobile .whatsapp-btn,
  body.ann-gone-mobile .float-cal-btn { bottom: 64px !important; }
  body.ann-gone-mobile.no-deals-bar .whatsapp-btn,
  body.ann-gone-mobile.no-deals-bar .float-cal-btn { bottom: 24px !important; }
  body.cookie-visible .whatsapp-btn,
  body.cookie-visible .float-cal-btn { bottom: 214px !important; }
}

/* Calendly panel — screen-sized on mobile, clear of banner */
@media (max-width: 600px) {
  .float-cal-panel {
    right: 8px !important; left: 8px !important;
    bottom: 170px !important;
    width: auto !important;
    max-height: 70vh; overflow-y: auto;
  }
}

/* ─── D. MOBILE DEALS BAR — above announcement-bar ─── */
@media (max-width: 900px) {
  .mobile-deals-bar {
    bottom: 40px !important;
    padding: 10px 16px !important;
    min-height: 44px;
    z-index: 845;
  }
  .mobile-deals-bar a {
    font-size: 12px !important;
    letter-spacing: 1.2px !important;
  }
  body.ann-gone-mobile .mobile-deals-bar { bottom: 0 !important; }
  body.cookie-visible .mobile-deals-bar { bottom: 150px !important; }
}

/* ─── E. COOKIE BAR — top priority at bottom when visible ─── */
@media (max-width: 900px) {
  .cookie-bar, .gdpr-cookie-bar {
    bottom: 0 !important;
    padding: 14px 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    z-index: 900;
  }
  .cookie-bar p, .gdpr-cookie-bar p { font-size: 12px !important; }
  .cookie-btns, .gdpr-cookie-btns {
    flex-direction: row !important;
    justify-content: flex-end;
    gap: 8px !important;
  }
  body.cookie-visible .announcement-bar { bottom: 110px !important; }
}

/* ─── F. RTL MOBILE FIXES ─── */
@media (max-width: 900px) {
  [dir="rtl"] .hero-content,
  [dir="rtl"] .hero-text-plate,
  [dir="rtl"] .hero-buttons,
  [dir="rtl"] .hero-eyebrow {
    padding-right: 20px !important;
    padding-left: 20px !important;
  }
  [dir="rtl"] .hero-buttons {
    flex-direction: column !important;
    width: 100% !important;
    margin: 0 !important;
    gap: 10px !important;
  }
  [dir="rtl"] .hero-buttons a {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
  [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
  [dir="rtl"] p, [dir="rtl"] li, [dir="rtl"] .lead {
    text-align: right !important;
  }
  [dir="rtl"] .image-break-content h2,
  [dir="rtl"] .image-break-content p {
    text-align: center !important;
  }
  [dir="rtl"] input,
  [dir="rtl"] textarea,
  [dir="rtl"] select {
    text-align: right !important;
    direction: rtl !important;
  }
  [dir="rtl"] .about-split,
  [dir="rtl"] .contact-section,
  [dir="rtl"] .footer-top,
  [dir="rtl"] .bookcall-inner,
  [dir="rtl"] .why-section {
    grid-template-columns: 1fr !important;
  }
  html[dir="rtl"], [dir="rtl"] body { overflow-x: hidden !important; }
}

/* ─── G. DEALS PAGE MOBILE LAYOUT ─── */
@media (max-width: 900px) {
  .deals-filter, .deals-filters,
  .results-grid,
  .deal-cards, .deals-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .deal-card, .result-card {
    padding: 22px 18px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .deal-card *, .result-card * { max-width: 100% !important; }
  .deal-card h3, .result-card h3 {
    font-size: clamp(18px, 5vw, 22px) !important;
    line-height: 1.25 !important;
    word-wrap: break-word;
  }
  .deal-meta, .result-meta {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .deal-actions, .result-actions {
    flex-direction: column !important;
    gap: 10px !important;
    width: 100%;
  }
  .deal-actions a, .result-actions a {
    width: 100% !important;
    text-align: center !important;
  }
  .hero-text-plate { padding: 24px 20px !important; }
}

/* ─── H. GLOBAL MOBILE SAFETY NET ─── */
@media (max-width: 900px) {
  html, body { overflow-x: hidden !important; }
  img, video, iframe { max-width: 100%; height: auto; }
  .form-row { grid-template-columns: 1fr !important; }
  button, a.btn-gold, a.btn-ghost-white,
  .nav-cta-btn, .nav-deals-btn, .announcement-cta, .lang-btn {
    min-height: 40px;
  }
  input, textarea, select { font-size: 16px !important; }
  [dir="rtl"] .btn-gold, [dir="rtl"] .btn-ghost-white {
    padding: 16px 28px !important;
    font-size: 13px !important;
    letter-spacing: 1.2px !important;
  }
}

/* ─── I. TABLET RANGE (769px–1024px) ─── */
@media (min-width: 769px) and (max-width: 1024px) {
  .mobile-deals-bar { display: none !important; }
  /* Banner still at bottom on tablet */
  .whatsapp-btn { bottom: 80px !important; }
  .float-cal-btn { bottom: 80px !important; }
  .mobile-lang-switcher { bottom: 80px !important; }
  body.ann-gone-mobile .whatsapp-btn,
  body.ann-gone-mobile .float-cal-btn,
  body.ann-gone-mobile .mobile-lang-switcher { bottom: 24px !important; }
}

/* ─── J. MOBILE MENU ─── */
@media (max-width: 900px) {
  .mobile-menu { z-index: 950 !important; }
  .mobile-menu .lang-switcher { display: flex !important; }
}

/* ─── K. AR /deals RTL MIRRORING — mobile only ─────────────
   The AR deals page uses inline style="" overrides on hero-
   buttons / hero-stats that were written for desktop RTL.
   Force them back into mobile-safe single-column stacks,
   right-aligned. Nothing else changes.
───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  /* 1. Inline-styled hero-buttons / hero-stats → full width, no auto margins */
  [dir="rtl"] .hero-buttons[style],
  [dir="rtl"] .hero-stats[style] {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    flex-direction: column !important;
  }
  [dir="rtl"] .hero-buttons[style] a {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
  [dir="rtl"] .hero-stats[style] .hero-stat {
    width: 100% !important;
    text-align: right !important;
  }

  /* 2. Hero text-plate always right-aligned in RTL */
  [dir="rtl"] .hero-text-plate,
  [dir="rtl"] .hero-content {
    text-align: right !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* 3. Inline-styled section headings on AR deals → right-aligned (already are via
        their inline style, but guard against future overrides) */
  [dir="rtl"] .services-section .section-label,
  [dir="rtl"] .services-section h2,
  [dir="rtl"] .services-section .lead,
  [dir="rtl"] .services-section h3,
  [dir="rtl"] .services-section p {
    text-align: right !important;
  }

  /* 4. Service cards: right-align number badge + headings */
  [dir="rtl"] .svc .svc-num,
  [dir="rtl"] .svc h3,
  [dir="rtl"] .svc p,
  [dir="rtl"] .svc .svc-tag {
    text-align: right !important;
  }

  /* 5. Nav logo: sits at the start (right) of the nav in RTL */
  [dir="rtl"] nav { flex-direction: row-reverse !important; }
  [dir="rtl"] .nav-logo { text-align: right; }

  /* 6. Prevent content bleeding under the fixed nav on mobile RTL */
  [dir="rtl"] .hero { padding-top: 0 !important; }
}
