/* ============================================================
   1. GLOBAL THEME — DARK SENDER UI (RESPONSIVE READY)
============================================================ */
:root {
  --sidebar-width: 260px;
  --sidebar-width-mobile: 72px; /* NEW: collapses on mobile */

  --panel-radius: 14px;

  --panel-bg: #0f1f4a;
  --page-bg: #0a1a3a;

  --border-color: #1f2937;
  --text-light: #e2e8f0;
  --text-muted: #94a3b8;

  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --sky: #38bdf8;

  --transition-fast: 250ms ease-in-out;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  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;
}

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

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

/* Mobile: sidebar collapses */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
  }
}

/* ============================================================
   3. TOP NAVIGATION BAR — SKY BLUE (RESPONSIVE)
============================================================ */
.top-nav {
  height: 56px;
  background: var(--sky);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 50;
}

.top-nav-title-main,
.top-nav-title-sub {
  color: #0f172a;
}

.top-nav-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #e0f7ff;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
}

.top-nav-search input {
  background: transparent;
  border: none;
  color: #0f172a;
  outline: none;
  font-size: 0.85rem;
}

/* Mobile: search shrinks */
@media (max-width: 768px) {
  .top-nav {
    padding: 0 0.5rem;
  }

  .top-nav-search {
    padding: 4px 8px;
  }

  .top-nav-search input {
    font-size: 0.75rem;
  }
}

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

/* Mobile: collapse sidebar */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-width-mobile);
    padding: 0.5rem;
  }

  .sidebar-item {
    justify-content: center;
    padding: 10px;
  }

  .sidebar-item span {
    display: none; /* hide text, keep icons */
  }
}

.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);
}
/* ============================================================
   5. CONTENT AREA (RESPONSIVE SCROLL)
============================================================ */
.content-area {
  flex: 1;
  overflow-y: auto !important;
  padding: 1.25rem;
  background: var(--page-bg);
}

/* Mobile: tighter padding */
@media (max-width: 768px) {
  .content-area {
    padding: 0.75rem;
  }
}

/* ============================================================
   6. PANEL — DARK BLUE (RESPONSIVE)
============================================================ */
.panel {
  background: var(--panel-bg);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--panel-radius);
  padding: 1.5rem;
  box-shadow: 0 14px 35px rgba(0,0,0,0.45);
  margin-bottom: 1.5rem;
  overflow: visible !important;
}

/* Mobile: reduce padding */
@media (max-width: 768px) {
  .panel {
    padding: 1rem;
    margin-bottom: 1rem;
  }
}

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

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

/* ============================================================
   7. PANEL BODY (RESPONSIVE)
============================================================ */
.panel-body {
  overflow: visible !important;
}

.panel-body > * + * {
  margin-top: 1.25rem;
}

/* Mobile: reduce spacing */
@media (max-width: 768px) {
  .panel-body > * + * {
    margin-top: 1rem;
  }
}

/* ============================================================
   8. FORM GRID — AUTO‑RESPONSIVE
============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  overflow: visible !important;
}

/* Mobile: smaller min width */
@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
  }
}

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

.full-width {
  grid-column: 1 / -1;
}

.limit-width {
  max-width: 480px;
}

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

/* Mobile: smaller label */
@media (max-width: 480px) {
  .form-label {
    font-size: 0.78rem;
  }
}

/* ============================================================
   9. INPUT-SHELL (Create Delivery) — RESPONSIVE + SAFE
============================================================ */
.input-shell {
  display: flex;
  align-items: center;
  background: #1b2b4a;
  border: 1px solid #2c3e5e;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;

  position: relative;
  overflow: visible !important;
  z-index: 100000;
}

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

.input-shell .input-icon {
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.input-shell input {
  padding-left: 0.25rem;
}

.input-shell:focus-within {
  border-color: var(--sky);
}

/* Mobile: tighter input shell */
@media (max-width: 480px) {
  .input-shell {
    padding: 0.45rem 0.6rem;
  }

  .input-shell input {
    font-size: 0.82rem;
  }

  .input-shell .input-icon {
    margin-right: 0.35rem;
  }
}

/* ============================================================
   10. AUTOCOMPLETE DROPDOWN
============================================================ */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;

  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 6px;

  max-height: 220px;
  overflow-y: auto;

  padding: 4px 0;
  z-index: 200000;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  color: #e5e7eb;
}

.autocomplete-item:hover {
  background: #374151;
}

/* ============================================================
   11. SIZE PILLS
============================================================ */
.pill-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  padding: 0.45rem 1rem;
  border-radius: 20px;
  background: #1b2b4a;
  border: 1px solid #2c3e5e;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.85rem;
}

.pill.active {
  background: var(--sky);
  color: #0f172a;
  border-color: var(--sky);
}

/* Mobile: tighter pills */
@media (max-width: 480px) {
  .pill {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* ============================================================
   12. ACTION ROW
============================================================ */
.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

/* Mobile: stack vertically */
@media (max-width: 600px) {
  .action-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

.protection-text {
  font-size: 0.75rem;
  color: rgba(148,163,184,0.9);
}

/* ============================================================
   13. MAP PANEL
============================================================ */
.map-panel {
  margin-top: 2rem !important;
}

.map-shell {
  width: 100%;
  height: 380px;
  background: #0a1a3a;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* Mobile: shorter map */
@media (max-width: 600px) {
  .map-shell {
    height: 260px;
  }
}

/* ============================================================
   14. PROFILE HEADER
============================================================ */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
}

.profile-photo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.profile-photo-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.25);
  box-shadow: 0 0 12px rgba(0,0,0,0.35);
}

#senderProfilePhotoUploadBtn {
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  border-radius: 6px;
  width: auto;
}

.profile-name {
  margin-top: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
}

.profile-stats {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Mobile: smaller name */
@media (max-width: 480px) {
  .profile-name {
    font-size: 1.1rem;
  }

  .profile-stats {
    font-size: 0.8rem;
  }
}

/* ============================================================
   15. BUTTONS
============================================================ */
.primary-btn {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
}

.primary-btn:hover {
  opacity: 0.9;
}

/* Mobile: slightly smaller */
@media (max-width: 480px) {
  .primary-btn {
    padding: 0.65rem;
    font-size: 0.85rem;
  }
}

/* ============================================================
   16. 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);
}

/* Mobile: move up and in */
@media (max-width: 600px) {
  #supportPanel {
    bottom: 12px;
    left: 12px;
    width: 220px;
    padding: 12px;
  }
}

#supportPanel.open {
  display: block;
}

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

/* ============================================================
   17. VIEW SWITCHING
============================================================ */
section[id$="View"] {
  display: none;
}

section[id$="View"]:not(.hidden) {
  display: block;
}

/* ============================================================
   18. MY DELIVERIES — DARK MODE LIST + CARDS
============================================================ */
.delivery-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.delivery-card {
  background: #0f1f4a;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.delivery-card:hover {
  background: #152a63;
  border-color: rgba(255,255,255,0.15);
}

.delivery-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 0.5rem;
}

/* Mobile: stack header */
@media (max-width: 600px) {
  .delivery-card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

.delivery-card-header strong {
  font-size: 1rem;
  color: var(--text-light);
}

.delivery-card-body p {
  margin: 3px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ============================================================
   19. STATUS BADGES — DARK MODE
============================================================ */
.status {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status.available {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.status.accepted {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.status.in_transit {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.status.delivered {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.status.payout_pending {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.status.payout_completed {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;

/* ============================================================
  20. DELIVERY STATUS VIEW — DARK MODE (RESPONSIVE)
============================================================ */
#deliveryStatusContent h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-light);
}

#deliveryStatusContent p {
  margin: 6px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

#deliveryStatusContent hr {
  margin: 1.2rem 0;
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Mobile: tighter spacing */
@media (max-width: 480px) {
  #deliveryStatusContent h3 {
    font-size: 1rem;
  }
  #deliveryStatusContent p {
    font-size: 0.82rem;
  }
}

/* ============================================================
   Logout Button (Responsive)
============================================================ */
.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;
}

@media (max-width: 480px) {
  .logout-btn {
    padding: 7px 12px;
    font-size: 13px;
    margin-left: 0;
    width: 100%;
  }
}

/* ============================================================
   32. MY DELIVERIES (SENDER) — RESPONSIVE
============================================================ */
.deliveries-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.delivery-card {
  background: #0b1220;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: 0 10px 25px rgba(15,23,42,0.85);
}

.delivery-card:hover {
  background: #111827;
}

.delivery-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
  gap: 0.5rem;
}

/* Mobile: stack rows */
@media (max-width: 600px) {
  .delivery-row {
    flex-direction: column;
    align-items: flex-start;
    font-size: 0.82rem;
  }
}

.delivery-status {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  text-transform: capitalize;
  font-weight: 600;
}

.status-available {
  background: #1e3a8a;
  color: #bfdbfe;
}

.status-accepted {
  background: #065f46;
  color: #a7f3d0;
}

.status-completed {
  background: #374151;
  color: #e5e7eb;
}

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

/* ============================================================
   MOBILE RESPONSIVE FIXES — CLEANED & ALIGNED WITH TRAVELER
============================================================ */
@media (max-width: 600px) {

  body {
    padding: 0;
    margin: 0;
  }

  .workspace-container {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding: 10px;
    font-size: 14px;
  }

  .main-content {
    width: 100%;
    padding: 10px;
  }

  .form-section {
    width: 100%;
    margin-bottom: 20px;
  }

  .form-section input,
  .form-section select {
    width: 100%;
    font-size: 16px;
  }

  .row {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }
}
