﻿/* ============================================================================================
   unify.css - one look for: card headers, table headers, the sidebar menu, status chips. Reads only tokens.css.
   It sits after the old page css (same idea as buttons.css) and wins over the old one-off colours, so every page follows the same tokens,
   and a state theme (theme-goa.css ...) only has to change the token values. The old rules stay in their files until each page is cleaned.
   NOT touched here: the MIS total rows (locked colours, MisDashboard.css) and the MIS sub-rows.
   Load order: after tokens.css and buttons.css.
   ============================================================================================ */

/* ---------- 1. card header (light tint band, dark ink title, primary icon) ---------- */
html body .mis-card-header,
html body :is(#pndCard, #obxCard, #obxFilter, #larCard, #larFilter) .mis-card-header,
html body .fx-top,
html body .sv-form .card-header,
html body .sv-view .card-header,
html body .sv-form.ac-ui .card-header {
    background: var(--ui-head-bg) !important; color: var(--ui-head-ink) !important;
    border-color: var(--ui-head-line) !important;
}
html body .mis-card-title, html body .fx-top h1, html body .fx-top .fx-eyebrow,
html body .sv-form .card-title, html body .sv-view .card-title,
html body .sv-form.ac-ui .card-header .card-title {
    color: var(--ui-head-ink) !important; font-size: var(--ui-fs-title); font-weight: 700; letter-spacing: 0;
}
html body .mis-card-title i, html body .mis-card-header > i, html body .mis-card-header svg,
html body .fx-top i, html body .sv-form .card-header i, html body .sv-view .card-header i { color: var(--ui-primary) !important; fill: currentColor; }
html body .mis-card-header .mis-card-sub, html body .fx-top p, html body .sv-form .card-header small, html body .sv-form .card-header .text-muted { color: var(--ui-muted) !important; }

/* ---------- 2. table header (same tint and ink as the card header) ---------- */
html body .mis-th-band, html body .mis-th-sub,
html body table.mis-tbl thead th,
html body :is(#pndCard, #obxCard, #larCard) :is(table.mis-tbl, table.dataTable) thead th,
html body .fx-table thead th, html body .fx-shell.is-embedded .fx-table thead th,
html body .lad-table .lad-group-row th, html body .lad-table .lad-group {
    background: var(--ui-th-bg) !important; color: var(--ui-th-ink) !important;
    font-size: var(--ui-fs-label); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
html body .mis-th-band { box-shadow: inset 0 -2px 0 var(--ui-th-line); }
html body .mis-th-sub  { border-bottom-color: var(--ui-th-line) !important; }
html body .lad-table .lad-sub-row th { background: var(--ui-surface-alt) !important; color: var(--ui-th-ink) !important; }

/* ---------- 3. sidebar menu: idle items = ONE lighter colour for icon and text, selected = the primary colour, small grow on hover ---------- */
html body .deznav, html body .deznav .deznav-scroll { background: var(--ui-side-bg) !important; }
html body .deznav { border-right: 1px solid var(--ui-side-line); }
html body .deznav .metismenu > li:not(.menu-title) > a,
html body .deznav .metismenu ul a {
    color: var(--ui-menu-idle) !important; font-weight: 600;
    transform-origin: left center; transition: transform .16s ease, background-color .16s ease, color .16s ease;
}
html body .deznav .metismenu > li:not(.menu-title) > a { font-size: var(--ui-fs-body); }
html body .deznav .metismenu ul a { font-size: 14px; font-weight: 500; }
html body .deznav .metismenu > li > a i, html body .deznav .metismenu > li > a .menu-icon,
html body .deznav .metismenu ul a i { color: var(--ui-menu-idle) !important; display: inline-block; transition: transform .16s ease, color .16s ease; }
/* hover / focus: slightly bigger, primary colour */
html body .deznav .metismenu > li:not(.menu-title) > a:hover, html body .deznav .metismenu > li > a:focus,
html body .deznav .metismenu ul a:hover {
    background: var(--ui-menu-active-bg) !important; color: var(--ui-menu-active-ink) !important; transform: scale(1.04);
}
html body .deznav .metismenu > li > a:hover i, html body .deznav .metismenu > li > a:hover .menu-icon, html body .deznav .metismenu > li > a:focus i,
html body .deznav .metismenu ul a:hover i { color: var(--ui-menu-active-ink) !important; transform: scale(1.15); }
/* selected */
html body .deznav .metismenu > li.mm-active > a,
html body .deznav .metismenu ul a.mm-active, html body .deznav .metismenu ul li.mm-active > a {
    background: var(--ui-menu-active-bg) !important; color: var(--ui-menu-active-ink) !important; box-shadow: inset 2px 0 0 var(--ui-menu-active-ink) !important;
}
html body .deznav .metismenu > li.mm-active > a i, html body .deznav .metismenu > li.mm-active > a .menu-icon, html body .deznav .metismenu ul li.mm-active > a i { color: var(--ui-menu-active-ink) !important; }
html body .deznav .metismenu > li.menu-title > span:nth-of-type(1) { color: var(--ui-head-ink) !important; }
html body .deznav .metismenu > li.menu-title > span:nth-of-type(2), html body .deznav .copyright, html body .deznav .copyright * { color: var(--ui-muted) !important; }
[data-sidebarbg] .deznav .metismenu li > a.has-arrow:after, [data-sidebarbg] .deznav .metismenu li > a.has-arrow::after { border-color: var(--ui-menu-idle) transparent transparent var(--ui-menu-idle) !important; }
@media (prefers-reduced-motion: reduce) {
    html body .deznav .metismenu a, html body .deznav .metismenu a i { transition: none; transform: none !important; }
}
/* ---------- 4. status chips (one set: success / danger / warning / info / neutral) ---------- */
.ui-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 1.5; border: 1px solid transparent; white-space: nowrap;
}
.ui-chip--success { background: var(--ui-success-bg); color: var(--ui-success-ink); border-color: var(--ui-success); }
.ui-chip--danger  { background: var(--ui-danger-bg);  color: var(--ui-danger-ink);  border-color: var(--ui-danger); }
.ui-chip--warning { background: var(--ui-warning-bg); color: var(--ui-warning-ink); border-color: var(--ui-warning); }
.ui-chip--info    { background: var(--ui-info-bg);    color: var(--ui-info-ink);    border-color: var(--ui-info-ink); }
.ui-chip--neutral { background: var(--ui-surface-alt); color: var(--ui-ink-2);      border-color: var(--ui-line); }

/* ---------- 5. admin / list pages built from a plain Bootstrap card + table: same header band and table head as the other pages ---------- */
html body .content-body .card:has(> .card-body .table) > .card-header {
    box-sizing: border-box; min-height: var(--band-h, 56px); padding: 0 18px; align-items: center;
    background: var(--ui-head-bg) !important; color: var(--ui-head-ink) !important; border: 1px solid var(--ui-head-line); border-radius: 8px 8px 0 0;
}
html body .content-body .card:has(> .card-body .table) > .card-header .card-title, html body .content-body .card:has(> .card-body .table) > .card-header h4 {
    margin: 0; color: var(--ui-head-ink) !important; font-size: var(--ui-fs-title); font-weight: 700; letter-spacing: 0;
}
html body .content-body table.table > thead > tr.bg-primary, html body .content-body table.table > thead.bg-primary { background: var(--ui-th-bg) !important; }
html body .content-body table.table > thead > tr.bg-primary > th, html body .content-body table.table > thead.bg-primary > tr > th {
    background: var(--ui-th-bg) !important; color: var(--ui-th-ink) !important; border-bottom: 2px solid var(--ui-th-line) !important;
    font-size: var(--ui-fs-label); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding-top: 14px; padding-bottom: 14px;
}

/* ---------- 6. process pages (accordion sections, info alert): same tint + ink as the card header, no template sky-blue ---------- */
html body .accordion-header-bg .accordion-header .accordion-button,
html body .accordion-header-bg .accordion-header-primary .accordion-button,
html body .accordion-header-bg .accordion-header-info .accordion-button,
html body .accordion-header-bg .accordion-header-success .accordion-button {
    background: var(--ui-head-bg) !important; color: var(--ui-head-ink) !important; border-color: var(--ui-head-line) !important;
    font-size: var(--ui-fs-title); font-weight: 700; box-shadow: none;
}
html body .accordion-header-bg .accordion-header .accordion-button::after { filter: brightness(.25); }
html body .alert.alert-info {
    background: var(--ui-primary-soft) !important; color: var(--ui-primary) !important; border: 1px solid var(--ui-primary-mid) !important;
}
html body .alert.alert-info a, html body .alert.alert-info i { color: var(--ui-primary) !important; }
html body .alert.alert-primary {
    background: var(--ui-primary-soft) !important; color: var(--ui-primary) !important; border: 1px solid var(--ui-primary-mid) !important;
}
html body .alert.alert-primary a, html body .alert.alert-primary i { color: var(--ui-primary) !important; }

/* ---------- 7. Loader: the emblem with a thin indigo ring turning round it and "Please wait...", on a soft lavender wash.
   Replaces the eight coloured balls (the markup stays, the balls are just not shown). It fades in after 0.3 s so quick pages do not flash it.
   Used by the page-load screen (#preloader) and the Chitar Khoji panel loader (#dvChitarKhojiLoader).
   ========================================================================== */
@keyframes cp-spin { to { transform: rotate(360deg); } }
@keyframes cp-fade { from { opacity: 0; } to { opacity: 1; } }
html body #preloader { background: var(--ui-bg,#f5f3fb); }
html body #dvChitarKhojiLoader:not([hidden]) { background: color-mix(in srgb, var(--ui-bg) 86%, transparent); }
html body :is(#preloader, #dvChitarKhojiLoader) .spinner-grow { display: none !important; }
html body :is(#preloader, #dvChitarKhojiLoader)::before { content: ""; position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -48px 0 0 -42px; box-sizing: border-box; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--ui-primary, #2b1a63) 14%, transparent); border-top-color: var(--ui-primary, #2b1a63); border-right-color: var(--ui-icon-soft,#8f77d8); animation: cp-fade .25s .3s both, cp-spin 1s linear infinite; }
html body :is(#preloader, #dvChitarKhojiLoader)::after { content: ""; position: absolute; left: 50%; top: 50%; width: 36px; height: 46px; margin: -47px 0 0 -18px; background: var(--ui-logo) center / contain no-repeat; animation: cp-fade .25s .3s both; }
html body :is(#preloader, #dvChitarKhojiLoader) > div { position: absolute; left: 50%; top: calc(50% + 58px); transform: translateX(-50%); font-size: 0; }
html body :is(#preloader, #dvChitarKhojiLoader) > div::after { content: "Please wait\2026"; display: block; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--ui-primary, #2b1a63); white-space: nowrap; animation: cp-fade .25s .3s both; }
