/* ===========================================================================
   Superior Wash Dallas — Shared Styles
   =========================================================================== */

/* -- Reset & base --------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: #1e293b;
  background: #f8fafc;
  line-height: 1.5;
  padding-top: 56px; /* room for fixed nav */
}

a {
  color: #2563eb;
  text-decoration: none;
}

/* -- Navigation bar ------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #1e293b;
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
}

.navbar .brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  margin-right: 32px;
  white-space: nowrap;
}

.navbar nav a {
  color: #94a3b8;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.navbar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.navbar nav a.active {
  color: #fff;
  background: #2563eb;
}

.navbar-logout {
  margin-left: auto;
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* -- Page layout ---------------------------------------------------------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* -- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
}
.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-success {
  background: #16a34a;
  color: #fff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* -- Filter bar ----------------------------------------------------------- */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input[type="text"] {
  padding: 8px 12px;
  font-size: 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
}

.filter-bar input[type="text"] {
  min-width: 220px;
}

/* -- Tables --------------------------------------------------------------- */
.table-wrap {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

tbody tr:hover {
  background: #f1f5f9;
}

tbody tr:not(:last-child) td {
  border-bottom: 1px solid #f1f5f9;
}

tbody td {
  padding: 10px 16px;
  font-size: 0.875rem;
}

/* -- Status badges -------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-new        { background: #dbeafe; color: #1d4ed8; }
.badge-contacted  { background: #fef3c7; color: #92400e; }
.badge-qualified  { background: #ede9fe; color: #6d28d9; }
.badge-converted  { background: #dcfce7; color: #15803d; }
.badge-lost       { background: #fee2e2; color: #b91c1c; }

/* -- Modals --------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
}

/* -- Forms ---------------------------------------------------------------- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.form-group label .required {
  color: #dc2626;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.875rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* -- Inline status select (in table rows) --------------------------------- */
.status-select {
  padding: 4px 8px;
  font-size: 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* -- Empty state ---------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #94a3b8;
}

.empty-state p {
  margin-bottom: 8px;
}

.empty-state p:first-child {
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
}

/* -- Toast notifications -------------------------------------------------- */
#toast-container {
  position: fixed;
  top: 68px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s;
}

.toast-success {
  background: #16a34a;
}

.toast-error {
  background: #dc2626;
}

.toast-hide {
  opacity: 0;
}

/* ---------------------------------------------------------------------------
   Quote modal — wide modal, line-item editor, totals box
   --------------------------------------------------------------------------- */

.modal.modal-lg {
  max-width: 820px;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.items-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
}

.items-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

.items-table input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.items-table .item-total {
  font-variant-numeric: tabular-nums;
  color: #334155;
  white-space: nowrap;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.btn-icon:hover {
  background: #fee2e2;
  color: #dc2626;
}

.totals-box {
  margin: 16px 0 8px auto;
  max-width: 320px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.9rem;
  color: #475569;
}

.totals-row input {
  width: 110px;
  padding: 4px 8px;
  font-size: 0.9rem;
  text-align: right;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.totals-total {
  border-top: 1px solid #e2e8f0;
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 600;
  font-size: 1rem;
  color: #0f172a;
}

.form-section {
  margin-top: 20px;
  margin-bottom: 10px;
  color: #444;
  font-size: 14px;
  text-transform: uppercase;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  border: none;
}

.btn-danger:hover {
  background-color: #c82333;
}

/* ---------------------------------------------------------------------------
   Send Quote modal — template selector, follow-up bar
   --------------------------------------------------------------------------- */

.template-selector {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 400;
  color: #1e293b;
  cursor: pointer;
}

.form-warning {
  color: #d97706;
  font-size: 0.8rem;
  margin-top: 4px;
}

.text-muted {
  color: #94a3b8;
  font-size: 0.8rem;
}

/* Follow-up action bar */
.follow-up-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-top: 16px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #92400e;
}

.follow-up-actions {
  display: flex;
  gap: 6px;
}

.btn-warning {
  background: #f59e0b;
  color: #fff;
  border: none;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-warning:hover {
  background: #d97706;
}

/* Send history */
.send-history {
  max-height: 200px;
  overflow-y: auto;
}

/* Brief focus highlight used when deep-linking to send history. */
.focus-flash {
  animation: focus-flash 1.6s ease-out;
  border-radius: 6px;
}
@keyframes focus-flash {
  0%   { background: #fef3c7; }
  100% { background: transparent; }
}

.send-history table {
  font-size: 0.8rem;
}

/* Badge variants for new statuses */
.badge-follow_up_scheduled { background: #fef3c7; color: #92400e; }
.badge-follow_up_due       { background: #fed7aa; color: #9a3412; }
.badge-followed_up         { background: #dbeafe; color: #1d4ed8; }
.badge-expired             { background: #f1f5f9; color: #64748b; }

/* Row actions layout */
.row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: nowrap;
}

/* Secondary action dropdown menu (used for Resend/Requote alongside Send Follow-up) */
.row-action-menu {
  display: inline-block;
  position: relative;
}
.row-action-menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 10px;
}
.row-action-menu > summary::-webkit-details-marker {
  display: none;
}
.row-action-menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  padding: 4px 0;
  min-width: 140px;
  z-index: 50;
}
.row-action-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 14px;
  font: inherit;
  color: #1e293b;
  cursor: pointer;
  white-space: nowrap;
}
.row-action-menu-item:hover {
  background: #f1f5f9;
}

/* ===========================================================================
   Follow-Up Dashboard (index.html)
   =========================================================================== */

.dash-section {
  margin-bottom: 28px;
}

.dash-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 10px;
}

/* Summary cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.1s, box-shadow 0.1s;
  text-align: left;
  font: inherit;
  color: inherit;
}

.summary-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.summary-card .count {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.1;
}

.summary-card .label {
  display: block;
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card.overdue .count { color: #b45309; }

/* Grouped queue sections */
.queue-group {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 14px;
  /* overflow left visible so absolutely-positioned row menus can escape.
     The summary header has its own background so the top corners still look
     clean without clipping. */
}

/* Override the shared .table-wrap's overflow-x so the row action dropdown
   inside dashboard queue groups is not clipped by the scroll container. */
.queue-group .table-wrap {
  overflow: visible;
}

/* Ensure the row action menu floats above adjacent sections/rows. */
.queue-group .row-action-menu-items {
  z-index: 100;
}

.queue-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  color: #1e293b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-group > summary::-webkit-details-marker { display: none; }

.queue-group > summary::before {
  content: "▸";
  font-size: 0.75rem;
  color: #64748b;
  transition: transform 0.1s;
}

.queue-group[open] > summary::before {
  transform: rotate(90deg);
}

.queue-group .count-pill {
  color: #64748b;
  font-weight: 500;
  font-size: 0.85rem;
}

.queue-group .group-body {
  padding: 0;
}

/* Overdue subtle visual emphasis */
.queue-group.group-overdue tbody tr {
  background: #fffaf0;
  border-left: 3px solid #f59e0b;
}

.queue-group.group-overdue tbody tr:hover {
  background: #fff3dc;
}

.overdue-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Empty state inside a queue group */
.group-empty {
  padding: 18px 16px;
  color: #64748b;
  font-size: 0.875rem;
  font-style: italic;
}

/* Recent activity (lighter styling) */
.recent-activity {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
}

.recent-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-activity-list li {
  padding: 8px 0;
  font-size: 0.85rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}

.recent-activity-list li:last-child {
  border-bottom: 0;
}

.recent-activity-list .ra-time {
  color: #94a3b8;
  font-size: 0.78rem;
  margin-left: auto;
}

.recent-activity-list .ra-type {
  color: #64748b;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recent-activity-note {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

/* Log Note / Reschedule small modals */
.modal.modal-sm {
  max-width: 420px;
}

/* Quick actions row */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Compact pipeline snapshot (lightweight — smaller than summary cards) */
.pipeline-snapshot {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 20px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8rem;
}

.pipeline-snapshot .ps-label {
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  margin-right: 4px;
}

.pipeline-snapshot .ps-item {
  color: #475569;
  padding: 2px 4px;
}

.pipeline-snapshot .ps-item strong {
  color: #1e293b;
  font-weight: 600;
  margin-left: 4px;
}

.pipeline-snapshot .ps-sep {
  color: #cbd5e1;
}
