/* ============================================================
   AATS - Mobile-First Responsive Fixes
   Loaded last — overrides all previous rules on small screens
   ============================================================ */

/* ── Desktop Navbar Tighten (992px–1280px) — DESKTOP ONLY ──── */
@media (min-width: 992px) and (max-width: 1280px) {
  #mainNav .brand-abbr  { font-size: 1.25rem; letter-spacing: 2px; }
  #mainNav .brand-full  { font-size: 0.52rem; }
  #mainNav .nav-link    { font-size: 0.82rem !important; padding: 7px 10px !important; }
  #mainNav .d-flex.align-items-center { gap: 10px !important; }
  .lang-btn             { padding: 5px 10px !important; font-size: 0.78rem !important; }
  .btn-gold.d-none.d-lg-inline-flex   { padding: 10px 18px !important; font-size: 0.82rem !important; }
}
@media (min-width: 992px) and (max-width: 1100px) {
  #mainNav .navbar-nav  { gap: 0 !important; }
  #mainNav .nav-link    { font-size: 0.78rem !important; padding: 6px 8px !important; }
  #mainNav .brand-full  { display: none; }   /* hide subtitle, keep AATS */
}

/* ── Global Overflow Prevention ────────────────────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}
*, *::before, *::after {
  max-width: 100%;
}
img, video, iframe {
  max-width: 100%;
  height: auto;
}
.container, .container-fluid {
  overflow-x: hidden;
}

/* ── Navbar ─────────────────────────────────────────────────── */
@media (max-width: 991px) {
  :root { --navbar-height: 68px; }

  #mainNav {
    height: var(--navbar-height);
    padding: 0 4px;
  }
  #mainNav .container {
    padding-left: 12px;
    padding-right: 12px;
  }
  #mainNav .brand-abbr  { font-size: 1.25rem; letter-spacing: 2px; }
  #mainNav .brand-full  { font-size: 0.52rem; letter-spacing: 0.8px; }

  #mainNav .navbar-collapse {
    position: absolute;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background: rgba(7, 24, 64, 0.99);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px;
    border-top: 1px solid rgba(251,190,29,0.2);
    border-bottom: 2px solid rgba(251,190,29,0.15);
    max-height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    z-index: 999;
  }
  #mainNav .navbar-nav {
    gap: 4px !important;
    margin-bottom: 12px;
  }
  #mainNav .nav-link {
    padding: 12px 16px !important;
    border-radius: 10px;
    font-size: 0.95rem !important;
  }
  #mainNav .d-flex.align-items-center {
    flex-wrap: wrap;
    gap: 10px !important;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  #mainNav .btn-gold {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    font-size: 0.9rem;
  }
  .lang-switcher { width: 100%; }
  .lang-btn { width: 100%; justify-content: center; }
  .lang-dropdown {
    position: static;
    display: none;
    width: 100%;
    margin-top: 8px;
    border-radius: 10px;
  }
  .lang-dropdown.open { display: block; }
}

/* ── Hero Section ───────────────────────────────────────────── */
@media (max-width: 991px) {
  .hero-section {
    padding-top: var(--navbar-height);
    min-height: auto;
  }
  .hero-content { padding: 40px 0 20px; }
  .hero-image-wrap { margin-top: 0; margin-bottom: 20px; order: -1; }
  .hero-main-image img { height: 280px; }
  .hero-float-card { display: none !important; }
  .hero-orb-1, .hero-orb-3 { display: none; }
}

@media (max-width: 767px) {
  .hero-section { min-height: auto; }
  .hero-content { padding: 24px 0 16px; }

  .hero-badge { font-size: 0.7rem; padding: 6px 14px; margin-bottom: 16px; }

  .hero-title {
    font-size: clamp(1.7rem, 7vw, 2.4rem) !important;
    margin-bottom: 16px;
    line-height: 1.25;
  }
  .hero-subtitle { font-size: 0.95rem; margin-bottom: 24px; }

  .hero-cta-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 24px;
  }
  .hero-cta-group .btn-gold,
  .hero-cta-group .btn-outline-gold {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
  }

  .hero-phones {
    flex-direction: column;
    gap: 10px;
  }
  .hero-phones .phone-item { width: 100%; }

  .hero-main-image img { height: 220px; }
}

/* ── Hero Stats ─────────────────────────────────────────────── */
@media (max-width: 991px) {
  .hero-stats { padding: 20px 16px; }
  .hero-stats .stat-number { font-size: 1.9rem; }
}
@media (max-width: 767px) {
  .hero-stats { padding: 16px 8px; }
  .hero-stats .row > div { padding: 12px 4px; }
  .hero-stats .stat-number { font-size: 1.7rem; }
  .hero-stats .stat-label { font-size: 0.68rem; }
  /* Keep 2 per row, remove vertical divider */
  .hero-stats .stat-item:not(:last-child)::after { display: none !important; }
}
@media (max-width: 400px) {
  .hero-stats .stat-number { font-size: 1.4rem; }
  .hero-stats .stat-suffix { font-size: 1rem; }
}

/* ── Category Filter ────────────────────────────────────────── */
@media (max-width: 767px) {
  .category-filter {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 8px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }
  .category-filter::-webkit-scrollbar { display: none; }
  .category-filter .filter-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    font-size: 0.8rem;
    padding: 7px 16px;
    white-space: nowrap;
  }
}

/* ── Service Cards ──────────────────────────────────────────── */
@media (max-width: 575px) {
  .service-card-image { height: 190px; }
  .service-card-body { padding: 18px; }
  .service-card-footer {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 14px 18px;
  }
  .service-enquire-btn {
    text-align: center;
    padding: 9px 18px;
  }
}

/* ── Why / Features Section ─────────────────────────────────── */
@media (max-width: 767px) {
  .why-card { padding: 22px 18px; }
  .why-card .why-icon { width: 52px; height: 52px; font-size: 1.3rem; }
  .why-card h4 { font-size: 1rem; }
  .why-card p { font-size: 0.85rem; }
}

/* ── Offers ─────────────────────────────────────────────────── */
@media (max-width: 575px) {
  .offer-card-image { height: 170px; }
  .offer-card-body { padding: 18px; }
  .offer-card-footer { padding: 14px 18px; }
}

/* ── Testimonials ───────────────────────────────────────────── */
@media (max-width: 767px) {
  .testimonial-card { padding: 22px 18px; }
  .testimonial-text { font-size: 0.88rem; }
}

/* ── CTA Section ────────────────────────────────────────────── */
@media (max-width: 767px) {
  .cta-section .d-flex {
    flex-direction: column;
    align-items: stretch;
  }
  .cta-section .btn-primary-custom,
  .cta-section .btn-outline-gold {
    width: 100%;
    justify-content: center;
  }
  .cta-section h2 { font-size: 1.6rem; }
}

/* ── FAQ Section ────────────────────────────────────────────── */
@media (max-width: 767px) {
  .faq-accordion .accordion-button { padding: 16px 18px; font-size: 0.9rem; }
  .faq-accordion .accordion-body   { padding: 16px 18px; font-size: 0.88rem; }
}

/* ── Contact Section ────────────────────────────────────────── */
@media (max-width: 991px) {
  .contact-info-card { margin-bottom: 24px; padding: 28px 24px; }
  .enquiry-form-card { padding: 28px 24px; }
}
@media (max-width: 575px) {
  .contact-info-card  { padding: 22px 18px; }
  .enquiry-form-card  { padding: 22px 18px; }
  .contact-info-item  { gap: 12px; }
  .contact-social-links a { width: 36px; height: 36px; font-size: 0.9rem; }
}

/* ── Service Detail Page ────────────────────────────────────── */
@media (max-width: 991px) {
  .service-detail-hero { min-height: 300px; }
  .service-detail-hero-content { padding: 32px 0; }
  .service-detail-hero-content h1 { font-size: 1.6rem; }
  .service-enquiry-sidebar { position: static; top: auto; }
  .service-detail-content { padding: 24px 20px; }
}
@media (max-width: 575px) {
  .service-detail-hero { min-height: 240px; }
  .service-detail-hero-content h1 { font-size: 1.3rem; }
  .service-detail-content { padding: 18px 16px; }
  .service-detail-content h3 { font-size: 1.1rem; }
  .service-enquiry-card { padding: 22px 18px; }
  .contact-phones-box { padding: 16px; }
}

/* ── Page Hero Header (inner pages) ────────────────────────── */
@media (max-width: 767px) {
  .page-hero-header { padding: 96px 0 32px; }
  .page-hero-header h1 { font-size: 1.6rem !important; }
  .page-hero-header p  { font-size: 0.88rem !important; }
}
@media (max-width: 400px) {
  .page-hero-header { padding: 88px 0 24px; }
  .page-hero-header h1 { font-size: 1.4rem !important; }
}

/* ── Footer ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .main-footer { padding-top: 48px; }
  .footer-brand .brand-abbr { font-size: 1.5rem; }
  .footer-brand .brand-full { font-size: 0.65rem; }
  .footer-heading { margin-bottom: 16px; font-size: 0.82rem; }
  .footer-links a { font-size: 0.85rem; }
  .footer-desc { font-size: 0.85rem; }
  .footer-bottom { padding: 18px 0; }
  .footer-bottom .row { gap: 6px; }
  .footer-bottom .col-md-6 { text-align: center !important; }
}
@media (max-width: 575px) {
  .main-footer .row.g-5 { --bs-gutter-y: 2rem; }
}

/* ── Float Buttons ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .float-buttons {
    bottom: 16px;
    right: 14px;
    gap: 10px;
  }
  body.rtl .float-buttons { right: auto; left: 14px; }
  .float-whatsapp { width: 50px; height: 50px; font-size: 1.4rem; }
  .float-call      { width: 44px; height: 44px; font-size: 1.1rem; }
  .scroll-top-btn  { width: 40px; height: 40px; font-size: 0.9rem; }
}

/* ── General Section Padding ────────────────────────────────── */
@media (max-width: 767px) {
  .section-pad     { padding: 52px 0; }
  .section-pad-sm  { padding: 36px 0; }
  .section-heading { margin-bottom: 32px; }
  .section-heading h2 { font-size: 1.6rem; }
  .section-heading p  { font-size: 0.9rem; }
}
@media (max-width: 400px) {
  .section-pad    { padding: 40px 0; }
  .section-pad-sm { padding: 28px 0; }
}

/* ── Accordion / FAQ Sidebar (Contact / FAQ pages) ──────────── */
@media (max-width: 991px) {
  /* On faq.php the sidebar (quick contact) goes below */
  .col-lg-4.mt-5.mt-lg-0 { margin-top: 2rem !important; }
}

/* ── Admin Panel ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 9999;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0 !important; }
  .admin-content { padding: 16px; }
  .admin-table { font-size: 0.82rem; }
  .admin-table th, .admin-table td { padding: 10px 12px; }
  .stat-card { padding: 16px; }
  .stat-card .stat-num { font-size: 1.5rem; }
}

/* ── Table horizontal scroll ────────────────────────────────── */
@media (max-width: 767px) {
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 560px; }
}

/* ── Forms ──────────────────────────────────────────────────── */
@media (max-width: 575px) {
  .form-control, .form-select {
    font-size: 0.9rem;
    padding: 11px 14px;
  }
  .btn-gold, .btn-primary-custom, .btn-outline-gold {
    padding: 12px 20px;
    font-size: 0.88rem;
  }
}

/* ── Popup Ad ───────────────────────────────────────────────── */
@media (max-width: 575px) {
  .popup-ad-box { border-radius: 14px; }
  .popup-ad-overlay { padding: 12px; }
}

/* ── Fix horizontal overflow from effects ───────────────────── */
@media (max-width: 767px) {
  .hero-gradient-mesh,
  .hero-grid-lines,
  .hero-orb   { overflow: hidden; }
  .hero-orb-1 { width: 200px; height: 200px; }
  .hero-orb-2 { width: 150px; height: 150px; }
  .hero-orb-3 { display: none; }
  #page-transition { display: none; }
}

/* ── Swiper mobile ──────────────────────────────────────────── */
@media (max-width: 575px) {
  .testimonials-swiper { padding-bottom: 40px !important; }
  .swiper-pagination { bottom: 0 !important; }
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
@media (max-width: 575px) {
  .breadcrumb { font-size: 0.78rem; flex-wrap: wrap; }
  .breadcrumb-item { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ── RTL + Mobile combined ──────────────────────────────────── */
@media (max-width: 767px) {
  body.rtl .hero-cta-group { align-items: stretch; }
  body.rtl .hero-phones { align-items: flex-end; }
  body.rtl .footer-bottom .col-md-6 { text-align: center !important; }
}

/* ── Touch-friendly tap targets ─────────────────────────────── */
@media (max-width: 767px) {
  a, button, [role="button"] { min-height: 44px; }
  .nav-link { min-height: 44px; display: flex; align-items: center; }
  .filter-btn { min-height: 38px; }
  .footer-links a { min-height: 36px; align-items: center; }
}

/* ── Prevent card tilt on touch ─────────────────────────────── */
@media (hover: none) {
  .service-card:active { transform: scale(0.98) !important; }
  .why-card:active      { transform: scale(0.98) !important; }
  .offer-card:active    { transform: scale(0.98) !important; }
}

/* ── Safe area insets (iPhone notch/home bar) ───────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .float-buttons {
    bottom: max(16px, env(safe-area-inset-bottom));
  }
  .main-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
