/* Tailwind CDN provides utility classes. These are layered components used across the app. */

:root {
  --brand-navy: #1e3a8a;
  --brand-cyan: #0ea5e9;
  --brand-navy-dark: #1e40af;
  --ring: 0 0 0 3px rgba(14, 165, 233, 0.18);
}

html, body { background: #f4f6fb; }
body { -webkit-font-smoothing: antialiased; }

/* Buttons --- consistent height (36px) so rows of buttons align cleanly */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; font-size: 13px; font-weight: 600;
  border-radius: 8px; border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--brand-navy); color: white; border-color: var(--brand-navy); }
.btn-primary:hover { background: var(--brand-navy-dark); }
.btn-ghost { background: white; color: #334155; border-color: #cbd5e1; }
.btn-ghost:hover { background: #f1f5f9; }
.btn-wa { background: #16a34a; color: white; border-color: #16a34a; }
.btn-wa:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: white; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-cyan { background: var(--brand-cyan); color: white; border-color: var(--brand-cyan); }
.btn-cyan:hover { background: #0284c7; }

/* Smaller buttons inline in tables */
.btn.text-xs, .btn-sm { height: 30px; font-size: 12px; padding: 0 10px; }

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Inputs */
.input {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 0 12px;
  font-size: 14px;
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.45; }
.input:focus { border-color: var(--brand-cyan); box-shadow: var(--ring); }
.input.uppercase { text-transform: uppercase; letter-spacing: 0.5px; }

label.lbl {
  display: block; font-size: 11px; font-weight: 700; color: #475569;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}

/* Tables */
table.table { width: 100%; font-size: 14px; }
table.table th {
  text-align: left; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; color: #64748b; font-weight: 700;
  padding: 10px 10px; border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}
table.table td { padding: 12px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
table.table tr:hover td { background: #fafbfc; }

/* Tags */
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: #e2e8f0; color: #334155;
}
.tag-open         { background: #fef3c7; color: #92400e; }
.tag-in_progress  { background: #dbeafe; color: #1e40af; }
.tag-quoted       { background: #ede9fe; color: #5b21b6; }
.tag-done         { background: #dcfce7; color: #166534; }
.tag-paid         { background: #d1fae5; color: #047857; }
.tag-cancelled    { background: #fee2e2; color: #991b1b; }

/* Brand strip / nav */
.brand-strip {
  background: white; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.brand-strip .logo { height: 40px; width: auto; display: block; }
.nav-link {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px;
  font-size: 13px; font-weight: 600; color: #475569; border-radius: 8px;
  text-decoration: none; transition: all 0.12s;
}
.nav-link:hover { background: #f1f5f9; color: #0f172a; }
.nav-link.active { background: #e0f2fe; color: var(--brand-navy); }

/* Action button rows: ensure consistent gap, wrap nicely */
.action-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Stat tiles */
.stat-tile {
  background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px;
}
.stat-tile .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; font-weight: 700; }
.stat-tile .value { font-size: 26px; font-weight: 800; color: #0f172a; line-height: 1.2; margin-top: 4px; }
.stat-tile .sub   { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.stat-tile.warn  .value { color: #b45309; }
.stat-tile.info  .value { color: var(--brand-navy); }
.stat-tile.green .value { color: #047857; }

/* Timeline (job card chat-style) */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-event {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fafbfc;
}
.timeline-event.event-note    { border-left: 3px solid #64748b; background: #f8fafc; }
.timeline-event.event-status  { border-left: 3px solid #6366f1; }
.timeline-event.event-image   { border-left: 3px solid #10b981; }
.timeline-event.event-whatsapp{ border-left: 3px solid #16a34a; }
.timeline-event.event-system  { border-left: 3px solid #94a3b8; opacity: 0.85; }
.timeline-event .ev-icon { font-size: 18px; line-height: 1; padding-top: 2px; }
.timeline-event .ev-body { flex: 1; min-width: 0; }
.timeline-event .ev-meta { font-size: 11px; color: #94a3b8; }
.timeline-event .ev-text { white-space: pre-wrap; word-break: break-word; }
.timeline-event img.thumb { max-width: 220px; max-height: 220px; border-radius: 8px; border: 1px solid #e2e8f0; margin-top: 6px; cursor: pointer; }

/* Composer at bottom of timeline */
.composer { border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px; background: white; }
.composer textarea { min-height: 64px; }

/* Vehicle / customer search dropdown (typeahead) */
.typeahead { position: relative; }
.typeahead-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: white; border: 1px solid #e2e8f0; border-radius: 8px; margin-top: 4px;
  max-height: 280px; overflow: auto; z-index: 20;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}
.typeahead-results > div {
  padding: 10px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9;
}
.typeahead-results > div:hover, .typeahead-results > div.active { background: #f0f9ff; }
.typeahead-results .empty { color: #64748b; }

/* Section headings */
.h-section { font-size: 16px; font-weight: 700; color: #0f172a; margin-bottom: 12px; }

/* Make WhatsApp action bar wrap cleanly on phones */
@media (max-width: 700px) {
  .action-row .btn { flex: 1 1 calc(50% - 4px); }
}

/* Mobile responsive tweaks */
@media (max-width: 760px) {
  /* Allow nav links to scroll horizontally on phone instead of wrapping awkwardly */
  .brand-strip > div { gap: 8px !important; }
  .brand-strip .nav-link { padding: 0 9px; font-size: 12px; }
  .brand-strip .logo { height: 32px; }

  /* Tables scroll horizontally on phone */
  table.table { min-width: 560px; }
  .card > .overflow-x-auto, .card > div > .overflow-x-auto { -webkit-overflow-scrolling: touch; }

  /* Smaller hero headings */
  h1.text-2xl { font-size: 20px; }

  /* Stat tile values smaller on small screens */
  .stat-tile .value { font-size: 22px; }

  /* Stretch the input + ensure a comfortable tap target */
  .input { font-size: 16px; }   /* avoids iOS zoom-on-focus */
  .btn { height: 40px; }        /* easier tap target */
  .btn.btn-sm, .btn.text-xs { height: 34px; }

  /* Chart bar labels can get crowded; rotate */
  .timeline-event img.thumb { max-width: 100%; }

  /* Job card show: single column flow on small screens */
  .lg\:col-span-3, .lg\:col-span-2 { grid-column: span 1 / span 1; }
}

/* Make all main lists wrappable inside an overflow container so phones don't break */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
