/* ============================================
   FRENTEX TECH — Arabic Identity & Mobile UX Enhancements
   تحسينات الهوية العربية وتجربة الجوال
   ============================================ */

/* --- Arabic Typography Refinements --- */
[dir="rtl"] {
  font-family: 'Cairo', sans-serif;
  letter-spacing: 0;
  word-spacing: 0.02em;
}

[dir="rtl"] .hero-title,
[dir="rtl"] .section-title,
[dir="rtl"] .cta-title,
[dir="rtl"] .page-header-title {
  font-family: 'Cairo', sans-serif;
  font-weight: 800;
  line-height: 1.4;
}

[dir="rtl"] .section-label {
  font-family: 'Cairo', sans-serif;
  letter-spacing: 0;
  font-weight: 700;
}

[dir="rtl"] .hero-description,
[dir="rtl"] .section-subtitle,
[dir="rtl"] .cta-desc,
[dir="rtl"] .page-header-desc {
  font-family: 'Cairo', sans-serif;
  line-height: 2;
  font-weight: 400;
}

[dir="rtl"] .btn {
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

[dir="rtl"] .nav-link {
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
}

/* --- Arabic Hero Alignment Fix --- */
[dir="rtl"] .hero-text {
  text-align: right;
}

[dir="rtl"] .hero-badge {
  align-self: flex-start;
}

[dir="rtl"] .hero-actions {
  justify-content: flex-start;
}

[dir="rtl"] .hero-stats {
  justify-content: flex-start;
}

/* --- Arabic Section Label Centering Fix --- */
[dir="rtl"] .section-header {
  text-align: right;
}

[dir="rtl"] .section-header.centered {
  text-align: center;
}

[dir="rtl"] .section-header.centered .section-label {
  justify-content: center;
}

/* --- Arabic Number Display --- */
[dir="rtl"] .hero-stat-value {
  font-family: 'Poppins', sans-serif;
  direction: ltr;
  display: inline-block;
}

[dir="rtl"] .hero-stat {
  align-items: flex-start;
}

/* --- Arabic Service Card Improvements --- */
[dir="rtl"] .service-feature {
  flex-direction: row-reverse;
}

[dir="rtl"] .service-features {
  align-items: flex-end;
}

[dir="rtl"] .service-link {
  flex-direction: row-reverse;
}

/* --- Arabic FAQ --- */
[dir="rtl"] .faq-question {
  text-align: right;
}

[dir="rtl"] .faq-icon {
  margin-right: auto;
  margin-left: 0;
}

/* --- Arabic Footer Alignment --- */
[dir="rtl"] .footer-brand {
  text-align: right;
}

[dir="rtl"] .footer-contact-item {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .social-links {
  justify-content: flex-start;
}

/* --- Arabic Why Feature --- */
[dir="rtl"] .why-feature {
  text-align: right;
}

/* ============================================
   MOBILE UX ENHANCEMENTS
   ============================================ */

/* Smooth scroll for iOS */
html {
  -webkit-overflow-scrolling: touch;
}

/* Better tap highlighting */
* {
  -webkit-tap-highlight-color: rgba(122, 15, 45, 0.15);
}

/* --- Mobile Navigation Slide Animation --- */
.mobile-nav {
  transform: translateY(-8px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.mobile-nav.open {
  transform: translateY(0);
}

/* Add close button to mobile nav */
.mobile-nav-close {
  position: absolute;
  top: 1.5rem;
  inset-inline-start: 1.5rem;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-nav-close:hover {
  background: var(--color-primary);
}

/* --- Improved Touch Targets --- */
.nav-link,
.footer-link,
.social-link,
.filter-btn,
.breadcrumb a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* --- Sleek Floating WhatsApp Button (Small & Unobtrusive) --- */
.whatsapp-fab {
  position: fixed;
  bottom: 1.5rem;
  inset-inline-end: 1.5rem;
  width: 50px;
  height: 50px;
  background: #25D366;
  border-radius: 50%;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.45);
  z-index: 990;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  text-decoration: none;
}

.whatsapp-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.6);
}

.whatsapp-fab svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
}

@media (max-width: 768px) {
  .whatsapp-fab {
    bottom: 1.2rem;
    inset-inline-end: 1.2rem;
    width: 44px;
    height: 44px;
  }

  .whatsapp-fab svg {
    width: 24px;
    height: 24px;
  }

  .scroll-top {
    bottom: 4.5rem;
    inset-inline-end: 1.2rem;
    width: 36px;
    height: 36px;
  }

  /* --- Mobile Top Bar (Header/Navbar) - Sleek & Compact --- */
  .navbar,
  .navbar.scrolled {
    padding: 0.45rem 0 !important;
  }

  .navbar-inner {
    gap: 0.5rem;
  }

  .navbar-logo img {
    height: 36px !important;
    width: 36px !important;
  }

  .navbar-logo-title {
    font-size: 0.95rem !important;
    letter-spacing: 0.01em;
  }

  .navbar-logo-subtitle {
    font-size: 0.62rem !important;
  }

  .navbar-actions {
    gap: 0.5rem;
  }

  .navbar-actions .btn-sm {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.78rem !important;
    min-height: 34px !important;
    border-radius: var(--radius-full);
  }

  .lang-toggle {
    padding: 0.25rem 0.6rem !important;
    font-size: 0.75rem !important;
    min-height: 32px !important;
  }

  .mobile-menu-btn {
    padding: 6px !important;
    gap: 4px !important;
  }

  .mobile-menu-btn span {
    width: 20px !important;
    height: 2px !important;
  }

  /* --- Resizing Hero & Page Elements on Mobile for Clean Aesthetics --- */
  .hero {
    min-height: auto;
    padding-top: 5.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .hero-badge {
    font-size: 0.72rem !important;
    padding: 0.3rem 0.8rem !important;
    margin-bottom: 0.85rem !important;
    gap: 0.4rem;
  }

  .hero-badge .badge-dot {
    width: 6px;
    height: 6px;
  }

  .hero-title {
    font-size: clamp(1.65rem, 5.5vw, 2.05rem) !important;
    line-height: 1.35 !important;
    margin-bottom: 0.75rem !important;
  }

  .hero-description {
    font-size: 0.88rem !important;
    line-height: 1.75 !important;
    margin-bottom: 1.4rem !important;
    max-width: 95%;
  }

  .hero-actions {
    gap: 0.6rem !important;
    margin-bottom: 1.5rem !important;
  }

  .hero-actions .btn {
    padding: 0.6rem 1.15rem !important;
    font-size: 0.85rem !important;
    min-height: 42px !important;
  }

  .hero-stats {
    gap: 1.25rem !important;
    margin-top: 1.25rem !important;
    padding-top: 1.25rem !important;
    flex-wrap: wrap;
  }

  .hero-stat-value {
    font-size: 1.65rem !important;
    line-height: 1 !important;
  }

  .hero-stat-label {
    font-size: 0.72rem !important;
  }

  /* --- Section Spacing & Sizing on Mobile --- */
  .section-padding {
    padding: 3rem 0 !important;
  }

  .section-padding-sm {
    padding: 2rem 0 !important;
  }

  .section-header {
    margin-bottom: 2rem !important;
  }

  .section-label {
    font-size: 0.75rem !important;
    margin-bottom: 0.4rem !important;
    gap: 0.4rem;
  }

  .section-title {
    font-size: clamp(1.4rem, 4.5vw, 1.75rem) !important;
    line-height: 1.35 !important;
    margin-bottom: 0.5rem !important;
  }

  .section-subtitle {
    font-size: 0.85rem !important;
    line-height: 1.7 !important;
  }

  /* Cards & Grids on Mobile */
  .service-card {
    padding: 1.35rem 1.15rem !important;
    border-radius: 14px !important;
  }

  .service-icon {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.2rem !important;
    margin-bottom: 1rem !important;
  }

  .service-title {
    font-size: 1.15rem !important;
    margin-bottom: 0.5rem !important;
  }

  .service-desc {
    font-size: 0.82rem !important;
    line-height: 1.65 !important;
  }

  .service-features li {
    font-size: 0.78rem !important;
    padding: 0.35rem 0 !important;
  }

  .why-feature {
    padding: 1.15rem !important;
    gap: 0.75rem !important;
  }

  .why-feature-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.1rem !important;
  }

  .why-feature-title {
    font-size: 1rem !important;
  }

  .why-feature-desc {
    font-size: 0.82rem !important;
  }

  .stats-row {
    gap: 1.25rem !important;
    margin-top: 1.25rem !important;
    padding-top: 1.25rem !important;
    justify-content: space-around;
  }

  .stats-row-num {
    font-size: 1.5rem !important;
  }

  .stats-row-label {
    font-size: 0.72rem !important;
  }

  /* Portfolio Mobile */
  .portfolio-card {
    border-radius: 14px !important;
  }

  .portfolio-info {
    padding: 1rem !important;
  }

  .portfolio-title {
    font-size: 1rem !important;
  }

  .portfolio-tags span {
    font-size: 0.7rem !important;
    padding: 0.2rem 0.5rem !important;
  }

  /* CTA Box Mobile */
  .cta-box {
    padding: 2rem 1.25rem !important;
    border-radius: 16px !important;
  }

  .cta-title {
    font-size: clamp(1.25rem, 4vw, 1.55rem) !important;
    line-height: 1.4 !important;
  }

  .cta-desc {
    font-size: 0.85rem !important;
    line-height: 1.65 !important;
  }

  .cta-actions {
    flex-direction: column !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }

  .cta-actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Footer Mobile */
  .footer {
    padding-top: 2.5rem !important;
  }

  .footer-grid {
    gap: 1.75rem !important;
  }

  .footer-col-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.75rem !important;
  }

  .footer-link,
  .footer-contact-item {
    font-size: 0.82rem !important;
    min-height: 38px !important;
  }

  .footer-bottom {
    padding: 1rem 0 1.25rem 0 !important;
    font-size: 0.75rem !important;
  }

  /* Page Headers on Inner Pages */
  .page-header {
    padding: 5.5rem 0 2.25rem 0 !important;
  }

  .page-header-title {
    font-size: clamp(1.5rem, 5vw, 1.85rem) !important;
  }

  .page-header-desc {
    font-size: 0.85rem !important;
    line-height: 1.7 !important;
  }

  /* RTL alignment fixes */
  [dir="rtl"] .hero-actions {
    justify-content: center;
  }

  [dir="rtl"] .hero-stats {
    justify-content: center;
  }

  [dir="rtl"] .hero-badge {
    align-self: center;
  }

  [dir="rtl"] .hero-text {
    text-align: center;
  }

  [dir="rtl"] .section-header {
    text-align: center;
  }

  [dir="rtl"] .section-header .section-label {
    justify-content: center;
  }

  [dir="rtl"] .section-header .section-subtitle {
    margin: 0 auto;
  }
}

/* --- Card hover → active on touch --- */
@media (hover: none) {
  .service-card:active {
    border-color: var(--color-primary-20);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
  }

  .portfolio-card:active {
    transform: translateY(-3px);
  }

  .btn:active {
    transform: scale(0.97);
  }
}

/* --- Pull-to-refresh visual fix --- */
html, body {
  overscroll-behavior-y: contain;
}

/* --- Image lazy loading fade-in --- */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.4s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ============================================
   SECTION INTEGRATION & CONSISTENCY
   ============================================ */

/* Ensure consistent section transitions */
section + section {
  border-top: none;
}

/* Section divider ornament for Arabic identity */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem auto;
  max-width: 200px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary-30), transparent);
}

.section-divider-icon {
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--color-primary-20);
}

/* --- Stats Section in Why-Us (Arabic style) --- */
.stats-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.stats-row-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stats-row-num {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-white);
  font-family: 'Poppins', sans-serif;
  line-height: 1;
}

.stats-row-num span {
  color: var(--color-primary-light);
}

.stats-row-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

[dir="rtl"] .stats-row-label {
  letter-spacing: 0;
  text-transform: none;
  font-size: var(--text-sm);
}

/* --- Arabic Decorative Elements --- */
.arabic-ornament {
  text-align: center;
  color: var(--color-primary-30);
  font-size: 1.5rem;
  letter-spacing: 0.5rem;
  margin: var(--space-4) 0;
  user-select: none;
}

/* --- Hero scroll indicator --- */
.hero-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.4);
  font-size: 0.7rem;
  font-family: 'Cairo', sans-serif;
  z-index: 2;
  animation: bounce 2s ease infinite;
  cursor: pointer;
}

.hero-scroll-indicator svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  .hero-scroll-indicator {
    display: none;
  }
}

/* --- Smooth Page Sections Background Transitions --- */
.hero + .services-section {
  position: relative;
}

.hero + .services-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, var(--bg-dark), transparent);
  pointer-events: none;
}

/* --- Contact Section Integration --- */
.contact-info {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  height: 100%;
}

/* --- Why-Us Right Side Enhancements --- */
.process-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4);
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all var(--transition-base);
}

.process-item:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(122,15,45,0.3);
}

[dir="rtl"] .process-item {
  flex-direction: row-reverse;
}

/* ============================================
   ACCESSIBILITY & FOCUS IMPROVEMENTS
   ============================================ */

:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 3px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--color-primary);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: var(--space-4);
}
