/*
 * Surcouche Posly du template Material Dashboard 3 (MIT, Creative Tim) :
 * couleurs de marque (bleu #1F4E79, orange #F97316) et quelques utilitaires
 * propres à l'espace super administration.
 */
:root {
    --posly-primary: #1F4E79;
    --posly-primary-dark: #14263f;
    --posly-accent: #F97316;
}

.bg-gradient-dark {
    background-image: linear-gradient(195deg, var(--posly-primary) 0%, var(--posly-primary-dark) 100%) !important;
}

.shadow-dark {
    box-shadow: 0 4px 20px 0 rgba(20, 38, 63, .14), 0 7px 10px -5px rgba(31, 78, 121, .4) !important;
}

.btn.bg-gradient-dark:hover {
    background-image: linear-gradient(195deg, #275f92 0%, var(--posly-primary) 100%) !important;
}

.btn-outline-dark {
    color: var(--posly-primary);
    border-color: var(--posly-primary);
}

.bg-gradient-warning {
    background-image: linear-gradient(195deg, #fb923c 0%, var(--posly-accent) 100%) !important;
}

a.text-primary, .text-primary {
    color: var(--posly-primary) !important;
}

.input-group.input-group-outline.is-focused .form-label,
.input-group.input-group-outline.is-filled .form-label {
    color: var(--posly-primary);
}

.input-group.input-group-outline.is-focused .form-control {
    border-color: var(--posly-primary) !important;
    box-shadow: inset 1px 0 var(--posly-primary), inset -1px 0 var(--posly-primary), inset 0 -1px var(--posly-primary) !important;
}

/* QR code d'enrôlement 2FA. */
.posly-qr svg {
    width: 200px;
    height: 200px;
    max-width: 100%;
}

.posly-secret {
    font-size: .9rem;
    letter-spacing: .08em;
    color: var(--posly-primary-dark);
    background: #f1f5f9;
    border-radius: .375rem;
    padding: .25rem .5rem;
    word-break: break-all;
}

/* Boutons tactiles (≥ 44 px) sur tablette. */
.btn {
    min-height: 44px;
}

.btn-sm {
    min-height: 36px;
}

/* Datatable (App\Support\Admin\DataTable + composants x-admin.*). */
.datatable-toolbar .input-group {
    width: auto;
    margin-bottom: 0;
}

.datatable-per-page select {
    min-width: 70px;
}

.datatable-filter select {
    min-width: 150px;
}

.datatable-search {
    min-width: 240px;
}

.datatable-sort {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.datatable-sort.is-active {
    color: var(--posly-primary) !important;
    opacity: 1;
}

.datatable-sort-icon {
    font-size: 14px !important;
}

.table td {
    vertical-align: middle;
}

.pagination .page-item.active .page-link {
    background-image: linear-gradient(195deg, var(--posly-primary) 0%, var(--posly-primary-dark) 100%);
    border: 0;
}

.pagination .page-link {
    border-radius: 50% !important;
    margin: 0 2px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #344767;
}

/* Fil de discussion des tickets. */
.ticket-message {
    border-radius: .75rem;
    padding: .75rem 1rem;
    max-width: 85%;
}

.ticket-message.is-support {
    background: #eaf1f8;
    margin-left: auto;
}

.ticket-message.is-client {
    background: #f1f5f9;
}

.ticket-message p {
    white-space: pre-wrap;
}

@media (max-width: 575.98px) {
    .datatable-search {
        min-width: 100%;
    }
}

/* Cases à cocher / interrupteurs : bleu Posly au lieu du rose du template. */
.form-check-input:checked {
    background-color: var(--posly-primary) !important;
    border-color: var(--posly-primary) !important;
}

.form-check-input:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input:checked {
    background-image: none !important;
}

.form-check-input:focus {
    border-color: var(--posly-primary);
    box-shadow: 0 0 0 .2rem rgba(31, 78, 121, .2);
}

/* Case à cocher suivie d'un libellé long (formulaire des rôles) : case en
   tête de ligne, libellé qui revient à la ligne à sa droite. */
.form-check.posly-check .form-check-input {
    float: none;
    margin-left: 0 !important;
    margin-right: 0;
}

/* Cases à cocher hors d'un .form-check (tableaux d'audience…) : le template
   ne leur donne aucune bordure, elles étaient invisibles sur fond blanc. */
.form-check-input[type="checkbox"] {
    border: 1.5px solid #8a94a6 !important;
    border-radius: .3rem;
    background-color: #fff;
    cursor: pointer;
}

.form-check-input[type="checkbox"]:hover {
    border-color: var(--posly-primary) !important;
}

.form-check-input[type="checkbox"]:checked {
    border-color: var(--posly-primary) !important;
}

/* Barre latérale : le template réserve 200 px à un pied de menu
   (« Documentation / Upgrade ») absent ici — la liste était coupée. */
.navbar-vertical.navbar-expand-xs #sidenav-collapse-main {
    height: calc(100vh - 110px);
}

/* Chargement : barre fine en haut de page + bouton occupé. */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 2000;
    background: linear-gradient(90deg, var(--posly-primary), var(--posly-accent));
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}

#page-loader.is-active {
    opacity: 1;
    animation: posly-page-loader 8s cubic-bezier(.1, .7, .3, 1) forwards;
}

@keyframes posly-page-loader {
    0% { width: 0; }
    20% { width: 45%; }
    100% { width: 92%; }
}

.btn.is-loading {
    pointer-events: none;
    opacity: .8;
}

.btn .btn-spinner {
    width: .85rem;
    height: .85rem;
    border-width: .15em;
    vertical-align: -0.1em;
}

@media (prefers-reduced-motion: reduce) {
    #page-loader.is-active {
        animation: none;
        width: 92%;
    }
}

/* Champ « outline » actif ou rempli : bordure et libellé flottant en bleu Posly (rose dans le template). */
.input-group.input-group-outline.is-filled .form-label + .form-control,
.input-group.input-group-outline.is-focused .form-label + .form-control {
    border-color: var(--posly-primary) !important;
    border-top-color: transparent !important;
    box-shadow: inset 1px 0 var(--posly-primary), inset -1px 0 var(--posly-primary), inset 0 -1px var(--posly-primary) !important;
}

.input-group.input-group-outline.is-filled .form-label,
.input-group.input-group-outline.is-focused .form-label {
    color: var(--posly-primary) !important;
}

.input-group.input-group-outline.is-filled .form-label:before,
.input-group.input-group-outline.is-filled .form-label:after,
.input-group.input-group-outline.is-focused .form-label:before,
.input-group.input-group-outline.is-focused .form-label:after {
    border-top-color: var(--posly-primary) !important;
    box-shadow: inset 0 1px var(--posly-primary) !important;
}

.input-group.input-group-static .form-control:focus,
.input-group.input-group-dynamic .form-control:focus {
    background-image: linear-gradient(0deg, var(--posly-primary) 2px, rgba(156, 39, 176, 0) 0), linear-gradient(0deg, #d2d2d2 1px, hsla(0, 0%, 82%, 0) 0) !important;
}
