:root {
    --ai-bg: #f6f7fb;
    --ai-panel: #ffffff;
    --ai-border: #e5e7eb;

    --ai-primary: #4f46e5;     /* Indigo */
    --ai-accent: #22d3ee;      /* Cyan */
    --ai-success: #22c55e;
    --ai-warning: #f59e0b;
    --ai-danger: #ef4444;

    --ai-text-muted: #6b7280;
}
html {
    font-size: 14px; /* Bootstrap default is 16px */
    overflow-y: scroll;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f6f7fb;
    color: #1f2937;
    line-height: 1.45;
}

/* Headings – smaller, calmer */
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }

/* Make table area keep height while loading */
.table-area {
    position: relative;
    min-height: 360px; /* tune for your UI */
}

/* Optional: visually indicate loading without removing rows */
.table-loading tbody {
    opacity: 0.35;
    pointer-events: none;
}

/* --- Sidebar --- */
#sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 56px;
    left: 0;
    padding-top: 1rem;

    background: linear-gradient(180deg, #ffffff, #f9fafb);
    border-right: 1px solid var(--ai-border);
    z-index: 1040;
}

/* Sidebar links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 10px;

    font-size: 0.9rem;
    font-weight: 500;

    color: #374151 !important; /* neutral dark */
    text-decoration: none;

    transition:
            background 0.15s ease,
            color 0.15s ease,
            transform 0.1s ease;
}

/* Hover = background highlight, not blue */
.sidebar-link:hover {
    background: rgba(79, 70, 229, 0.08);
    color: #111827 !important;
}
.sidebar-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
.sidebar-link.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar-link .badge {
    font-size: 0.65rem;
    letter-spacing: 0.03em;
}
.sidebar-link .bi-lock-fill {
    opacity: 0.6;
}
/* Icon styling */
.sidebar-link i {
    font-size: 1rem;
    color: #6b7280;
    transition: color 0.15s ease;
}

.sidebar-link:hover i {
    color: var(--ai-primary);
}

/* Mobile */
@media (max-width: 768px) {
    #sidebar {
        left: -250px;
        transition: left 0.3s ease;
    }

    #sidebar.active {
        left: 0;
    }
}
/* Cards & tables */
.card {
    font-size: 0.9rem;
}

.table {
    font-size: 0.85rem;
}
.ai-agent-card {
    background: var(--ai-panel);
    border: 1px solid var(--ai-border);
    border-radius: 16px;
    transition: transform .15s ease, box-shadow .15s ease;
}

.ai-agent-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 30px rgba(79,70,229,0.12);
}
/* Reduce button loudness */
.btn {
    font-size: 0.85rem;
    border-radius: 0.5rem;
}
.ai-agent-card .btn {
    border-radius: 0.5rem;
}
.btn-primary {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

.btn-primary:hover {
    background: #0b1220;
    border-color: #0b1220;
}
.btn-outline-secondary {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #374151;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}
/* Muted secondary buttons */
.btn-outline-secondary {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #374151;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #111827;
}
.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
}
.btn-link {
    color: var(--ai-text-muted);
    text-decoration: none;
    padding-left: 0;
}

.btn-link:hover {
    color: var(--ai-primary);
    text-decoration: none;
}
.btn-outline-brand {
    --bs-btn-color: #4f46e5;
    --bs-btn-border-color: #4f46e5;

    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: #4f46e5;
    --bs-btn-hover-border-color: #4f46e5;

    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: #4338ca;
    --bs-btn-active-border-color: #4338ca;

    --bs-btn-focus-shadow-rgb: 79, 70, 229;
}
/* Neutral impact highlighting (Bootstrap-table-safe) */
.table tbody tr.impact-high > td {
    background-color: rgba(79, 70, 229, 0.08);
}

.table tbody tr.impact-medium > td {
    background-color: rgba(79, 70, 229, 0.04);
}
.table tbody tr.impact-high:hover > td {
    background-color: rgba(79, 70, 229, 0.12);
}

.table tbody tr.impact-medium:hover > td {
    background-color: rgba(79, 70, 229, 0.08);
}
.table tbody tr.impact-high {
    font-weight: 600;
}

.table tbody tr.impact-high > td:first-child {
    border-left: 3px solid var(--ai-primary);
}
/* --- Form controls (checkboxes & radios) --- */
.form-check-input {
    cursor: pointer;
}

/* Checked state */
.form-check-input:checked {
    background-color: var(--ai-primary);
    border-color: var(--ai-primary);
}

/* Focus ring */
.form-check-input:focus {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

/* Indeterminate (checkbox) */
.form-check-input:indeterminate {
    background-color: var(--ai-primary);
    border-color: var(--ai-primary);
}
.form-check-label {
    font-size: 0.85rem;
    color: #374151;
}
.ai-agent-avatar {
    filter: drop-shadow(0 0 3px rgba(79, 70, 229, 0.35))
    drop-shadow(0 0 16px rgba(79, 70, 229, 0.2));
    transition: filter 0.3s ease;
}
.ai-agent-avatar:hover {
    filter: drop-shadow(0 0 8px rgba(79, 70, 229, 0.5))
    drop-shadow(0 0 24px rgba(79, 70, 229, 0.25));
}
.score-circle {
    box-shadow: 0 0 0 rgba(34,211,238,0.4);
    animation: pulse 2.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,211,238,0.3); }
    70% { box-shadow: 0 0 0 18px rgba(34,211,238,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,211,238,0); }
}
/* Page content area */
#content {
    margin-left: 250px; /* matches sidebar width */
    margin-top: 56px;
    padding: 2rem;
}

@media (max-width: 768px) {
    #content {
        margin-left: 0;
    }
}
.kpi-card {
    border-left: 3px solid rgba(79,70,229,0.25);
    /*display: flex;*/
    /*flex-direction: column;*/
    /*justify-content: center;*/

    /*min-height: 92px;*/

    /*border-radius: 14px;*/

    /*transition:*/
    /*        transform .12s ease,*/
    /*        box-shadow .12s ease,*/
    /*        border-color .12s ease;*/
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(17,24,39,0.08);
    border-color: rgba(79,70,229,0.2);
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--ai-text-muted);
}

.kpi-sub {
    font-size: 0.75rem;
}
.ai-head {
    max-width: 350px;
    filter: drop-shadow(0 0 8px rgba(0, 200, 190, 0.35));
}
.score-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle {
    --score: 0;
    --size: 150px;

    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;

    /*
     Traffic-light spectrum:
     - score=0   → HSL(0°,   80%, 50%)  = Red
     - score=50  → HSL(60°,  80%, 50%)  = Yellow
     - score=100 → HSL(120°, 80%, 50%)  = Green
    */
    --color: hsl(calc(var(--score) * 1.2), 80%, 50%);

    background: conic-gradient(
            var(--color) calc(var(--score) * 1%),
            #e9ecef 0
    );

    transition:
            background 2.2s ease-out,
            color 1.4s ease-out,
            --color 1.4s ease-out;
}

.score-circle::before {
    content: "";
    width: calc(var(--size) * 0.72);
    height: calc(var(--size) * 0.72);
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
}

.score-value {
    position: relative;
    font-size: 2.4rem;
    font-weight: bold;
    color: var(--color);
    transition: color 1.4s ease-out;
}
@keyframes fillAnimation {
    from {
        background: conic-gradient(
                var(--color) 0%,
                #e9ecef 0
        );
    }
    to {
        background: conic-gradient(
                var(--color) calc(var(--score) * 1%),
                #e9ecef 0
        );
    }
}

/* Results */
.stat-row {
    font-size: 0.85rem;
    padding: 2px 0;
}
.stat-label {
    padding-right: 4px;
}
.stat-value span.arrow {
    display: inline-block;
    width: 14px; /* ensures spacing between arrow and number */
    text-align: center;
    margin-right: 4px;
}

/* ===============================
   Cognity Pagination Styling
=================================*/

.pagination {
    --bs-pagination-padding-x: 0.65rem;
    --bs-pagination-padding-y: 0.35rem;
    --bs-pagination-font-size: 0.8rem;
}

.pagination .page-item .page-link {
    background: var(--ai-panel);
    border: 1px solid var(--ai-border);
    color: var(--ai-text-muted);

    border-radius: 8px;
    margin: 0 3px;

    transition:
            background 0.15s ease,
            color 0.15s ease,
            border-color 0.15s ease,
            box-shadow 0.15s ease;
}

/* Hover */
.pagination .page-item .page-link:hover {
    background: rgba(79, 70, 229, 0.06);
    border-color: rgba(79, 70, 229, 0.25);
    color: #111827;
}

/* Active page */
.pagination .page-item.active .page-link {
    background: var(--ai-primary);
    border-color: var(--ai-primary);
    color: #ffffff;
    font-weight: 600;

    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* Disabled */
.pagination .page-item.disabled .page-link {
    background: #f9fafb;
    border-color: var(--ai-border);
    color: #d1d5db;
}

/* Remove Bootstrap sharp corners */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border-radius: 8px;
}

/* Make arrows a bit tighter */
.pagination .page-link {
    min-width: 32px;
    text-align: center;
}

.table-area {
    transition: opacity 0.15s ease;
}

/* =========================
   AI Search Component
========================= */

.ai-search {
    position: relative;
}

.ai-search-input {
    padding-left: 2.2rem;
    padding-right: 2.2rem;
    border-radius: 12px;
    border: 1px solid var(--ai-border);
    transition: all 0.15s ease;
    background: #ffffff;
}

.ai-search-input:focus {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 0.15rem rgba(79,70,229,0.15);
}

.ai-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ai-text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.ai-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--ai-text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
}

.ai-search-clear:hover {
    color: var(--ai-primary);
}

/* Dropdown */

.ai-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--ai-panel);
    border: 1px solid var(--ai-border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(17,24,39,0.08);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 1050;
    padding: 6px 0;
    animation: fadeInDropdown 0.12s ease;
}

@keyframes fadeInDropdown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-search-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.12s ease;
}

.ai-search-item:hover {
    background: rgba(79,70,229,0.08);
}

.ai-search-item-title {
    font-weight: 600;
    color: #111827;
}

.ai-search-item-sub {
    font-size: 0.75rem;
    color: var(--ai-text-muted);
}

/* =========================
   AI Modal + Inputs
========================= */

.ai-modal {
    border-radius: 16px;
    border: 1px solid var(--ai-border);
}

.ai-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ai-text-muted);
    margin-bottom: 4px;
    display: block;
}

.ai-input {
    border-radius: 12px;
    border: 1px solid var(--ai-border);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.15s ease;
}

.ai-input:focus {
    border-color: var(--ai-primary);
    box-shadow: 0 0 0 0.15rem rgba(79,70,229,0.15);
}

.ai-readonly {
    background: #f9fafb;
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #111827;
}

/* Softer primary button */
.btn-primary {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
    transition:
            background 0.15s ease,
            box-shadow 0.15s ease,
            transform 0.08s ease;
}

/* Subtle hover */
.btn-primary:hover {
    background: #1f2937;   /* slightly lighter */
    border-color: #1f2937;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

/* Slight press feedback */
.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/*  Loading dots  */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.4s infinite both;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
.badge-late {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(220,38,38,0.15);
}
@keyframes blink {
    0% { opacity: .2; }
    20% { opacity: 1; }
    100% { opacity: .2; }
}

.arrow {
    display: inline-block;
    font-weight: bold;
    margin-right: 4px;
    animation: fadeIn 0.4s ease;
}

.arrow-up { color: #198754; }
.arrow-down { color: #dc3545; }
.arrow-neutral { color: #d98d00; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================
   Reports
========================= */

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.report-card {
    height: 100%;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 36px -32px rgba(15, 23, 42, 0.36);
}

.report-card__body {
    min-height: 160px;
}

.report-card__icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef6f2;
    color: #157347;
    font-size: 1.35rem;
}

.report-card__meta {
    font-size: 0.78rem;
    color: var(--ai-text-muted);
}
