﻿.input-group-text {
    /*  white-space: normal;
    flex-basis: 145px;*/
    /*max-width: 145px;*/
    /*min-width: 145px;*/
    padding: 0.7rem 0.5rem;
}

.blazored-typeahead__input-mask {
    padding: 10px;
}

.blazored-typeahead__input-multiselect-wrapper {
    padding: 0 0.4rem;
}

td {
    vertical-align: middle;
}

.blazored-typeahead__controls {
    height: 100% !important;
    /* flex-wrap:wrap !important; */
}

.control-label {
    width: 100%;
    font-weight: 700;
    font-size: 1.1rem;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-all;
}

.form-check-custom .form-check-input {
    cursor: pointer;
}

.action-container i {
    color: var(--kt-primary);
}

.data-tabs-container .nav-item .nav-link {
    font-weight: 700;
    padding: 10px 15px;
    margin: 0 !important;
}

.data-tabs-container .nav-item .nav-link.active {
    color: #fff;
    background: var(--kt-primary);
    padding: 10px 15px
}

.blazored-typeahead__input-icon {
    justify-content: center;
    align-items: center;
    width: auto;
    padding: 0;
}

.blazored-typeahead:focus-within,
.blazored-typeahead__input-icon:focus {
    box-shadow: none
}

.table.table-row-dashed td {
    cursor: pointer;
}

.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--kt-body-bg, #fff);
    z-index: 9999;
    overflow: hidden;
}

[data-theme="dark"] .loading,
[data-bs-theme="dark"] .loading {
    background: var(--kt-body-bg, #1e1e2d);
}

.loading .loading-img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.loading img {
    width: 250px;
}

.blazored-typeahead__input {
    padding: 10px;
}

.blazored-typeahead__input-mask-wrapper {
    flex-wrap: wrap !important;
}

.blazored-typeahead__input-mask {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: block !important;
}

/* Listes deroulantes : la hauteur etait plafonnee SANS defilement, donc tout ce qui
   depassait ~4 lignes etait invisible et inatteignable a la souris comme au clavier.
   Regle globale : elle corrige les ~140 formulaires generes d un coup, la ou une
   correction par ecran en aurait oublie. */
.blazored-typeahead__results {
    max-height: 16rem !important;
    overflow-y: auto !important;
    /* Le conteneur pose overflow:hidden pour arrondir ses coins ; sans cette levee
       ici, la barre de defilement resterait rognee. */
    overscroll-behavior: contain;
}

input::file-selector-button {
    font-weight: bold;
    padding: 0.5em;
    border: thin solid grey;
    border-radius: 3px;
    height: 55px
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item .menu-link.active {
    background: var(--kt-primary-active);
}

[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item.hover:not(.here)>.menu-link:not(.disabled):not(.active):not(.here),
[data-kt-app-layout=dark-sidebar] .app-sidebar .menu .menu-item:not(.here) .menu-link:hover:not(.disabled):not(.active):not(.here) {
    background: var(--kt-primary);
}

.smart-editor {
    height: 200px !important;
}



@media screen and (max-width:1920px) {
    .blazored-typeahead__input {
        max-width: unset;
        width: 100%;
    }
}

@media screen and (min-width:1200px) {
    textarea.sm-texarea {
        max-height: unset;
        height: 43px;
    }
}

.is-invalid .blazored-typeahead__input {
    border-color: #dc3545 !important;
    padding-right: calc(1.5em + .75rem);
    background-repeat: no-repeat;
    background-position: right calc(.375em + .1875rem) center;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem);
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, .25);
}

.is-invalid .blazored-typeahead__results {
    border-color: #dc3545 !important;
}

/*testing purposes*/
.table-bordered> :not(caption)>*,
.table.table-bordered tfoot tr:last-child th,
.table-bordered tfoot tr:last-child td,
.table tbody tr:last-child th,
.table-bordered tbody tr:last-child td {
    border: 1px solid var(--kt-border-color, #F1F1F4);
    padding: .75rem .75rem;
    color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)));
    background-color: var(--bs-table-bg);
    border-bottom-width: 1px;
    box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
    text-align: center
}

[data-theme="dark"] .table,
[data-theme="dark"] .table tbody,
[data-theme="dark"] .table tr,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table tbody,
[data-bs-theme="dark"] .table tr,
[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    background-color: transparent !important;
    border-color: #323248 !important;
}

[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-bs-theme="dark"] .table td,
[data-bs-theme="dark"] .table th {
    color: #e0e0e0 !important;
}

.blazored-typeahead__input-multiselect-wrapper {
    max-height: 250px;
    overflow: auto
}

[data-kt-app-sidebar-fixed=true] .app-wrapper {
    padding-left: 30px;
    padding-right: 30px
}

/* ── Secondary Color Overrides ── */
.btn-secondary {
    background-color: var(--kt-secondary) !important;
    border-color: var(--kt-secondary) !important;
    color: #ffffff !important;
}

.btn-secondary:hover,
.btn-secondary:active,
.btn-secondary:focus {
    background-color: var(--kt-secondary-active, var(--kt-secondary)) !important;
    border-color: var(--kt-secondary-active, var(--kt-secondary)) !important;
    filter: brightness(0.9);
}

.badge-secondary {
    background-color: var(--kt-secondary) !important;
    color: #ffffff !important;
}

.bg-secondary {
    background-color: var(--kt-secondary) !important;
}

.text-secondary {
    color: var(--kt-secondary) !important;
}

.custom-is-invalid {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    border-bottom-color: transparent !important;
    border-bottom-width: 1px !important;
    box-shadow: none !important;
}

.custom-validation-message,
.tp-validation-text {
    color: #ff5f73 !important;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
    margin-top: 0.25rem;
    display: block;
}

.custom-validation-message:not(:empty)::before,
.tp-validation-text:not(:empty)::before {
    content: "\f06a";
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    margin-inline-end: .35rem;
    font-size: .78rem;
}

/* ── Dark Mode Overrides ── */
[data-theme="dark"] .subPageTable,
[data-theme="dark"] .table-content,
[data-bs-theme="dark"] .subPageTable,
[data-bs-theme="dark"] .table-content {
    background-color: var(--kt-card-bg, #1e1e2d) !important;
    color: var(--kt-text-inverse-white, #ffffff) !important;
    border-color: var(--kt-border-color, #2b2b40) !important;
}

[data-theme="dark"] .card,
[data-bs-theme="dark"] .card {
    background-color: var(--kt-card-bg, #1e1e2d) !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .blazored-typeahead__input,
[data-theme="dark"] .blazored-typeahead__input-mask,
[data-theme="dark"] .blazored-typeahead__input-mask-wrapper,
[data-theme="dark"] .blazored-typeahead__input-mask-wrapper--disabled,
[data-theme="dark"] .blazored-typeahead__results,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .blazored-typeahead__input,
[data-bs-theme="dark"] .blazored-typeahead__input-mask,
[data-bs-theme="dark"] .blazored-typeahead__input-mask-wrapper,
[data-bs-theme="dark"] .blazored-typeahead__input-mask-wrapper--disabled,
[data-bs-theme="dark"] .blazored-typeahead__results {
    background-color: var(--kt-input-bg, #1b1b29) !important;
    border-color: var(--kt-input-border-color, #323248) !important;
    color: var(--kt-input-text-color, #ffffff) !important;
}

/* ── Light theme: force white background on typeahead + selects (follow theme toggle) ── */
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .blazored-typeahead__input,
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .blazored-typeahead__input-mask,
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .blazored-typeahead__input-mask-wrapper,
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .blazored-typeahead__results,
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .form-select,
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .form-control {
    background-color: var(--kt-input-bg, #ffffff) !important;
    color: var(--kt-input-text-color, #181c32) !important;
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
}

html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .blazored-typeahead__down-arrow path,
html:not([data-theme="dark"]):not([data-bs-theme="dark"]) .blazored-typeahead__clear-icon path {
    fill: var(--kt-text-gray-600, #7e8299) !important;
}

html:not([data-theme="dark"]):not([data-bs-theme="dark"]) select option {
    background-color: #ffffff !important;
    color: #181c32 !important;
}

[data-theme="dark"] .blazored-typeahead__down-arrow path,
[data-theme="dark"] .blazored-typeahead__clear-icon path,
[data-bs-theme="dark"] .blazored-typeahead__down-arrow path,
[data-bs-theme="dark"] .blazored-typeahead__clear-icon path {
    fill: var(--kt-text-gray-600, #7e8299) !important;
}

[data-theme="dark"] select option,
[data-bs-theme="dark"] select option {
    background-color: #1e1e2d !important;
    color: #ffffff !important;
}

/* ── Select2 Dark Mode ── */
[data-theme="dark"] .select2-dropdown,
[data-bs-theme="dark"] .select2-dropdown {
    background-color: #1e1e2d !important;
    border-color: #323248 !important;
}

[data-theme="dark"] .select2-container--bootstrap5 .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection {
    background-color: #1b1b29 !important;
    border-color: #323248 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .select2-results__option,
[data-bs-theme="dark"] .select2-results__option {
    color: #cdcdde !important;
}

[data-theme="dark"] .select2-results__option--highlighted,
[data-bs-theme="dark"] .select2-results__option--highlighted {
    background-color: var(--kt-primary-light, #212e48) !important;
    color: #ffffff !important;
}

/* ── Menu & Bootstrap Dropdowns ── */
[data-theme="dark"] .menu-sub-dropdown,
[data-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .menu-sub-dropdown,
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1e1e2d !important;
    box-shadow: 0 0 50px 0 rgba(0, 0, 0, 0.3) !important;
    border: 1px solid #323248 !important;
}

[data-theme="dark"] .menu-item .menu-link,
[data-theme="dark"] .dropdown-item,
[data-bs-theme="dark"] .menu-item .menu-link,
[data-bs-theme="dark"] .dropdown-item {
    color: #cdcdde !important;
}

[data-theme="dark"] .menu-item .menu-link:hover,
[data-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .menu-item .menu-link:hover,
[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #212e48 !important;
    color: #ffffff !important;
}

[data-theme="dark"] .blazored-typeahead__result-selected,
[data-theme="dark"] .blazored-typeahead__result-hover,
[data-bs-theme="dark"] .blazored-typeahead__result-selected,
[data-bs-theme="dark"] .blazored-typeahead__result-hover {
    background-color: var(--kt-component-hover-bg, #2b2b40) !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed),
[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--kt-primary-active, #2b2b40) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .accordion-button.collapsed,
[data-bs-theme="dark"] .accordion-button.collapsed {
    background-color: var(--kt-card-bg, #1e1e2d) !important;
    color: var(--kt-text-gray-600, #7e8299) !important;
}

/* ── Sidebar Dark Mode ── */
[data-theme="dark"] #kt_app_sidebar,
[data-theme="dark"] .app-sidebar {
    background-color: #1a1a2e !important;
}

[data-theme="dark"] .app-sidebar .menu-title,
[data-theme="dark"] .app-sidebar .menu-link {
    color: #cdcdde !important;
}

[data-theme="dark"] .app-sidebar .menu-link:hover,
[data-theme="dark"] .app-sidebar .menu-link.active {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .app-sidebar-logo {
    background-color: #1a1a2e !important;
}

[data-theme="dark"] .app-sidebar-logo .text-dark {
    color: #cdcdde !important;
}

/* ── Neutralize Utility Classes in Dark Mode ── */
[data-theme="dark"] .bg-white {
    background-color: var(--kt-card-bg, #1e1e2d) !important;
}

[data-theme="dark"] .bg-light {
    background-color: #1b1b29 !important;
}

[data-theme="dark"] .bg-light-primary {
    background-color: var(--kt-primary-light, #212e48) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--kt-text-gray-900, #ffffff) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--kt-text-gray-500, #a1a5b7) !important;
}

[data-theme="dark"] .border {
    border-color: var(--kt-border-color, #2b2b40) !important;
}

[data-theme="dark"] .app-header {
    background-color: var(--kt-header-bg, #1a1a2e) !important;
}

[data-theme="dark"] .app-toolbar {
    background-color: var(--kt-toolbar-bg, #1a1a2e) !important;
}

/* ── Premium Pill Toggle (Dark / Light) ── */
.gb-theme-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.gb-theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.gb-theme-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #87CEEB 0%, #E0F0FF 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .06);
    transition: background 0.5s cubic-bezier(.4, 0, .2, 1),
        box-shadow 0.5s cubic-bezier(.4, 0, .2, 1);
}

.gb-theme-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    transition: transform 0.5s cubic-bezier(.34, 1.56, .64, 1),
        background 0.5s ease;
    z-index: 2;
}

.gb-theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(.34, 1.56, .64, 1);
    z-index: 1;
}

.gb-sun {
    right: 7px;
    color: #F59E0B;
    opacity: 1;
    transform: translateY(-50%) rotate(0deg);
}

.gb-moon {
    left: 7px;
    color: #A78BFA;
    opacity: 0;
    transform: translateY(-50%) rotate(-90deg) scale(.5);
}

/* ── Checked = Dark Mode ── */
.gb-theme-switch input:checked+.gb-theme-slider {
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3), 0 0 12px rgba(99, 102, 241, .15);
}

.gb-theme-switch input:checked+.gb-theme-slider::before {
    transform: translateX(28px);
    background: #1E1B4B;
    box-shadow: 0 0 8px rgba(167, 139, 250, .4), 0 2px 6px rgba(0, 0, 0, .25);
}

.gb-theme-switch input:checked+.gb-theme-slider .gb-sun {
    opacity: 0;
    transform: translateY(-50%) rotate(90deg) scale(.5);
}

.gb-theme-switch input:checked+.gb-theme-slider .gb-moon {
    opacity: 1;
    transform: translateY(-50%) rotate(0deg) scale(1);
    color: #C4B5FD;
}

/* ── Hover feedback ── */
.gb-theme-switch:hover .gb-theme-slider::before {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .22);
}

.gb-theme-switch input:checked:hover+.gb-theme-slider::before {
    box-shadow: 0 0 12px rgba(167, 139, 250, .5), 0 2px 8px rgba(0, 0, 0, .3);
}

.assets-validation-form .assets-required-label {
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    gap: .25rem;
    font: inherit;
    white-space: nowrap;
    direction: rtl;
}

.assets-validation-form .assets-required-mark {
    color: #ff7d8d;
    font-size: .9em;
    font-weight: 400;
    line-height: 1;
    display: inline-block;
    transform: translateY(.03rem);
}

.assets-validation-form .input-group-text:has(.assets-required-label) {
    min-width: max-content;
    overflow: visible;
}

.assets-info-form .input-group {
    flex-wrap: nowrap;
    align-items: stretch;
}

.assets-info-form .input-group > .input-group-text {
    flex: 0 0 auto;
    justify-content: flex-start;
    text-align: start;
    white-space: nowrap;
    overflow: visible;
    direction: rtl;
}

.assets-info-form .input-group > .form-control,
.assets-info-form .input-group > .form-select,
.assets-info-form .input-group > .blazored-typeahead {
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.assets-info-form .input-group > .blazored-typeahead .blazored-typeahead__controls,
.assets-info-form .input-group > .blazored-typeahead .blazored-typeahead__input,
.assets-info-form .input-group > .blazored-typeahead .blazored-typeahead__input input {
    width: 100% !important;
}

.assets-info-form .input-group > .blazored-typeahead .blazored-typeahead__input input {
    border: 0 !important;
    box-shadow: none !important;
}

.assets-validation-form .validation-message,
.assets-validation-form .input-error-details {
    display: block;
    color: #ff5f73 !important;
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.4;
    margin-top: .25rem;
    padding-inline-start: .25rem;
    text-align: start;
}

.assets-validation-form .input-group.assets-invalid-group {
    position: relative;
    box-shadow: none !important;
}

.assets-validation-form .input-group.assets-invalid-group::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 1px;
    background-color: #ff5f73;
    border-radius: 0 0 .475rem .475rem;
    pointer-events: none;
    z-index: 30;
}

.assets-validation-form .form-control.invalid,
.assets-validation-form .form-select.invalid,
.assets-validation-form .assets-invalid-group .form-control,
.assets-validation-form .assets-invalid-group .form-select,
.assets-validation-form .assets-invalid-group .blazored-typeahead__input,
.assets-validation-form .assets-invalid-group .blazored-typeahead input,
.assets-validation-form .assets-invalid-group .form-check-input {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    border-bottom-color: transparent !important;
    border-bottom-width: 1px !important;
    box-shadow: none !important;
}

.assets-validation-form .form-control.invalid:focus,
.assets-validation-form .form-select.invalid:focus,
.assets-validation-form .assets-invalid-group .form-control:focus,
.assets-validation-form .assets-invalid-group .form-select:focus,
.assets-validation-form .assets-invalid-group .blazored-typeahead__input:focus,
.assets-validation-form .assets-invalid-group .blazored-typeahead input:focus,
.assets-validation-form .assets-invalid-group .form-check-input:focus {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
}

.assets-validation-summary,
.assets-validation-form .assets-validation-summary {
    flex-basis: 100%;
    width: 100%;
    color: #ff5f73 !important;
    font-size: .925rem;
    font-weight: 400;
    line-height: 1.45;
    margin-top: .75rem;
    text-align: start;
}

.assets-validation-form .form-heading .d-flex {
    flex-wrap: wrap;
}

.input-group:has(.border-danger),
.input-group:has(.is-invalid),
.input-group:has(.tp-invalid-typeahead),
.input-group:has(.custom-is-invalid),
.input-group.tp-invalid-typeahead,
.input-group.custom-invalid-group,
.blazored-typeahead.is-invalid,
.sales-validation-group.is-invalid {
    position: relative;
    box-shadow: none !important;
}

.input-group:has(.border-danger)::after,
.input-group:has(.is-invalid)::after,
.input-group:has(.tp-invalid-typeahead)::after,
.input-group:has(.custom-is-invalid)::after,
.input-group.tp-invalid-typeahead::after,
.input-group.custom-invalid-group::after,
.blazored-typeahead.is-invalid::after,
.sales-validation-group.is-invalid::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 1px;
    background-color: #ff5f73;
    border-radius: 0 0 .475rem .475rem;
    pointer-events: none;
    z-index: 30;
}

.input-group:has(.border-danger) > .input-group-text,
.input-group:has(.border-danger) > .form-control,
.input-group:has(.border-danger) > .form-select,
.input-group:has(.is-invalid) > .input-group-text,
.input-group:has(.is-invalid) > .form-control,
.input-group:has(.is-invalid) > .form-select,
.input-group:has(.custom-is-invalid) > .input-group-text,
.input-group:has(.custom-is-invalid) > .form-control,
.input-group:has(.custom-is-invalid) > .form-select,
.input-group.tp-invalid-typeahead > .input-group-text,
.input-group.tp-invalid-typeahead > .form-control,
.input-group.tp-invalid-typeahead > .form-select,
.input-group.custom-invalid-group > .input-group-text,
.input-group.custom-invalid-group > .form-control,
.input-group.custom-invalid-group > .form-select,
.blazored-typeahead.is-invalid .blazored-typeahead__input,
.blazored-typeahead.is-invalid .blazored-typeahead__input input {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    box-shadow: none !important;
}

.form-control.border-danger,
.form-select.border-danger,
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    border-bottom-color: transparent !important;
    border-bottom-width: 1px !important;
    box-shadow: none !important;
}

.input-group:has(.border-danger) > .input-group-text,
.input-group:has(.border-danger) > .form-control,
.input-group:has(.border-danger) > .form-select,
.input-group:has(.is-invalid) > .input-group-text,
.input-group:has(.is-invalid) > .form-control,
.input-group:has(.is-invalid) > .form-select,
.input-group:has(.custom-is-invalid) > .input-group-text,
.input-group:has(.custom-is-invalid) > .form-control,
.input-group:has(.custom-is-invalid) > .form-select,
.input-group.tp-invalid-typeahead > .input-group-text,
.input-group.tp-invalid-typeahead > .form-control,
.input-group.tp-invalid-typeahead > .form-select,
.input-group.custom-invalid-group > .input-group-text,
.input-group.custom-invalid-group > .form-control,
.input-group.custom-invalid-group > .form-select,
.assets-validation-form .input-group.assets-invalid-group > .input-group-text,
.assets-validation-form .input-group.assets-invalid-group > .form-control,
.assets-validation-form .input-group.assets-invalid-group > .form-select,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__controls,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__input,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead input {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    border-bottom-color: transparent !important;
    border-bottom-width: 1px !important;
    box-shadow: none !important;
}

/* Single-source validation underline: keep inner controls neutral, draw one line on the wrapper only. */
.input-group.custom-invalid-group::after,
.input-group.tp-invalid-typeahead::after,
.input-group:has(.custom-is-invalid)::after,
.input-group:has(.tp-invalid-typeahead)::after,
.input-group:has(.border-danger)::after,
.input-group:has(.is-invalid)::after,
.assets-validation-form .input-group.assets-invalid-group::after {
    bottom: -1px !important;
    height: 1px !important;
    background-color: #ff5f73 !important;
    z-index: 100 !important;
}

.input-group.custom-invalid-group > .input-group-text,
.input-group.custom-invalid-group > .form-control,
.input-group.custom-invalid-group > .form-select,
.input-group.custom-invalid-group > .form-control:focus,
.input-group.custom-invalid-group > .form-select:focus,
.input-group:has(.custom-is-invalid) > .input-group-text,
.input-group:has(.custom-is-invalid) > .form-control,
.input-group:has(.custom-is-invalid) > .form-select,
.input-group:has(.custom-is-invalid) > .form-control:focus,
.input-group:has(.custom-is-invalid) > .form-select:focus,
.input-group.tp-invalid-typeahead > .input-group-text,
.input-group.tp-invalid-typeahead > .form-control,
.input-group.tp-invalid-typeahead > .form-select,
.input-group.tp-invalid-typeahead > .blazored-typeahead,
.input-group.tp-invalid-typeahead .blazored-typeahead__controls,
.input-group.tp-invalid-typeahead .blazored-typeahead__input,
.input-group.tp-invalid-typeahead .blazored-typeahead__input input,
.input-group.tp-invalid-typeahead .blazored-typeahead__input-mask,
.input-group.tp-invalid-typeahead .blazored-typeahead__input-mask-wrapper,
.input-group:has(.border-danger) > .input-group-text,
.input-group:has(.border-danger) > .form-control,
.input-group:has(.border-danger) > .form-select,
.input-group:has(.is-invalid) > .input-group-text,
.input-group:has(.is-invalid) > .form-control,
.input-group:has(.is-invalid) > .form-select,
.assets-validation-form .input-group.assets-invalid-group > .input-group-text,
.assets-validation-form .input-group.assets-invalid-group > .form-control,
.assets-validation-form .input-group.assets-invalid-group > .form-select,
.assets-validation-form .input-group.assets-invalid-group > .blazored-typeahead,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__controls,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__input,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__input input,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__input-mask,
.assets-validation-form .input-group.assets-invalid-group .blazored-typeahead__input-mask-wrapper {
    border-bottom-color: transparent !important;
    box-shadow: none !important;
}

.assets-validation-form .custom-is-invalid input.form-control,
.assets-validation-form .custom-is-invalid textarea.form-control,
.assets-validation-form .custom-is-invalid select.form-select,
.assets-validation-form .custom-is-invalid .form-control,
.assets-validation-form .custom-is-invalid .form-select,
.assets-validation-form .custom-is-invalid .blazored-typeahead,
.assets-validation-form .custom-is-invalid .blazored-typeahead__controls,
.assets-validation-form .custom-is-invalid .blazored-typeahead__input,
.assets-validation-form .custom-is-invalid .blazored-typeahead__input input,
.assets-validation-form .custom-is-invalid .blazored-typeahead__input-mask,
.assets-validation-form .custom-is-invalid .blazored-typeahead__input-mask-wrapper,
.assets-validation-form .input-group .form-control.is-invalid,
.assets-validation-form .input-group .form-select.is-invalid,
.assets-validation-form .form-control.is-invalid,
.assets-validation-form .form-select.is-invalid,
.assets-validation-form .custom-is-invalid-radio .form-check-input {
    border-color: var(--kt-input-border-color, #e1e3ea) !important;
    border-bottom-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/*
 * Faye Arabic form controls
 *
 * Chromium clips some Arabic descenders inside a native input's internal
 * line box even when the outer control has enough free space. Apply the fix
 * directly to the existing Faye controls, including eligibility and profile
 * forms, without requiring a replacement component. Tenant font family and
 * weight remain unchanged.
 */
body.faye-website-surface {
    --faye-native-input-font-size: 16px;
    --faye-native-input-line-height: 40px;
    --faye-native-input-min-height: 56px;
    font-family: var(--gb-website-font-family, var(--kt-font-family, Cairo, sans-serif)) !important;
    font-weight: var(--gb-website-font-weight, 400) !important;
}

body.faye-website-surface :where(
    #kt_app_root,
    .app-root,
    .app-page,
    .app-wrapper,
    .app-main,
    .app-content,
    .card,
    .modal-content,
    .blazored-modal,
    .dropdown-menu,
    .offcanvas,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    div,
    section,
    article,
    header,
    footer,
    aside,
    nav,
    p,
    span,
    small,
    strong,
    em,
    a,
    button,
    label,
    legend,
    li,
    table,
    th,
    td,
    input,
    textarea,
    select,
    option,
    optgroup
) {
    font-family: var(--gb-website-font-family, var(--kt-font-family, Cairo, sans-serif)) !important;
    font-weight: var(--gb-website-font-weight, 400) !important;
}

body.faye-website-surface :where(
    input,
    textarea,
    select,
    .form-control,
    .form-select,
    .select2-selection,
    .select2-search__field,
    .blazored-typeahead__input input,
    .dataTables_filter input
)::placeholder {
    font-family: var(--gb-website-font-family, var(--kt-font-family, Cairo, sans-serif)) !important;
    font-weight: var(--gb-website-font-weight, 400) !important;
    font-style: normal;
}

body.faye-website-surface :where(
    .select2-container,
    .select2-container *,
    .blazored-typeahead,
    .blazored-typeahead *,
    .dataTables_wrapper,
    .dataTables_wrapper *,
    .flatpickr-calendar,
    .flatpickr-calendar *
) {
    font-family: var(--gb-website-font-family, var(--kt-font-family, Cairo, sans-serif)) !important;
}

/*
 * Every Faye search control must use the tenant's approved website font.
 * Include native, shared-component, data-table, Select2 and typeahead search
 * fields so third-party controls cannot fall back to the browser font.
 */
body.faye-website-surface :where(
    input[type="search"],
    input[placeholder*="بحث"],
    input[placeholder*="ابحث"],
    input[aria-label*="بحث"],
    .search-box input,
    .dataTables_filter input,
    .select2-search__field,
    .blazored-typeahead__input input
),
body.faye-website-surface .search-box .program-search-placeholder {
    font-family: var(--gb-website-font-family, var(--kt-font-family, Cairo, sans-serif)) !important;
    font-weight: var(--gb-website-font-weight, 400) !important;
}

body.faye-website-surface :where(
    input[type="search"],
    input[placeholder*="بحث"],
    input[placeholder*="ابحث"],
    input[aria-label*="بحث"],
    .search-box input,
    .dataTables_filter input,
    .select2-search__field,
    .blazored-typeahead__input input
)::placeholder {
    font-family: inherit !important;
    font-weight: inherit !important;
}

body.faye-website-surface :where(
    input:not([type]),
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="search"],
    input[type="url"],
    input[type="number"],
    .blazored-typeahead__input input,
    .blazored-typeahead__input-mask
):not(.faye-otp-input) {
    box-sizing: border-box !important;
    height: auto !important;
    min-height: var(--faye-native-input-min-height) !important;
    padding-block: 8px !important;
    overflow: visible !important;
    font-family: var(--faye-font-family, var(--gb-website-font-family, inherit)) !important;
    font-size: var(--faye-native-input-font-size) !important;
    font-weight: var(--faye-font-weight, var(--gb-website-font-weight, inherit)) !important;
    line-height: var(--faye-native-input-line-height) !important;
    vertical-align: middle;
}

body.faye-website-surface :where(
    select,
    input[type="date"],
    input[type="datetime-local"],
    input[type="month"],
    input[type="week"],
    input[type="time"]
) {
    box-sizing: border-box;
    font-family: var(--faye-font-family, var(--gb-website-font-family, inherit)) !important;
    font-size: var(--faye-native-input-font-size) !important;
    font-weight: var(--faye-font-weight, var(--gb-website-font-weight, inherit)) !important;
    line-height: normal !important;
}

body.faye-website-surface textarea {
    box-sizing: border-box;
    overflow: auto;
    font-family: var(--faye-font-family, var(--gb-website-font-family, inherit)) !important;
    font-size: var(--faye-native-input-font-size) !important;
    font-weight: var(--faye-font-weight, var(--gb-website-font-weight, inherit)) !important;
    line-height: 2 !important;
}

/*
 * Shared tenant-aware text input
 *
 * The control deliberately has no fixed height. A fixed 48px input combined
 * with tenant fonts can clip Arabic glyph descenders in Chromium. Keep a real
 * 16px text size even when the theme reduces the root font size to 12/13px.
 */
.gb-text-input {
    --gb-input-font-size: 16px;
    --gb-input-min-height: 56px;
    --gb-input-line-height: 40px;
    appearance: none;
    box-sizing: border-box !important;
    display: block;
    width: 100%;
    min-width: 0;
    height: auto !important;
    min-height: var(--gb-input-min-height) !important;
    margin: 0;
    padding-block: 8px !important;
    padding-inline: 16px !important;
    overflow: visible !important;
    border: 1px solid var(--faye-line, var(--kt-input-border-color, #d8e8ec));
    border-radius: 8px;
    background-color: #fff;
    background-clip: padding-box;
    color: var(--faye-text, var(--bs-body-color, #17232b));
    font-family: var(--faye-font-family, var(--gb-website-font-family, inherit)) !important;
    font-size: var(--gb-input-font-size) !important;
    font-style: normal;
    font-weight: var(--faye-font-weight, var(--gb-website-font-weight, inherit)) !important;
    line-height: var(--gb-input-line-height) !important;
    letter-spacing: normal;
    text-align: start;
    vertical-align: middle;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.gb-text-input[dir="rtl"] {
    text-align: right;
}

.gb-text-input[dir="ltr"] {
    text-align: left;
}

.gb-text-input::placeholder {
    color: #89969f;
    opacity: 1;
}

.gb-text-input:hover:not(:disabled):not([readonly]) {
    border-color: #b8d5da;
}

.gb-text-input:focus {
    border-color: var(--faye-primary, #007687);
    box-shadow: 0 0 0 3px rgba(0, 118, 135, .12);
    outline: 0;
}

.gb-text-input.is-invalid,
.gb-text-input.invalid,
.gb-text-input[aria-invalid="true"] {
    border-color: #d92d20;
    background-color: #fffafa;
}

.gb-text-input.is-invalid:focus,
.gb-text-input.invalid:focus,
.gb-text-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(217, 45, 32, .12);
}

.gb-text-input:disabled {
    cursor: not-allowed;
    opacity: 1;
    color: #5f6d75;
    -webkit-text-fill-color: #5f6d75;
    background-color: #f3f8f9;
}

.gb-text-input[readonly] {
    color: #42525b;
    background-color: #f8fafb;
}

.gb-text-input.gb-text-input--has-end-adornment {
    padding-inline-end: 56px !important;
}

textarea.gb-text-input--multiline {
    min-height: 112px !important;
    padding-block: 12px !important;
    overflow: auto !important;
    line-height: 1.8 !important;
    resize: vertical;
}

/*
 * Faye service log modal
 *
 * Blazored Modal otherwise shrinks to the table's intrinsic width. Give this
 * log a desktop-friendly canvas while retaining safe viewport margins.
 */
.blazored-modal.faye-service-log-modal {
    width: min(1180px, calc(100vw - 2rem));
    max-width: 1180px;
    max-height: calc(100vh - 2rem);
    overflow: hidden;
    border: 0;
    border-radius: 12px;
    padding: 1.5rem;
}

.faye-service-log-modal .bm-header {
    align-items: center;
    padding-bottom: 1.25rem;
    direction: rtl;
}

.faye-service-log-modal .bm-title {
    font-size: 1.35rem;
    font-weight: 700;
}

.faye-service-log-modal .bm-close {
    flex: 0 0 auto;
}

.faye-service-log-modal .faye-log-entry {
    min-width: 0;
    padding: 0;
    direction: rtl;
}

.faye-service-log-modal .faye-log-entry > h2 {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem !important;
    border: 1px solid var(--kt-border-color, #eff2f5);
    border-radius: 8px;
    background: var(--kt-gray-100, #f5f8fa);
    font-size: 1.05rem;
    line-height: 1.8;
}

.faye-service-log-modal .faye-log-table-wrapper {
    max-height: calc(100vh - 13rem) !important;
    border: 1px solid var(--kt-border-color, #eff2f5);
    border-radius: 8px;
}

.faye-service-log-modal .faye-log-table {
    margin-bottom: 0;
    min-width: 940px;
}

.faye-service-log-modal .faye-log-table thead {
    background: var(--kt-gray-100, #f5f8fa) !important;
}

.faye-service-log-modal .faye-log-table th,
.faye-service-log-modal .faye-log-table td {
    padding: 1rem 1.25rem;
    text-align: center;
    vertical-align: middle;
    border-color: var(--kt-border-color, #eff2f5);
}

.faye-service-log-modal .faye-log-table tbody tr:nth-child(even) {
    background: var(--kt-gray-100, #f8fafb);
}

.faye-service-log-modal .faye-log-table td:last-child {
    min-width: 320px;
    text-align: right;
    line-height: 1.8;
}

@media (max-width: 767.98px) {
    .blazored-modal.faye-service-log-modal {
        width: calc(100vw - 1rem);
        max-height: calc(100vh - 1rem);
        margin: .5rem;
        padding: 1rem;
    }
}
