/* ================================================================
   tracker.css — BGI Freight Customer Tracker
   ================================================================ */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f7;
  color: #1a2035;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
.tracker-header {
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.tracker-logo { font-weight: 800; font-size: 18px; color: #1a2035; letter-spacing: -.3px; }
.logo-accent  { color: #1a73e8; }
.customer-name { font-size: 13px; color: #666; }
.header-actions { display: flex; gap: 12px; align-items: center; }

/* ── Cards ───────────────────────────────────────────────────── */
.tracker-card {
  max-width: 560px;
  margin: 28px auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 14px rgba(0,0,0,.08);
  padding: 28px 24px;
}

.detail-main, .form-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.detail-card, .form-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  padding: 18px 20px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #888;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  padding: 20px 0 12px;
}

/* ── Status badges ───────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge-pending-review    { background: #f5f5f5;  color: #777; }
.badge-scheduled         { background: #e8f0fe;  color: #1a73e8; }
.badge-appt-pending      { background: #fff8e1;  color: #f57c00; }
.badge-appt-confirmed    { background: #e3f2fd;  color: #0d47a1; }
.badge-appt-declined     { background: #fce4ec;  color: #c62828; }
.badge-out               { background: #fff3e0;  color: #e65100; }
.badge-delivered         { background: #e6f4ea;  color: #1e8e3e; }

/* ── Progress steps ──────────────────────────────────────────── */
.track-steps {
  display: flex;
  align-items: center;
  margin: 20px 0 4px;
}
.step { display: flex; flex-direction: column; align-items: center; flex: 0 0 auto; }
.step-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #dde2ee;
  border: 2px solid #dde2ee;
  transition: background .3s;
}
.step-active .step-dot  { background: #1a73e8; border-color: #1a73e8; box-shadow: 0 0 0 3px #c5d8fc; }
.step-done .step-dot    { background: #1a73e8; border-color: #1a73e8; }
.step-label { font-size: 10px; color: #aaa; margin-top: 5px; white-space: nowrap; }
.step-done .step-label, .step-active .step-label { color: #1a73e8; font-weight: 600; }
.step-line { flex: 1; height: 2px; background: #dde2ee; margin: 0 4px 18px; }
.step-line.done { background: #1a73e8; }

/* ── Detail rows ─────────────────────────────────────────────── */
.track-status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}
.detail-tracking-num { font-size: 12px; color: #999; margin-top: 4px; }
.detail-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f2f4f8;
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #999; min-width: 100px; flex-shrink: 0; font-size: 13px; }
.detail-value { color: #1a2035; font-weight: 500; word-break: break-word; }
.mono { font-family: 'SF Mono', 'Consolas', monospace; }
.text-muted { font-size: 13px; color: #888; }
.ml-8 { margin-left: 8px; }
.mt-8 { margin-top: 8px; }

/* ── Appointment ─────────────────────────────────────────────── */
.info-panel {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #f0f7ff;
  border: 1px solid #c5d8fc;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.info-panel-icon { font-size: 22px; }
.info-panel-title { font-size: 12px; font-weight: 600; color: #1a73e8; text-transform: uppercase; letter-spacing: .4px; }
.info-panel-value { font-size: 17px; font-weight: 700; margin: 3px 0 2px; }
.info-panel-sub   { font-size: 12px; color: #666; }

.appt-date-big { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.appt-window   { font-size: 15px; color: #444; margin-bottom: 8px; }
.appt-status-label { font-size: 13px; color: #888; margin-bottom: 8px; }

.appt-prompt { font-size: 13px; color: #555; margin-bottom: 12px; }
.appt-btn-row { display: flex; gap: 10px; }
.btn-confirm {
  flex: 1; padding: 11px;
  background: #1e8e3e; color: #fff;
  border: none; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.btn-confirm:hover { background: #166d32; }
.btn-decline {
  flex: 1; padding: 11px;
  background: #fff; color: #c62828;
  border: 1.5px solid #c62828; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.btn-decline:hover { background: #fce4ec; }

/* ── Map ─────────────────────────────────────────────────────── */
.map-container {
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0 8px;
  border: 1px solid #e5e9f0;
}
.map-header { display: flex; align-items: center; justify-content: space-between; }
.map-title  { font-size: 13px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: .5px; }
.phase-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 10px;
  text-transform: uppercase; letter-spacing: .5px;
}
.phase-fuzzy  { background: #fff3e0; color: #e65100; }
.phase-direct { background: #e6f4ea; color: #1e8e3e; }
.map-message { font-size: 12px; color: #666; line-height: 1.5; }
.map-last-update { font-size: 11px; color: #aaa; margin-top: 4px; }
.driver-info-row { display: flex; gap: 12px; font-size: 13px; color: #555; margin-top: 8px; }

/* ── Collapsible sections ────────────────────────────────────── */
.toggle-header { cursor: pointer; user-select: none; margin-bottom: 0; }
.toggle-header:hover { color: #1a73e8; }
.toggle-icon { float: right; font-size: 11px; transition: transform .2s; }
.toggle-header.open .toggle-icon { transform: rotate(180deg); }
.collapsible-body { padding-top: 12px; }

/* ── OSD exception ───────────────────────────────────────────── */
.osd-card { border-left: 4px solid #e65100; }
.osd-type-badge {
  display: inline-block;
  padding: 4px 12px; border-radius: 20px;
  background: #fff3e0; color: #e65100;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
  margin-bottom: 6px;
}
.osd-status { font-size: 13px; color: #777; margin-bottom: 4px; }
.osd-desc   { font-size: 14px; color: #333; }

.osd-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  cursor: pointer;
  font-size: 14px;
  color: #e65100;
  font-weight: 600;
}
.osd-toggle input { width: 16px; height: 16px; cursor: pointer; accent-color: #e65100; }

.osd-form-inner { background: #fff8f5; border: 1px solid #ffd0b0; border-radius: 10px; padding: 16px; }
.osd-type-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.radio-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 20px;
  border: 1.5px solid #dde2ee;
  font-size: 13px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.radio-chip:has(input:checked) { border-color: #e65100; background: #fff3e0; color: #e65100; font-weight: 600; }
.radio-chip input { display: none; }

/* ── Star rating ─────────────────────────────────────────────── */
.stars-row { display: flex; gap: 8px; margin-bottom: 16px; }
.star {
  font-size: 36px; color: #dde2ee; cursor: pointer;
  transition: color .15s, transform .1s;
  user-select: none;
}
.star:hover, .star.active { color: #f9a825; }
.star:active { transform: scale(1.2); }

.stars-display { display: flex; gap: 4px; margin-bottom: 8px; }
.stars-display .star-filled { font-size: 22px; color: #f9a825; }
.stars-display .star-empty  { font-size: 22px; color: #dde2ee; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag {
  padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid #dde2ee;
  font-size: 13px; cursor: pointer;
  transition: border-color .2s, background .2s;
  user-select: none;
}
.tag.selected { border-color: #1a73e8; background: #e8f0fe; color: #1a73e8; font-weight: 600; }

.rated-panel { margin-top: 12px; }
.rated-tags  { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.rated-tag   { padding: 4px 12px; border-radius: 20px; background: #e8f0fe; color: #1a73e8; font-size: 12px; }
.rated-comment { font-size: 14px; color: #555; font-style: italic; }

/* ── Photo upload ────────────────────────────────────────────── */
.photo-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 10px;
}
.photo-thumb {
  width: 76px; height: 76px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid #dde2ee;
  position: relative;
}
.photo-thumb-wrap {
  position: relative; width: 76px; height: 76px;
}
.photo-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-remove {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: #d32f2f; color: #fff;
  border-radius: 50%; border: none;
  font-size: 12px; line-height: 20px; text-align: center;
  cursor: pointer; font-weight: 700;
}
.btn-photo-add {
  display: inline-block;
  padding: 8px 16px; border-radius: 8px;
  border: 1.5px dashed #1a73e8;
  color: #1a73e8; font-size: 13px; font-weight: 600;
  cursor: pointer; margin-bottom: 14px;
}
.btn-photo-add:hover { background: #e8f0fe; }

/* ── Form fields ─────────────────────────────────────────────── */
.field-label { display: block; font-size: 12px; font-weight: 600; color: #666; margin: 12px 0 5px; }
.field-label:first-child { margin-top: 0; }
.required { color: #d32f2f; }

.input-field {
  width: 100%; padding: 11px 13px;
  border: 1.5px solid #dde2ee; border-radius: 8px;
  font-size: 14px; outline: none;
  font-family: inherit;
  transition: border-color .2s;
  background: #fff;
}
.input-field:focus { border-color: #1a73e8; }
.textarea { resize: vertical; min-height: 80px; }
select.input-field { cursor: pointer; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 440px) { .two-col { grid-template-columns: 1fr; } }

.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f2f4f8;
  cursor: pointer; font-size: 14px; line-height: 1.4;
}
.check-row:last-of-type { border-bottom: none; }
.check-row input { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; accent-color: #1a73e8; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: block; width: 100%; padding: 13px;
  background: #1a73e8; color: #fff;
  border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 16px;
  transition: background .2s;
  font-family: inherit;
}
.btn-primary:hover { background: #1557b0; }
.btn-primary:disabled { background: #b0c4e8; cursor: not-allowed; }

.btn-secondary {
  display: block; width: 100%; padding: 11px;
  background: #f4f6f9; color: #1a2035;
  border: 1px solid #dde2ee; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; margin-top: 10px; font-family: inherit;
}
.btn-secondary:hover { background: #e8ecf4; }
.btn-link {
  background: none; border: none;
  color: #1a73e8; font-size: 14px;
  cursor: pointer; padding: 4px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* ── Login ───────────────────────────────────────────────────── */
.tracker-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.login-sub { font-size: 14px; color: #666; margin-bottom: 18px; line-height: 1.5; }
.otp-input { letter-spacing: 10px; font-size: 24px; text-align: center; }
.field-error { color: #d32f2f; font-size: 13px; margin-top: 6px; min-height: 18px; }

/* ── Orders list ─────────────────────────────────────────────── */
.orders-list { max-width: 600px; margin: 0 auto; padding: 0 16px 32px; }
.order-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,.07);
  padding: 16px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: box-shadow .2s;
}
.order-card:hover { box-shadow: 0 3px 14px rgba(0,0,0,.12); }
.order-card-top   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-tracking   { font-size: 12px; color: #aaa; font-family: monospace; }
.order-title      { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.order-sub        { font-size: 13px; color: #777; }
.order-appt-alert {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: #f57c00;
  background: #fff8e1; padding: 3px 10px; border-radius: 10px;
  margin-top: 8px;
}

/* ── State messages ──────────────────────────────────────────── */
.state-msg {
  text-align: center; color: #999; padding: 40px 0; font-size: 15px;
}
.state-msg.error { color: #d32f2f; }

/* ── Decline modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal {
  background: #fff; border-radius: 16px;
  padding: 32px 28px; max-width: 360px; width: 90%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.modal-icon { font-size: 40px; margin-bottom: 12px; }
.modal h3   { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.modal p    { font-size: 14px; color: #555; line-height: 1.6; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a2035; color: #fff;
  padding: 11px 22px; border-radius: 10px;
  font-size: 14px; opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none; white-space: nowrap;
  z-index: 999;
}
.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #1e8e3e; }
.toast.error   { background: #d32f2f; }
.toast.warning { background: #e65100; }

/* ── Responsive tweaks ───────────────────────────────────────── */
@media (max-width: 480px) {
  .tracker-card { margin: 12px; padding: 20px 16px; }
  .detail-main, .form-main { padding: 8px 8px 40px; }
  .appt-btn-row { flex-direction: column; }
  .map-container { height: 180px; }
  .page-title { padding: 12px 0 8px; }
}
