/* =====================================================
   رصيف — تحسينات الموبايل (يُحمَّل بعد باقي ملفات CSS)
   ===================================================== */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

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

img { max-width: 100%; }

/* حقول 16px على الموبايل عشان iOS ماتعملش zoom وقت الكتابة */
.form-select, .form-control { font-size: 16px; }

/* ---------- القائمة العلوية ---------- */

/* زر الثيم عنصر مستقل جنب زر القائمة (مش جوا القائمة) */
.theme-toggle-bar {
  order: 1;
  margin-inline-start: auto;
  margin-inline-end: 8px;
  flex: 0 0 auto;
}
.raseef-nav .navbar-toggler { order: 2; flex: 0 0 auto; min-width: 44px; min-height: 40px; }
.raseef-nav .navbar-collapse { order: 3; }

@media (min-width: 992px) {
  .raseef-nav .navbar-collapse { order: 1; }
  .theme-toggle-bar { order: 2; margin-inline-start: 12px; margin-inline-end: 0; }
}

@media (max-width: 991.98px) {
  .home-page .navbar-collapse {
    margin-top: 10px;
    padding: 6px 14px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(40, 10, 70, .12);
    max-height: calc(100vh - 92px);
    max-height: calc(100dvh - 92px);
    overflow-y: auto;
  }

  .home-page .navbar-nav { gap: 0 !important; }

  .home-page .navbar-nav .nav-link {
    min-height: 46px;
    display: flex;
    align-items: center;
    padding: 10px 6px !important;
    border-bottom: 1px solid var(--line);
  }

  .home-page .navbar-nav .nav-item:last-child .nav-link { border-bottom: 0; }

  .home-page .nav-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 10px !important;
    padding: 12px 0 0 !important;
  }

  .home-page .nav-actions .btn {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    white-space: nowrap;
  }
}

@media (max-width: 575.98px) {
  .raseef-nav { min-height: 64px; }
  .raseef-nav .logo-img { height: 38px; }
  .theme-toggle { width: 40px; height: 40px; }
}

/* ---------- الصفحة الرئيسية ---------- */

/* كارت الهيرو في الدارك مود */
[data-theme=dark] .home-page .hero-side-card {
  background: rgba(26, 16, 41, .96);
  border-color: rgba(255, 255, 255, .08);
}
[data-theme=dark] .home-page .hero-side-top h3,
[data-theme=dark] .home-page .mini-route b { color: #fff; }
[data-theme=dark] .home-page .hero-side-kicker,
[data-theme=dark] .home-page .mini-route small { color: var(--muted); }
[data-theme=dark] .home-page .mini-route-icon { background: var(--tint); color: #f0ff00; }

/* نموذج الحجز */
.booking-field .form-select,
.passenger-booking-form .form-select { font-size: 16px; }

@media (max-width: 767.98px) {
  .home-page .booking-submit,
  .passenger-booking-form button[type=submit] { min-height: 52px; font-size: 1rem; }

  .home-page .hero-actions { flex-wrap: wrap; }
  .home-page .hero-main-btn { flex: 1 1 100%; justify-content: center; min-height: 52px; }
  .home-page .hero-secondary-btn { flex: 1 1 100%; justify-content: center; min-height: 44px; }

  .home-page .section-heading { text-align: center; }
  .home-page .step-card { min-height: 0; }
}

/* نتايج الرحلات — كارت مضغوط وزر كبير للّمس */
.result-card .result-info { min-width: 0; }

@media (max-width: 575.98px) {
  .result-card,
  #quickResults .result-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 15px;
  }

  .result-card .result-action,
  #quickResults .result-card .result-action {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 12px;
    width: 100%;
    text-align: right !important;
  }

  .result-card .result-action > :not(button) { grid-column: 1; }

  .result-card .result-action button,
  #quickResults .result-card .result-action button {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: auto;
    min-width: 98px;
    min-height: 46px;
    margin: 0 !important;
    font-size: .95rem;
  }

  .result-price { font-size: 1.1rem; }
}

/* ---------- لوحات الراكب والسواق ---------- */

.dashboard-page .raseef-nav .container { flex-wrap: nowrap; gap: 8px; }
.dashboard-page .nav-user { flex: 0 0 auto; }

@media (max-width: 575.98px) {
  .dashboard-page .raseef-nav { min-height: 60px; }
  .dashboard-page .raseef-nav .logo-img { height: 34px; }

  /* اسم المستخدم مخفي على الشاشات الصغيرة (الأيقونة كفاية) */
  .dashboard-page #welcomeName { display: none; }

  /* خروج: أيقونة فقط */
  .dashboard-page .logout-btn {
    font-size: 0;
    gap: 0;
    width: 38px;
    padding: 0 !important;
  }
  .dashboard-page .logout-btn i { font-size: 1.05rem; }

  .dashboard-page .nav-user { gap: 6px; }
  .dashboard-page .nav-user .theme-toggle { width: 38px; height: 38px; }
}

/* الإحصائيات: 3 كروت في صف واحد بدل 3 تحت بعض */
@media (max-width: 700px) {
  .dashboard-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-stat-card {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 9px;
    min-height: 0;
    padding: 12px;
  }

  .dashboard-stat-card .stat-decoration { display: none; }
  .dashboard-stat-card span { font-size: .68rem; line-height: 1.45; }
  .dashboard-stat-card strong { font-size: 1.2rem; }

  .stat-icon { width: 36px; height: 36px; flex-basis: 36px; font-size: 1rem; }

  .dashboard-hero-content .dashboard-main-btn {
    width: 100%;
    justify-content: center;
    min-height: 50px;
  }
}

@media (max-width: 575.98px) {
  .booking-actions .btn { min-height: 46px; }
  .toast-container { padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important; }
}

/* ---------- صفحات الدخول والتسجيل ---------- */
@media (max-width: 575.98px) {
  .auth-card .form-control,
  .auth-card .form-select { min-height: 50px; }
  .auth-card .btn-primary { min-height: 50px; }
}

/* احترام أمان الشاشات اللي فيها نوتش */
@supports (padding: max(0px)) {
  .raseef-nav .container {
    padding-inline: max(12px, env(safe-area-inset-right), env(safe-area-inset-left));
  }
}

/* ---------- كود التحقق ---------- */
.otp-note {
  display: flex; gap: 9px; align-items: flex-start;
  margin-bottom: 14px; padding: 11px 14px;
  border-radius: 12px;
  background: var(--tint, #f4ecff);
  color: var(--ink, #1b0733);
  font-size: .82rem; line-height: 1.7;
}
.otp-note i { margin-top: 3px; color: var(--teal, #9900ff); }

/* ---------- حالات وكروت الرحلات الجديدة ---------- */
.status.started { background: rgba(14, 116, 255, .12); color: #0b63d6; }
[data-theme=dark] .status.started { background: rgba(80, 160, 255, .16); color: #7db8ff; }

.booking-pin {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 12px; padding: 12px 14px;
  border-radius: 14px;
  background: var(--tint, #f4ecff);
  color: var(--ink, #1b0733);
  font-size: .88rem;
}
.booking-pin i { color: var(--teal, #9900ff); }
.booking-pin b { font-size: 1.25rem; letter-spacing: .25em; color: var(--teal, #9900ff); }
.booking-pin small { flex-basis: 100%; color: var(--muted, #6b6480); font-size: .75rem; }

.booking-rate { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; font-size: .85rem; font-weight: 700; }
.rate-stars { display: flex; gap: 4px; }
.rate-stars button {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--line, #e6dcf5); background: transparent;
  color: #f5a623; font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.rate-stars button:hover { background: rgba(245, 166, 35, .14); }
.booking-rated { margin-top: 10px; color: #f5a623; font-size: 1.1rem; }
.booking-rated small { color: var(--muted, #6b6480); font-size: .75rem; margin-inline-start: 6px; }

.booking-start { margin-top: 12px; }
.booking-start label { display: block; margin-bottom: 6px; font-size: .8rem; font-weight: 800; }
.booking-start-row { display: flex; gap: 8px; }
.booking-start-row .form-control { flex: 1; min-width: 0; min-height: 46px; border-radius: 12px; text-align: center; letter-spacing: .3em; font-weight: 800; }
.booking-start-row .btn { min-height: 46px; white-space: nowrap; }
