/* easibots — shared styles. Vanilla CSS, no framework. */

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

:root {
    --bg:           #0f1116;
    --bg-elev:      #181b23;
    --bg-elev-2:    #21252f;
    --border:       #2a2f3a;
    --text:         #e8eaed;
    --text-mute:    #9aa0a6;
    --accent:       #4f8cff;
    --accent-hover: #6b9eff;
    --success:      #38c172;
    --danger:       #e3342f;
    --warn:         #f6993f;
    --radius:       6px;
    --shadow:       0 2px 8px rgba(0,0,0,0.35);
    --mono:         "JetBrains Mono", "Consolas", "Menlo", monospace;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

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

button, .btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 9px 16px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s ease;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled { background: #3a3f4b; color: var(--text-mute); cursor: not-allowed; }

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

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #f04a44; }

input, textarea, select {
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}
textarea { font-family: var(--mono); resize: vertical; min-height: 80px; }

label {
    display: block;
    font-size: 13px;
    color: var(--text-mute);
    margin-bottom: 6px;
}

.field { margin-bottom: 16px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 4px; }

/* ── landing / auth pages ────────────────────────────────────────── */

.center-card {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.center-card .card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.center-card h1 { font-size: 22px; margin-bottom: 8px; }
.center-card .lead { color: var(--text-mute); margin-bottom: 24px; }
.center-card .actions { display: flex; gap: 12px; margin-top: 8px; }
.center-card .actions .btn { flex: 1; text-align: center; padding: 11px 16px; }
.center-card .footer-link { font-size: 13px; color: var(--text-mute); margin-top: 16px; text-align: center; }

/* ── dashboard ───────────────────────────────────────────────────── */

.wrapper { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}
.sidebar .brand {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 32px;
    padding: 0 8px;
}
.sidebar nav { flex: 1; }
.sidebar nav button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    color: var(--text-mute);
    padding: 9px 12px;
    border-radius: var(--radius);
    margin-bottom: 4px;
}
.sidebar nav button:hover { background: var(--bg-elev-2); color: var(--text); }
.sidebar nav button.active { background: var(--bg-elev-2); color: var(--text); }
.sidebar .user-row {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-mute);
}
.sidebar .user-row .email { word-break: break-all; margin-bottom: 8px; }
.sidebar .user-row .logout { font-size: 13px; padding: 6px 10px; width: 100%; }

.main-content { flex: 1; padding: 32px; max-width: 1100px; }
.main-content h2 { font-size: 20px; margin-bottom: 16px; }
.tab-section { display: none; }
.tab-section.active { display: block; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.toolbar .left { display: flex; gap: 12px; align-items: center; }

/* ── tables / lists ──────────────────────────────────────────────── */

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
th { background: var(--bg-elev-2); color: var(--text-mute); font-weight: 500; }
tr:last-child td { border-bottom: none; }
td.mono { font-family: var(--mono); font-size: 13px; color: var(--text-mute); }
td.actions { text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 12px;
    color: var(--text-mute);
}

.empty {
    background: var(--bg-elev);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--text-mute);
}

/* ── modal ───────────────────────────────────────────────────────── */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
}
.modal h3 { font-size: 17px; margin-bottom: 16px; }
.modal .actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.modal .checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal .checkbox-row input { width: auto; }
.modal .checkbox-row label { margin: 0; color: var(--text); }

.secret-display {
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 13px;
    word-break: break-all;
    margin-bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.secret-display .value { flex: 1; }
.secret-display .copy-btn { padding: 4px 10px; font-size: 12px; }
.secret-warn {
    background: rgba(246,153,63,0.10);
    border: 1px solid var(--warn);
    border-radius: var(--radius);
    padding: 12px;
    color: var(--warn);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── live tab ────────────────────────────────────────────────────── */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    color: var(--text-mute);
}
.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-mute);
}
.status-pill.connected .dot { background: var(--success); }
.status-pill.connecting .dot { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.status-pill.disconnected .dot { background: var(--danger); }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.live-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr; } }

.panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.panel h3 { font-size: 14px; color: var(--text-mute); margin-bottom: 12px; font-weight: 500; }

.log {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-family: var(--mono);
    font-size: 12px;
    height: 360px;
    overflow-y: auto;
}
.log-row {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border);
    word-break: break-all;
}
.log-row:last-child { border-bottom: none; }
.log-row .ts { color: var(--text-mute); margin-right: 8px; }
.log-row .tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 11px; margin-right: 8px; }
.log-row .tag.in  { background: rgba(56,193,114,0.15); color: var(--success); }
.log-row .tag.out { background: rgba(79,140,255,0.15); color: var(--accent); }
.log-row .tag.err { background: rgba(227,52,47,0.15); color: var(--danger); }

/* ── notifications (toasts) ──────────────────────────────────────── */

.toast-host {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    min-width: 240px;
    font-size: 14px;
    animation: slideIn 0.18s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
