/*
 * WEB4 (one brand system): the brand layer of the React app (tenant app, POS, dashboards, super admin, sign-in).
 *
 * The values are the --brand-* custom properties that resources/views/brand/head.blade.php writes into the page
 * head from Super admin > Front CMS > Site theme (App\Support\Brand::cssVariables). Change a colour or upload a font
 * there and every screen follows, with no rebuild. Linked at the end of <body> in resources/views/web/app.blade.php,
 * after the stylesheets the app bundle injects into <head>, so it wins at equal specificity.
 *
 * The bundled stylesheets (resources/pos/src/assets/css/*.css) already read the same variables for Bootstrap's
 * primary, success, warning, danger and info. This file adds what they cannot: the font everywhere, the focus ring,
 * button states, links, selection, and the Bootstrap 5 variables for code that reads them directly.
 */

:root {
    --bs-primary: var(--brand-primary);
    --bs-primary-rgb: var(--brand-primary-rgb);
    --bs-success: var(--brand-success);
    --bs-success-rgb: var(--brand-success-rgb);
    --bs-warning: var(--brand-warning);
    --bs-warning-rgb: var(--brand-warning-rgb);
    --bs-danger: var(--brand-danger);
    --bs-danger-rgb: var(--brand-danger-rgb);
    --bs-info: var(--brand-info);
    --bs-info-rgb: var(--brand-info-rgb);
    --bs-font-sans-serif: var(--brand-font);
    --bs-body-font-family: var(--brand-font);
    --bs-link-color: var(--brand-link);
    --bs-link-hover-color: var(--brand-primary-hover);
}

/* ── Font: one family for the whole app (icon fonts keep their own) ───────────── */
body,
button,
input,
select,
textarea,
.btn,
.form-control,
.form-select,
.form-label,
.table,
.modal,
.dropdown-menu,
.tooltip,
.popover,
.toast,
.pro-sidebar,
.pro-sidebar .pro-menu .pro-menu-item > .pro-inner-item > .pro-item-content a,
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--brand-font) !important;
}

/* ── Links ──────────────────────────────────────────────────────────────────── */
a.text-primary,
.link-primary {
    color: var(--brand-link) !important;
}
a.text-primary:hover,
.link-primary:hover {
    color: var(--brand-primary-hover) !important;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary-text) !important;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
    background-color: var(--brand-primary-hover) !important;
    border-color: var(--brand-primary-hover) !important;
    color: var(--brand-primary-text) !important;
}
.btn-outline-primary {
    color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary.active {
    background-color: var(--brand-primary) !important;
    color: var(--brand-primary-text) !important;
}
.btn-light-primary {
    background-color: var(--brand-primary-soft) !important;
    color: var(--brand-primary) !important;
}
.btn-light-primary:hover {
    background-color: var(--brand-primary) !important;
    color: var(--brand-primary-text) !important;
}

/* ── Badges and soft fills ──────────────────────────────────────────────────── */
.badge.bg-primary,
.bg-primary {
    background-color: var(--brand-primary) !important;
    color: var(--brand-primary-text);
}
.bg-light-primary {
    background-color: var(--brand-primary-soft) !important;
}
.bg-light-success {
    background-color: var(--brand-success-soft) !important;
}
.bg-light-warning {
    background-color: var(--brand-warning-soft) !important;
}
.bg-light-danger {
    background-color: var(--brand-danger-soft) !important;
}
.bg-light-info {
    background-color: var(--brand-info-soft) !important;
}

/* ── Form controls and focus ────────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
    border-color: var(--brand-focus) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-primary-rgb), 0.15) !important;
}
.form-check-input:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}
.form-check-input:focus {
    border-color: var(--brand-focus) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-primary-rgb), 0.15) !important;
}
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--brand-focus) !important;
    outline-offset: 2px !important;
}

/* ── Navigation: active tab and sidebar item ────────────────────────────────── */
.nav-tabs .nav-link.active,
.nav-pills .nav-link.active {
    color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
}
.nav-pills .nav-link.active {
    background-color: var(--brand-primary) !important;
    color: var(--brand-primary-text) !important;
}
.pro-sidebar .pro-menu .pro-menu-item.active > .pro-inner-item {
    background-color: var(--brand-primary-soft) !important;
    border-left-color: var(--brand-primary) !important;
}
.pro-sidebar .pro-menu .pro-menu-item.active > .pro-inner-item > .pro-icon-wrapper .pro-icon {
    color: var(--brand-primary) !important;
}

/* ── Pagination, progress, spinners, selection ──────────────────────────────── */
.page-item.active .page-link {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: var(--brand-primary-text) !important;
}
.page-link {
    color: var(--brand-primary);
}
.progress-bar {
    background-color: var(--brand-primary);
}
.spinner-border.text-primary,
.spinner-grow.text-primary {
    color: var(--brand-primary) !important;
}
::selection {
    background: var(--brand-accent);
    color: var(--brand-accent-text);
}
