/* panels/openai-realtime/public/styles.css */

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

/* Make HTML [hidden] win over flex/grid containers that set their own display.
   Without this, .layout (display:flex) and .poc-container (display:flex) keep
   their hidden siblings visible — the routing script un-hides one mode but the
   others stay rendered, producing a stacked confusing UI. */
[hidden] { display: none !important; }

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", monospace;

  --text: #ffffff;
  --text-light: #d0d4e0;
  --text-muted: #999999;

  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.15);
  --bg-input: rgba(0,0,0,0.25);

  --green: #0FE59D;
  --red: #FF002C;
  --blue: #30ADFF;
  --blue-dark: #1E5CE3;

  --accent: #10A37F;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  --t-fast: 150ms;
}

body {
  font-family: var(--font);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.5px;
  min-height: 100vh;
}

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border: 4px solid transparent; background-clip: padding-box; }

/* ========================================================================== */
/* PoC test card (mode=test)                                                  */
/* ========================================================================== */

.poc-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.poc-card {
  max-width: 480px;
  width: 100%;
  padding: var(--space-2xl);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.poc-card h1 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.dot {
  width: 10px; height: 10px;
  background: var(--text-muted);
  border-radius: 50% !important;
  transition: background var(--t-fast);
}
/* Glow uses --green token; 12px sigma is decorative, not a layout dimension */
.dot.live { background: var(--green); box-shadow: 0 0 12px var(--green); }
.poc-card button {
  width: 100%;
  padding: var(--space-lg);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 0;
  background: var(--accent);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}
.poc-card button:hover:not(:disabled) { background: var(--blue-dark); }
.poc-card button:disabled { background: rgba(255,255,255,0.1); color: var(--text-muted); cursor: not-allowed; }
.poc-card button.stop { background: var(--red); }
.poc-card #status {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
}

/* ========================================================================== */
/* Master/detail layout                                                       */
/* ========================================================================== */

.layout {
  display: flex;
  height: 100vh;
}

/* ---------- master ---------- */

.master {
  width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.15);
}
.master-header {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.master-search {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px;
}
.master-search:focus { outline: none; border-color: var(--blue); }
.master-add {
  background: var(--accent);
  color: var(--text);
  border: 0;
  padding: 0 var(--space-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.master-add:hover { background: var(--blue-dark); }
.master-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}
/* Padding 10px 12px + 2px gap mandated by tickr-dev-spec §13 */
.master-item {
  padding: 10px 12px;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  background: rgba(255,255,255,0.06);
  /* Shadow per tickr-dev-spec §13 (master list item) */
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: background var(--t-fast);
}
.master-item:hover { background: rgba(255,255,255,0.08); }
.master-item.selected {
  border-left-color: var(--accent);
  background: rgba(255,255,255,0.10);
}
.master-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.master-item-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  font-family: var(--mono);
}
.master-item.is-default .master-item-title { color: var(--accent); }

/* ---------- detail ---------- */

.detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  max-width: none;
}
.detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.detail-empty .ph-bold {
  font-size: 48px;
}

.field {
  margin-bottom: var(--space-lg);
}
.field-label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}
/* Form input padding 8px 10px per tickr-dev-spec §13 */
.field-input,
.field-textarea,
.field-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 10px;
}
.field-textarea {
  font-family: var(--mono);
  resize: vertical;
  min-height: 64px;
}
.field-input:focus,
.field-textarea:focus,
.field-select:focus { outline: none; border-color: var(--blue); }
.field-input:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}
.field-row {
  display: flex;
  gap: var(--space-md);
}
.field-row > .field { flex: 1; }
.field-error {
  font-size: 11px;
  color: var(--red);
  margin-top: var(--space-xs);
}
.field-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  letter-spacing: 0.3px;
}

.detail-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: 6px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.6);
}
.btn {
  padding: 9px 16px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  border: 0;
}
.btn-primary {
  background: var(--blue);
  color: #000;
}
.btn-primary:disabled {
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
  cursor: not-allowed;
}
.btn-secondary {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-light);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger {
  background: none;
  border: 1px solid rgba(248,113,113,0.2);
  color: #F87171;
}
.btn-danger:hover { background: rgba(248,113,113,0.08); }

/* ========================================================================== */
/* Calls view                                                                 */
/* ========================================================================== */

.call-meta {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-xs) var(--space-md);
  font-size: 12px;
}
.call-meta dt {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.call-meta dd {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.call-transcript {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.call-turn {
  padding: var(--space-md);
  border-left: 3px solid var(--border);
  background: rgba(255,255,255,0.03);
}
.call-turn.agent { border-left-color: var(--accent); }
.call-turn.caller { border-left-color: var(--blue); }
.call-turn-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}
.call-turn-role { color: var(--text-light); }
.call-turn.agent .call-turn-role { color: var(--accent); }
.call-turn.caller .call-turn-role { color: var(--blue); }
.call-turn-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.call-status {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.call-status.sent    { background: rgba(15,229,157,0.15);  color: var(--green); }
.call-status.failed  { background: rgba(255,0,44,0.15);    color: var(--red); }
.call-status.no-url  { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.call-status.pending { background: rgba(48,173,255,0.15);  color: var(--blue); }

.master-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ========================================================================== */
/* App shell with tabs                                                        */
/* ========================================================================== */

#app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 20px;
  cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text-light); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.view {
  flex: 1;
  min-height: 0; /* allow inner overflow to scroll instead of stretching */
}

/* Existing .layout sets display:flex with height:100vh — that height was for
   the old full-window layout. Inside the shell, .view (flex:1) provides height,
   so override the inner .layout to fill its parent. */
.view.layout {
  height: auto;
}

/* ========================================================================== */
/* Rapportage section toggle                                                  */
/* ========================================================================== */

.section-divider {
  margin: var(--space-xl) 0 var(--space-md);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}
.toggle-input {
  appearance: none;
  width: 36px;
  height: 20px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.toggle-input::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  transition: transform var(--t-fast), background var(--t-fast);
}
.toggle-input:checked {
  background: rgba(16,163,127,0.25);
  border-color: var(--accent);
}
.toggle-input:checked::after {
  transform: translateX(16px);
  background: var(--accent);
}
.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.report-fields {
  /* No extra styling needed; inherits .field/.field-row */
}
.report-fields code {
  font-family: var(--mono);
  font-size: 11px;
  background: rgba(255,255,255,0.06);
  padding: 1px 4px;
  color: var(--text-light);
}

.call-cost {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================================================== */
/* Advanced audio settings disclosure                                         */
/* ========================================================================== */

.adv-audio {
  margin: var(--space-md) 0 var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.adv-audio-summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  user-select: none;
}
.adv-audio-summary:hover { color: var(--text-light); }
.adv-audio[open] .adv-audio-summary { color: var(--text); }
