/* AI Voice Agent Panel — Dark Theme */
:root {
    --bg-primary:   #0d0f14;
    --bg-secondary: #161a23;
    --bg-card:      #1e2330;
    --bg-input:     #252b3b;
    --border:       #2d3548;
    --accent:       #6c5ce7;
    --accent-hover: #7d6ff0;
    --accent-light: rgba(108,92,231,0.15);
    --success:      #00b894;
    --warning:      #fdcb6e;
    --danger:       #e17055;
    --info:         #0984e3;
    --text-primary: #e8eaf2;
    --text-secondary:#8892a4;
    --text-muted:   #5a6480;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 4px 20px rgba(0,0,0,0.4);
    --transition:   0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 34px; height: 34px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

.sidebar-logo .logo-text {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
}

.sidebar-logo .logo-text span {
    color: var(--accent);
}

.sidebar-nav { padding: 16px 0; flex: 1; overflow-y: auto; }

.nav-section {
    padding: 4px 16px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 30px; height: 30px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 11px; color: var(--text-muted); }

.main {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: 58px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky; top: 0;
    z-index: 50;
}

.topbar-title { font-size: 17px; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 10px; }

.content { padding: 28px; flex: 1; }

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.card-title { font-size: 15px; font-weight: 600; }

/* ── STATS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover { background: #d9634a; color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 7px; }
.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 9px 12px;
    font-size: 13.5px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }

textarea.form-control { resize: vertical; min-height: 90px; font-family: inherit; }

.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13.5px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
}

.badge-success { background: rgba(0,184,148,0.15); color: var(--success); }
.badge-warning { background: rgba(253,203,110,0.15); color: var(--warning); }
.badge-danger  { background: rgba(225,112,85,0.15);  color: var(--danger);  }
.badge-info    { background: rgba(9,132,227,0.15);   color: var(--info);    }
.badge-muted   { background: var(--bg-secondary);    color: var(--text-muted); }
.badge-accent  { background: var(--accent-light);    color: var(--accent);  }

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: rgba(0,184,148,0.1); border: 1px solid rgba(0,184,148,0.3); color: var(--success); }
.alert-danger  { background: rgba(225,112,85,0.1); border: 1px solid rgba(225,112,85,0.3); color: var(--danger);  }
.alert-info    { background: rgba(9,132,227,0.1);  border: 1px solid rgba(9,132,227,0.3);  color: var(--info);    }

/* ── TOGGLE ── */
.toggle {
    position: relative; display: inline-block;
    width: 40px; height: 22px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 22px; cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute;
    width: 16px; height: 16px; left: 2px; bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%; transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: #fff; }

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 20px; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }

.modal-body   { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab {
    padding: 10px 20px;
    font-size: 13.5px; font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 42px; margin-bottom: 14px; display: block; opacity: 0.4; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }

/* ── MISC ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-3 { margin-bottom: 20px; }
.w-full { width: 100%; }

/* ── AGENT CARD ── */
.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
    cursor: pointer;
}
.agent-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.agent-icon {
    width: 42px; height: 42px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: var(--accent);
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ── TOOL ITEM ── */
.tool-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-phase {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.phase-pre    { background: rgba(9,132,227,0.2);   color: var(--info);    }
.phase-in     { background: rgba(0,184,148,0.2);   color: var(--success); }
.phase-post   { background: rgba(253,203,110,0.2); color: var(--warning); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
