/* Calltrek — Core Stylesheet
   Design system: dark bg (#0a0a0a), orange accent (#ff6b35), Space Grotesk + DM Sans */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --border: #222;
  --border-2: #2e2e2e;
  --text: #e8e8e8;
  --text-dim: #888;
  --text-muted: #555;
  --accent: #ff6b35;
  --accent-dim: rgba(255, 107, 53, 0.15);
  --accent-hover: #ff8255;
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --radius: 6px;
  --radius-lg: 10px;
}

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── NAV ── */
.nav {
  position: fixed; top: 0; width: 100%; z-index: 100;
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 1.5rem;
  background: rgba(10, 10, 10, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.25rem;
  letter-spacing: -0.5px; color: var(--text);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 0.25rem; align-items: center; flex: 1; }
.nav-link {
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-dim);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); background: var(--surface-2); }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: white;
  font-size: 0.7rem; font-weight: 700;
  border-radius: 999px; margin-left: 4px;
}

/* ── PAGE WRAPPER ── */
.page { padding: 5rem 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }

/* ── LANDING PAGE ── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 8rem 2rem 4rem; max-width: 900px; margin: 0 auto;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--accent-dim); border: 1px solid rgba(255,107,53,0.3);
  color: var(--accent); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.35rem 0.85rem; border-radius: 999px; margin-bottom: 2rem;
  width: fit-content;
}
.hero-eyebrow::before { content: '●'; font-size: 0.5rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700; letter-spacing: -2px;
  line-height: 1.05; margin-bottom: 1.5rem;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-sub {
  font-size: 1.1rem; color: var(--text-dim); max-width: 560px;
  line-height: 1.7; margin-bottom: 2.5rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem; font-weight: 600;
  border-radius: var(--radius); border: none; cursor: pointer;
  transition: all 0.15s ease; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: white;
}
.btn-primary:hover { background: var(--accent-hover); color: white; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255,107,53,0.3); }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-sm { padding: 0.45rem 1rem; font-size: 0.82rem; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-2); background: var(--surface); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.btn-success:hover { background: rgba(52,211,153,0.2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* feature strip on landing */
.features-strip {
  padding: 6rem 2rem;
  max-width: 1100px; margin: 0 auto;
  border-top: 1px solid var(--border);
}
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem;
}
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--border-2); }
.feature-icon {
  width: 40px; height: 40px;
  background: var(--accent-dim); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; margin-bottom: 1rem;
}
.feature-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.875rem; color: var(--text-dim); line-height: 1.6; }

/* ── CARDS / SURFACES ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
}
.card-sm { padding: 1rem 1.25rem; }
.card-title { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.65rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-pending { background: var(--yellow-dim); color: var(--yellow); }
.badge-assigned { background: var(--blue-dim); color: var(--blue); }
.badge-in_progress { background: var(--accent-dim); color: var(--accent); }
.badge-completed { background: var(--green-dim); color: var(--green); }
.badge-cancelled { background: rgba(100,100,100,0.15); color: var(--text-muted); }
.badge-emergency { background: rgba(248,113,113,0.2); color: var(--red); }
.badge-urgent { background: var(--yellow-dim); color: var(--yellow); }
.badge-normal { background: rgba(100,100,100,0.15); color: var(--text-dim); }
.badge-low { background: var(--green-dim); color: var(--green); }
.badge-available { background: var(--green-dim); color: var(--green); }
.badge-unavailable { background: rgba(100,100,100,0.15); color: var(--text-muted); }

/* ── FORM ELEMENTS ── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.25rem; }
.form-label {
  font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--text); border-radius: var(--radius);
  padding: 0.65rem 0.9rem; font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
  padding-right: 2rem;
}
.form-select option { background: var(--surface-2); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); }
.form-error { font-size: 0.78rem; color: var(--red); }

/* ── DISPATCH BOARD ── */
.dispatch-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.dispatch-header h1 { font-size: 1.5rem; font-weight: 700; }
.dispatch-stats { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.stat-chip {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.4rem 0.85rem;
  font-size: 0.8rem; display: flex; align-items: center; gap: 0.4rem;
}
.stat-chip strong { color: var(--text); }
.stat-chip span { color: var(--text-dim); }

.jobs-table-wrap { overflow-x: auto; }
.jobs-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.875rem;
}
.jobs-table th {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0.6rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.jobs-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.jobs-table tr:last-child td { border-bottom: none; }
.jobs-table tr:hover td { background: rgba(255,255,255,0.015); }
.job-customer { font-weight: 600; }
.job-phone { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.job-address { font-size: 0.82rem; color: var(--text-dim); }
.job-summary { font-size: 0.8rem; color: var(--text-dim); max-width: 280px; line-height: 1.4; }

/* ── CALL INTAKE ── */
.intake-wrap {
  max-width: 680px; margin: 0 auto;
}
.intake-header { margin-bottom: 2rem; }
.intake-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.intake-header p { color: var(--text-dim); }

.urgency-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
@media (min-width: 480px) { .urgency-grid { grid-template-columns: repeat(4, 1fr); } }
.urgency-btn {
  padding: 0.75rem 0.5rem; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface);
  color: var(--text-dim); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; text-align: center; transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.urgency-btn:hover { border-color: var(--border-2); color: var(--text); }
.urgency-btn.selected-low { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.urgency-btn.selected-normal { border-color: var(--blue); background: var(--blue-dim); color: var(--blue); }
.urgency-btn.selected-urgent { border-color: var(--yellow); background: var(--yellow-dim); color: var(--yellow); }
.urgency-btn.selected-emergency { border-color: var(--red); background: var(--red-dim); color: var(--red); }

.ai-thinking {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--accent); padding: 0.75rem 0;
}
.ai-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; animation: blink 1.2s infinite; }
.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.2; } 40% { opacity: 1; } }

/* ── BOOKING CONFIRMATION ── */
.booking-wrap { max-width: 560px; margin: 0 auto; }
.booking-check {
  width: 56px; height: 56px;
  background: var(--green-dim); border: 2px solid var(--green);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1.5rem;
}
.booking-detail { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.booking-detail:last-child { border-bottom: none; }
.booking-detail-label { font-size: 0.8rem; color: var(--text-dim); font-weight: 500; }
.booking-detail-value { font-size: 0.9rem; font-weight: 600; text-align: right; }

/* ── TECHNICIANS ── */
.techs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.tech-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  transition: border-color 0.2s;
}
.tech-card:hover { border-color: var(--border-2); }
.tech-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.tech-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-dim); border: 1px solid rgba(255,107,53,0.3);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700;
  font-size: 1rem; color: var(--accent); flex-shrink: 0;
}
.tech-name { font-weight: 600; font-size: 0.95rem; }
.tech-meta { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.tech-skills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0; }
.tech-skill {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.2rem 0.6rem;
  font-size: 0.72rem; color: var(--text-dim);
}
.tech-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.toggle-switch {
  position: relative; display: inline-flex; align-items: center;
  width: 40px; height: 22px; cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border-2); border-radius: 999px;
  transition: 0.2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  transition: 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 2rem); overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.25rem; padding: 0.25rem; border-radius: var(--radius); transition: color 0.15s; }
.modal-close:hover { color: var(--text); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: var(--text-dim);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; }

/* ── ALERT ── */
.alert {
  padding: 0.85rem 1rem; border-radius: var(--radius);
  font-size: 0.875rem; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 0.5rem;
}
.alert-error { background: var(--red-dim); border: 1px solid rgba(248,113,113,0.2); color: var(--red); }
.alert-success { background: var(--green-dim); border: 1px solid rgba(52,211,153,0.2); color: var(--green); }

/* ── SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SECTION ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; flex-wrap: wrap; }
.section-header h2 { font-size: 1.1rem; font-weight: 700; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .jobs-table th:nth-child(n+5), .jobs-table td:nth-child(n+5) { display: none; }
  .nav-links { gap: 0; }
  .nav-link { padding: 0.4rem 0.65rem; font-size: 0.8rem; }
}
