/* ===================================================
   CairoTech – Mobile Enhancement Stylesheet
   تحسينات الجوال الشاملة
=================================================== */

/* ── Safe Area (iPhone notch/home bar) ── */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ── Touch improvements ── */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

input, textarea, select, button, a {
  touch-action: manipulation;
}

/* ── Minimum touch target size (48×48px) ── */
.btn, .nav-link, .whatsapp-btn-main, .scroll-top,
.mobile-toggle, .dropdown-item, .mega-menu-item,
.footer-links a, .social-link {
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-links a, .dropdown-item, .mega-menu-item {
  min-width: unset;
  justify-content: flex-start;
}

/* ── WhatsApp float: safe-area aware + bigger on mobile ── */
.whatsapp-float {
  bottom: calc(24px + var(--safe-bottom)) !important;
  left: calc(16px + var(--safe-left)) !important;
}

.whatsapp-btn-main {
  width: 60px !important;
  height: 60px !important;
  font-size: 1.5rem !important;
}

.scroll-top {
  bottom: calc(24px + var(--safe-bottom)) !important;
  right: calc(16px + var(--safe-right)) !important;
  width: 48px !important;
  height: 48px !important;
}

/* ── Header safe area ── */
#header {
  padding-top: var(--safe-top);
}

/* ── Sticky CTA bar (mobile only) ── */
.mobile-sticky-cta {
  display: none;
}

@media (max-width: 768px) {
  .mobile-sticky-cta {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 8500;
    padding: 10px 16px calc(10px + var(--safe-bottom)) 16px;
    background: var(--white);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    gap: 10px;
    border-top: 1px solid var(--border);
  }

  .mobile-sticky-cta a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 10px;
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
  }

  .mobile-sticky-cta .cta-call {
    background: var(--primary);
    color: var(--white);
  }

  .mobile-sticky-cta .cta-wa {
    background: #25D366;
    color: var(--white);
  }

  .mobile-sticky-cta .cta-book {
    background: var(--accent);
    color: var(--white);
  }

  /* Push page content above sticky bar */
  body {
    padding-bottom: calc(80px + var(--safe-bottom));
  }

  /* WhatsApp float moves up above sticky bar */
  .whatsapp-float {
    bottom: calc(90px + var(--safe-bottom)) !important;
  }

  .scroll-top {
    bottom: calc(90px + var(--safe-bottom)) !important;
  }
}

/* ── Better mobile fonts ── */
@media (max-width: 600px) {
  html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Hero improvements */
  .hero {
    padding-top: calc(80px + var(--safe-top)) !important;
    padding-bottom: 48px;
  }

  .hero-title {
    font-size: clamp(1.5rem, 6vw, 1.9rem) !important;
    line-height: 1.4;
  }

  .hero-subtitle {
    font-size: 0.92rem;
    line-height: 1.7;
  }

  /* Hero badge pill */
  .hero-badge {
    font-size: 0.75rem !important;
    padding: 6px 14px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Buttons full width on small screens */
  .hero-actions {
    flex-direction: column;
    gap: 12px;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 0.95rem;
  }

  /* Stats row becomes horizontal scroll */
  .hero-stats {
    display: flex;
    flex-direction: row !important;
    overflow-x: auto;
    gap: 0 !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .hero-stats::-webkit-scrollbar { display: none; }

  .hero-stat-item {
    flex: 0 0 auto;
    padding: 10px 20px;
    text-align: center;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .hero-stat-divider {
    display: block !important;
    width: 1px;
    background: rgba(255,255,255,0.2);
    align-self: stretch;
  }

  /* Section titles */
  .section-title {
    font-size: clamp(1.3rem, 5vw, 1.6rem) !important;
    line-height: 1.4;
  }

  /* Services grid - single column with better cards */
  .services-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .service-card {
    padding: 24px 20px;
  }

  /* Locations grid - 2 columns compact */
  .locations-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }

  .location-card {
    padding: 16px 12px;
  }

  /* Stats grid single column */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px;
  }

  /* Trust bar - scrollable */
  .trust-bar-inner {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    padding: 4px 0;
  }

  .trust-bar-inner::-webkit-scrollbar { display: none; }

  .trust-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Footer improvements */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px;
  }

  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.82rem;
  }

  /* Form improvements */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px !important; /* Prevents iOS zoom on focus */
    padding: 14px 16px;
    border-radius: var(--radius-md);
  }

  /* CTA section */
  .cta-inner {
    text-align: center;
  }

  .cta-actions {
    justify-content: center;
    flex-direction: column;
    align-items: stretch;
  }

  .cta-actions .btn {
    text-align: center;
    justify-content: center;
  }

  /* Blog grid */
  .blog-grid {
    grid-template-columns: 1fr !important;
  }

  /* Page hero padding */
  .page-hero {
    padding: calc(110px + var(--safe-top)) 0 50px !important;
  }

  /* Scroll sections have proper padding */
  .section-pad {
    padding: 52px 0;
  }
}

/* ── Medium phones (600-768px) ── */
@media (min-width: 601px) and (max-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Mobile nav improvements ── */
@media (max-width: 900px) {
  .nav-menu {
    padding-top: 8px !important;
    padding-bottom: calc(20px + var(--safe-bottom)) !important;
  }

  .nav-link {
    font-size: 1rem !important;
    padding: 14px 16px !important;
    font-weight: 600;
    border-radius: var(--radius-md) !important;
  }

  .mega-menu, .dropdown-menu {
    border-radius: var(--radius-md) !important;
    margin: 4px 8px 4px 0 !important;
  }

  .dropdown-item {
    padding: 12px 14px !important;
    font-size: 0.9rem;
  }

  /* Mobile toggle bigger */
  .mobile-toggle {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm) !important;
    background: rgba(0,102,204,0.08) !important;
  }
}

/* ── Image optimization ── */
img {
  image-rendering: -webkit-optimize-contrast;
}

/* ── Smooth scrolling everywhere ── */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ── Remove hover states on touch devices ── */
@media (hover: none) and (pointer: coarse) {
  .service-card:hover,
  .location-card:hover,
  .blog-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-md) !important;
  }

  .btn:hover {
    transform: none !important;
  }
}

/* ── Focus visible for accessibility ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
