/* ══════════════════════════════════════════
   SANS Portal — Login + Dashboard CSS
   Colors: Navy #0B1628 | Blue #1B4FFF | Amber #F59E0B | White #E8EAF0
══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0B1628;
  --navy2: #111827;
  --blue: #1B4FFF;
  --blue-hover: #1440e0;
  --amber: #F59E0B;
  --white: #E8EAF0;
  --muted: #9BA3AF;
  --card-bg: #141F33;
  --border: rgba(255,255,255,0.08);
  --green: #10B981;
  --red: #EF4444;
  --orange: #F97316;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--navy);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* ══ LOGIN PAGE ══ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px 16px;
}

.login-bg-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.login-bg-logo img {
  width: min(70vw, 500px);
  opacity: 0.04;
  filter: invert(1);
  user-select: none;
}

.login-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(11,22,40,0.6) 0%, rgba(11,22,40,0.95) 70%);
  z-index: 1;
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  background: rgba(20, 31, 51, 0.95);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  backdrop-filter: blur(20px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo img {
  height: 52px;
  filter: invert(1);
  object-fit: contain;
}

.login-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  text-align: center;
  color: var(--white);
  margin-bottom: 6px;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 28px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-group input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--blue);
  background: rgba(27,79,255,0.06);
}

.form-group input::placeholder { color: rgba(232,234,240,0.3); }

.input-password-wrap {
  position: relative;
}

.input-password-wrap input {
  width: 100%;
  padding-right: 44px;
}

.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.toggle-pw:hover { color: var(--white); }

.login-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #FCA5A5;
}

.btn-login {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-login:hover { background: var(--blue-hover); }
.btn-login:active { transform: scale(0.98); }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-footer-note {
  margin-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--white); }

/* ══ DASHBOARD HEADER ══ */
.dash-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11,22,40,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.dash-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-logo img {
  height: 40px;
  filter: invert(1);
  object-fit: contain;
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-client-name {
  font-size: 0.9rem;
  color: var(--muted);
}

.btn-logout {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: 8px;
  padding: 7px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); }

/* ══ DASHBOARD MAIN ══ */
.dash-main {
  min-height: calc(100vh - 64px);
  background: var(--navy);
  padding: 32px 0 60px;
}

.dash-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.dash-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.dash-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--white);
}

.dash-client-badge {
  background: rgba(27,79,255,0.15);
  border: 1px solid rgba(27,79,255,0.3);
  color: #93A8FF;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ══ STATS ══ */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon--blue { background: rgba(27,79,255,0.15); color: #93A8FF; }
.stat-icon--amber { background: rgba(245,158,11,0.15); color: var(--amber); }
.stat-icon--green { background: rgba(16,185,129,0.15); color: var(--green); }

.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--white);
  line-height: 1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ══ DELIVERY CARDS ══ */
.deliveries-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 0;
  color: var(--muted);
}

.spinner-large {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.delivery-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

.delivery-card:hover {
  border-color: rgba(27,79,255,0.4);
  transform: translateY(-1px);
}

.delivery-card--in-transit {
  border-left: 3px solid var(--amber);
}

.delivery-card--delivered {
  border-left: 3px solid var(--green);
}

.delivery-card--pending {
  border-left: 3px solid var(--muted);
}

.delivery-card--cancelled {
  border-left: 3px solid var(--red);
}

.delivery-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.delivery-tracking {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--white);
}

.delivery-status-badge {
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge--in-transit { background: rgba(245,158,11,0.15); color: var(--amber); border: 1px solid rgba(245,158,11,0.3); }
.badge--delivered { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.badge--pending { background: rgba(155,163,175,0.15); color: var(--muted); border: 1px solid rgba(155,163,175,0.2); }
.badge--out_for_delivery { background: rgba(27,79,255,0.15); color: #93A8FF; border: 1px solid rgba(27,79,255,0.3); }
.badge--picked_up { background: rgba(147,168,255,0.12); color: #93A8FF; border: 1px solid rgba(147,168,255,0.2); }
.badge--cancelled { background: rgba(239,68,68,0.12); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.2); }

.delivery-route {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.delivery-city {
  font-size: 0.9rem;
  color: var(--white);
  font-weight: 500;
}

.delivery-arrow {
  color: var(--muted);
  font-size: 0.9rem;
}

.delivery-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.delivery-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.delivery-meta-item svg { flex-shrink: 0; }

.delivery-progress {
  margin-top: 16px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--blue), var(--amber));
  transition: width 0.6s ease;
}

/* ══ MODAL ══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--white); }

.modal-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: 6px;
  padding-right: 40px;
}

.modal-tracking-num {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.modal-section {
  margin-bottom: 22px;
}

.modal-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.88rem;
}

.modal-detail-row:last-child { border-bottom: none; }

.modal-detail-label { color: var(--muted); }
.modal-detail-value { color: var(--white); text-align: right; font-weight: 500; }

/* ══ MAP SECTION ══ */
.modal-map-section {
  margin-top: 4px;
}

.modal-driver-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(27,79,255,0.1);
  border: 1px solid rgba(27,79,255,0.25);
  border-radius: 10px 10px 0 0;
  padding: 12px 16px;
  border-bottom: none;
}

.modal-driver-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(27,79,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #93A8FF;
}

.modal-driver-info {
  flex: 1;
}

.modal-driver-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--white);
  line-height: 1.2;
}

.modal-driver-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.modal-driver-phone {
  color: #93A8FF;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.modal-driver-phone:hover { color: var(--white); }

.modal-map-embed {
  width: 100%;
  height: 280px;
  border: 1px solid rgba(27,79,255,0.25);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  position: relative;
  background: #0d1a2e;
}

.modal-map-embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.modal-map-open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: rgba(27,79,255,0.12);
  border: 1px solid rgba(27,79,255,0.3);
  color: #93A8FF;
  border-radius: 8px;
  padding: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  margin-top: 6px;
}
.modal-map-open-btn:hover { background: rgba(27,79,255,0.2); }

.modal-gps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: rgba(27,79,255,0.12);
  border: 1px solid rgba(27,79,255,0.3);
  color: #93A8FF;
  border-radius: 10px;
  padding: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  margin-top: 8px;
}
.modal-gps-btn:hover { background: rgba(27,79,255,0.2); }

.delivered-banner {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.delivered-banner svg { color: var(--green); flex-shrink: 0; margin-top: 2px; }

.delivered-banner-text h4 {
  font-weight: 600;
  color: var(--green);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.delivered-banner-text p {
  font-size: 0.82rem;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 60px 0;
  color: var(--muted);
}

.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ══ RESPONSIVE ══ */
@media (max-width: 640px) {
  .login-card { padding: 28px 20px; }
  .dash-stats { grid-template-columns: 1fr; }
  .dash-container { padding: 0 16px; }
  .dash-title { font-size: 1.4rem; }
  .delivery-card { padding: 16px; }
  .delivery-meta { gap: 12px; }
  .modal-card { padding: 24px 18px; }
}

@media (max-width: 400px) {
  .dash-title-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}
