/* Admin Dashboard Styles */

/* ── Navbar branding (height/border inherited from .navbar in custom.css) ── */

.admin-console-label {
    font-size: 15px;
    color: var(--bs-body-color);
    border-left: 1px solid var(--bs-border-color);
    padding-left: 0.75rem;
    margin-left: 0.25rem;
}

/* Compact controls in navbar (don't inherit the 40px min-height of btn-xs) */
.admin-navbar-btn {
    min-height: 34px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.admin-org-select {
    padding: 4px 2rem 4px 12px;
    font-size: var(--bs-body-font-size);
    border-radius: 30px;
    min-height: 34px;
    height: 34px;
    border: 1.5px solid var(--bs-border-color);
}

.admin-org-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15);
}

/* ── Grid action buttons — compact, no min-height override ── */
/* Scoped to user-access-grid which is the only grid rendering action buttons */
#user-access-grid .ag-cell .btn {
    min-height: unset !important;
    height: 28px;
    padding: 0 10px;
    font-size: var(--font-sm);
    border-radius: 6px;
    line-height: 1;
}

.admin-tab-content {
    padding: 1.5rem 0;
}

.kpi-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    background: var(--bs-body-bg);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.kpi-card .kpi-chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 80px;
}

.kpi-card .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.kpi-card .kpi-label {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    margin-top: 0.25rem;
}

.admin-filter-bar {
    background: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.admin-grid {
    width: 100%;
    min-height: 200px;
}

.badge-source {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-source-web     { background-color: #0d6efd; color: white; }
.badge-source-slack   { background-color: #4a154b; color: white; }
.badge-source-gemini  { background-color: #1a73e8; color: white; }
.badge-source-sdk     { background-color: #198754; color: white; }
.badge-source-terminal{ background-color: #6c757d; color: white; }
.badge-source-mcp     { background-color: #8b5cf6; color: white; }

.status-completed  { color: #198754; }
.status-error      { color: #dc3545; }
.status-cache_hit  { color: #0d6efd; }
.status-pending    { color: #6c757d; }

#admin-chart-container {
    position: relative;
    height: 250px;
}

.popular-badge {
    background-color: #0dcaf0;
    color: #000;
}

.feedback-positive { color: #198754; }
.feedback-negative { color: #dc3545; }

/* ── Semantic Model Editor ── */
.sm-breadcrumb-bar {
    background: var(--bs-tertiary-bg);
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.sm-status-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 0.75rem;
}

.sm-ds-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.sm-ds-card {
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    background: var(--bs-body-bg);
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.sm-ds-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.sm-ds-card-delete {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--bs-secondary-color);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background-color 0.15s;
}

.sm-ds-card:hover .sm-ds-card-delete,
.sm-ds-card:focus-within .sm-ds-card-delete,
.sm-ds-card-delete:focus-visible {
    opacity: 1;
}

.sm-ds-card-delete:hover {
    color: var(--bs-danger);
    background-color: rgba(220, 53, 69, 0.1);
}

.sm-ds-card-add {
    border-style: dashed;
    border-color: var(--bs-primary);
    border-width: 2px;
    color: var(--bs-primary);
    background: transparent;
}

.sm-ds-card-add:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.sm-ds-card-add-plus {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.sm-badge-published { background-color: #198754; color: white; }
.sm-badge-draft     { background-color: #ffc107; color: #000; }
.sm-badge-archived  { background-color: #6c757d; color: white; }

.sm-choice-editor .sm-choice-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.sm-choice-editor .sm-choice-row input { flex: 1; }

.sm-validation-list {
    max-height: 200px;
    overflow-y: auto;
}

.sm-validation-error {
    padding: 0.2rem 0.5rem;
    background: #fff3f3;
    border-left: 3px solid #dc3545;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    border-radius: 0 0.25rem 0.25rem 0;
}

.sm-validation-warning {
    padding: 0.2rem 0.5rem;
    background: #fffbf0;
    border-left: 3px solid #ffc107;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    border-radius: 0 0.25rem 0.25rem 0;
}

/* ── Session drawer conversation ── */
.session-turn {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.session-turn:last-child { border-bottom: none; }
.session-q {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}
.session-q-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #0d6efd; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6875rem; font-weight: 600;
    flex-shrink: 0; margin-top: 2px;
}
.session-q-text {
    font-size: 0.875rem; font-weight: 600;
    color: #1a1a1a; line-height: 1.4;
}
.session-q-meta { font-size: 0.6875rem; color: #999; margin-top: 2px; }
.session-a { margin-left: 2.375rem; }
.session-a-insight {
    font-size: 0.8125rem; color: #333; line-height: 1.6;
    background: #f8f9fa; border-radius: 8px;
    padding: 0.75rem 1rem; margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
}
.session-a-sql {
    font-size: 0.75rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    background: #1e1e1e; color: #d4d4d4;
    border-radius: 6px; padding: 0.75rem;
    overflow-x: auto; max-height: 200px;
    white-space: pre-wrap; word-break: break-word;
    margin-bottom: 0.5rem;
}
.session-a-error {
    font-size: 0.8125rem; color: #dc3545;
    background: #fff5f5; border-radius: 8px;
    padding: 0.625rem 0.875rem; border: 1px solid #f5c6cb;
    margin-bottom: 0.5rem;
}
.session-a-tables { font-size: 0.6875rem; color: #888; margin-bottom: 0.25rem; }
.session-a-tables code {
    font-size: 0.6875rem; background: #e9ecef;
    padding: 1px 4px; border-radius: 3px;
}
.session-a-trace { font-size: 0.6875rem; color: #aaa; }
.session-a-trace a { color: #aaa; text-decoration: none; }
.session-a-trace a:hover { color: #0d6efd; }
.session-status {
    display: inline-block; font-size: 0.625rem;
    padding: 1px 6px; border-radius: 3px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.session-status-completed { background: #d1e7dd; color: #0f5132; }
.session-status-error { background: #f8d7da; color: #842029; }
.session-status-pending { background: #e2e3e5; color: #41464b; }

/* Timeline layout */
.session-timeline { padding: 0.5rem 0; }
.session-evt {
    display: flex;
    gap: 1rem;
    padding: 0 1.5rem;
    position: relative;
}
.session-evt-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
    z-index: 1;
}
.session-evt-dot-query { background: #0d6efd; }
.session-evt-dot-activity { background: #e9ecef; border: 2px solid #adb5bd; width: 10px; height: 10px; margin-top: 7px; }
.session-evt-content {
    flex: 1;
    padding-bottom: 1.25rem;
    border-left: 2px solid #e9ecef;
    padding-left: 1rem;
    margin-left: -7px;
}
.session-evt:last-child .session-evt-content { border-left-color: transparent; }

/* Activity events */
.session-activity-label { font-size: 0.8125rem; margin-bottom: 0.125rem; }
.session-activity-label .text-muted { font-size: 0.6875rem; }
.session-activity-detail { font-size: 0.8125rem; color: #555; }
