/**
 * Bootstrap 5.3 dark theme  -  RepoLens brand alignment
 */
:root,
[data-bs-theme="dark"] {
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bs-body-bg: #0f172a;
    --bs-body-color: #f1f5f9;
    --bs-secondary-bg: #1e293b;
    --bs-tertiary-bg: #334155;
    --bs-border-color: #334155;
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-link-color: #60a5fa;
    --bs-link-hover-color: #93c5fd;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
    background-color: #1e293b;
    border-color: #3b82f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    color: #f1f5f9;
}

/* Offcanvas sidebar: permanent column on lg+ (collapsible via body.sidebar-collapsed) */
@media (min-width: 992px) {
    .sidebar.offcanvas-lg {
        position: sticky;
        top: 0;
        transform: translate3d(0, 0, 0) !important;
        visibility: visible !important;
        display: flex !important;
        flex-direction: column;
        width: var(--sidebar-width, 280px);
        min-width: var(--sidebar-width, 280px);
        height: 100dvh;
        z-index: 100;
        border-right: 1px solid var(--border-color, #334155);
        flex-shrink: 0;
        transition:
            transform var(--duration-slow, 0.38s) var(--ease-spring, ease),
            width var(--duration-slow, 0.38s) ease,
            min-width var(--duration-slow, 0.38s) ease,
            visibility var(--duration-slow, 0.38s) ease;
    }

    body.sidebar-collapsed .sidebar.offcanvas-lg {
        transform: translate3d(-100%, 0, 0) !important;
        visibility: hidden !important;
        pointer-events: none;
        width: 0 !important;
        min-width: 0 !important;
        border-right-width: 0;
        overflow: hidden;
    }

    .sidebar.offcanvas-lg .offcanvas-header {
        display: none !important;
    }

    .sidebar.offcanvas-lg .btn-close {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .sidebar.offcanvas {
        width: min(88vw, 300px);
    }
}

.app-bootstrap {
    display: flex;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
}

.app-bootstrap > .main {
    flex: 1;
    min-width: 0;
}

.task-status-download.btn {
    --bs-btn-font-weight: 600;
}

/* Glass pill buttons  -  translucent like data-source pills */
html[data-bs-theme="dark"] .btn {
    --bs-btn-border-radius: 999px;
    --bs-btn-box-shadow: none;
}

html[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: rgba(59, 130, 246, 0.12);
    --bs-btn-border-color: rgba(59, 130, 246, 0.38);
    --bs-btn-color: #93c5fd;
    --bs-btn-hover-bg: rgba(59, 130, 246, 0.2);
    --bs-btn-hover-border-color: rgba(96, 165, 250, 0.55);
    --bs-btn-hover-color: #bfdbfe;
    --bs-btn-active-bg: rgba(59, 130, 246, 0.24);
    --bs-btn-active-border-color: rgba(96, 165, 250, 0.6);
    --bs-btn-active-color: #dbeafe;
    --bs-btn-disabled-bg: rgba(59, 130, 246, 0.08);
    --bs-btn-disabled-border-color: rgba(59, 130, 246, 0.2);
    --bs-btn-disabled-color: rgba(147, 197, 253, 0.45);
}

html[data-bs-theme="dark"] .btn-secondary {
    --bs-btn-bg: rgba(148, 163, 184, 0.08);
    --bs-btn-border-color: rgba(148, 163, 184, 0.28);
    --bs-btn-color: #cbd5e1;
    --bs-btn-hover-bg: rgba(148, 163, 184, 0.14);
    --bs-btn-hover-border-color: rgba(148, 163, 184, 0.4);
    --bs-btn-hover-color: #f1f5f9;
    --bs-btn-active-bg: rgba(148, 163, 184, 0.18);
    --bs-btn-active-border-color: rgba(148, 163, 184, 0.45);
    --bs-btn-disabled-bg: rgba(148, 163, 184, 0.05);
    --bs-btn-disabled-border-color: rgba(148, 163, 184, 0.15);
}

html[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #93c5fd;
    --bs-btn-border-color: rgba(59, 130, 246, 0.38);
    --bs-btn-hover-bg: rgba(59, 130, 246, 0.12);
    --bs-btn-hover-border-color: rgba(96, 165, 250, 0.55);
    --bs-btn-hover-color: #bfdbfe;
}

.org-stats-cards.row > .col {
    min-width: 0;
}

.table-responsive.repolens-table-scroll {
    border: 1px solid var(--border-color, #334155);
    border-radius: var(--radius-md, 10px);
}
