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

:root {
  --bg:       #0d0f12;
  --bg2:      #141720;
  --bg3:      #1c2030;
  --bg4:      #252a38;
  --border:   #2a3045;
  --border2:  #3a4260;
  --text:     #e2e6f0;
  --text2:    #8890a8;
  --text3:    #555f7a;
  --accent:   #4f8fff;
  --teal:     #2dd4bf;
  --green:    #22c55e;
  --amber:    #f59e0b;
  --red:      #ef4444;
  --onair:    #ff2d2d;

  --font-ui:   'Barlow', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --font-cond: 'Barlow Condensed', sans-serif;

  --radius:   6px;
  --radius-lg: 10px;
  --shadow:   0 2px 12px rgba(0,0,0,.5);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── On Air Banner ────────────────────────────────────────────── */
.onair-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: 52px;
  background: var(--onair);
  color: #fff;
  font-family: var(--font-cond);
  animation: bannerIn .25s ease;
}
.onair-banner.hidden { display: none; }

@keyframes bannerIn {
  from { transform: translateY(-52px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.onair-pulse {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  animation: pulse 1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}

.onair-label {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .12em;
  white-space: nowrap;
}

.onair-info { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.onair-info #onair-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onair-loc { font-size: 12px; opacity: .8; }

.onair-actions { display: flex; gap: 8px; }
.btn-pullback {
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 5px 14px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-pullback:hover { background: rgba(255,255,255,.3); }

.btn-endcall {
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: 5px 14px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-endcall:hover { background: rgba(0,0,0,.5); }

.onair-timer {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .06em;
  min-width: 52px;
  text-align: right;
}

/* ── Header ───────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-cond);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  flex-shrink: 0;
}

.header-titles { display: flex; flex-direction: column; gap: 1px; }
.header-show { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1; }
.header-subtitle { font-size: 11px; font-weight: 400; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; }

.header-right { display: flex; align-items: center; gap: 10px; }

/* Status pills */
.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-connecting { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.25); color: var(--amber); }
.status-connecting .status-dot { background: var(--amber); animation: pulse 1s infinite; }
.status-connected   { background: rgba(34,197,94,.1);  border-color: rgba(34,197,94,.25); color: var(--green); }
.status-connected   .status-dot { background: var(--green); }
.status-disconnected { background: rgba(255,255,255,.04); border-color: var(--border); color: var(--text3); }
.status-disconnected .status-dot { background: var(--text3); }
.status-error       { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.25); color: var(--red); }
.status-error       .status-dot { background: var(--red); animation: pulse .6s infinite; }

.btn-icon {
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }

/* ── Board / Lines Grid ───────────────────────────────────────── */
.board {
  padding: 20px;
  min-height: calc(100vh - 54px - 40px);
}

.lines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

/* ── Line Card ────────────────────────────────────────────────── */
.line-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 14px 12px;
  cursor: default;
  transition: border-color .15s, background .15s;
  position: relative;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line-card.state-idle { opacity: .55; }
.line-card.state-idle:hover { opacity: .7; }

.line-card.state-ringing {
  border-color: var(--amber);
  background: rgba(245,158,11,.06);
  animation: ringFlash 1s ease-in-out infinite;
  cursor: pointer;
}
@keyframes ringFlash {
  0%,100% { border-color: var(--amber); }
  50%      { border-color: rgba(245,158,11,.3); }
}

.line-card.state-screening {
  border-color: var(--teal);
  background: rgba(45,212,191,.06);
  cursor: pointer;
}
.line-card.state-screening:hover { background: rgba(45,212,191,.1); }

.line-card.state-holding {
  border-color: var(--accent);
  background: rgba(79,143,255,.05);
  cursor: pointer;
}

.line-card.state-onair {
  border-color: var(--onair);
  background: rgba(255,45,45,.08);
}

/* Line number badge */
.line-number {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* State badge */
.line-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  width: fit-content;
}
.badge-idle       { background: var(--bg3); color: var(--text3); }
.badge-ringing    { background: rgba(245,158,11,.15); color: var(--amber); }
.badge-screening  { background: rgba(45,212,191,.15); color: var(--teal); }
.badge-holding    { background: rgba(79,143,255,.12); color: var(--accent); }
.badge-onair      { background: rgba(255,45,45,.18); color: var(--onair); }

.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-ringing .badge-dot   { animation: pulse .8s infinite; }
.badge-onair   .badge-dot   { animation: pulse .6s infinite; }

/* Line DID */
.line-did {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}

/* Caller info */
.line-caller-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-caller-location {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-caller-note {
  font-size: 12px;
  color: var(--text2);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .8;
}

/* Line card action row */
.line-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.btn-answer {
  flex: 1;
  background: var(--teal);
  color: #0d1a17;
  border: none;
  border-radius: var(--radius);
  padding: 6px 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-answer:hover { opacity: .85; }

.btn-card-onair {
  flex: 1;
  background: var(--onair);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 6px 0;
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-card-onair:hover { opacity: .85; }

.btn-card-details {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-card-details:hover { background: var(--bg4); color: var(--text); }

/* ── Caller Detail Panel ──────────────────────────────────────── */
.caller-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 320px;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transform: translateX(0);
  transition: transform .2s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,.4);
}
.caller-panel.hidden { transform: translateX(320px); }

.caller-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.caller-panel-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text2);
}
.caller-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.caller-panel-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* ── Form fields ──────────────────────────────────────────────── */
.field-row { display: flex; flex-direction: column; gap: 5px; }
.field-row label { font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; }
.field-row input,
.field-row textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s;
  resize: none;
}
.field-row input:focus,
.field-row textarea:focus { border-color: var(--accent); }
.field-row input[readonly] { opacity: .6; cursor: default; }
.field-row input::placeholder,
.field-row textarea::placeholder { color: var(--text3); }

/* ── Panel buttons ────────────────────────────────────────────── */
.btn-onair {
  flex: 1;
  background: var(--onair);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 0;
  font-family: var(--font-cond);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity .15s;
}
.btn-onair:hover { opacity: .85; }

.btn-hold {
  background: rgba(79,143,255,.12);
  border: 1px solid rgba(79,143,255,.25);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-hold:hover { background: rgba(79,143,255,.2); }

.btn-hangup {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: var(--red);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-hangup:hover { background: rgba(239,68,68,.2); }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Line config row */
/* ── Connection log ───────────────────────────────────────────── */
.connect-log {
  margin: 0 20px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.connect-log.hidden { display: none; }

.connect-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.connect-log-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text3);
}
.connect-log-dot.spinning {
  background: var(--amber);
  animation: pulse .8s infinite;
}
.connect-log-dot.ok  { background: var(--green); animation: none; }
.connect-log-dot.err { background: var(--red);   animation: none; }
.connect-log-dot.off { background: var(--text3);  animation: none; }

.connect-log-label { color: var(--text2); min-width: 80px; }
.connect-log-msg   { color: var(--text3); font-size: 12px; font-family: var(--font-mono); }
.connect-log-msg.ok  { color: var(--green); }
.connect-log-msg.err { color: var(--red); }

/* ── Password toggle ──────────────────────────────────────────── */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap input {
  flex: 1;
  padding-right: 36px;
}
.btn-show-pass {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color .15s;
}
.btn-show-pass:hover { color: var(--text2); }

/* ── Checkbox row ─────────────────────────────────────────────── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
  margin-top: 2px;
}
.checkbox-row input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.line-cfg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.line-cfg-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  min-width: 24px;
}
.line-cfg-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  padding: 0;
}
.line-cfg-row input::placeholder { color: var(--text3); }
.btn-remove-line {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 2px;
  display: flex;
  transition: color .15s;
}
.btn-remove-line:hover { color: var(--red); }

/* ── Shared buttons ───────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 20px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }

.btn-secondary {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-secondary:hover { background: var(--bg4); color: var(--text); }

/* ── Talent bar ───────────────────────────────────────────────── */
.talent-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  font-size: 12px;
}
.talent-bar-label { color: var(--text3); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.btn-talent {
  background: rgba(79,143,255,.1);
  border: 1px solid rgba(79,143,255,.25);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-talent:hover { background: rgba(79,143,255,.2); }
.talent-bar-hint { color: var(--text3); font-size: 11px; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
