/* App UI styles — extends theme.css tokens */

/* NAV extensions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover,
.nav-link-active {
  color: var(--fg);
}

/* BUTTONS */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--fg);
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-primary:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-primary.btn-lg { padding: 13px 28px; font-size: 15px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}
.btn-secondary:hover { background: var(--bg-alt); transform: translateY(-1px); }

.btn-call {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(0, 180, 166, 0.25);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.2s;
}
.btn-call:hover { background: rgba(0, 180, 166, 0.18); }
.btn-call:disabled { opacity: 0.5; cursor: not-allowed; }

/* APP LAYOUT */
.app-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 40px 80px;
}
@media (max-width: 640px) { .app-main { padding: 24px 20px 60px; } }

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-head);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--fg);
  line-height: 1.1;
  margin-bottom: 6px;
}
.page-sub { font-size: 15px; color: var(--fg-muted); }
.back-link {
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  font-weight: 500;
}
.back-link:hover { color: var(--fg); }

/* SURVEY GRID */
.survey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.survey-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--fg);
  transition: box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.survey-card:hover { box-shadow: 0 4px 20px rgba(15,31,61,0.1); transform: translateY(-2px); }
.survey-card-top { display: flex; align-items: center; justify-content: space-between; }
.survey-card-q { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--fg); line-height: 1.4; }
.survey-card-meta { display: flex; gap: 12px; font-size: 12px; color: var(--fg-muted); }
.survey-card-date { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

/* BADGES */
.canton-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(0, 180, 166, 0.2);
  padding: 3px 10px;
  border-radius: 20px;
}
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.status-draft { background: var(--bg-alt); color: var(--fg-muted); border: 1px solid var(--border); }
.status-active { background: rgba(0, 180, 166, 0.1); color: var(--accent); border: 1px solid rgba(0, 180, 166, 0.3); }
.status-done { background: rgba(212, 136, 42, 0.1); color: var(--gold); border: 1px solid rgba(212, 136, 42, 0.3); }

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 640px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}
.stat-card-value {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 800;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-label { font-size: 12px; color: var(--fg-muted); font-weight: 500; }

/* PROGRESS */
.progress-section { margin-bottom: 24px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.progress-bar-track {
  height: 6px;
  background: var(--bg-alt);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* CALL LOG */
.call-log {
  background: #0F1F3D;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  max-height: 200px;
  overflow-y: auto;
}
.call-log-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #7A9CC0;
  margin-bottom: 12px;
  font-weight: 600;
}
.call-log-items { display: flex; flex-direction: column; gap: 4px; }
.log-item {
  font-size: 12px;
  font-family: monospace;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.log-success { color: #A8E8E3; }
.log-error { color: #ff7b7b; }
.log-done { color: var(--gold); font-weight: 600; }

/* PULSE DOT */
.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* SECTION CARD */
.section-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.section-card-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}
.hint-text { font-size: 12px; color: var(--fg-muted); }

/* TABLE */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

.td-name { font-weight: 600; }
.td-phone { color: var(--fg-muted); }
.td-action { text-align: right; width: 80px; }
.td-notes { color: var(--fg-muted); max-width: 220px; font-style: italic; }
.td-dur { color: var(--fg-muted); text-align: right; }
.phone-mono { font-family: monospace; font-size: 12px; }

/* RESPONDENT STATUS */
.resp-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}
.resp-pending { background: var(--bg-alt); color: var(--fg-muted); }
.resp-active { background: rgba(0, 180, 166, 0.1); color: var(--accent); animation: pulse 2s infinite; }
.resp-done { background: rgba(212, 136, 42, 0.1); color: var(--gold); }
.resp-failed { background: rgba(220, 38, 38, 0.08); color: #dc2626; }

/* FORM STYLES */
.form-page { max-width: 640px; }
.form-header { margin-bottom: 32px; }
.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}
.form-section-title {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-group { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}
.required { color: var(--accent); }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-textarea { resize: vertical; min-height: 88px; }
.form-hint { font-size: 12px; color: var(--fg-muted); margin-top: 6px; }
.input-group { display: flex; align-items: center; gap: 0; }
.input-group .form-input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); max-width: 160px; }
.input-suffix {
  padding: 10px 14px;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px;
  color: var(--fg-muted);
  white-space: nowrap;
}
.demo-notice {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(0, 180, 166, 0.06);
  border: 1px solid rgba(0, 180, 166, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.demo-notice-icon { color: var(--accent); flex-shrink: 0; padding-top: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.alert-error {
  padding: 12px 16px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 20px;
}

/* RESULTS DASHBOARD */
.results-hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 768px) { .results-hero { grid-template-columns: 1fr; } }

.results-bars {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.result-bar-item { display: flex; flex-direction: column; gap: 8px; }
.result-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.result-bar-pct {
  margin-left: auto;
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
}
.result-bar-track {
  height: 10px;
  background: var(--bg-alt);
  border-radius: 5px;
  overflow: hidden;
}
.result-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease;
}
.result-bar-yes { background: var(--accent); }
.result-bar-no { background: #e05252; }
.result-bar-undecided { background: var(--gold); }
.result-bar-count { font-size: 12px; color: var(--fg-muted); }

.vote-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vote-dot-yes { background: var(--accent); }
.vote-dot-no { background: #e05252; }
.vote-dot-undecided { background: var(--gold); }

.results-summary-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.results-total {
  background: #0F1F3D;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.results-total-num {
  font-family: var(--font-head);
  font-size: 52px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 6px;
}
.results-total-label { font-size: 13px; color: #7A9CC0; }
.results-meta {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.results-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--fg-muted);
}
.results-meta-row:last-child { border-bottom: none; }
.results-meta-row strong { color: var(--fg); font-weight: 600; }

/* VOTE BADGES */
.vote-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.vote-yes { background: rgba(0, 180, 166, 0.1); color: var(--accent); }
.vote-no { background: rgba(220, 80, 80, 0.1); color: #e05252; }
.vote-undecided { background: var(--gold-light); color: var(--gold); }
.vote-refused { background: var(--bg-alt); color: var(--fg-muted); }

.confidence-val {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  color: var(--fg);
}

/* TRANSCRIPTS */
.transcripts-list { padding: 4px 0; }
.transcript-item {
  border-bottom: 1px solid var(--border);
}
.transcript-item:last-child { border-bottom: none; }
.transcript-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  transition: background 0.15s;
}
.transcript-summary:hover { background: var(--bg); }
.transcript-summary::-webkit-details-marker { display: none; }
.transcript-phone { color: var(--fg-muted); font-family: monospace; font-size: 12px; }
.transcript-dur { margin-left: auto; color: var(--fg-muted); }
.transcript-body {
  padding: 16px 24px 20px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
}
.transcript-line-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 80%;
}
.tl-agent { align-self: flex-start; }
.tl-resp { align-self: flex-end; align-items: flex-end; }
.tl-speaker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.tl-text {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--fg);
}
.tl-agent .tl-text { background: rgba(0, 180, 166, 0.12); color: #1a4a46; border-radius: 2px 10px 10px 10px; }
.tl-resp .tl-text { background: #0F1F3D; color: #e8eaf0; border-radius: 10px 2px 10px 10px; }

/* LIVE BADGE */
.live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(0, 180, 166, 0.25);
  padding: 7px 14px;
  border-radius: 20px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 40px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.empty-icon {
  width: 56px;
  height: 56px;
  background: var(--bg-alt);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  margin: 0 auto 16px;
}
.empty-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}
.empty-sub { font-size: 14px; color: var(--fg-muted); margin-bottom: 24px; max-width: 400px; margin-left: auto; margin-right: auto; }
