/* =====================================================================
   ALF Mobile Fixes v4.0 — Complete Rewrite
   Professional mobile optimization for Abdou Law Firm
   ===================================================================== */

/* ── 1. GLOBAL BASE ─────────────────────────────────────────────────── */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}
img, video, iframe, embed, object {
  max-width: 100% !important;
  height: auto;
}

/* ── 2. TEAM CARDS: Always-visible info + View Profile on mobile ─────── */
/* Full-cover invisible tap link (hidden on desktop) */
.alf-tcard { position: relative; }
.alf-tcard__full-link {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
}
/* Mobile view button (hidden on desktop) */
.alf-tcard__view-btn-mobile { display: none; }

@media (hover: none), (pointer: coarse) {
  .alf-tcard__overlay    { display: none !important; }
  .alf-tcard__full-link  { display: block !important; }
  .alf-tcard__view-btn-mobile {
    display: inline-flex !important;
    position: relative;
    z-index: 6;
    align-items: center;
    gap: 6px;
    background: #1F52B8;
    color: #fff !important;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    text-decoration: none !important;
    transition: background 0.2s;
  }
  .alf-tcard__view-btn-mobile:active { background: #163d8a; }
}

/* =====================================================================
   3. MOBILE NAVBAR  ≤ 991px
   Color: #0a1628 (exact same as desktop navbar — "Navy" brand color)
   Strategy:
     • .navbar-area  = fixed wrapper, full width, 64px tall
     • .mobile-nav   = logo on the left (sits inside navbar-area)
     • .mean-bar     = only the hamburger button, absolute on the right
     • .mean-nav     = full dropdown panel below the bar
   ===================================================================== */
@media (max-width: 991px) {

  /* ── Push page content below the fixed 64px bar ── */
  body { padding-top: 64px !important; }

  /* ── Main wrapper: exact same navy as desktop ── */
  .navbar-area {
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    height: 64px !important;
    z-index: 9999 !important;
    /* #0a1628 = --navy: the exact original site color */
    background: #0a1628 !important;
    box-shadow: 0 2px 16px rgba(0,0,0,0.45) !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* ── Logo bar (left side) ── */
  .mobile-nav {
    display: flex !important;
    align-items: center !important;
    height: 64px !important;
    padding: 0 16px !important;
    flex: 1 !important;
    z-index: 2 !important;
    position: relative !important;
  }
  .mobile-nav .logo {
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    height: 64px !important;
  }
  .mobile-nav .logo img {
    height: 42px !important;
    width: auto !important;
    display: block !important;
    object-fit: contain !important;
  }

  /* ── Desktop nav: zeroed out (meanmenu takes over) ── */
  .main-nav {
    position: static !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow: visible !important;
  }
  .main-nav .container,
  .main-nav .navbar,
  .main-nav .side-nav { display: none !important; }

  /* ── MeanMenu bar: 64×64 slot on the right, transparent ── */
  .mean-container .mean-bar {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: 64px !important;
    height: 64px !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* ── Hamburger button ── */
  .mean-container a.meanmenu-reveal {
    /* Hard-reset all meanmenu positioning defaults */
    position: static !important;
    float: none !important;
    margin: 0 12px 0 0 !important;
    top: auto !important;
    right: auto !important;
    transform: none !important;
    /* Visual style */
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    border: 1.5px solid rgba(255,255,255,0.28) !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.07) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    padding: 0 !important;
    /* Hide the "X" / "≡" text meanmenu renders */
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    line-height: 0 !important;
    transition: background 0.2s, border-color 0.2s !important;
  }
  .mean-container a.meanmenu-reveal:hover,
  .mean-container a.meanmenu-reveal:active {
    background: rgba(74,127,212,0.2) !important;
    border-color: rgba(74,127,212,0.55) !important;
  }
  /* The three white bars */
  .mean-container a.meanmenu-reveal span {
    display: block !important;
    width: 18px !important;
    height: 2px !important;
    background: #ffffff !important;
    border-radius: 2px !important;
    margin: 0 !important;
    float: none !important;
    text-indent: 0 !important;
    position: static !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
  }

  /* ── Dropdown nav panel ── */
  .mean-container .mean-nav {
    position: fixed !important;
    top: 64px !important;
    left: 0 !important; right: 0 !important;
    z-index: 9998 !important;
    width: 100% !important;
    max-height: calc(100dvh - 64px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    background: rgba(7, 14, 34, 0.99) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(255,255,255,0.06) !important;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5) !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Nav list reset */
  .mean-container .mean-nav ul {
    list-style: none !important;
    margin: 0 !important; padding: 0 !important;
    float: none !important;
    width: 100% !important;
  }
  .mean-container .mean-nav ul li {
    position: relative !important;
    float: none !important;
    width: 100% !important;
    display: block !important;
    border-bottom: 1px solid rgba(255,255,255,0.055) !important;
    margin: 0 !important;
  }

  /* Nav links */
  .mean-container .mean-nav ul li a {
    display: block !important;
    float: none !important;
    width: auto !important;
    padding: 16px 56px 16px 24px !important;
    color: rgba(255,255,255,0.85) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    letter-spacing: 0.2px !important;
    text-decoration: none !important;
    text-transform: none !important;
    background: transparent !important;
    border-top: none !important;
    transition: color 0.2s, background 0.2s !important;
  }
  .mean-container .mean-nav ul li a:hover,
  .mean-container .mean-nav ul li a:active {
    color: #4a7fd4 !important;
    background: rgba(31,82,184,0.08) !important;
  }

  /* Expand (+/-) button */
  .mean-container .mean-nav ul li a.mean-expand {
    position: absolute !important;
    top: 0 !important; right: 0 !important;
    width: 52px !important;
    height: 52px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 20px !important;
    font-weight: 300 !important;
    color: rgba(255,255,255,0.55) !important;
    background: rgba(31,82,184,0.08) !important;
    border-left: 1px solid rgba(255,255,255,0.06) !important;
    cursor: pointer !important;
    text-align: center !important;
    float: none !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
  }

  /* Sub-menu indent */
  .mean-container .mean-nav ul li ul li a {
    padding-left: 40px !important;
    font-size: 14px !important;
    color: rgba(255,255,255,0.6) !important;
    background: rgba(0,0,0,0.12) !important;
  }
  .mean-container .mean-nav ul li ul li a:hover {
    color: #4a7fd4 !important;
    background: rgba(31,82,184,0.1) !important;
  }
}

/* =====================================================================
   4. HOMEPAGE HERO  ≤ 991px
   The hero uses inline style="padding: 180px 0 120px"
   Override with attribute selector (higher specificity than inline)
   ===================================================================== */
@media (max-width: 991px) {
  section.hp-hero,
  .hp-hero[style] {
    padding-top: 80px !important;
    padding-bottom: 60px !important;
    text-align: center !important;
  }
  .hp-hero__eyebrow {
    font-size: 10px !important;
    letter-spacing: 1px !important;
    white-space: normal !important;
    display: inline-flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    padding: 6px 14px !important;
    max-width: 90% !important;
    margin: 0 auto 20px !important;
    line-height: 1.5 !important;
  }
  .hp-hero__title {
    font-size: clamp(28px, 8vw, 40px) !important;
    line-height: 1.15 !important;
    margin-bottom: 16px !important;
    text-align: center !important;
  }
  .hp-hero__sub {
    font-size: 15px !important;
    line-height: 1.7 !important;
    margin: 0 auto 28px !important;
    text-align: center !important;
    max-width: 90% !important;
  }
  .hp-hero__actions {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 0 !important;
  }
  .hp-hero__actions a,
  .hp-hero__actions .hp-btn {
    width: 100% !important;
    max-width: 340px !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 52px !important;
  }
  /* Hide the right-side glass recognition box */
  .col-lg-6.d-none.d-lg-block { display: none !important; }
  .hp-hero__float-card { display: none !important; }
  .hp-hero__blob1, .hp-hero__blob2 { display: none !important; }
}

/* =====================================================================
   5. ALL SECTIONS: Center + Spacing  ≤ 767px
   ===================================================================== */
@media (max-width: 767px) {

  /* ── Section padding ── */
  .hp-practices,
  .hp-about,
  .hp-cases,
  .hp-team,
  .hp-news,
  .hp-clients,
  .hp-track-record,
  section[style*="padding: 100px"],
  section[style*="padding: 60px"] {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* ── Section headers: always center ── */
  .hp-section-header,
  .hp-section-header.center,
  .d-flex.align-items-end.justify-content-between {
    text-align: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
  }
  .hp-section-sub { margin: 0 auto !important; }
  .hp-badge { margin: 0 auto !important; }

  /* ── Practices grid: 1 column ── */
  .hp-practices__grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin-top: 32px !important;
  }
  .hp-practice-card {
    padding: 24px 20px !important;
    text-align: left !important;
  }

  /* ── About: stack image above text ── */
  .hp-about .row { flex-direction: column !important; }
  .hp-about__img { height: 240px !important; border-radius: 16px !important; }
  .hp-about__badge-float { display: none !important; }
  .hp-about__img-deco { display: none !important; }
  .hp-about__features {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    margin: 20px 0 24px !important;
  }
  .hp-about .d-flex[style*="gap:12px"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .hp-about .d-flex[style*="gap:12px"] a {
    text-align: center !important;
    justify-content: center !important;
  }

  /* ── Case studies: full width ── */
  .hp-cases .col-md-4 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* ── Team cards (homepage) ── */
  .hp-team .col-sm-6.col-lg-4 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* ── News cards: full width ── */
  .hp-news .col-md-6,
  .hp-news .col-md-3 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* ── Track record: 2-col ── */
  .hp-track-record .col-sm-6.col-lg-3 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
  .hp-track-record .col-sm-6.col-lg-3 > div {
    padding: 28px 16px !important;
  }
  .hp-track-record h3[style] { font-size: 24px !important; }

  /* ── Clients grid ── */
  .hp-clients__grid {
    flex-wrap: wrap !important;
    gap: 20px !important;
    justify-content: center !important;
    padding: 0 !important;
  }
  .hp-cl-brand { flex: 0 0 calc(33.33% - 14px) !important; height: 70px !important; }
  .hp-cl-brand__logo { max-height: 48px !important; max-width: 100px !important; }
  .hp-cl-brand__init { width: 52px !important; height: 52px !important; font-size: 15px !important; }

  /* ── CTA bottom band ── */
  div[style*="justify-content:space-between"][style*="display:flex"],
  div[style*="justify-content: space-between"][style*="display: flex"] {
    flex-direction: column !important;
    text-align: center !important;
    padding: 32px 20px !important;
    gap: 20px !important;
  }
  div[style*="justify-content:space-between"][style*="display:flex"] > div:first-child,
  div[style*="justify-content: space-between"][style*="display: flex"] > div:first-child {
    max-width: 100% !important;
  }
  div[style*="justify-content:space-between"][style*="display:flex"] > div:last-child a,
  div[style*="justify-content: space-between"][style*="display: flex"] > div:last-child a {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }
}

/* =====================================================================
   6. INNER PAGES: Hero + Sections  ≤ 767px
   ===================================================================== */
@media (max-width: 767px) {
  /* Inner page hero */
  .alf-page-hero { padding: 88px 0 52px !important; }
  .alf-page-hero h1 {
    font-size: clamp(24px, 7vw, 34px) !important;
    text-align: center !important;
  }
  .alf-page-hero__sub { font-size: 14px !important; text-align: center !important; }
  .alf-page-hero__inner { text-align: center !important; }

  /* Inner page sections */
  .alf-page-section { padding: 52px 0 !important; }

  /* Team page grid: 2 columns */
  .alf-grid-4, .alf-grid-3 {
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }
  .alf-grid-2 { grid-template-columns: 1fr !important; gap: 20px !important; }

  /* Team card mobile enhancements */
  .alf-tcard__img-wrap { aspect-ratio: 3/4 !important; }
  .alf-tcard__info h3 { font-size: 13px !important; }
  .alf-tcard__role { font-size: 10px !important; }
  .alf-tcard__body {
    padding: 10px 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .alf-tcard__dept-badge { margin-bottom: 0 !important; font-size: 9px !important; }
  .alf-tcard__view-btn-mobile {
    font-size: 11px !important;
    padding: 6px 12px !important;
  }

  /* Filter bar */
  .alf-filters {
    flex-direction: column !important;
    padding: 14px !important;
    gap: 12px !important;
    align-items: stretch !important;
  }
  .alf-search-wrap { width: 100% !important; flex: none !important; }
  .alf-filter-tabs { gap: 6px !important; flex-wrap: wrap !important; }
  .alf-filter-tab { padding: 6px 14px !important; font-size: 12px !important; }

  /* Stats strip */
  .alf-stats-strip { grid-template-columns: repeat(3,1fr) !important; }
  .alf-stats-strip__val { font-size: 20px !important; }
  .alf-stats-strip__lbl { font-size: 9px !important; letter-spacing: 0.5px !important; }

  /* Info box */
  .alf-info-box { padding: 20px !important; }

  /* Appointment: full-width columns */
  .col-lg-8, .col-lg-4 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* Prevent iOS input zoom */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Contact map */
  .contact-map iframe { height: 240px !important; }

  /* Blog detail */
  .blog-details-item img { max-width: 100% !important; height: auto !important; }
}

/* =====================================================================
   7. VERY SMALL PHONES  ≤ 390px
   ===================================================================== */
@media (max-width: 390px) {
  .hp-hero__title { font-size: 26px !important; }
  .alf-grid-4, .alf-grid-3 { grid-template-columns: 1fr !important; }
  .hp-track-record .col-sm-6.col-lg-3 { flex: 0 0 100% !important; max-width: 100% !important; }
  .alf-stats-strip { grid-template-columns: repeat(3,1fr) !important; }
}

/* =====================================================================
   8. TABLET  768px – 991px
   ===================================================================== */
@media (min-width: 768px) and (max-width: 991px) {
  section.hp-hero, .hp-hero[style] {
    padding-top: 100px !important;
    padding-bottom: 80px !important;
  }
  .hp-practices__grid { grid-template-columns: repeat(2,1fr) !important; }
  .alf-grid-4 { grid-template-columns: repeat(3,1fr) !important; }
  .alf-grid-3 { grid-template-columns: repeat(2,1fr) !important; }
  .hp-about__img { height: 340px !important; }
  .hp-cases .col-md-4 {
    flex: 0 0 50% !important;
    max-width: 50% !important;
  }
}

/* =====================================================================
   9. TOUCH + TAP TARGETS
   ===================================================================== */
@media (max-width: 991px) {
  /* Minimum 44px tap target for all interactive elements */
  a, button, [role="button"],
  .alf-filter-tab, .hp-btn, .cmn-btn, .alf-btn {
    min-height: 44px;
  }
  /* Fix fixed background on iOS (causes blank areas) */
  .hp-hero, .banner-area, .alf-page-hero {
    background-attachment: scroll !important;
  }
  /* Footer */
  footer { padding-top: 52px !important; }
  .footer-logo img { max-height: 52px !important; }
  /* Scroll to top */
  #toTop, .go-top { bottom: 72px !important; right: 16px !important; }
  /* WhatsApp float */
  .whatsapp-float {
    width: 52px !important; height: 52px !important;
    font-size: 26px !important;
    bottom: 16px !important; right: 16px !important;
  }
  /* Word wrap for headings */
  h1, h2, h3 {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
}
