/* css/base.css */
/* --- Light theme to match Dock Operations --- */

:root{
  /* Core palette */
  --bg:#f7f8fa;              /* page background */
  --panel:#ffffff;           /* cards/panels */
  --text:#111827;            /* primary text */
  --muted:#6b7280;           /* secondary text */
  --line:#e5e7eb;            /* borders/dividers */
  --line-strong:#d1d5db;     /* inputs/controls */
  --brand:#e51515;           /* Roadtex red */
  --brand-dark:#b81212;      /* hover red */
  --accent:#2563eb;          /* focus ring */
  --accent-soft:rgba(37,99,235,.15);
  --ok:#10b981;
  --warn:#f59e0b;
}

/* Always hide elements marked [hidden] (some browsers ignore without this) */
[hidden]{display:none !important;visibility:hidden !important;}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

/* Top bar */
.topbar{
  position:sticky; top:0; z-index:100;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px;
  background:#fff;
  border-bottom:1px solid var(--line);
}
.brand{font-weight:700; color:var(--text)}
.right{color:var(--muted)}
.divider{margin:0 8px; color:#9ca3af}

/* Page container */
.page{padding:16px}

/* Cards / panels */
.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
  padding:14px;
  margin-bottom:16px;
  box-shadow:0 1px 2px rgba(0,0,0,.04);
}

/* Layout helpers */
.row{display:flex; gap:12px; align-items:center; flex-wrap:wrap}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.grid-3{display:grid; grid-template-columns:repeat(3,1fr); gap:12px}

/* Inputs / controls */
input,select,textarea,button{
  font:inherit;
  color:var(--text);
  background:#fff;
  border:1px solid var(--line-strong);
  border-radius:8px;
  padding:8px 10px;
  outline:none;
}
input::placeholder,textarea::placeholder{color:#9ca3af}
input:focus,select:focus,textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft);
}

/* Buttons */
button{cursor:pointer}
button.primary{
  background:var(--brand);
  border-color:var(--brand);
  color:#fff; font-weight:700;
}
button.primary:hover{background:var(--brand-dark); border-color:var(--brand-dark)}
button.ghost{
  background:#fff;
  color:var(--text);
  border-color:var(--line-strong);
}
button.ghost:hover{background:#f3f4f6}

/* Disabled state */
button[disabled], input[disabled], select[disabled], textarea[disabled]{opacity:.6; cursor:not-allowed}

/* Labels */
label{display:block; font-size:12px; color:var(--muted); margin-bottom:4px}

/* Paste zone (OCR) */
#pasteZone{
  border:2px dashed var(--line-strong);
  background:#fafafa;
  padding:18px; text-align:center; border-radius:10px; cursor:pointer;
}
#pasteZone.hover{border-color:var(--accent); background:#f0f6ff}

/* Table */
.table{width:100%; border-collapse:collapse; background:#fff}
.table th,.table td{border-bottom:1px solid var(--line); padding:8px; vertical-align:top}
.table th{font-weight:600; color:#374151; background:#fafafa}
.table tr:hover{background:#f9fafb}

/* Badges */
.badge{
  display:inline-block; padding:2px 8px;
  border-radius:999px; border:1px solid var(--line-strong);
  color:#374151; font-size:12px; background:#fff;
}
.badge.ok{border-color:#a7f3d0; color:#065f46; background:#ecfdf5}
.badge.warn{border-color:#fde68a; color:#7c2d12; background:#fffbeb}

/* Overlay & spinner */
.overlay{
  position:fixed; inset:0;
  display:grid; place-items:center;
  background:rgba(0,0,0,.35);
  z-index:9999;
}
.spinner{
  width:40px; height:40px;
  border:4px solid #e5e7eb;
  border-top-color:var(--brand);
  border-radius:50%;
  animation:spin 1s linear infinite;
}
.overlay-text{margin-top:10px; color:#111827; font-weight:600; text-align:center}
@keyframes spin{to{transform:rotate(360deg)}}

/* Utilities */
.actions{display:flex; gap:10px; justify-content:flex-end; margin-top:12px}
.small{font-size:12px}
.muted{color:var(--muted)}

/* Links inside cards (e.g., table action links) */
a{color:#1f2937; text-decoration:none}
a:hover{text-decoration:underline}

/* Modal card inside .overlay: keep readable widths on small screens */
.overlay .card{max-width:960px; width:95%}

/* Create trip textareas - no scrollbars, fixed 2 rows */
.ct-address, .ct-notes{
  resize:none !important;
  overflow:hidden !important;
  line-height:1.4;
  max-height:calc(1.4em * 3 + 16px); /* 3 lines + padding */
}

/* Responsive tweaks */
@media (max-width:900px){
  .grid-3{grid-template-columns:1fr}
}
@media (max-width:640px){
  .grid-2{grid-template-columns:1fr}
  .topbar{padding:8px 12px}
  .page{padding:12px}
}

/* status colors */
.badge.info   { border-color:#bfdbfe; color:#1e3a8a; background:#eff6ff; }
.badge.danger { border-color:#fecaca; color:#7f1d1d; background:#fef2f2; }

/* === Broker list: status-based row colors === */
/* Uses :has() to inspect the status badge inside column 3 */

/* Submitted = light blue */
#tripTable tbody tr:has(td:nth-child(3) .badge.info) {
  background: #f0f9ff;
}

/* Confirmed = light green */
#tripTable tbody tr:has(td:nth-child(3) .badge.ok) {
  background: #f0fff4;
}

/* Require Approval / Failed = light red */
#tripTable tbody tr:has(td:nth-child(3) .badge.danger) {
  background: #fff5f5;
}

/* Default (e.g., Pending/Assigned and Closed) = light yellow */
#tripTable tbody tr:has(td:nth-child(3) .badge:not(.ok):not(.info):not(.danger)) {
  background: #fffaf0;
}

/* Subtle hover */
#tripTable tbody tr:hover {
  filter: brightness(0.98);
}

/* ================================================
   Modal Styles
   ================================================ */
.modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}



/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 500px;
  padding: 16px 20px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  border-left: 4px solid #e51515;
}

.toast.success {
  border-left-color: #10b981;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast.info {
  border-left-color: #3b82f6;
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px 0;
}

.toast-message {
  color: #6b7280;
  font-size: 13px;
  margin: 0;
}

.toast.fade-out {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

