body {
  padding: 20px;
  background-color: #f7f9fc;
  font-family: var(--font-family);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.deliver-container {
  max-width: 1000px;
  margin: 0 auto;
}

.card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.03);
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
  color: #101828;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, #2563eb, #6366f1);
  flex-shrink: 0;
}

.my-car-card {
  background: linear-gradient(135deg, #f0f4ff, #f8f9fc);
}

.my-car-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.my-car-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.car-plate {
  display: inline-block;
  align-self: flex-start;
  padding: 8px 18px;
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #1e293b;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.car-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #475569;
}

.car-notes {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.car-none {
  font-size: 14px;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.field-group label {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  border: 1.5px solid #d0d5dd;
  border-radius: 12px;
  min-height: 48px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input:disabled {
  background: #f1f5f9;
  color: var(--gray-500);
  cursor: not-allowed;
}

textarea.input {
  min-height: 80px;
  resize: vertical;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.order-search-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.order-id-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.search-btn-group {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  min-height: 48px;
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  filter: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.25);
}

.btn-light {
  background: #fff;
  color: #344054;
  border: 1.5px solid #d0d5dd;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.search-loader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.search-message {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
}

.review-warning {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 14px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
}

.prev-deliveries {
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
}

.order-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
  padding: 18px;
  background: linear-gradient(135deg, #f0f4ff, #f8f9fc);
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.08);
  font-size: 14px;
  color: #344054;
}

.order-summary strong {
  color: #1e3a5f;
  font-weight: 700;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: #e0e7ff;
  color: #3730a3;
}

.status-badge.status-reviewed {
  background: #dcfce7;
  color: #166534;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.items-table thead th {
  position: sticky;
  top: 0;
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
}

.items-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #344054;
}

.items-table tbody tr:last-child td {
  border-bottom: none;
}

.items-table tbody tr.row-touched {
  background: #f0fdf4;
}

.table-value {
  display: inline-block;
  min-width: 40px;
  font-weight: 700;
}

.mini-input {
  width: 80px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  text-align: center;
  color: var(--text);
  background: #fff;
  border: 1.5px solid #d0d5dd;
  border-radius: 8px;
  min-height: 42px;
}

.mini-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.status-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-btn {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #344054;
  background: #fff;
  border: 1.5px solid #d0d5dd;
  border-radius: 12px;
  min-height: 48px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast),
    color var(--transition-fast), box-shadow var(--transition-fast);
}

.choice-btn:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.choice-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

.choice-btn[data-status="refund"].active,
.choice-btn[data-status="partial refund"].active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.25);
}

.choice-btn[data-status="delay"].active {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: 0 6px 20px rgba(100, 116, 139, 0.25);
}

.finish-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.region-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.region-pill--cairo {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.region-pill--alex {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
}

body.dark-mode {
  background-color: #0f1115;
  color: #e2e8f0;
}

body.dark-mode .card {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.94));
  border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .my-car-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.6));
}

body.dark-mode .section-title {
  color: #f8fafc;
}

body.dark-mode .car-plate {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-mode .car-meta {
  color: #cbd5e1;
}

body.dark-mode .car-none {
  background: rgba(120, 53, 15, 0.25);
  border-color: rgba(217, 119, 6, 0.4);
  color: #fcd34d;
}

body.dark-mode .field-group label {
  color: #cbd5e1;
}

body.dark-mode .input,
body.dark-mode .mini-input {
  background-color: #232831;
  border-color: #2a2e36;
  color: #f1f5f9;
}

body.dark-mode .input:disabled {
  background: #1a1d23;
  color: #64748b;
}

body.dark-mode .btn-light {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}

body.dark-mode .order-summary {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(15, 23, 42, 0.5));
  border-color: rgba(99, 102, 241, 0.12);
  color: #cbd5e1;
}

body.dark-mode .order-summary strong {
  color: #93c5fd;
}

body.dark-mode .status-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

body.dark-mode .status-badge.status-reviewed {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

body.dark-mode .table-wrapper {
  border-color: #2a2e36;
}

body.dark-mode .items-table thead th {
  background: #232831;
  color: #cbd5e1;
  border-bottom-color: #2a2e36;
}

body.dark-mode .items-table td {
  color: #cbd5e1;
  border-bottom-color: #232831;
}

body.dark-mode .items-table tbody tr.row-touched {
  background: rgba(34, 197, 94, 0.08);
}

body.dark-mode .choice-btn {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}

body.dark-mode .review-warning {
  background: rgba(120, 53, 15, 0.25);
  border-color: rgba(217, 119, 6, 0.4);
  color: #fcd34d;
}

body.dark-mode .prev-deliveries {
  background: rgba(30, 58, 138, 0.25);
  border-color: rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
}

@media (max-width: 768px) {
  body {
    padding: 14px;
  }

  .card {
    padding: 18px;
    border-radius: 16px;
  }

  .order-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-btn-group {
    width: 100%;
  }

  .search-btn-group .btn {
    flex: 1;
  }

  .status-choice {
    flex-direction: column;
  }

  .choice-btn {
    width: 100%;
  }

  .finish-row .btn {
    width: 100%;
  }

  .table-wrapper {
    overflow-x: visible;
    border: none;
    border-radius: 0;
  }

  .items-table,
  .items-table tbody {
    display: block;
  }

  .items-table thead {
    display: none;
  }

  .items-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #2563eb;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
  }

  .items-table td {
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    border-bottom: none;
    font-size: 14px;
  }

  .items-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 2px;
  }

  .items-table td[data-label="Item"] {
    grid-column: 1 / -1;
  }

  .mini-input {
    width: 100%;
  }

  body.dark-mode .items-table tr {
    background: rgba(30, 41, 59, 0.5);
    border-color: #2a2e36;
    border-left-color: #2563eb;
  }
}
