/* ==========================================================================
   Kusava UI Foundation (Vendor Portal)
   Design tokens + global accessibility and interaction polish.
   Mirrors the Employee Portal's ui-foundation.css so both portals share the
   same look and feel, adapted to the Vendor Portal brand blue (#0253F1).
   Loaded LAST in the ~/bundles/css/master-top bundle so it can standardize
   styles introduced by the older Metronic (kt-*) and newer (CommonNew.css)
   design systems without editing either file.
   Presentation-layer only: no rule here may change business behavior.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   Existing stylesheets hardcode these values; new/edited styles should use
   the variables so the palette stays consistent.
   -------------------------------------------------------------------------- */
:root {
    /* Brand */
    --ks-primary: #0253F1;
    --ks-primary-hover: #0243C7;
    --ks-primary-soft: #E8F0FF;
    --ks-surface-tint: #EAF1FB;
    --ks-navy: #002e63;

    /* Status */
    --ks-success: #1E8E3E;
    --ks-warning: #B26A00;
    --ks-danger: #C5221F;
    --ks-info: #1867C0;

    /* Neutrals */
    --ks-text: #1F2430;
    --ks-text-muted: #5F6B7A;
    --ks-border: #E1E9F8;
    --ks-border-strong: #C6D2E9;
    --ks-bg: #F7F9FC;
    --ks-white: #FFFFFF;

    /* Elevation */
    --ks-shadow-sm: 0 1px 2px rgba(9, 23, 60, 0.06);
    --ks-shadow-md: 0 4px 12px rgba(9, 23, 60, 0.08);
    --ks-shadow-lg: 0 10px 30px rgba(9, 23, 60, 0.14);

    /* Shape */
    --ks-radius-sm: 4px;
    --ks-radius-md: 8px;
    --ks-radius-lg: 12px;
    --ks-radius-pill: 18px;

    /* Spacing scale */
    --ks-space-1: 4px;
    --ks-space-2: 8px;
    --ks-space-3: 12px;
    --ks-space-4: 16px;
    --ks-space-5: 24px;
    --ks-space-6: 32px;

    /* Motion */
    --ks-transition-fast: 120ms ease;
    --ks-transition: 200ms ease;

    /* Focus ring */
    --ks-focus-ring: 0 0 0 3px rgba(2, 83, 241, 0.25);
}

/* --------------------------------------------------------------------------
   2. Accessibility: visible keyboard focus
   The theme suppresses outlines almost everywhere; restore a clear,
   keyboard-only focus indicator without affecting mouse users.
   -------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--ks-primary) !important;
    outline-offset: 2px;
    border-radius: var(--ks-radius-sm);
}

/* Inputs already show their own border treatment; a ring reads better */
.form-control:focus-visible {
    outline: none !important;
    border-color: var(--ks-primary) !important;
    box-shadow: var(--ks-focus-ring) !important;
}

/* One focus treatment on every page. Page stylesheets that load after the
   bundle (ClinetInvoice.css, login.css) define their own :focus colors;
   the doubled class out-ranks them so fields focus brand-blue everywhere. */
.form-control.form-control:focus {
    background: var(--ks-white) !important;
    border-color: var(--ks-primary) !important;
    box-shadow: var(--ks-focus-ring) !important;
    outline: 0;
}

/* --------------------------------------------------------------------------
   3. Reusable primitives
   -------------------------------------------------------------------------- */

/* Unstyled button: lets icon-only controls be real <button> elements
   (keyboard + screen-reader accessible) without visual change. */
.btn-reset {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

/* Screen-reader-only text (for icon-only controls and table captions) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Brand-colored icon/text helper (used by the header notification bell) */
.theme-color {
    color: var(--ks-primary);
}

/* --------------------------------------------------------------------------
   4. Micro-interactions: consistent, subtle transitions
   -------------------------------------------------------------------------- */
.theme-btn,
.theme-btn-secondary,
.theme-outline-btn,
.close-btn,
.btn,
.head-tab,
.note-item,
.kt-menu__link,
.form-control {
    transition: background-color var(--ks-transition-fast),
                color var(--ks-transition-fast),
                border-color var(--ks-transition-fast),
                box-shadow var(--ks-transition-fast);
}

.dashboard-cards {
    transition: box-shadow var(--ks-transition), transform var(--ks-transition);
}

/* Gentle press feedback on the primary button styles */
.theme-btn:active,
.theme-btn-secondary:active,
.btn-dark:active {
    transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   5. Table polish (applies to the shared .theme-table pattern)
   -------------------------------------------------------------------------- */
.theme-table tbody tr {
    transition: background-color var(--ks-transition-fast);
}

.theme-table tbody tr:hover {
    background-color: var(--ks-surface-tint);
}

/* --------------------------------------------------------------------------
   6. Responsive / touch ergonomics
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    /* WCAG 2.5.8: keep interactive targets comfortably tappable */
    .btn-reset,
    .head-tab,
    .kt-pagination .kt-pagination__links a {
        min-height: 40px;
        min-width: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Tables scroll inside their wrapper instead of breaking the page */
    .table-responsive,
    .theme-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* --------------------------------------------------------------------------
   7. Visual consistency polish
   Small overrides that harmonize the shared components defined in
   CommonNew.css / common.css. This file loads after both, so equal-specificity
   rules here win; !important is used only where the original rule uses it.
   -------------------------------------------------------------------------- */

/* Buttons: gentle depth on the primary action so it reads as the main CTA */
.theme-btn {
    box-shadow: var(--ks-shadow-sm);
}

/* Buttons: every actionable style gets a visible hover state */
.theme-btn:hover {
    background: var(--ks-primary-hover) !important;
    box-shadow: var(--ks-shadow-md);
}

.theme-btn-secondary:hover {
    background: var(--ks-primary-soft) !important;
    border-color: #C6DBFC !important;
}

.theme-outline-btn:hover {
    background: var(--ks-primary-soft);
}

.close-btn:hover {
    background: #D43B3B;
}

/* Disabled controls should not invite clicks */
button.disable,
a.disable,
.theme-btn.disable,
.theme-btn-secondary.disable {
    cursor: not-allowed !important;
}

/* Cards: uniform corner radius (was 8px 10px) and a gentle lift on hover
   for the clickable dashboard filter cards */
.dashboard-cards {
    border-radius: var(--ks-radius-md);
}

/* Only clickable cards (.c-p = cursor pointer) advertise interactivity */
.dashboard-cards.c-p:hover {
    box-shadow: var(--ks-shadow-md);
    transform: translateY(-2px);
}

/* Tables: tinted header row so column titles stand apart from data,
   borders harmonized to the blue-gray palette and slimmed from 2px to 1px
   for a lighter, more modern grid */
.theme-table th {
    background: var(--ks-bg);
    border-color: var(--ks-border) !important;
    border-width: 1px !important;
}

.theme-table,
.theme-table td {
    border-width: 1px;
}

.theme-table .searchrow td {
    border-width: 1px;
}

/* Filter-row inputs: rounded corners to match the button/input language */
.theme-table .searchrow td div input,
.theme-table .searchrow td div select {
    border-radius: var(--ks-radius-sm);
}

/* Forms: placeholders read as hints, not values */
.form-control::placeholder {
    color: #97A3B8 !important;
    font-weight: 400 !important;
    opacity: 1;
}

/* Page headings: clearer hierarchy and border color consistent with the
   rest of the blue-gray divider palette (was #ddd) */
.heading-section {
    border-bottom-color: var(--ks-border-strong);
}

.heading-section h4 {
    font-weight: 600;
    color: var(--ks-text);
}

/* Filter tabs: clickable affordance plus a subtle hover for inactive tabs */
.head-tab {
    cursor: pointer;
}

.head-tab:not(.active):hover {
    background: var(--ks-bg);
    border-color: var(--ks-border-strong);
}

/* Modals: soften edges and use elevation instead of a hard border.
   padding: 0 guards against stray padding that would show as a white
   frame around full-bleed (colored) modal headers. */
.modal .modal-content {
    border: none;
    border-radius: var(--ks-radius-lg);
    box-shadow: var(--ks-shadow-lg);
    padding: 0;
}

/* Round the header/footer edges to match (overflow:hidden would clip
   dropdowns and datepickers opened inside modals, so round explicitly) */
.modal .modal-content > *:first-child,
.modal .modal-content .modal-header {
    border-top-left-radius: var(--ks-radius-lg);
    border-top-right-radius: var(--ks-radius-lg);
}

.modal .modal-content > *:last-child,
.modal .modal-content .modal-footer {
    border-bottom-left-radius: var(--ks-radius-lg);
    border-bottom-right-radius: var(--ks-radius-lg);
}

/* Header/footer hairlines match the app's blue-gray divider palette */
.modal .modal-content .modal-header {
    border-bottom-color: var(--ks-border);
}

.modal .modal-content .modal-footer {
    border-top-color: var(--ks-border);
}

/* Brand-colored headers (.theme-bg): Bootstrap's light border-bottom shows
   as a white line inside the blue bar; the color contrast already provides
   the separation */
.modal .modal-content .modal-header.theme-bg {
    border-bottom: 0;
}

/* Portlet-headed modals (e.g. the dashboard's Invoice Messages/Details
   popup renders a .kt-portlet as its header inside .modal-content).
   Strip the portlet's own card chrome (margin, border, shadow, 4px radius)
   so the blue bar sits flush with the modal edges, and give the bar the
   same corner radius as the modal so the corners look uniform. */
.modal .modal-content .kt-portlet:first-child,
.modal .modal-content > *:first-child > .kt-portlet:first-child {
    margin: 0;
    border: 0;
    box-shadow: none;
    border-radius: var(--ks-radius-lg) var(--ks-radius-lg) 0 0;
}

.modal .modal-content .kt-portlet:first-child > .kt-portlet__head,
.modal .modal-content > *:first-child > .kt-portlet:first-child > .kt-portlet__head {
    border-top-left-radius: var(--ks-radius-lg);
    border-top-right-radius: var(--ks-radius-lg);
    border-bottom: 0;
}

/* --------------------------------------------------------------------------
   8. Version 2 polish
   Larger, immediately visible refinements. Everything here is still
   presentation-only and preserves layout, navigation, and workflows.
   Load-order note: this file is last in the master-top bundle, so
   equal-specificity rules beat Metronic/common/CommonNew. Only
   KusavaStyleSheet.css loads later; rules that must beat it use !important.
   -------------------------------------------------------------------------- */

/* ---- 8.1 Typography ------------------------------------------------------
   The application's existing font is kept as-is (per request).
   Financial data aligns cleanly when digits share a fixed width: */
.theme-table td {
    font-variant-numeric: tabular-nums;
}

/* ---- 8.2 App shell: header, sidebar, content canvas --------------------- */

/* Header: crisp separation from the page instead of blending into it */
.kt-header {
    border-bottom: 1px solid var(--ks-border-strong);
}

.kt-aside {
    border-right: 1px solid var(--ks-border);
}

/* Sidebar navigation: rounded, inset menu items (Notion/Linear style) */
.kt-aside-menu .kt-menu__nav > .kt-menu__item > .kt-menu__link {
    margin: 0 10px;
    border-radius: var(--ks-radius-md);
}

.kt-aside-menu .kt-menu__nav > .kt-menu__item:hover > .kt-menu__link {
    background-color: rgba(255, 255, 255, 0.7) !important;
}

/* Active item: today it is painted the same color as the sidebar itself,
   so the current page is invisible in the nav. Give it a clear white
   card with brand-colored text and icon. (!important beats the
   KusavaStyleSheet.css rule that loads after this file.) */
.kt-aside-menu .kt-menu__nav > .kt-menu__item.kt-menu__item--active > .kt-menu__link {
    background-color: var(--ks-white) !important;
    box-shadow: var(--ks-shadow-sm);
}

.kt-aside-menu .kt-menu__item.kt-menu__item--active > .kt-menu__link .kt-menu__link-text,
.kt-aside-menu .kt-menu__item.kt-menu__item--active > .kt-menu__link .kt-menu__link-icon {
    color: var(--ks-primary) !important;
    font-weight: 600;
}

.kt-aside-menu .kt-menu__link-text {
    font-weight: 500;
}

/* Content canvas: a faint blue-gray so white tables/cards read as surfaces */
.kt-content {
    background-color: var(--ks-bg);
}

/* Sidebar action buttons keep their 85% width everywhere. Pages that load
   login.css late (Reports, Account, password pages) re-declare a generic
   .theme-btn { width: fit-content } that otherwise beats the .w-85 utility
   in the cascade and collapses these buttons to their content width. */
.kt-aside .theme-btn.sidebar {
    width: 85%;
}

/* ---- 8.3 Tables: modern data-grid header and empty state ---------------- */

/* Compact, uppercase column labels: quieter than the old 16px bold black,
   which competed with the data instead of framing it */
.theme-table th {
    font-size: 12px;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ks-text-muted) !important;
}

/* Soften the grid's outer corners */
.theme-table tr:first-child th:first-child {
    border-top-left-radius: var(--ks-radius-md);
}

.theme-table tr:first-child th:last-child {
    border-top-right-radius: var(--ks-radius-md);
}

.theme-table tr:last-child td:first-child {
    border-bottom-left-radius: var(--ks-radius-md);
}

.theme-table tr:last-child td:last-child {
    border-bottom-right-radius: var(--ks-radius-md);
}

/* Empty state: give "No records found" room to breathe so it reads as a
   deliberate state, not a broken row */
.theme-table td.text-center.text-muted {
    padding: 40px 16px !important;
    font-size: 13px;
    color: var(--ks-text-muted) !important;
}

/* ---- 8.4 Status badges: soft enterprise style ---------------------------
   Solid saturated chips become tinted backgrounds with strong text,
   the pattern used across Linear/Jira/M365. Unified/avatar variants
   (kt-badge--unified-*, --username) are intentionally untouched. */
.kt-badge.kt-badge--success {
    background: #E1F3E6;
    color: var(--ks-success);
}

.kt-badge.kt-badge--warning {
    background: #FCF0DC;
    color: var(--ks-warning);
}

.kt-badge.kt-badge--danger {
    background: #FBE4E4;
    color: var(--ks-danger);
}

.kt-badge.kt-badge--info {
    background: #E4EEFB;
    color: var(--ks-info);
}

.kt-badge.kt-badge--primary,
.kt-badge.kt-badge--brand {
    background: var(--ks-primary-soft);
    color: var(--ks-primary);
}

.kt-badge.kt-badge--dark {
    background: #EAEEF5;
    color: #3F4A5A;
}

.kt-badge.kt-badge--pill {
    font-weight: 600;
}

/* ---- 8.5 Forms: readable values, clear field states --------------------- */

/* White fields with dark text: the old pale-blue fill with #666 12px text
   made entered values look like placeholders.
   Selector is doubled on purpose: login.css (loaded late by Reports,
   Account, and password pages) re-declares .form-control with !important;
   the extra class beats it on specificity so fields stay consistent. */
.form-control.form-control {
    background: var(--ks-white) !important;
    color: var(--ks-text) !important;
    font-size: 13px !important;
    border-radius: 6px;
}

/* Read-only and disabled fields are now visibly non-editable */
.form-control[readonly],
.form-control:disabled {
    background: #F1F4F9 !important;
    color: var(--ks-text-muted) !important;
}

/* Field labels anchor the form's scanning rhythm */
.form-group label {
    font-weight: 500;
    color: #3F4A5A;
}

/* ---- 8.6 Page titles and cards ------------------------------------------ */
.heading-section {
    padding-bottom: 6px;
}

.heading-section h4 {
    font-size: 22px;
    letter-spacing: -0.01em;
}

/* Cards get a hairline border for definition on the tinted canvas */
.dashboard-cards {
    border: 1px solid rgba(9, 23, 60, 0.08);
}

/* Selected dashboard card: replace the old heavy treatment (3px border,
   dark halo shadow, scale jump) with a calm 1px brand border plus a soft
   blue ring; no size change, so surrounding cards don't shift */
.dashboard-cards.selected {
    border-width: 1px;
    border-color: var(--ks-primary);
    box-shadow: 0 0 0 3px rgba(2, 83, 241, 0.14), var(--ks-shadow-md);
    transform: none;
}

/* An already-selected card stays put on hover (no lift, ring kept) */
.dashboard-cards.selected.c-p:hover {
    box-shadow: 0 0 0 3px rgba(2, 83, 241, 0.14), var(--ks-shadow-md);
    transform: none;
}

.kt-portlet {
    border-radius: var(--ks-radius-md);
    border: 1px solid var(--ks-border);
}

/* ---- 8.7 Scrollbars: slim and unobtrusive ------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--ks-border-strong) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--ks-border-strong);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #A9B8D6;
}

/* ---- 8.8 Pagination controls -------------------------------------------- */
.row-select-pagination {
    background: var(--ks-white);
    border: 1px solid var(--ks-border-strong);
    border-radius: var(--ks-radius-sm);
}

/* --------------------------------------------------------------------------
   9. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   Font Awesome 5 @font-face fix (SPA font-load).
   The metronic bundle declares the FA fonts with paths RELATIVE to the CSS
   ("fonts/@fortawesome/..."). Served from /bundles/css/master-top, the browser
   resolves those to /bundles/css/fonts/@fortawesome/..., which is not a real
   file, so the Web.Core SPA fallback returns index.html and the font load
   FAILS ("Font Awesome 5 Free: error") — every fa/fas/far/fab icon renders
   blank. ui-foundation.css loads LAST in the bundle, so re-declaring the same
   @font-face families here (with ABSOLUTE paths the bundle's URL-rewriter
   leaves untouched, and which the front door serves as real fonts) wins the
   cascade and restores the icons. Applies to legacy-proxied pages and the SPA.
   ========================================================================== */
@font-face {
    font-family: "Font Awesome 5 Free";
    font-style: normal;
    font-weight: 900;
    font-display: block;
    src: url("/Assets/global/assets/plugins/global/fonts/@fortawesome/fa-solid-900.woff2") format("woff2"),
         url("/Assets/global/assets/plugins/global/fonts/@fortawesome/fa-solid-900.ttf") format("truetype");
}
@font-face {
    font-family: "Font Awesome 5 Free";
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url("/Assets/global/assets/plugins/global/fonts/@fortawesome/fa-regular-400.woff2") format("woff2"),
         url("/Assets/global/assets/plugins/global/fonts/@fortawesome/fa-regular-400.ttf") format("truetype");
}
@font-face {
    font-family: "Font Awesome 5 Brands";
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url("/Assets/global/assets/plugins/global/fonts/@fortawesome/fa-brands-400.woff2") format("woff2"),
         url("/Assets/global/assets/plugins/global/fonts/@fortawesome/fa-brands-400.ttf") format("truetype");
}

/* ==========================================================================
   Collapsed sidebar footer (icon rail). CommonNew.css only shrinks the profile
   name font in the minimized aside (the "hide" rule is commented out), so the
   user name overflows ~50px past the 70px rail into the page. Stack the footer
   vertically and hide the name in the collapsed state — avatar centered with
   the logout icon below; both reappear (with the name) on hover-expand.
   ========================================================================== */
.kt-aside--minimize .logout {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 4px;
}
.kt-aside--minimize .logout > .d-flex {
    justify-content: center;
}
.kt-aside--minimize .logout .details {
    display: none;
}
.kt-aside--minimize .logout .profile-pic {
    margin-right: 0;
}
/* Sign-out is hidden in the collapsed rail; it reappears on hover-expand. */
.kt-aside--minimize .logout a {
    display: none;
}
/* Pin the profile footer to the bottom of the rail: the menu only grew to its
   content height, so justify-content:space-between stopped short of the bottom.
   Fill the wrapper so the footer sits at the very bottom. */
#kt_aside_menu {
    min-height: 100%;
}
