/* ============================================================
   1. GLOBAL THEME — DARK TRAVELER UI
   ============================================================ */
:root {
  --sidebar-width: 260px;        /* Desktop width */
  --sidebar-width-mobile: 100%;  /* Mobile override */
  --panel-radius: 14px;
  --panel-bg: radial-gradient(circle at top left, #020617 0, #020617 70%);
  --border-color: #1f2937;
  --text-light: #e2e8f0;
  --text-muted: #94a3b8;
  --blue: #3b82f6;
  --blue-dark: #2563eb;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #1e293b 0, #020617 55%, #000 100%);
  color: var(--text-light);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

button,
input,
textarea,
select {
  transition: all 0.18s ease-out;
}

/* Mobile override for sidebar width */
@media (max-width: 768px) {
  :root {
    --sidebar-width: var(--sidebar-width-mobile);
  }
}

/* ============================================================
   2. MAIN APP LAYOUT
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Mobile fix: allow scrolling + avoid 100vh bug */
@media (max-width: 768px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Mobile fix: allow main content to scroll */
@media (max-width: 768px) {
  .main-layout {
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column;
  }
}

/* ============================================================
   3. TOP NAVIGATION BAR
   ============================================================ */
.top-nav {
  height: 56px;
  background: #0f172a;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 50;
}

/* Shared desktop styles */
.top-nav-left,
.top-nav-center,
.top-nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-nav-title-main {
  font-size: 1rem;
  font-weight: 600;
}

.top-nav-title-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.top-nav-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #1e293b;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.top-nav-search input {
  background: transparent;
  border: none;
  color: var(--text-light);
  outline: none;
  font-size: 0.85rem;
}

/* ============================================================
   MOBILE FIXES — FULL RESPONSIVENESS
   ============================================================ */
@media (max-width: 768px) {

  .top-nav {
    height: auto;
    padding: 0.75rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .top-nav-left,
  .top-nav-center,
  .top-nav-right {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .top-nav-search {
    width: 100%;
    padding: 8px 12px;
  }

  .top-nav-search input {
    width: 100%;
    font-size: 0.9rem;
  }

  .top-nav-title-main {
    font-size: 1.1rem;
  }

  .top-nav-title-sub {
    font-size: 0.8rem;
  }
}

/* ============================================================
   4. SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: #020617;
  border-right: 1px solid var(--border-color);
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

/* Mobile: sidebar becomes full-width and stacks above content */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-width-mobile); /* 100% */
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
  }
}

.sidebar-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 0.9rem;
}

.sidebar-item:hover {
  background: #0f172a;
}

.sidebar-item.active {
  background: #0f172a;
  border-left: 3px solid var(--blue);
  box-shadow: 0 0 0 1px rgba(15,23,42,0.9), 0 10px 25px rgba(15,23,42,0.9);
}

.sidebar-item svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-light);
}

.sidebar-item.active svg {
  stroke: var(--blue);
}

.sidebar-footer {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Mobile: tighten spacing */
@media (max-width: 768px) {
  .sidebar-item {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .sidebar-item svg {
    width: 16px;
    height: 16px;
  }

  .sidebar-footer {
    margin-top: 1.5rem;
    font-size: 0.7rem;
  }
}

/* ============================================================
   5. CONTENT AREA
   ============================================================ */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: transparent;
}

/* Mobile: prevent double scrolling and allow natural height */
@media (max-width: 768px) {
  .content-area {
    overflow-y: visible;
    padding: 0.75rem;
  }
}

.main-content {
  height: 100%;
}

/* Mobile: avoid forced height that breaks layout */
@media (max-width: 768px) {
  .main-content {
    height: auto;
    min-height: 100%;
  }
}

/* ============================================================
   6. TOP COLUMNS LAYOUT
   ============================================================ */
#jobsLayout {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
}

.top-columns {
  display: grid;
  grid-template-columns: 1.2fr 1fr; /* Desktop: 2 columns */
  gap: 1.2rem;
  width: 100%;
}

/* Mobile: stack columns vertically */
@media (max-width: 768px) {
  .top-columns {
    grid-template-columns: 1fr; /* Single column */
    gap: 1rem;
  }
}

/* ============================================================
   7. PANEL BASE STYLE
   ============================================================ */

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--panel-radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 35px rgba(15,23,42,0.95);
}

/* Mobile: reduce padding for better spacing */
@media (max-width: 768px) {
  .panel {
    padding: 0.75rem;
  }
}

.panel-header {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.panel-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.panel-body {
  flex: 1;
  padding-top: 0.75rem;
  overflow-y: auto;
}

/* Mobile: avoid double scrolling inside panels */
@media (max-width: 768px) {
  .panel-body {
    overflow-y: visible;
    padding-top: 0.6rem;
  }
}

/* ============================================================
   8. ROUTE PLANNER
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

/* Mobile: ensure single-column layout on small screens */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.required {
  color: #ef4444;
  margin-left: 4px;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #0f172a;
  border: 1px solid var(--border-color);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
}

/* Mobile: tighter spacing + better readability */
@media (max-width: 768px) {
  .input-shell {
    padding: 0.5rem 0.65rem;
  }
}

.input-shell input,
.input-shell select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-light);
  outline: none;
  font-size: 0.85rem;
}

/* Mobile: slightly larger font for readability */
@media (max-width: 768px) {
  .input-shell input,
  .input-shell select {
    font-size: 0.9rem;
  }
}

/* ============================================================
   9. SEARCH BUTTON
   ============================================================ */
#generate-matches-btn {
  width: fit-content; /* Desktop */
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Mobile: full-width button for better UX */
@media (max-width: 768px) {
  #generate-matches-btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 1rem;
  }
}

#generate-matches-btn i {
  stroke: white;
}

/* ============================================================
   10. MAP CONTAINER
   ============================================================ */
#travelerMap {
  width: 100%;
  height: 260px; /* Desktop */
  border-radius: 10px;
  margin-top: 1rem;
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 25px rgba(15,23,42,0.9);
  position: relative;
  z-index: 1;
}

/* Mobile: reduce height for small screens */
@media (max-width: 768px) {
  #travelerMap {
    height: 200px;
    margin-top: 0.75rem;
  }
}

/* Very small devices (iPhone SE, older Android) */
@media (max-width: 480px) {
  #travelerMap {
    height: 170px;
  }
}

/* Tablets: increase height slightly */
@media (min-width: 769px) and (max-width: 1024px) {
  #travelerMap {
    height: 300px;
  }
}

/* ============================================================
   11. JOBS PANEL
   ============================================================ */
#jobsPanel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px); /* Desktop */
  overflow-y: auto;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--panel-radius);
  padding: 1rem;
  box-shadow: 0 14px 35px rgba(15,23,42,0.95);
}

/* Mobile: remove forced height + remove scroll lock */
@media (max-width: 768px) {
  #jobsPanel {
    max-height: none;
    overflow-y: visible;
    padding: 0.75rem;
  }
}

#jobsCount {
  font-size: 0.75rem;
  color: var(--text-muted);
}

#jobsPanel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding-top: 1rem;
}

/* Mobile: avoid double scrolling inside jobs panel */
@media (max-width: 768px) {
  #jobsPanel .panel-body {
    overflow-y: visible;
    padding-top: 0.75rem;
  }
}

/* ============================================================
   12. EARNINGS SUMMARY
   ============================================================ */
.earnings-summary {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--panel-radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 14px 35px rgba(15,23,42,0.95);
}

/* Mobile: reduce padding for better spacing */
@media (max-width: 768px) {
  .earnings-summary {
    padding: 0.75rem;
    gap: 0.5rem;
  }
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Mobile: stack rows vertically for readability */
@media (max-width: 768px) {
  .summary-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.95rem; /* slightly larger for mobile */
  }
}

.summary-row strong {
  color: var(--blue);
  font-weight: 600;
}

/* ============================================================
   13. JOB TABS
   ============================================================ */
.jobs-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

/* Mobile: stack tabs vertically */
@media (max-width: 768px) {
  .jobs-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }
}

.jobs-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

/* Mobile: better tap target + readability */
@media (max-width: 768px) {
  .jobs-tab {
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
  }
}

.jobs-tab:hover {
  border-color: #334155;
  color: var(--text-light);
}

.jobs-tab.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-color: var(--blue);
  color: white;
  box-shadow: 0 10px 25px rgba(37,99,235,0.45);
}

/* ============================================================
   14. JOB LISTS (SCROLL FIX APPLIED)
   ============================================================ */
.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 4px;
  height: 100%;          /* Desktop */
  overflow-y: auto;      /* Desktop */
}

/* Mobile: remove forced height + remove scroll lock */
@media (max-width: 768px) {
  .jobs-list {
    height: auto;
    overflow-y: visible;
    padding-right: 0;
  }
}

#jobsAvailableList,
#jobsAcceptedList,
#jobsCompletedList {
  overflow-y: auto;
  max-height: calc(100vh - 420px); /* Desktop */
  padding-right: 6px;
  scrollbar-width: thin;
}

/* Mobile: remove max-height + remove nested scrolling */
@media (max-width: 768px) {
  #jobsAvailableList,
  #jobsAcceptedList,
  #jobsCompletedList {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}

.empty-state {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Mobile: tighten spacing */
@media (max-width: 768px) {
  .empty-state {
    padding: 0.75rem;
    font-size: 0.85rem;
  }
}

/* ============================================================
   15. JOB CARD — BASE STYLE (CONTRAST FIX APPLIED)
   ============================================================ */
.job-card {
  background: #0b1220; /* FIXED for clarity */
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 14px 35px rgba(15,23,42,0.95);
  position: relative;
  overflow: hidden;
}

/* Mobile: tighten spacing + improve readability */
@media (max-width: 768px) {
  .job-card {
    padding: 0.75rem;
    gap: 0.6rem;
  }
}

.job-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(56,189,248,0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease-out;
  z-index: -1;
}

.job-card:hover::before {
  opacity: 1;
}

/* ============================================================
   16. NEW: ICONS (Pickup, Dropoff, Money)
   ============================================================ */
.icon-pin {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
}

.icon-pin.pickup { background: #22c55e; }   /* green */
.icon-pin.dropoff { background: #ef4444; } /* red */

.icon-money {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: gold;
  border-radius: 3px;
  margin-right: 6px;
}

/* ============================================================
   17. NEW: DISTANCE BADGES
   ============================================================ */
.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: white;
  font-weight: 600;
}

.badge-green { background: #22c55e; }
.badge-orange { background: #f59e0b; }
.badge-red { background: #ef4444; }

/* ============================================================
   NEW: JOB CARD HEADER (Badge + Details Button)
   ============================================================ */
.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Mobile: stack header elements */
@media (max-width: 768px) {
  .job-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

.details-btn {
  background: #1e293b;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--text-light);
  font-size: 0.75rem;
  cursor: pointer;
}

.details-btn:hover {
  background: #334155;
}

/* ============================================================
   16. JOB MAIN ROW (ROUTE + META)
   ============================================================ */
.job-main {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

/* Mobile: stack route + meta vertically */
@media (max-width: 768px) {
  .job-main {
    flex-direction: column;
    gap: 0.75rem;
  }
}

.job-route {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.job-pickup,
.job-dropoff {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.job-pickup::before,
.job-dropoff::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.job-pickup::before { background: #22c55e; }
.job-dropoff::before { background: #ef4444; }

/* ============================================================
   17. JOB META (DISTANCE, PRICE, SIZE)
   ============================================================ */
.job-meta {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Mobile: left-align meta for readability */
@media (max-width: 768px) {
  .job-meta {
    text-align: left;
    font-size: 0.9rem;
  }
}

.job-price {
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
}

.job-distance {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.job-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   20. ACCEPT / DECLINE BUTTONS
   ============================================================ */
.job-actions {
  display: flex;
  gap: 0.6rem;
}

/* Mobile: stack buttons vertically */
@media (max-width: 768px) {
  .job-actions {
    flex-direction: column;
  }
}

.accept-btn {
  flex: 1;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: none;
  padding: 0.55rem;
  border-radius: 999px;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(22,163,74,0.45);
}

.accept-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(22,163,74,0.55);
}

.decline-btn {
  flex: 1;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border: none;
  padding: 0.55rem;
  border-radius: 999px;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(239,68,68,0.45);
}

.decline-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(239,68,68,0.55);
}

/* ============================================================
   21. VEHICLE COMPATIBILITY FLAG
   ============================================================ */
.vehicle-compatibility {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #f97316;
  background: rgba(248,113,113,0.08);
  border-radius: 999px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Mobile: slightly larger text */
@media (max-width: 768px) {
  .vehicle-compatibility {
    font-size: 0.85rem;
  }
}

.vehicle-compatibility::before {
  content: "!";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #f97316;
  color: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}

/* ============================================================
   22. ACCEPTED JOB — EXPANDED DETAILS SECTION
   ============================================================ */
.accepted-expanded {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  font-size: 0.8rem;
}

/* Mobile: tighter grid spacing */
@media (max-width: 768px) {
  .accepted-expanded {
    gap: 0.75rem;
  }
}

.detail-block {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 10px 25px rgba(15,23,42,0.9);
}

.detail-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.detail-row {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.35rem;
}

.detail-row strong {
  color: var(--text-light);
}

/* Contact buttons */
.contact-sender-btn,
.contact-receiver-btn {
  margin-top: 0.4rem;
  background: #111827;
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.contact-sender-btn:hover,
.contact-receiver-btn:hover {
  background: #1f2937;
}

/* ============================================================
   23. ITEM PHOTO
   ============================================================ */
.item-photo {
  width: 100%;
  max-width: 120px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  object-fit: cover;
  display: none;
}

/* Mobile: larger preview */
@media (max-width: 768px) {
  .item-photo {
    max-width: 160px;
  }
}

/* ============================================================
   24. STATUS BUTTONS (ON MY WAY → DELIVERED)
   ============================================================ */
.traveler-status-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.status-btn {
  width: 100%;
  padding: 0.55rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
  color: white;
}

/* Mobile: larger tap targets */
@media (max-width: 768px) {
  .status-btn {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }
}

.on-my-way-pickup-btn { background: #0ea5e9; }
.on-my-way-pickup-btn:hover { background: #0284c7; }

.picked-up-btn { background: #22c55e; }
.picked-up-btn:hover { background: #16a34a; }

.on-my-way-dropoff-btn { background: #f59e0b; }
.on-my-way-dropoff-btn:hover { background: #d97706; }

.delivered-btn { background: #8b5cf6; }
.delivered-btn:hover { background: #7c3aed; }

/* ============================================================
   25. DELIVERY PHOTO UPLOAD SECTION
   ============================================================ */
.delivery-photo-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.delivery-photo-section .form-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-delivery-photo-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 999px;
}

.delivery-photo-preview {
  width: 100%;
  max-width: 140px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  object-fit: cover;
  display: none;
}

/* Mobile: larger preview */
@media (max-width: 768px) {
  .delivery-photo-preview {
    max-width: 180px;
  }
}

/* ============================================================
   26. SIGNATURE PAD
   ============================================================ */
.signature-section {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.signature-pad {
  background: #ffffff;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* Mobile: larger pad */
@media (max-width: 768px) {
  .signature-pad {
    height: 200px;
  }
}

.clear-signature-btn,
.submit-signature-btn {
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.clear-signature-btn {
  background: #111827;
  border: 1px solid var(--border-color);
  color: var(--text-light);
}

.clear-signature-btn:hover {
  background: #1f2937;
}

.submit-signature-btn {
  background: var(--blue);
  color: white;
  border: none;
}

.submit-signature-btn:hover {
  background: var(--blue-dark);
}

.signed-by-input {
  background: #0f172a;
  border: 1px solid var(--border-color);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* ============================================================
   27. CHAT WIDGET — FLOATING BUBBLE
   ============================================================ */
#chatBubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 280px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  display: none;
  flex-direction: column;
  z-index: 99999;
  box-shadow: 0 18px 45px rgba(15,23,42,0.95);
}

#chatBubble.open {
  display: flex;
}

.chat-header {
  padding: 10px;
  background: #111827;
  color: var(--text-light);
  font-weight: 600;
  border-radius: 14px 14px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chatCloseBtn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

#chatBody {
  padding: 10px;
  height: 180px;
  overflow-y: auto;
  font-size: 13px;
}

.chat-line {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #020617;
  border-radius: 8px;
  color: var(--text-light);
}

.chat-line.user {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: white;
}

.chat-footer {
  display: flex;
  border-top: 1px solid var(--border-color);
}

#chatInput {
  flex: 1;
  padding: 10px;
  background: #020617;
  border: none;
  color: var(--text-light);
}

#chatSendBtn {
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border: none;
  color: white;
  cursor: pointer;
}

/* Floating toggle button */
.chat-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--blue);
  color: white;
  border-radius: 999px;
  padding: 0.75rem;
  border: none;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 10px 25px rgba(37,99,235,0.45);
}

/* ============================================================
   28. SUPPORT PANEL
   ============================================================ */
#supportPanel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 260px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  display: none;
  z-index: 99999;
  box-shadow: 0 18px 45px rgba(15,23,42,0.95);
}

#supportPanel.open {
  display: block;
}

.support-box {
  background: #020617;
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: 10px;
  margin: 10px 0 20px 0;
}

.support-box strong {
  color: var(--text-light);
  font-size: 15px;
}

.support-box ul {
  margin: 10px 0 0 18px;
  padding: 0;
}

.support-box li {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 6px;
}

/* ============================================================
   29. MODALS (GLOBAL)
   ============================================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  pointer-events: none;
}

.modal.hidden {
  display: none;
}

.modal:not(.hidden) {
  pointer-events: auto;
}

.modal-content {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 14px;
  width: 90%;
  max-width: 420px;
  color: var(--text-light);
  box-shadow: 0 18px 45px rgba(15,23,42,0.95);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  float: right;
  cursor: pointer;
}

.modal-title {
  margin-bottom: 12px;
  font-size: 1.2rem;
  font-weight: 600;
}

/* ============================================================
   35. FIX: Restore Traveler sidebar colors
   ============================================================ */
.sidebar,
.sidebar * {
  color: #e5e7eb !important;
}

.sidebar-item {
  opacity: 0.75;
}

.sidebar-item:hover {
  opacity: 1;
  background: rgba(255,255,255,0.04);
}

.sidebar-item.active {
  opacity: 1;
  background: rgba(255,255,255,0.08);
  border-left: 3px solid #3b82f6;
  padding-left: calc(14px - 3px);
}

.sidebar-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.65;
  color: #e5e7eb !important;
}

/* ============================================================
   36. FIX: Ensure Delivery Details modal scrolls
   ============================================================ */
#jobDetailsModal,
#jobDetailsModal .modal-content,
.job-details-modal,
.modal-body {
  max-height: 90vh !important;
  overflow-y: auto !important;
  padding-right: 6px;
}

/* ============================================================
   37. LOGO
   ============================================================ */
.flexago-logo {
  display: flex;
  align-items: center;
  margin-left: 12px;
}

.flexago-logo-img {
  height: 80px;
  width: auto;
  object-fit: contain;
}

/* ============================================================
   38. LOGOUT
   ============================================================ */
.logout-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 12px;
}

.logout-btn:hover {
  background: #dc2626;
}

/* ============================================================
   39. FINAL Z-INDEX FIXES
   ============================================================ */
#traveler-job-panel,
#traveler-job-controls,
#jobsAvailableList,
#jobsAcceptedList,
#jobsCompletedList {
  position: relative;
  z-index: 1; /* lower than modal */
  pointer-events: auto;
}

/* Push ONLY the form fields behind the modal */
#routePanel .form-field,
#routePanel .form-field * {
  position: relative !important;
  z-index: 1 !important;
}

/* Restore map above form fields but below modal */
#travelerMap {
  position: relative !important;
  z-index: 5 !important;
}

/* Modal stays on top */
.modal {
  z-index: 99999 !important;
}

/* ============================================================
   40. FINAL MOBILE FIXES FOR TRAVELER PAGE
   ============================================================ */
@media (max-width: 768px) {

  /* Top Nav */
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    gap: 10px;
  }

  .top-nav-left,
  .top-nav-center,
  .top-nav-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .top-nav-right {
    gap: 10px;
  }

  .logout-btn {
    padding: 6px 12px;
    font-size: 14px;
  }

  .lang-select {
    font-size: 14px;
    padding: 6px;
  }

  /* Search Bar */
  .top-nav-search {
    width: 100%;
  }

  .top-nav-search input {
    width: 100%;
  }

  /* Workspace Panels */
  .workspace-container {
    flex-direction: column;
    gap: 20px;
  }

  .workspace-panel {
    width: 100% !important;
  }

  /* Map */
  .map-container {
    width: 100% !important;
    height: 300px !important;
    margin-top: 20px;
  }

  /* Form Inputs */
  .input-shell {
    width: 100% !important;
  }

  form input,
  form select {
    width: 100% !important;
  }
}
