/*
 * theme-override.css
 *
 * Load order: motronic.min.css → theme.css → this file
 *
 * This stylesheet applies the theme.css colour palette and overrides
 * the BootstrapBlazor (--bb-*) variables that motronic.min.css hard-codes
 * so they stay consistent with the theme.
 *
 * Theme palette reference:
 *   primary   #78c2ad  (teal-green)
 *   secondary #f3969a  (soft red/pink)
 *   success   #56cc9d
 *   info      #6cc3d5
 *   warning   #ffce67
 *   danger    #ff7851
 *   light     #f8f9fa
 *   dark      #343a40
 */

/* =====================================================================
   1. CORE BS VARIABLES  (light / default)
      Replaces motronic's :root values with theme.css values
   ===================================================================== */
:root,
[data-bs-theme='light'] {
    /* Named colours */
    --bs-blue: #007bff;
    --bs-indigo: #6610f2;
    --bs-purple: #6f42c1;
    --bs-pink: #e83e8c;
    --bs-red: #ff7851;
    --bs-orange: #fd7e14;
    --bs-yellow: #ffce67;
    --bs-green: #56cc9d;
    --bs-teal: #20c997;
    --bs-cyan: #6cc3d5;
    /* Gray scale */
    --bs-gray: #888;
    --bs-gray-dark: #343a40;
    --bs-gray-100: #f8f9fa;
    --bs-gray-200: #f7f7f9;
    --bs-gray-300: #eceeef;
    --bs-gray-400: #ced4da;
    --bs-gray-500: #aaa;
    --bs-gray-600: #888;
    --bs-gray-700: #5a5a5a;
    --bs-gray-800: #343a40;
    --bs-gray-900: #212529;
    /* Semantic colours */
    --bs-primary: #78c2ad;
    --bs-secondary: #f3969a;
    --bs-success: #56cc9d;
    --bs-info: #6cc3d5;
    --bs-warning: #ffce67;
    --bs-danger: #ff7851;
    --bs-light: #f8f9fa;
    --bs-dark: #343a40;
    /* RGB variants */
    --bs-primary-rgb: 120, 194, 173;
    --bs-secondary-rgb: 243, 150, 154;
    --bs-success-rgb: 86, 204, 157;
    --bs-info-rgb: 108, 195, 213;
    --bs-warning-rgb: 255, 206, 103;
    --bs-danger-rgb: 255, 120, 81;
    --bs-light-rgb: 248, 249, 250;
    --bs-dark-rgb: 52, 58, 64;
    /* Text-emphasis */
    --bs-primary-text-emphasis: #304e45;
    --bs-secondary-text-emphasis: #613c3e;
    --bs-success-text-emphasis: #22523f;
    --bs-info-text-emphasis: #2b4e55;
    --bs-warning-text-emphasis: #665229;
    --bs-danger-text-emphasis: #663020;
    --bs-light-text-emphasis: #5a5a5a;
    --bs-dark-text-emphasis: #5a5a5a;
    /* Subtle backgrounds */
    --bs-primary-bg-subtle: #e4f3ef;
    --bs-secondary-bg-subtle: #fdeaeb;
    --bs-success-bg-subtle: #ddf5eb;
    --bs-info-bg-subtle: #e2f3f7;
    --bs-warning-bg-subtle: #fff5e1;
    --bs-danger-bg-subtle: #ffe4dc;
    --bs-light-bg-subtle: #fcfcfd;
    --bs-dark-bg-subtle: #ced4da;
    /* Subtle borders */
    --bs-primary-border-subtle: #c9e7de;
    --bs-secondary-border-subtle: #fad5d7;
    --bs-success-border-subtle: #bbebd8;
    --bs-info-border-subtle: #c4e7ee;
    --bs-warning-border-subtle: #ffebc2;
    --bs-danger-border-subtle: #ffc9b9;
    --bs-light-border-subtle: #f7f7f9;
    --bs-dark-border-subtle: #aaa;
    /* Body */
    --bs-body-color: #888;
    --bs-body-color-rgb: 136, 136, 136;
    --bs-body-bg: #fff;
    --bs-body-bg-rgb: 255, 255, 255;
    /* Typography */
    --bs-heading-color: #b2b2b2;
    --bs-link-color: #78c2ad;
    --bs-link-color-rgb: 120, 194, 173;
    --bs-link-hover-color: #609b8a;
    --bs-link-hover-color-rgb: 96, 155, 138;
    --bs-code-color: #e83e8c;
    /* Borders & radius */
    --bs-border-color: #eceeef;
    --bs-border-radius: 0.4rem;
    --bs-border-radius-sm: 0.3rem;
    --bs-border-radius-lg: 0.6rem;
    /* Focus ring */
    --bs-focus-ring-color: rgba(120, 194, 173, 0.25);
    /* Form validation */
    --bs-form-valid-color: #56cc9d;
    --bs-form-valid-border-color: #56cc9d;
    --bs-form-invalid-color: #ff7851;
    --bs-form-invalid-border-color: #ff7851;
    /* ----------------------------------------------------------------
       BootstrapBlazor (--bb-*) overrides — keyed to theme palette
       ---------------------------------------------------------------- */
    --bb-disabled-bg: #f8f9fa; /* was #f5f8fa — use theme light */
    --bb-border-focus-color: #78c2ad; /* was #b5b5c3 — use theme primary */
    --bb-border-hover-color: #78c2ad; /* was #b5b5c3 — use theme primary */
    --bb-menu-item-hover-bg: #78c2ad; /* nav sidebar active/hover bg */
    --bb-menu-item-hover-color: #fff; /* nav sidebar active/hover text */
}

/* =====================================================================
   2. DARK MODE VARIABLES
   ===================================================================== */
[data-bs-theme='dark'] {
    color-scheme: dark;
    --bs-body-color: #eceeef;
    --bs-body-color-rgb: 236, 238, 239;
    --bs-body-bg: #212529;
    --bs-body-bg-rgb: 33, 37, 41;
    --bs-border-color: #5a5a5a;
    --bs-primary-text-emphasis: #aedace;
    --bs-secondary-text-emphasis: #f8c0c2;
    --bs-success-text-emphasis: #9ae0c4;
    --bs-info-text-emphasis: #a7dbe6;
    --bs-warning-text-emphasis: #ffe2a4;
    --bs-danger-text-emphasis: #ffae97;
    --bs-light-text-emphasis: #f8f9fa;
    --bs-dark-text-emphasis: #eceeef;
    --bs-primary-bg-subtle: #182723;
    --bs-secondary-bg-subtle: #311e1f;
    --bs-success-bg-subtle: #11291f;
    --bs-info-bg-subtle: #16272b;
    --bs-warning-bg-subtle: #332915;
    --bs-danger-bg-subtle: #331810;
    --bs-light-bg-subtle: #343a40;
    --bs-dark-bg-subtle: #1a1d20;
    --bs-primary-border-subtle: #487468;
    --bs-secondary-border-subtle: #925a5c;
    --bs-success-border-subtle: #347a5e;
    --bs-info-border-subtle: #417580;
    --bs-warning-border-subtle: #997c3e;
    --bs-danger-border-subtle: #994831;
    --bs-light-border-subtle: #5a5a5a;
    --bs-dark-border-subtle: #343a40;
    --bs-link-color: #aedace;
    --bs-link-hover-color: #bee1d8;
    --bs-form-valid-color: #9ae0c4;
    --bs-form-valid-border-color: #9ae0c4;
    --bs-form-invalid-color: #ffae97;
    --bs-form-invalid-border-color: #ffae97;
    /* --bb-* dark overrides */
    --bb-disabled-bg: #2b3035;
    --bb-border-focus-color: #78c2ad;
    --bb-border-hover-color: #78c2ad;
    --bb-menu-item-hover-bg: #609b8a; /* slightly darker in dark mode */
    --bb-menu-item-hover-color: #fff;
}

/* =====================================================================
   3. BUTTON OVERRIDES
      motronic hard-codes hover/active hex values derived from its own
      palette. Re-key them to the theme colours.
   ===================================================================== */

/* Primary  #78c2ad → hover ~10% darker */
.btn-primary {
    --bs-btn-bg: #78c2ad;
    --bs-btn-border-color: #78c2ad;
    --bs-btn-disabled-bg: #78c2ad;
    --bs-btn-disabled-border-color: #78c2ad;
    --bs-btn-hover-bg: #609b8a;
    --bs-btn-active-bg: #4f8072;
    --bs-btn-hover-border-color: #609b8a;
    --bs-btn-active-border-color: #609b8a;
}

.btn-outline-primary {
    --bs-btn-color: #78c2ad;
    --bs-btn-border-color: #78c2ad;
    --bs-btn-disabled-color: #78c2ad;
    --bs-btn-disabled-border-color: #78c2ad;
    --bs-btn-hover-bg: #609b8a;
    --bs-btn-active-bg: #4f8072;
    --bs-btn-hover-border-color: #609b8a;
    --bs-btn-active-border-color: #609b8a;
}

.btn-link {
    --bs-btn-color: #78c2ad;
    --bs-btn-hover-color: #609b8a;
}

/* Secondary  #f3969a → hover ~10% darker */
.btn-secondary {
    --bs-btn-color: #5a3a3c;
    --bs-btn-hover-color: #5a3a3c;
    --bs-btn-active-color: #5a3a3c;
    --bs-btn-disabled-color: #5a3a3c;
    --bs-btn-bg: #f3969a;
    --bs-btn-border-color: #f3969a;
    --bs-btn-disabled-bg: #f3969a;
    --bs-btn-disabled-border-color: #f3969a;
    --bs-btn-hover-bg: #ef7478;
    --bs-btn-active-bg: #eb5560;
    --bs-btn-hover-border-color: #ef7478;
    --bs-btn-active-border-color: #ef7478;
}

.btn-outline-secondary {
    --bs-btn-color: #f3969a;
    --bs-btn-border-color: #f3969a;
    --bs-btn-disabled-color: #f3969a;
    --bs-btn-disabled-border-color: #f3969a;
    --bs-btn-hover-bg: #ef7478;
    --bs-btn-active-bg: #eb5560;
    --bs-btn-hover-border-color: #ef7478;
    --bs-btn-active-border-color: #ef7478;
}

/* Success  #56cc9d → hover ~10% darker */
.btn-success {
    --bs-btn-bg: #56cc9d;
    --bs-btn-border-color: #56cc9d;
    --bs-btn-disabled-bg: #56cc9d;
    --bs-btn-disabled-border-color: #56cc9d;
    --bs-btn-hover-bg: #3aab6d;
    --bs-btn-active-bg: #2e8f5a;
    --bs-btn-hover-border-color: #3aab6d;
    --bs-btn-active-border-color: #3aab6d;
}

.btn-outline-success {
    --bs-btn-color: #56cc9d;
    --bs-btn-border-color: #56cc9d;
    --bs-btn-disabled-color: #56cc9d;
    --bs-btn-disabled-border-color: #56cc9d;
    --bs-btn-hover-bg: #3aab6d;
    --bs-btn-active-bg: #2e8f5a;
    --bs-btn-hover-border-color: #3aab6d;
    --bs-btn-active-border-color: #3aab6d;
}

/* Info  #6cc3d5 → hover ~10% darker */
.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: #fff;
    --bs-btn-bg: #6cc3d5;
    --bs-btn-border-color: #6cc3d5;
    --bs-btn-disabled-bg: #6cc3d5;
    --bs-btn-disabled-border-color: #6cc3d5;
    --bs-btn-hover-bg: #4aadc2;
    --bs-btn-active-bg: #3596ac;
    --bs-btn-hover-border-color: #4aadc2;
    --bs-btn-active-border-color: #4aadc2;
}

.btn-outline-info {
    --bs-btn-color: #6cc3d5;
    --bs-btn-border-color: #6cc3d5;
    --bs-btn-disabled-color: #6cc3d5;
    --bs-btn-disabled-border-color: #6cc3d5;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-hover-bg: #4aadc2;
    --bs-btn-active-bg: #3596ac;
    --bs-btn-hover-border-color: #4aadc2;
    --bs-btn-active-border-color: #4aadc2;
}

/* Warning  #ffce67 → hover ~10% darker */
.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: #fff;
    --bs-btn-bg: #ffce67;
    --bs-btn-border-color: #ffce67;
    --bs-btn-disabled-bg: #ffce67;
    --bs-btn-disabled-border-color: #ffce67;
    --bs-btn-hover-bg: #f0b733;
    --bs-btn-active-bg: #d99e10;
    --bs-btn-hover-border-color: #f0b733;
    --bs-btn-active-border-color: #f0b733;
}

.btn-outline-warning {
    --bs-btn-color: #ffce67;
    --bs-btn-border-color: #ffce67;
    --bs-btn-disabled-color: #ffce67;
    --bs-btn-disabled-border-color: #ffce67;
    --bs-btn-hover-bg: #f0b733;
    --bs-btn-active-bg: #d99e10;
    --bs-btn-hover-border-color: #f0b733;
    --bs-btn-active-border-color: #f0b733;
}

/* Danger  #ff7851 → hover ~10% darker */
.btn-danger {
    --bs-btn-bg: #ff7851;
    --bs-btn-border-color: #ff7851;
    --bs-btn-disabled-bg: #ff7851;
    --bs-btn-disabled-border-color: #ff7851;
    --bs-btn-hover-bg: #f05530;
    --bs-btn-active-bg: #d43d18;
    --bs-btn-hover-border-color: #f05530;
    --bs-btn-active-border-color: #f05530;
}

.btn-outline-danger {
    --bs-btn-color: #ff7851;
    --bs-btn-border-color: #ff7851;
    --bs-btn-disabled-color: #ff7851;
    --bs-btn-disabled-border-color: #ff7851;
    --bs-btn-hover-bg: #f05530;
    --bs-btn-active-bg: #d43d18;
    --bs-btn-hover-border-color: #f05530;
    --bs-btn-active-border-color: #f05530;
}

/* Dark  #343a40 → hover ~10% darker */
.btn-dark {
    --bs-btn-bg: #343a40;
    --bs-btn-border-color: #343a40;
    --bs-btn-disabled-bg: #343a40;
    --bs-btn-disabled-border-color: #343a40;
    --bs-btn-hover-bg: #23282d;
    --bs-btn-active-bg: #1a1d20;
    --bs-btn-hover-border-color: #23282d;
    --bs-btn-active-border-color: #23282d;
}

.btn-outline-dark {
    --bs-btn-color: #343a40;
    --bs-btn-border-color: #343a40;
    --bs-btn-disabled-color: #343a40;
    --bs-btn-disabled-border-color: #343a40;
    --bs-btn-hover-bg: #23282d;
    --bs-btn-active-bg: #1a1d20;
    --bs-btn-hover-border-color: #23282d;
    --bs-btn-active-border-color: #23282d;
}

/* =====================================================================
   4. COMPONENT SPOT FIXES
   ===================================================================== */

/* Sidebar nav — bootstrap.blazor sets these directly on .menu with
   hard-coded #409eff values, beating our :root definitions */
.menu {
    --bb-menu-active-color: #78c2ad;
    --bb-menu-bar-bg: #78c2ad;
    --bb-menu-item-hover-bg: #78c2ad;
    --bb-menu-item-hover-color: var(--bs-body-color);
}

/* Tree-view hover inherits new primary automatically via var(), but
   make explicit in case motronic ever hard-codes it */
.tree-view {
    --bb-tree-item-hover-color: var(--bs-primary);
}

/* Table filter card header uses secondary — already via var() in
   motronic, but secondary is now the pink theme colour; keep consistent */
.table-filter .card-header,
.table-filter .card-arrow:after,
.table-filter .card-arrow:before {
    border-bottom-color: var(--bs-secondary);
}

/* =====================================================================
   5. MISC / TYPOGRAPHY  (from theme.css extras)
   ===================================================================== */
code {
    color: var(--bs-light) !important;
}

pre {
    display: block;
    margin-top: 0;
    margin-bottom: 1rem;
    overflow: auto;
    font-size: .875em;
    background-color: var(--bs-dark);
    color: inherit;
    padding: 1rem;
    border-radius: 0.5rem;
}

.tabs-item {
    text-decoration: none;
}

/* Width */
::-webkit-scrollbar {
    width: 6px; /* Vertical scrollbar */
    height: 6px; /* Horizontal scrollbar */
}

/* Track (background) */
::-webkit-scrollbar-track {
    background: #1a1a1a;
}

/* Handle */
::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

    /* Handle on hover */
    ::-webkit-scrollbar-thumb:hover {
        background: #333;
    }

.clickable {
}

    .clickable:hover {
        cursor: pointer;
    }

.cursor-pointer {
}

    .cursor-pointer:hover {
        cursor: pointer;
    }

.z-10 {
    z-index: 1000 !important;
}

.z-20 {
    z-index: 2000 !important;
}

.vh-25 {
    height: 25vh !important;
}

.vh-50 {
    height: 50vh !important;
}

.vh-75 {
    height: 75vh !important;
}

.auto-grow {
    overflow-y: auto;
    resize: none;
}


/* =====================================================================
   6. CHAT BUBBLES
   ===================================================================== */
.chat-bubble {
    max-width: min(900px, 90%);
    border-radius: var(--bs-border-radius-lg);
    padding: 5px 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    overflow: auto;
}

.chat-bubble-has-items {
    min-width: 90%;
}

.chat-bubble p {
    margin: 0;
}

.chat-bubble-user {
    background: var(--bs-gray-800);
    color: var(--bs-light);
    border-top-right-radius: var(--bs-border-radius-sm);
}

.chat-bubble-assistant {
    background: var(--bs-gray-900);
    color: var(--bs-light);
    border-top-left-radius: var(--bs-border-radius-sm);
    border: 1px solid var(--bs-border-color);
}