/* ============================================================
   LT controls — THEME COLOURS (lt-theme.css)
   The colour palette shared by the Ubimia / LexTools apps and every colour the LT controls use. To re-tint the
   apps (e.g. green -> blue) change the ACCENT scale below; nothing else needs to be touched. Stylesheets (the
   controls' and the apps') must only use tokens, never a hex/rgb literal. Colours that only one app uses live in
   that app's own theme file, built on these scales.

   The host loads it first: _content/LTControls/css/lt-theme.css, then lt-base.css, then its own stylesheets.

   THEMES: the :root block below is the "Ubimia" theme (mint accent), used when <html> has no data-theme attribute.
   The "LexTools" theme (blue accent, for when an app runs inside the LexTools desktop program) is the
   [data-theme="lextools"] block at the end of this file. It only overrides the ACCENT scale and the brand mark, so
   every component and legacy name (--ubimia-mint-*) follows it. The active theme is the data-theme attribute of
   <html> in the host's index.html.
   ============================================================ */

:root {
    /* ---------- 1. ACCENT — the brand colour (currently green). Change this scale to re-tint the app. ---------- */
    --accent-050: #F1FCF8;   /* faintest tint: hovered grid rows */
    --accent-100: #E6FFF7;   /* tint: selected rows, soft backgrounds */
    --accent-200: #C2FFE9;
    --accent-300: #8EFFD8;
    --accent-400: #4DFFC4;
    --accent-500: #00FFB2;   /* the accent itself: checkboxes, focus, highlights */
    --accent-600: #00D998;   /* strong accent: bars, dots */
    --accent-700: #00A876;   /* accent used as text on a light background */
    --accent-soft: #6EFFD0;
    --accent-glow: rgba(0, 217, 152, 0.28);

    /* ---------- 2. BRAND DARK — primary buttons, headings, active tabs ---------- */
    --brand-dark:    #16252F;
    --on-brand:      #FFFFFF;   /* text/icons over --brand-dark or any solid fill */

    /* ---------- 3. NEUTRALS — greys for text, borders and backgrounds ---------- */
    --neutral-900: #0E1A22;
    --neutral-800: #16252F;
    --neutral-700: #233340;
    --neutral-600: #3A4A57;
    --neutral-500: #5C6B77;
    --neutral-400: #8593A0;
    --neutral-300: #B5BFC8;
    --neutral-200: #D8DEE3;
    --neutral-100: #ECEFF2;
    --neutral-050: #F6F8F9;
    --white:       #FFFFFF;

    /* ---------- 4. STATUS COLOURS (semantic: they keep their meaning whatever the accent is) ---------- */
    --danger:         #C62828;   /* text/icons/borders of an error */
    --danger-strong:  #B42318;   /* text over --danger-soft, solid danger buttons */
    --danger-hover:   #9A3329;
    --danger-soft:    #FDECEC;   /* soft background of an error */
    --danger-border:  #F7A8A0;
    --danger-accent:  #F0665A;   /* bars and dots of an error */
    --danger-on-dark: #FF8A80;   /* error text over a dark dialog */

    --warning:        #F5A623;   /* bars and dots of a warning / pending item */
    --warning-fg:     #A16207;   /* text of a warning */
    --warning-soft:   #FFF4E0;
    --warning-border: #FBD38D;

    --success:        #15803D;
    --success-strong: #065F46;
    --success-soft:   #DCFCE7;
    --success-faint:  #ECFDF5;
    --success-border: #6EE7B7;

    /* ---------- 5. ACCENTS used as decoration (coloured dots, etc.) ---------- */
    --deco-coral:  #FF7A6B;
    --deco-amber:  #FFC65C;
    --deco-violet: #8C7BFF;
    --deco-sky:    #5BC8FF;

    /* ---------- 6. SEMANTIC ROLES ---------- */
    --bg:        var(--white);
    --bg-elev:   var(--neutral-050);
    --fg:        var(--brand-dark);
    --fg-muted:  var(--neutral-500);
    --fg-subtle: var(--neutral-400);
    --fg-accent: var(--accent-700);
    --line:        var(--neutral-200);
    --line-strong: var(--neutral-300);

    --surface:       var(--white);
    --surface-muted: var(--neutral-050);
    --border:        var(--neutral-200);
    --text:          var(--brand-dark);

    /* Brand mark (the app icon of the toolbar, the login page and the dialog headers) and the brand subtitle.
       The mark sizes live here too because the LexTools theme copies the LexTools 6 Blazor page header (PVPageHeader). */
    --brand-mark-bg:        var(--brand-dark);
    --brand-mark-fg:        var(--accent-500);
    --brand-mark-border:    transparent;
    --brand-mark-size:      28px;
    --brand-mark-radius:    8px;
    --brand-mark-icon-size: 16px;
    --brand-sub-fg:         var(--neutral-500);

    /* Tick of the selected option in a list: mint with a dark tick in Ubimia; the LexTools theme makes it navy with
       a white tick, as the brand mark. */
    --selected-check-bg:    var(--accent-500);
    --selected-check-fg:    var(--brand-dark);
    --text-muted:    var(--neutral-500);

    /* ---------- 7. CONTROL ROLES ---------- */
    --grid-row-hover:    var(--accent-050);   /* mouse over a grid row (LTDataGrid) */
    --grid-row-selected: var(--accent-100);
    --grid-row-bar:      var(--accent-600);   /* left bar of a selected row */
    --check-accent:      var(--accent-500);   /* checkboxes (LTCheck and the grid's) */

    --indicator-unread:  #0EA5E9;             /* unread dot / bar (LTGridIndicatorCell, LTFilterSelect) */
    --indicator-pending: var(--warning);      /* pending dot */

    --hover-danger-bg: var(--danger-soft);    /* LTButton HoverTone="Danger" */
    --hover-danger-fg: var(--danger-strong);

    /* Dark surfaces (the floating LTSelectionBar; LTButton Type="OnDark") */
    --surface-dark:       var(--brand-dark);
    --on-dark-fg:         rgba(255, 255, 255, 0.85);
    --on-dark-muted:      rgba(255, 255, 255, 0.7);
    --on-dark-hover-bg:   rgba(255, 255, 255, 0.1);
    --on-dark-close-bg:   rgba(255, 255, 255, 0.08);
    --on-dark-close-hover-bg: rgba(255, 255, 255, 0.18);
    --on-dark-danger-fg:  var(--deco-coral);
    --on-dark-danger-bg:  rgba(255, 122, 107, 0.15);
    --shadow-dark:        0 8px 32px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.2);

    /* LTButton Type="Blue" (light blue, the same in both themes) and Type="Danger" (red) */
    --button-blue-bg:         #1B6EC2;
    --button-blue-hover-bg:   #1861AC;
    --button-blue-fg:         var(--white);
    --button-danger-bg:       var(--danger-strong);
    --button-danger-hover-bg: var(--danger-hover);
    --button-danger-fg:       var(--white);

    /* LTBadge tones (an app adds its own with LTBadge Palette and its --{prefix}-bg / -fg / -border tokens) */
    --badge-neutral-bg:     var(--neutral-100);
    --badge-neutral-fg:     var(--neutral-600);
    --badge-neutral-border: var(--neutral-200);
    --badge-strong-bg:      var(--brand-dark);
    --badge-strong-fg:      var(--white);
    --badge-strong-border:  var(--brand-dark);
    --badge-accent-bg:      var(--accent-100);
    --badge-accent-fg:      var(--accent-700);
    --badge-accent-border:  var(--accent-200);
    --badge-success-bg:     var(--success-faint);
    --badge-success-fg:     var(--success-strong);
    --badge-success-border: var(--success-border);
    --badge-warning-bg:     var(--warning-soft);
    --badge-warning-fg:     var(--warning-fg);
    --badge-warning-border: var(--warning-border);
    --badge-danger-bg:      var(--danger-soft);
    --badge-danger-fg:      var(--danger-strong);
    --badge-danger-border:  var(--danger-border);
    --badge-info-bg:        #E0F2FE;
    --badge-info-fg:        #0369A1;
    --badge-info-border:    #BAE6FD;

    /* LTEmptyState icon tile */
    --empty-icon-bg:          var(--accent-100);
    --empty-icon-fg:          var(--accent-600);

    /* LTAlert: info (blue, the LexTools blue in both themes), success (green), warning (yellow) and error (red) */
    --alert-info-bg:          #F5F8FF;
    --alert-info-border:      #D6E3FF;
    --alert-info-icon:        #3E7FFF;
    --alert-info-title:       #1D4FD8;
    --alert-success-bg:       var(--success-faint);
    --alert-success-border:   var(--success-border);
    --alert-success-icon:     var(--success);
    --alert-success-title:    var(--success-strong);
    --alert-warning-bg:       var(--warning-soft);
    --alert-warning-border:   var(--warning-border);
    --alert-warning-icon:     var(--warning-fg);
    --alert-warning-title:    var(--warning-fg);
    --alert-error-bg:         var(--danger-soft);
    --alert-error-border:     var(--danger-border);
    --alert-error-icon:       var(--danger);
    --alert-error-title:      var(--danger-strong);

    /* LTLoader: the "u" of the Ubimia logo in glass filling with water, its text and the veil of an overlay. The water
       follows the ACCENT scale (mint in Ubimia, blue in LexTools); the glass is tinted per theme. */
    --loader-water-top:       var(--accent-200);   /* top of the water, under the surface */
    --loader-water-bottom:    var(--accent-600);   /* depth of the water, so it shows over a white background */
    --loader-water-back:      var(--accent-500);   /* the wave behind */
    --loader-water-surface:   var(--accent-050);   /* line of the surface */
    --loader-glass-top:       rgba(255, 255, 255, 0.85);
    --loader-glass-bottom:    rgba(194, 255, 233, 0.45);   /* --accent-200, translucent */
    --loader-glass-stroke:    #8CCDB8;             /* edge of the glass: a muted mint */
    --loader-shine:           var(--white);        /* glints and the inner band of the glass */
    --loader-fg:              var(--brand-dark);
    --loader-veil:            rgba(22, 37, 47, 0.2);

    /* LTCodeViewer: JSON and XML on a dark surface */
    --code-bg:                var(--surface-dark);
    --code-fg:                var(--on-dark-fg);
    --code-muted:             var(--on-dark-muted);   /* punctuation, comments, the language and the messages */
    --code-line:              rgba(255, 255, 255, 0.1);
    --code-scrollbar:         rgba(255, 255, 255, 0.3);
    --code-key:               var(--deco-sky);        /* JSON keys, XML tags */
    --code-string:            var(--deco-amber);      /* JSON texts, XML attribute values */
    --code-number:            var(--deco-violet);     /* JSON numbers and true / false / null, XML attribute names */
    --code-hidden:            var(--deco-coral);      /* values that were not stored ("***") */
    --code-hidden-bg:         rgba(255, 122, 107, 0.18);

    /* Menus (the LTSplitButton panel) */
    --menu-bg:                var(--white);
    --menu-border:            var(--neutral-200);
    --menu-item-fg:           var(--brand-dark);
    --menu-item-hover-bg:     var(--neutral-050);
    --menu-item-disabled-fg:  var(--neutral-400);
    --menu-group-fg:          var(--neutral-400);

    /* LTTree: redefine these on a container to restyle a tree (e.g. on a dark sidebar) */
    --tree-fg:              var(--brand-dark);
    --tree-fg-muted:        var(--neutral-500);
    --tree-section-fg:      var(--neutral-400);
    --tree-hover-bg:        var(--neutral-100);
    --tree-active-bg:       var(--white);
    --tree-active-bar:      var(--accent-500);
    --tree-focus-ring:      var(--accent-600);
    --tree-count-bg:        var(--neutral-100);
    --tree-count-fg:        var(--neutral-500);
    --tree-count-active-bg: var(--accent-100);
    --tree-count-active-fg: var(--accent-700);
    --tree-count-strong-bg: var(--brand-dark);
    --tree-count-strong-fg: var(--white);

    --shadow-color:   rgba(22, 37, 47, 0.12);

    /* LTButton Type="Accent" (e.g. a toolbar "Conectar" button) — always green, whatever the theme is */
    --conn-btn-bg:       #E6FFF7;
    --conn-btn-hover-bg: #C2FFE9;
    --conn-btn-border:   rgba(0, 255, 178, 0.32);
    --conn-btn-fg:       #00A876;

    /* ---------- 8. LEGACY NAMES — kept so existing stylesheets keep working; they just point at the scales above ---------- */
    --ubimia-quantum-blue: var(--brand-dark);
    --ubimia-white:        var(--white);
    --ubimia-mint-green:   var(--accent-500);
    --ubimia-mint-soft:    var(--accent-soft);

    --ubimia-ink-900: var(--neutral-900);
    --ubimia-ink-800: var(--neutral-800);
    --ubimia-ink-700: var(--neutral-700);
    --ubimia-ink-600: var(--neutral-600);
    --ubimia-ink-500: var(--neutral-500);
    --ubimia-ink-400: var(--neutral-400);
    --ubimia-ink-300: var(--neutral-300);
    --ubimia-ink-200: var(--neutral-200);
    --ubimia-ink-100: var(--neutral-100);
    --ubimia-ink-050: var(--neutral-050);

    --ubimia-mint-100: var(--accent-100);
    --ubimia-mint-200: var(--accent-200);
    --ubimia-mint-300: var(--accent-300);
    --ubimia-mint-400: var(--accent-400);
    --ubimia-mint-500: var(--accent-500);
    --ubimia-mint-600: var(--accent-600);
    --ubimia-mint-700: var(--accent-700);

    --ubimia-accent-coral:  var(--deco-coral);
    --ubimia-accent-amber:  var(--deco-amber);
    --ubimia-accent-violet: var(--deco-violet);
    --ubimia-accent-sky:    var(--deco-sky);

    --shadow-mint: 0 12px 28px var(--accent-glow);
}

/* ============================================================
   THEME "LexTools" — blue accent. The ACCENT scale changes, and the brand mark is a white icon on a navy background;
   the brand dark, neutrals, status colours and LTButton Type="Accent" (always green) keep their Ubimia values.
   ============================================================ */
:root[data-theme="lextools"] {
    --accent-050: #F5F8FF;
    --accent-100: #EBF1FF;
    --accent-200: #D6E3FF;
    --accent-300: #BFD3FF;
    --accent-400: #9DBDFF;
    --accent-500: #7DA6FF;
    --accent-600: #3E7FFF;
    --accent-700: #1D4FD8;
    --accent-soft: #9DBDFF;
    --accent-glow: rgba(62, 127, 255, 0.28);

    /* Brand mark and subtitle as the LexTools 6 Blazor page header (PVPageHeader) */
    --brand-mark-bg:        #0D0149;   /* LexTools 6 "secondary" (its --page-header-icon-bg) */
    --brand-mark-fg:        var(--white);
    --brand-mark-size:      36px;
    --brand-mark-radius:    10px;
    --brand-mark-icon-size: 20px;
    --brand-sub-fg:         #3E7FFF;   /* LexTools 6 "primary-dark" (its --page-subtitle-color) */

    /* Selected option tick: navy with a white tick, as the brand mark. */
    --selected-check-bg:    var(--brand-mark-bg);
    --selected-check-fg:    var(--white);

    /* LTLoader: the water already follows the blue ACCENT scale; the glass gets a blue tint and edge. */
    --loader-glass-bottom:  rgba(214, 227, 255, 0.55);   /* --accent-200, translucent */
    --loader-glass-stroke:  #8FAEE8;                     /* edge of the glass: a muted LexTools blue */
}
