/* ── NimbleAI — Shared Styles ─────────────────────────────── */

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2d3148;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --danger: #ef4444;
    --success: #22c55e;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* ── Reset ───────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────── */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

header h1 { font-size: 1.25rem; font-weight: 600; }
header h1 span { color: var(--primary); }

header a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
}
header a:hover { color: var(--text); }

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-nav {
    padding: 0.35rem 0.8rem;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-nav:hover { background: var(--primary-hover); color: #fff; }

/* ── Form Controls ───────────────────────────────────────── */

label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

label:first-of-type { margin-top: 0; }

input, select, textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
}

textarea {
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.5;
    resize: vertical;
}

/* ── Buttons ─────────────────────────────────────────────── */

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    margin-top: 1rem;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

/* ── Panels ──────────────────────────────────────────────── */

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.panel h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ── Status / Alert ──────────────────────────────────────── */

.status {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.status.ok {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status.err {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert {
    margin-top: 1rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

.alert.err {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Tags ────────────────────────────────────────────────── */

.role-tag,
.model-tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 999px;
    color: var(--primary-hover);
}

/* ── Utilities ───────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Site Navigation ────────────────────────────────────── */

.user-badge-wrapper {
    position: relative;
}

.user-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.user-badge:hover { background: rgba(99, 102, 241, 0.08); }
.user-badge strong { color: var(--text); }

.user-badge .fa-chevron-down {
    font-size: 0.55rem;
    margin-left: 0.3rem;
    transition: transform 0.15s;
}
.user-badge.open .fa-chevron-down { transform: rotate(180deg); }

.btn-logout {
    padding: 0.4rem 0.9rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* ── Profile Popover ────────────────────────────────────── */

.profile-popover {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 200;
}

.profile-popover.open { display: block; }

.profile-popover h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1.5rem;
}

.profile-item label {
    font-size: 0.7rem;
    margin-bottom: 0.1rem;
}

.profile-item span {
    font-size: 0.825rem;
}

.profile-links {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.profile-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    font-size: 0.825rem;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
}

.profile-links a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-hover);
}

.profile-links a i {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .profile-popover { width: 260px; }
    .profile-grid { grid-template-columns: 1fr; }
}
