/* ===== بوابة الزبون — أنماط خاصة (تعتمد متغيّرات الثيم من styles.css) ===== */

.portal-main { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }

/* الهيدر: أكشنز الزبون */
.header-actions[hidden] { display: none; }
.cust-name { font-weight: 800; color: var(--navy-2); font-size: .95rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout { padding: 8px 14px; font-size: .85rem; }

/* جرس الإشعارات */
.bell-btn { position: relative; background: transparent; border: 0; cursor: pointer; padding: 6px; line-height: 1; min-width: 44px; min-height: 44px; }
.bell-ic { font-size: 1.5rem; }
.bell-count {
  position: absolute; top: 2px; inset-inline-start: 2px;
  background: var(--gold); color: #fff; font-size: .66rem; font-weight: 900;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.bell-count[hidden] { display: none; }

/* ===== تسجيل الدخول ===== */
.login-wrap { display: flex; justify-content: center; padding: 30px 0; }
.login-card { background: var(--card); width: min(440px, 100%); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.login-head { background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; padding: 22px 20px; }
.login-head h2 { margin: 0; font-size: 1.3rem; }
.login-sub { margin: 6px 0 0; color: var(--gold-soft); font-size: .88rem; }
.login-step { padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.fld-label { font-size: .82rem; font-weight: 800; color: var(--navy-2); margin-top: 6px; }
.fld { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 1.05rem; font-family: inherit; background: var(--card); color: var(--ink); min-height: 48px; }
.fld:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.code-input { text-align: center; letter-spacing: 10px; font-size: 1.5rem; font-weight: 800; direction: ltr; }
.code-hint { font-size: .9rem; color: var(--muted); margin: 0 0 4px; line-height: 1.6; }
.code-hint span { font-weight: 800; color: var(--navy-2); direction: ltr; unicode-bidi: embed; }
.btn-block { width: 100%; padding: 14px; font-size: 1rem; margin-top: 8px; }
.form-msg { padding: 0 20px 18px; font-size: .9rem; font-weight: 700; min-height: 1.1em; }
.form-msg.ok { color: var(--good); }
.form-msg.err { color: var(--gold); }

/* ===== لوحة الطلبات ===== */
.dash-title { color: var(--navy-2); font-size: 1.25rem; margin: 8px 4px 16px; }
.orders-list { display: flex; flex-direction: column; gap: 16px; }

.order-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.order-card.cancelled { opacity: .82; }
.oc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.oc-vehicle { font-weight: 900; color: var(--navy-2); font-size: 1.05rem; line-height: 1.35; }
.oc-ref { font-size: .72rem; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.badge-cancel { flex: none; background: #fde8e8; color: var(--gold); border: 1px solid var(--gold-soft); font-size: .72rem; font-weight: 900; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }

.oc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 14px 16px; }
.oc-meta .m-row { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.oc-meta .m-label { font-size: .7rem; color: var(--muted); font-weight: 700; }
.oc-meta .m-val { font-size: .9rem; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.oc-meta .m-val.total { color: var(--good); font-weight: 900; font-variant-numeric: tabular-nums; }

/* ===== الخطّ الزمني الأفقي ===== */
.timeline { padding: 16px 10px 18px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.timeline-track { display: flex; align-items: flex-start; min-width: 540px; }
.tl-step { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; position: relative; text-align: center; }
/* الخطّ الواصل بين النقاط (RTL: يمتدّ من مركز النقطة نحو الخطوة التالية على اليسار) */
.tl-step::before {
  content: ""; position: absolute; top: 13px; height: 4px; border-radius: 2px;
  inset-inline-start: -50%; width: 100%; background: var(--line); z-index: 0;
}
.tl-step:first-child::before { display: none; }
.tl-dot {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; border: 3px solid var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 900;
  transition: all .2s;
}
.tl-label { margin-top: 7px; font-size: .68rem; font-weight: 800; color: var(--muted); line-height: 1.25; max-width: 74px; }

/* مكتملة: أخضر */
.tl-step.done .tl-dot { background: var(--good); border-color: var(--good); color: #fff; }
.tl-step.done::before { background: var(--good); }
.tl-step.done .tl-label { color: var(--good); }

/* الحالية: أحمر نابض */
.tl-step.current .tl-dot { background: var(--gold); border-color: var(--gold); color: #fff; box-shadow: 0 0 0 0 rgba(191, 34, 41, .5); animation: tl-pulse 1.6s infinite; }
.tl-step.current .tl-label { color: var(--gold); }
/* الخطّ الذي يدخل الخطوة الحالية (السابق له مكتمل) يبقى أخضر؛ نتركه افتراضياً */
@keyframes tl-pulse {
  0% { box-shadow: 0 0 0 0 rgba(191, 34, 41, .5); }
  70% { box-shadow: 0 0 0 10px rgba(191, 34, 41, 0); }
  100% { box-shadow: 0 0 0 0 rgba(191, 34, 41, 0); }
}

/* تذييل بطاقة الطلب: زر الدردشة */
.oc-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.btn-chat { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-chat .chat-ic { font-size: 1.1rem; }

/* ===== Overlays / Drawers ===== */
.overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 20, 25, .55); display: flex; }
.overlay[hidden] { display: none; }
.notif-drawer { margin-inline-start: auto; }
.chat-drawer { margin-inline-start: auto; }
.drawer { background: var(--card); width: min(440px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.3); animation: drawer-in .2s ease; }
@keyframes drawer-in { from { transform: translateX(-100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; padding: 14px 16px; }
.drawer-head h3 { margin: 0; font-size: 1.05rem; flex: 1; }
.drawer-x { background: transparent; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; min-width: 40px; min-height: 40px; }
.drawer-actions { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.btn-sm { padding: 7px 12px; font-size: .82rem; }

/* الإشعارات */
.notif-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.notif-item { padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif-item.unread { background: #fff8f8; border-inline-start: 4px solid var(--gold); }
.notif-title { font-weight: 800; color: var(--navy-2); font-size: .92rem; }
.notif-body { color: var(--ink); font-size: .85rem; margin-top: 3px; line-height: 1.5; }
.notif-time { color: var(--muted); font-size: .72rem; margin-top: 4px; }

/* الدردشة */
.chat-head { align-items: flex-start; }
.chat-head-info { flex: 1; }
.chat-head-info h3 { margin: 0; font-size: 1rem; }
.chat-sub { font-size: .76rem; color: var(--gold-soft); }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.msg { max-width: 80%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; line-height: 1.5; word-break: break-word; }
.msg-meta { font-size: .66rem; color: var(--muted); margin-top: 4px; }
.msg.them { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--gold); color: #fff; border-bottom-left-radius: 4px; }
.msg.me .msg-meta { color: rgba(255,255,255,.8); }
.msg.them .msg-sender { font-weight: 800; color: var(--gold); font-size: .72rem; margin-bottom: 2px; display: block; }
.chat-empty { text-align: center; color: var(--muted); font-size: .85rem; padding: 30px 16px; }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--card); }
.chat-input { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .95rem; font-family: inherit; min-height: 46px; }
.chat-input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.chat-send-btn { padding: 12px 18px; white-space: nowrap; }

/* حالات فارغة */
.empty-state { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty-ic { font-size: 2.6rem; margin-bottom: 8px; }

@media (max-width: 480px) {
  .oc-meta { grid-template-columns: 1fr 1fr; }
  .cust-name { max-width: 90px; }
  .timeline-track { min-width: 500px; }
}
