*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg-page);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--fg);
}

/* ── Nav ──────────────────────────────────── */

nav {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--bd);
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg-strong);
  text-decoration: none;
}

nav .brand:hover { color: var(--fg-max); }

.lang-switcher {
  background: var(--bg-inset);
  border: 1px solid var(--bd);
  color: var(--fg-muted);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
}

/* ── Main ─────────────────────────────────── */

main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 2rem;
}

.call-container {
  width: 100%;
  max-width: 560px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.back-link:hover { color: var(--fg-soft); }

/* ── States ───────────────────────────────── */

.call-state {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bd);
  border-top-color: steelblue;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loading-text {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.error-icon {
  font-size: 2.5rem;
  color: var(--fg-red);
  margin-bottom: 0.75rem;
}

#error-text {
  color: var(--fg-red);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ── Call Card ────────────────────────────── */

.call-card {
  background: var(--bg-panel);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 2rem;
}

.call-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.business-avatar {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(70, 130, 180, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--fg-steel);
  flex-shrink: 0;
}

.business-info h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg-strong);
  margin-bottom: 0.15rem;
}

.business-subtitle {
  color: var(--fg-muted);
  font-size: 0.82rem;
}

/* ── Status bar ───────────────────────────── */

.call-status-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-inset);
  border-radius: 8px;
  font-size: 0.88rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #8b9cb3;
  flex-shrink: 0;
  transition: background 0.3s;
}

.status-dot.status-idle    { background: #8b9cb3; }
.status-dot.status-connecting { background: #f59e0b; animation: pulse 1s infinite; }
.status-dot.status-active  { background: #22c55e; animation: pulse 1s infinite; }
.status-dot.status-error   { background: #f87171; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Controls ─────────────────────────────── */

.call-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 2rem;
  border-radius: 10px;
  border: 1px solid #334155;
  background: steelblue;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  min-width: 180px;
}

.call-btn:hover { background: #3b82f6; border-color: #3b82f6; }
.call-btn:active { transform: scale(0.97); }
.call-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.call-btn.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
}

.call-btn.btn-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
}

/* ── Transcript ───────────────────────────── */

.call-transcript {
  background: var(--bg-inset);
  border-radius: 8px;
  padding: 1rem;
  min-height: 120px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.call-transcript:empty { display: none; }

.transcript-line {
  margin-bottom: 0.45rem;
}

.transcript-role {
  font-weight: 700;
  margin-right: 0.35rem;
}

.transcript-user .transcript-role { color: var(--fg-blue); }
.transcript-gemini .transcript-role { color: var(--fg-emerald); }

/* ── Responsive ───────────────────────────── */

@media (max-width: 600px) {
  main { padding: 1rem; }
  .call-card { padding: 1.25rem; }
  .call-btn { min-width: 140px; padding: 0.65rem 1.5rem; font-size: 0.88rem; }
}

/* Pre-microphone disclosure. Deliberately part of the normal reading flow above
   the start button rather than a collapsible: it has to be seen before the
   permission prompt, not found afterwards. */
.call-disclosure {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--bd);
  border-left: 3px solid #38bdf8;
  border-radius: 8px;
  background: var(--bg-inset);
  color: var(--fg-soft);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
}
.call-disclosure p { margin: 0 0 0.5rem; }
.call-disclosure p:last-child { margin-bottom: 0; }
.call-disclosure ul { margin: 0 0 0.6rem; padding-left: 1.1rem; }
.call-disclosure li { margin-bottom: 0.35rem; }
.call-disclosure a { color: var(--fg-sky-soft); }

/* ── Focus visibility ────────────────────────────────────────────────────────
   The rules above remove the native outline from inputs and selects and often
   replace it with a colour change only, which is invisible to anyone who
   cannot distinguish the two colours and disappears entirely in forced-colours
   mode. Keyboard users need to be able to see where they are. */
:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 2px;
}

/* Honour the OS-level preference: pulses, spins and smooth scrolling are
   decorative, and for some people they are a migraine or a vestibular episode. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Published business profile ─────────────
   Server-rendered by app/seo.py when a business has opted into publishing this
   page, and absent entirely otherwise. Below the call card on purpose: someone
   arriving from a link the business sent them came to call, and someone arriving
   from a search came to read — this order serves the first without hiding the
   second. */
.business-profile {
  max-width: 680px;
  margin: 2rem auto 0;
  padding: 1.75rem 1.75rem 1.5rem;
  background: var(--bg-deep-3);
  border: 1px solid var(--bd-soft-5);
  border-radius: 12px;
}

/* Who and where, centred as one block. */
.profile-header { text-align: center; }

.profile-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
  margin: 0;
}

.profile-address {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* The "about us", set off by a rule above and below. The rules stop short of the
   container's edges so they read as punctuation around the paragraph rather than
   as dividers cutting the card in half. */
.profile-desc {
  position: relative;
  margin: 1.4rem auto;
  padding: 1.1rem 0;
  max-width: 34rem;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--fg-soft);
  text-align: center;
}
.profile-desc::before,
.profile-desc::after {
  content: '';
  position: absolute;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--bg-steel-deep) 25%, var(--bg-steel-deep) 75%, transparent);
}
.profile-desc::before { top: 0; }
.profile-desc::after  { bottom: 0; }

.profile-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-skyblue);
  margin: 1.5rem 0 0.5rem;
}

/* Services and staff are both tables — a name against a figure, and a person
   against their week. Alignment is the whole point, so the numbers share a column
   instead of trailing each name at whatever width it happens to end. */
.profile-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  color: var(--fg-soft);
}

.profile-table th,
.profile-table td {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bd-soft-4);
  vertical-align: top;
  font-weight: 400;
  text-align: left;
}
.profile-table tr:last-child th,
.profile-table tr:last-child td { border-bottom: none; }

.profile-cell-name {
  font-weight: 600;
  color: var(--fg-strong);
  /* Takes whatever the figures do not. */
  width: auto;
}

.profile-cell-duration,
.profile-cell-day {
  color: var(--fg-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  width: 8.5rem;
}

.profile-cell-price,
.profile-cell-hours {
  text-align: right;
  white-space: nowrap;
  width: 7.5rem;
}

.profile-cell-price { color: var(--fg); font-weight: 600; }
.profile-cell-hours { color: var(--fg-muted); font-size: 0.82rem; }

/* A staff member's name spans their working days, so each person reads as one
   block; the rule goes above the first row of the next person. */
.profile-staff .profile-cell-name { vertical-align: top; padding-right: 1rem; }
.profile-staff tr:not(.profile-staff-row) .profile-cell-day,
.profile-staff tr:not(.profile-staff-row) .profile-cell-hours { border-bottom: none; }
.profile-staff .profile-staff-row:not(:first-child) th,
.profile-staff .profile-staff-row:not(:first-child) td { border-top: 1px solid var(--bd-soft-4); }
.profile-staff tr:not(:last-child) .profile-cell-day,
.profile-staff tr:not(:last-child) .profile-cell-hours { border-bottom: none; }

@media (max-width: 600px) {
  .business-profile { margin-top: 1.5rem; padding: 1.35rem 1.25rem 1.15rem; }
  .profile-desc { padding: 0.9rem 0; margin: 1.1rem auto; }
  .profile-desc::before, .profile-desc::after { left: 8%; right: 8%; }
  .profile-cell-duration, .profile-cell-day { width: 6.5rem; font-size: 0.78rem; }
  .profile-cell-price, .profile-cell-hours { width: 6.5rem; font-size: 0.78rem; }
}
