/**
 * 2T — واجهة الراكب الاحترافية
 */

.screen.ride {
  --rider-ink: #0f172a;
  --rider-muted: #64748b;
  --rider-line: rgba(15, 23, 42, 0.07);
  --rider-blue: #19a974;
  --rider-green: #10b981;
  --rider-surface: #ffffff;
  --rider-sheet-shadow: 0 -12px 48px rgba(15, 23, 42, 0.1);
  --rider-ar-font: "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --rider-search-font: "IBM Plex Sans Arabic", "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --rider-card-r: 12px;
  --rider-row-h: 44px;
  --ig-white: #ffffff;
  --ig-surface: #ffffff;
  --ig-line: var(--rider-line);
  --ig-muted: #e2e8f0;
  --ig-shadow: 0 2px 8px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
  background: #f1f5f9;
}

/* ── الورقة السفلية ── */
.screen.ride .ride-sheet {
  max-height: 58%;
  border-radius: 16px 16px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--rider-sheet-shadow);
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
}

.screen.ride .ride-sheet.phase-plan { max-height: 56%; }
.screen.ride .ride-sheet.phase-plan.plan-step-route { max-height: 28%; }
.screen.ride .ride-sheet.phase-plan.plan-step-details { max-height: 52%; }
.screen.ride .ride-sheet.phase-driver,
.screen.ride .ride-sheet.phase-active { max-height: 58%; }

/* ── خطوتان: مسار ثم تفاصيل ── */
#phasePlan .plan-step {
  display: none;
}

#phasePlan .plan-step.active {
  display: block;
}

/* ── أزرار رئيسية موحّدة (لون متابعة — التفاصيل في theme-polish.css) ── */
.screen.ride .btn-continue-route:not(:disabled),
.screen.ride .btn-surge,
.screen.ride .btn-finish,
.screen.ride .btn-new-trip {
  background: var(--2t-btn-primary, linear-gradient(145deg, #22c55e 0%, #16a34a 100%));
  color: #fff;
  font-weight: 800;
  border: none;
  box-shadow: var(--2t-btn-primary-shadow, 0 8px 20px rgba(34, 197, 94, 0.22));
}

.screen.ride .btn-continue-route,
.screen.ride .btn-surge,
.screen.ride .btn-finish,
.screen.ride .btn-new-trip {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  font-size: 14px;
}

.screen.ride .btn-continue-route {
  margin-top: 10px;
}

.screen.ride .btn-continue-route:disabled {
  background: var(--2t-btn-primary-disabled, #e2e8f0);
  color: var(--2t-btn-primary-disabled-text, #94a3b8);
  box-shadow: none;
}

.screen.ride .btn-finish {
  margin-top: 6px;
}

.plan-edit-route {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #334155;
  font-family: var(--rider-ar-font);
  font-size: 11px;
  font-weight: 500;
}

.plan-route-summary {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: var(--rider-card-r);
  background: #f8fafc;
  border: 1px solid var(--rider-line);
  font-family: var(--rider-ar-font);
}

.plan-route-line {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 6px;
  align-items: baseline;
}

.plan-route-line span {
  font-size: 10px;
  font-weight: 500;
  color: var(--rider-muted);
}

.plan-route-line strong {
  font-size: 12px;
  font-weight: 400;
  color: var(--rider-ink);
  line-height: 1.35;
}

.screen.ride .map-gps-fab {
  right: 20px;
  bottom: calc(28% + 14px);
}

.screen.ride .ride-sheet.phase-plan.plan-step-details ~ .map-gps-fab,
.screen.ride:has(.ride-sheet.plan-step-details) .map-gps-fab {
  bottom: calc(52% + 12px);
}

@media (max-width: 460px) {
  .screen.ride .ride-sheet.phase-plan.plan-step-route { max-height: 32%; }
  .screen.ride .ride-sheet.phase-plan.plan-step-details { max-height: 54%; }
  .screen.ride:has(.ride-sheet.plan-step-route) .map-gps-fab { bottom: calc(32% + 10px); }
}

.screen.ride .sheet-handle {
  width: 36px;
  height: 4px;
  margin-top: 8px;
  background: linear-gradient(90deg, #cbd5e1, #94a3b8, #cbd5e1);
}

.screen.ride .sheet-body {
  padding: 10px 16px 20px;
}

/* ── بطاقة المسار ── */
.screen.ride #phasePlan .route-card,
.screen.ride .live-trip .route-card {
  position: relative;
  overflow: visible;
  padding: 2px 12px;
  border: none;
  border-radius: var(--rider-card-r);
  background: #fff;
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.05);
  margin-bottom: 10px;
}

.screen.ride #phasePlan .route-card::before {
  content: "";
  position: absolute;
  top: 36px;
  right: 23px;
  bottom: 36px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, #1e293b 0%, #10b981 100%);
  opacity: 0.18;
  pointer-events: none;
}

.screen.ride .route-row {
  min-height: var(--rider-row-h);
  border-bottom: none;
  gap: 10px;
}

.screen.ride .route-row + .route-row {
  border-top: 1px solid var(--rider-line);
}

.screen.ride .route-row input {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  white-space: normal;
  word-spacing: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.screen.ride #destInput {
  font-family: var(--rider-search-font);
  font-size: 14px;
  font-weight: 500;
}

.screen.ride #destInput::placeholder {
  color: #94a3b8;
  font-weight: 600;
  opacity: 1;
}

.screen.ride .route-row--dest input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.screen.ride .route-dest-wrap {
  position: relative;
  z-index: 4;
}

.screen.ride .route-gps {
  position: relative;
  z-index: 4;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #ecfdf5;
  border-color: rgba(25, 169, 116, 0.16);
  color: var(--2t-accent-dark, #15803d);
  box-shadow: none;
}

.screen.ride .map-btn--fab {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.14);
}

/* ── سجل بحث الوجهة (مثل خرائط جوجل) ── */
.screen.ride .route-row input::placeholder {
  font-family: inherit;
  font-weight: 400;
}

.screen.ride .dest-history {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  z-index: 20;
}

.screen.ride .dest-history-title,
.screen.ride .dest-section-label {
  margin: 0 10px 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--rider-muted);
  letter-spacing: 0.02em;
}

.screen.ride .dest-history-list {
  display: grid;
  gap: 0;
  max-height: 184px;
  overflow-y: auto;
  border-radius: var(--rider-card-r);
  background: #fff;
  border: 1px solid var(--rider-line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.screen.ride .dest-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid var(--rider-line);
  background: #fff;
  text-align: right;
  cursor: pointer;
  transition: background 0.14s ease;
  font-family: var(--rider-search-font);
}

.screen.ride .dest-history-item:last-child {
  border-bottom: none;
}

.screen.ride .dest-history-item:hover,
.screen.ride .dest-history-item:active {
  background: #f8fafc;
}

.screen.ride .dest-history-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
}

.screen.ride .dest-history-icon .ui-icon {
  width: 14px;
  height: 14px;
}

.screen.ride .dest-history-text {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.screen.ride .dest-history-text strong {
  font-size: 13px;
  font-weight: 400;
  color: var(--rider-ink);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.screen.ride .dest-history-text small {
  font-size: 10px;
  font-weight: 400;
  color: var(--rider-muted);
}

.screen.ride .dest-panel-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--rider-muted);
  font-family: var(--rider-search-font);
  text-align: center;
}

/* ── الخدمات ── */
.screen.ride .section-head {
  margin-bottom: 6px;
}

.screen.ride .section-label {
  font-size: 13px;
  letter-spacing: -0.01em;
}

.screen.ride .vehicle-badge {
  background: #f1f5f9;
  color: var(--rider-ink);
  border: 1px solid var(--rider-line);
  font-size: 9px;
  letter-spacing: 0.02em;
  padding: 4px 8px;
}

.screen.ride .service-list {
  gap: 8px;
  margin-bottom: 10px;
}

.screen.ride .service-card {
  grid-template-columns: 72px 1fr auto;
  gap: 8px;
  padding: 8px 10px 8px 6px;
  border-radius: var(--rider-card-r);
  border: 1px solid transparent;
  background: #fff;
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
}

.screen.ride .service-card .service-vehicle-img {
  width: 72px;
  height: 50px;
  object-fit: contain;
  object-position: center bottom;
}

.screen.ride .service-card.selected {
  border-color: var(--rider-blue);
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.08),
    0 4px 14px rgba(37, 99, 235, 0.1);
}

.screen.ride .service-card .info small,
.screen.ride .service-card .meta strong,
.screen.ride .service-card .meta span {
  font-family: var(--rider-ar-font);
}

.screen.ride .service-card .info b {
  font-family: Cairo, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
  color: #121417;
}

.screen.ride .service-card .info small {
  font-size: 10px;
  font-weight: 500;
}

.screen.ride .service-card .meta strong {
  font-size: 14px;
  color: var(--rider-blue);
}

.screen.ride .service-card .meta span {
  font-size: 10px;
  color: var(--rider-green);
}

/* ── شريط الرحلة ── */
.screen.ride .trip-strip {
  gap: 5px;
  padding: 0;
  background: transparent;
  margin-bottom: 10px;
}

.screen.ride .trip-strip.visible,
.screen.ride .trip-strip.live {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.screen.ride .trip-chip {
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: var(--rider-card-r);
  background: #fff;
  border: 1px solid var(--rider-line);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.03);
}

.screen.ride .trip-chip strong {
  font-size: 12px;
}

.screen.ride .trip-chip.price strong {
  color: var(--rider-blue);
}

/* ── الدفع ── */
.screen.ride .pay-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
  padding: 3px;
  border-radius: var(--rider-card-r);
  background: #f1f5f9;
}

.screen.ride .pay-method {
  height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  color: var(--rider-muted);
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}

.screen.ride .pay-method.on {
  background: #fff;
  border-color: var(--rider-line);
  color: var(--rider-ink);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

/* ── زر الطلب ── */
.screen.ride .btn-request:not(:disabled) {
  height: 48px;
  border-radius: 14px;
  background: var(--2t-btn-primary, linear-gradient(145deg, #22c55e 0%, #16a34a 100%));
  box-shadow: var(--2t-btn-primary-shadow, 0 8px 20px rgba(34, 197, 94, 0.22));
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  color: #fff;
  border: none;
}

.screen.ride .btn-request:disabled {
  background: var(--2t-btn-primary-disabled, #e2e8f0);
  color: var(--2t-btn-primary-disabled-text, #94a3b8);
  opacity: 1;
  box-shadow: none;
}

/* ── البحث عن كابتن ── */
.screen.ride .search-panel h3 {
  font-size: 19px;
  letter-spacing: -0.02em;
}

.screen.ride .search-radar .core {
  background: linear-gradient(135deg, #34d399, #19a974);
}

.screen.ride .search-radar .ring {
  border-color: rgba(25, 169, 116, 0.22);
}

/* ── الكابتن ── */
.screen.ride .driver-status-bar {
  padding: 6px 10px;
  border-radius: var(--rider-card-r);
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid rgba(25, 169, 116, 0.14);
  color: #047857;
  margin-bottom: 10px;
  font-size: 12px;
}

.screen.ride .driver-eta-chip {
  background: #fff;
  color: #047857;
  border: 1px solid rgba(25, 169, 116, 0.18);
  font-weight: 800;
}

.screen.ride .driver-hero {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--rider-card-r);
  background: #fff;
  border: 1px solid var(--rider-line);
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
  margin-bottom: 10px;
}

.screen.ride .driver-hero .avatar-wrap,
.screen.ride .driver-hero .avatar-photo {
  width: 56px;
  height: 56px;
}

.screen.ride .avatar-photo {
  border-radius: 14px;
}

.screen.ride .driver-hero-text strong {
  font-size: 15px;
}

.screen.ride .driver-vehicle-card {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px 8px 6px;
  border-radius: var(--rider-card-r);
  background: #fff;
  border: 1px solid var(--rider-line);
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
  margin-bottom: 10px;
}

.screen.ride .driver-vehicle-card img {
  width: 72px;
  height: 50px;
  object-fit: contain;
  object-position: center bottom;
}

.screen.ride .driver-vehicle-meta b {
  font-size: 13px;
}

.screen.ride .driver-vehicle-meta span {
  font-size: 10px;
}

.screen.ride .plate-badge {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  background: linear-gradient(135deg, #0f172a, #334155);
}

/* ── الرحلة الجارية ── */
.screen.ride .live-status-card {
  padding: 12px;
  border-radius: var(--rider-card-r);
  background: #fff;
  border: 1px solid var(--rider-line);
  box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
  margin-bottom: 10px;
}

.screen.ride .status-stepper {
  gap: 4px;
  margin-bottom: 8px;
}

.screen.ride .status-stepper .step.on {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.screen.ride .status-stepper .step.done {
  background: #86efac;
}

.screen.ride .live-status-card strong {
  font-size: 15px;
  letter-spacing: 0;
}

.screen.ride .live-status-card p {
  font-size: 11px;
}

.screen.ride .wallet-balance {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: var(--rider-card-r);
  font-size: 11px;
}

.screen.ride .wallet-balance strong {
  font-size: 13px;
}

.screen.ride .btn-cancel-trip {
  border-radius: var(--rider-card-r);
  height: 44px;
  font-size: 13px;
}

@media (max-width: 460px) {
  .screen.ride .service-card {
    grid-template-columns: 68px 1fr auto;
  }

  .screen.ride .service-card .service-vehicle-img {
    width: 68px;
    height: 46px;
  }

  .screen.ride .trip-strip.visible,
  .screen.ride .trip-strip.live {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .screen.ride .trip-chip strong {
    font-size: 11px;
  }
}
