@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg:          #080808;
  --surface:     #111;
  --surface2:    #1a1a1a;
  --border:      #242424;
  --border2:     #2e2e2e;
  --accent:      #f59e0b;
  --accent-dim:  rgba(245,158,11,.12);
  --accent-dim2: rgba(245,158,11,.06);
  --text:        #e2e2e2;
  --muted:       #666;
  --muted2:      #444;
  --green:       #22c55e;
  --green-dim:   rgba(34,197,94,.1);
  --red:         #ef4444;
  --red-dim:     rgba(239,68,68,.1);
  --blue:        #3b82f6;
  --blue-dim:    rgba(59,130,246,.1);
  --mono:        'IBM Plex Mono', monospace;
  --sans:        'IBM Plex Sans', sans-serif;
  --r:           6px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── TOP BAR ── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 52px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 100;
}
.logo {
  font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--accent); letter-spacing: .05em; flex-shrink: 0;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border2); }
.topbar-sub { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted2); transition: background .3s;
}
.status-dot.ok  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.err { background: var(--red); }
.status-label { font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* ── CONFIG BAR ── */
.config-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.config-group { display: flex; align-items: center; gap: 6px; }
.config-label {
  font-size: 10px; font-family: var(--mono);
  color: var(--muted); letter-spacing: .08em;
  text-transform: uppercase; white-space: nowrap;
}

input[type="text"],
input[type="password"],
input[type="tel"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--mono); font-size: 12px;
  padding: 6px 10px; outline: none;
  transition: border-color .2s; width: 210px;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: var(--muted2); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--r);
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #fbbf24; }
.btn-primary:disabled { background: var(--muted2); color: var(--muted); cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); }

.eye-btn {
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; color: var(--muted); font-size: 13px;
  transition: all .15s;
}
.eye-btn:hover { color: var(--text); border-color: var(--border2); }

/* ── TABS ── */
.tabs {
  display: flex; gap: 2px;
  padding: 12px 20px 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 8px 16px; border-radius: 6px 6px 0 0;
  font-size: 12px; font-family: var(--mono);
  cursor: pointer; border: 1px solid transparent;
  border-bottom: none; color: var(--muted);
  transition: all .15s; background: transparent;
  position: relative; bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent); background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}

/* ── MAIN ── */
.main { padding: 20px; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.spacer { flex: 1; }
.count-badge {
  font-family: var(--mono); font-size: 11px;
  color: var(--muted); padding: 4px 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r);
}
select.filter-select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: var(--mono); font-size: 12px;
  padding: 5px 10px; outline: none; cursor: pointer;
}
select.filter-select:focus { border-color: var(--accent); }

/* ── TABLE ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 14px;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
  text-align: left; border-bottom: 1px solid var(--border);
  background: var(--surface2); white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody tr.selected { background: var(--accent-dim2); }
td { padding: 10px 14px; font-size: 12px; vertical-align: middle; }
.mono { font-family: var(--mono); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 100px;
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  white-space: nowrap;
}
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red   { background: var(--red-dim);   color: var(--red);   }
.badge-blue  { background: var(--blue-dim);  color: var(--blue);  }
.badge-gray  { background: rgba(100,100,100,.1); color: var(--muted); }

/* ── EMPTY / LOADING ── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 10px;
  color: var(--muted); text-align: center;
}
.empty-icon { font-size: 32px; opacity: .3; }
.empty-text { font-size: 13px; }
.loading-row td { text-align: center; padding: 40px; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── PAGINATION ── */
#pagination { display: flex; justify-content: center; margin-top: 12px; gap: 8px; }

/* ── DETAIL PANEL ── */
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 200; display: flex; justify-content: flex-end;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn  { from { opacity: 0; }              to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.panel {
  width: 520px; max-width: 95vw; height: 100vh; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--border);
  animation: slideIn .2s ease; display: flex; flex-direction: column;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.panel-title { font-size: 13px; font-weight: 600; }
.panel-sub   { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.close-btn {
  width: 28px; height: 28px; display: flex; align-items: center;
  justify-content: center; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); font-size: 16px; line-height: 1;
  transition: all .15s;
}
.close-btn:hover { color: var(--text); border-color: var(--border2); }
.panel-body { padding: 20px; flex: 1; }

/* ── PANEL CONTENT ── */
.section-label {
  font-family: var(--mono); font-size: 10px;
  color: var(--accent); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.dl-btn {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--accent); background: var(--accent-dim2);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: 4px; padding: 2px 8px;
  cursor: pointer; text-decoration: none;
  transition: all .15s; white-space: nowrap;
  flex-shrink: 0;
}
.dl-btn:hover { background: var(--accent-dim); border-color: rgba(245,158,11,.4); }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.meta-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 12px;
}
.meta-key { font-size: 10px; color: var(--muted); font-family: var(--mono); margin-bottom: 4px; }
.meta-val { font-size: 13px; font-family: var(--mono); font-weight: 500; }

.summary-box {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px;
  font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 20px;
}

.transcript { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.msg { display: flex; gap: 10px; }
.msg-role {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  padding: 2px 7px; border-radius: 4px;
  white-space: nowrap; height: fit-content; margin-top: 2px; flex-shrink: 0;
}
.msg-role.agent { background: var(--accent-dim); color: var(--accent); }
.msg-role.user  { background: rgba(100,100,100,.1); color: var(--muted); }
.msg-text { font-size: 13px; line-height: 1.6; }

/* ── AUDIO PLAYER ── */
.audio-wrap {
  margin-bottom: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.audio-wrap audio {
  width: 100%;
  height: 36px;
  outline: none;
  border-radius: 4px;
  accent-color: var(--accent);
}

/* Chromium tabanlı tarayıcılarda scrollbar gibi native kontrol rengi */
.audio-wrap audio::-webkit-media-controls-panel {
  background: var(--surface2);
}

.audio-error {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  padding: 4px 0;
}

/* ── OUTBOUND FORM ── */
.form-grid { display: flex; flex-direction: column; gap: 16px; max-width: 440px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-family: var(--mono); font-size: 10px;
  color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
}
.form-input {
  width: 100%; padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: var(--mono); font-size: 13px; outline: none;
  transition: border-color .2s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted2); }
.form-hint { font-size: 11px; color: var(--muted); }

.call-result {
  padding: 12px 14px; border-radius: var(--r);
  font-family: var(--mono); font-size: 12px; margin-top: 8px;
}
.call-result.ok  { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,.2); }
.call-result.err { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(239,68,68,.2); }
