/* ============================================================
   mobile-fixes.css — إصلاحات الموبايل الشاملة
   الصقر الجارح — نقل العفش بجدة
   ============================================================ */

/* === GLOBAL: منع الـ overflow الأفقي في كل الصفحات === */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
*, *::before, *::after {
  box-sizing: border-box;
}
img, picture, video {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   MOBILE — max 768px
   ============================================================ */
@media (max-width: 768px) {

  /* Hero banner image */
  .hero-main-img img {
    height: 220px !important;
    border-radius: 12px !important;
  }
  .hero-main-img {
    padding: 0 1rem !important;
  }

  /* Hero section padding */
  .hero {
    padding: 3rem 0 2rem !important;
  }

  /* Hero stats */
  .hero-stats {
    gap: 1rem !important;
    flex-wrap: wrap;
    justify-content: center;
  }
  .hero-stat {
    min-width: 80px;
    text-align: center;
  }

  /* ── GRIDS — collapse to 2 then 1 ────────────────── */
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns:repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* 2-col inline grids → 1 col */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* 2-col with sp-16 gap (story/about section) */
  .grid-2[style*="gap:var(--sp-16)"],
  .grid-2[style*="gap: var(--sp-16)"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* ── GALLERY ITEMS ────────────────────────────────── */
  .gallery-item {
    aspect-ratio: 4/3 !important;
    overflow: hidden !important;
    position: relative !important;
    border-radius: 10px !important;
  }
  .gallery-item picture {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
  }
  .gallery-item picture img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }
  .gallery-content {
    padding: 8px 10px !important;
  }
  .gallery-content h3 {
    font-size: 0.82rem !important;
    margin: 0 !important;
    line-height: 1.3 !important;
  }
  .gallery-tag {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }

  /* Gallery grid page */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Filters bar */
  .filters-container {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .filter-btn {
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
  }

  /* ── INLINE IMAGE HEIGHTS ─────────────────────────── */
  [style*="height:450px"],
  [style*="height: 450px"] {
    height: 220px !important;
  }
  [style*="height:380px"],
  [style*="height: 380px"] {
    height: 200px !important;
  }
  [style*="height:340px"],
  [style*="height: 340px"] {
    height: 200px !important;
  }
  [style*="height:220px"],
  [style*="height: 220px"] {
    height: 150px !important;
  }
  [style*="height:194px"],
  [style*="height: 194px"] {
    height: 130px !important;
  }

  /* ── CARDS IMAGES ─────────────────────────────────── */
  .grid-3 .card img,
  .grid-3 .card picture img {
    height: 160px !important;
  }

  /* Blog cards */
  .b-img-wrap img {
    height: 180px !important;
  }
  /* Blog grid 1 col */
  .blog-preview-section .grid-3,
  section .grid-3.blog-cards {
    grid-template-columns: 1fr !important;
  }

  /* ── PRICING ──────────────────────────────────────── */
  .pricing-teaser {
    margin: 20px 0 !important;
    padding: 20px 15px !important;
    border-radius: 10px !important;
  }
  .price-pkg-card.popular {
    transform: none !important;
    margin-top: 30px;
  }

  /* ── COMPARISON TABLE ─────────────────────────────── */
  .comparison-table {
    font-size: 0.82rem;
  }
  .comparison-table th,
  .comparison-table td {
    padding: 8px 6px;
  }

  /* ── PROCESS STEPS ────────────────────────────────── */
  .process-steps {
    flex-direction: column !important;
  }

  /* ── CALCULATOR ───────────────────────────────────── */
  .calc-body {
    padding: 15px !important;
  }
  .calc-wrapper {
    border-radius: 8px !important;
  }

  /* ── PAGE HEADER ──────────────────────────────────── */
  .page-header {
    padding: 3rem 0 !important;
  }
  .page-header h1 {
    font-size: 1.6rem !important;
  }
  .page-header p {
    font-size: 0.95rem !important;
    padding: 0 1rem;
  }

  /* ── EMERGENCY OFFER BAR ──────────────────────────── */
  .emergency-bar {
    font-size: 0.76rem !important;
    padding: 5px 0 !important;
    line-height: 1.4 !important;
  }
  .emergency-bar .emergency-inner,
  .emergency-bar > div {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px 10px !important;
    padding: 0 28px !important;
  }
  .emergency-badge {
    font-size: 0.7rem !important;
    padding: 1px 5px !important;
  }
  .countdown {
    gap: 2px !important;
    padding: 2px 5px !important;
    font-size: 0.7rem !important;
  }
  .countdown span small {
    font-size: 0.44rem !important;
  }
  .close-emergency {
    font-size: 1rem !important;
    padding: 3px !important;
  }

  /* ── CONTAINER PADDING ────────────────────────────── */
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* ── TEXT OVERFLOW PREVENTION ─────────────────────── */
  h1, h2, h3, h4 {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  p {
    overflow-wrap: break-word;
  }
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── ICON GRID (auto 1fr) ─────────────────────────── */
  [style*="grid-template-columns:auto 1fr"],
  [style*="grid-template-columns: auto 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   SMALL MOBILE — max 480px (تليفونات أصغر)
   ============================================================ */
@media (max-width: 480px) {

  /* Gallery → 1 column */
  .gallery-grid,
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: 1fr !important;
  }
  .gallery-item {
    aspect-ratio: 16/9 !important;
  }
  picture[style*="grid-column:span 2"] {
    grid-column: span 1 !important;
  }

  /* Hero image smaller */
  .hero-main-img img {
    height: 180px !important;
  }

  /* Cards images */
  .grid-3 .card picture img,
  .grid-3 .card img {
    height: 140px !important;
  }

  /* Hero CTA buttons → stack */
  .hero-cta-group {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .hero-cta-group .btn {
    width: 100% !important;
    text-align: center !important;
    font-size: 0.95rem !important;
    padding: 14px 12px !important;
  }

  /* Footer → 1 col */
  .footer-inner {
    grid-template-columns: 1fr !important;
  }

  /* Hero stats numbers */
  .hero-stat-num {
    font-size: 1.8rem !important;
  }
  .hero-stat-label {
    font-size: 0.7rem !important;
  }
  .hero-stats {
    gap: 0.75rem !important;
  }
}
