/*
 * Back-office webjjma : ajustements légers par-dessus Bootstrap 5.3.
 * Préfixe « wj- » pour les classes propres au back-office.
 */

:root {
    --wj-navbar-bg: #172033;
    --wj-navbar-active: #2f6fed;
    --wj-body-bg: #f4f6f9;
    --wj-pre-bg: #0f172a;
    --wj-pre-color: #e2e8f0;
}

body.wj-admin {
    background-color: var(--wj-body-bg);
    font-size: 0.9375rem;
}

/* Icônes Lucide : taille du texte, alignées sur la ligne de base. */
svg.lucide,
i.icon {
    width: 1.05em;
    height: 1.05em;
    stroke-width: 2;
    vertical-align: -0.15em;
    flex-shrink: 0;
}

i.icon {
    display: inline-block;
}

/* Barre de navigation */
.wj-navbar {
    background-color: var(--wj-navbar-bg);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.wj-navbar .navbar-brand {
    font-weight: 600;
    letter-spacing: 0.01em;
}

.wj-navbar .nav-link {
    border-radius: 0.375rem;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}

.wj-navbar .nav-link.active,
.wj-navbar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.wj-navbar .dropdown-menu {
    font-size: 0.9rem;
    min-width: 13rem;
}

.wj-navbar .dropdown-item.active,
.wj-navbar .dropdown-item:active {
    background-color: var(--wj-navbar-active);
}

.wj-navbar form .dropdown-item {
    width: 100%;
}

/* En-tête de page */
.wj-page-header h1 {
    font-weight: 600;
}

.wj-breadcrumbs .breadcrumb {
    --bs-breadcrumb-divider-color: var(--bs-secondary-color);
}

/* Cartes et tableaux */
.card {
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card-header {
    background-color: #fff;
    font-weight: 500;
}

.wj-table {
    font-size: 0.875rem;
}

.wj-table > thead > tr > th {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-bottom-width: 1px;
}

.wj-table > :not(caption) > * > * {
    padding: 0.5rem 0.75rem;
}

.wj-table form {
    margin: 0;
}

.wj-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.wj-sort:hover,
.wj-sort.is-sorted {
    color: var(--bs-emphasis-color);
}

.wj-sort-icon {
    width: 0.9em !important;
    height: 0.9em !important;
}

.wj-truncate {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Badges de statut */
.wj-badge {
    font-weight: 500;
    font-size: 0.75rem;
}

/* Cartes de statistique */
.wj-stat-link {
    transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.wj-stat-link:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.wj-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wj-stat-icon svg.lucide {
    width: 1.3rem;
    height: 1.3rem;
}

.min-w-0 {
    min-width: 0;
}

/* États vides et pages d'erreur */
.wj-empty-icon,
.wj-error-icon {
    width: 2.5rem !important;
    height: 2.5rem !important;
    opacity: 0.45;
}

.wj-empty-icon-sm {
    width: 1.75rem !important;
    height: 1.75rem !important;
}

.wj-error-icon {
    width: 3.5rem !important;
    height: 3.5rem !important;
}

/* Blocs de code et JSON */
.wj-pre {
    background-color: var(--wj-pre-bg);
    color: var(--wj-pre-color);
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    max-height: 28rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.wj-pre-tall {
    max-height: 70vh;
}

.wj-json-inline {
    font-size: 0.78rem;
    white-space: normal;
    word-break: break-all;
}

textarea.wj-json {
    font-size: 0.82rem;
}

.wj-details summary {
    cursor: pointer;
    list-style: none;
}

.wj-details summary::-webkit-details-marker {
    display: none;
}

.wj-dl dd {
    margin-bottom: 0.4rem;
}

/* Filtres */
.wj-filters .form-label {
    font-size: 0.78rem;
}

.wj-filter-wide .ts-wrapper,
.wj-filter-wide select {
    min-width: 14rem;
}

.wj-filter-narrow input {
    max-width: 8rem;
}

.wj-filters .ts-wrapper,
.wj-filters select {
    min-width: 10rem;
}

/* TomSelect en petite taille : même hauteur que .form-control-sm. */
.ts-wrapper.form-select-sm .ts-control,
.ts-wrapper.form-select-sm.has-items .ts-control,
.ts-wrapper.form-control-sm .ts-control {
    padding-top: calc(0.25rem - 1px);
    padding-bottom: calc(0.25rem - 1px);
}

.ts-wrapper.form-select-sm.single .ts-control > .item,
.ts-wrapper.form-select-sm.single .ts-control > input {
    margin-top: 0;
    margin-bottom: 0;
}

.ts-dropdown {
    font-size: 0.875rem;
}

/* Barre d'action collante des longs formulaires */
.wj-sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0;
    background: linear-gradient(to top, var(--wj-body-bg) 70%, rgba(244, 246, 249, 0));
    z-index: 5;
}

/* Sélection multiple et actions de masse (Ui::bulkBar(), admin.js) */
.wj-bulk-cell {
    width: 1%;
    white-space: nowrap;
    user-select: none;
}

td.wj-bulk-cell {
    cursor: pointer;
}

.wj-bulk-check {
    cursor: pointer;
    margin-top: 0;
    vertical-align: middle;
}

.table > tbody > tr.wj-bulk-selected > * {
    --bs-table-bg-state: rgba(47, 111, 237, 0.08);
}

table:not(.table) tr.wj-bulk-selected > * {
    background-color: rgba(47, 111, 237, 0.08);
}

.wj-bulk-selected:not(tr) {
    outline: 2px solid var(--wj-navbar-active);
    outline-offset: -2px;
}

.wj-bulk-bar {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + var(--wj-bulk-stack, 0px));
    transform: translateX(-50%);
    z-index: 1035;
    width: max-content;
    max-width: calc(100vw - 2rem);
    background-color: #fff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-left: 4px solid var(--wj-navbar-active);
    border-radius: 0.75rem;
    box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.18);
    animation: wj-bulk-in 0.15s ease-out;
}

.wj-bulk-bar[hidden] {
    display: none;
}

@keyframes wj-bulk-in {
    from {
        opacity: 0;
    }
}

.wj-bulk-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
}

.wj-bulk-count {
    font-weight: 600;
    white-space: nowrap;
    margin-right: 0.25rem;
}

.wj-bulk-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.wj-bulk-fields .ts-wrapper,
.wj-bulk-fields select,
.wj-bulk-fields input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 12rem;
}

.wj-bulk-fields .mb-3 {
    margin-bottom: 0 !important;
}

/* Barre en bas de l'écran : les listes TomSelect s'ouvrent vers le haut. */
.wj-bulk-bar .ts-dropdown {
    top: auto;
    bottom: 100%;
    margin: 0 0 0.25rem;
}

.wj-bulk-clear {
    padding-left: 0.4rem;
    padding-right: 0.4rem;
}

body.wj-bulk-open {
    padding-bottom: calc(var(--wj-bulk-space, 0px) + 1.5rem);
}

/* La barre collante « Enregistrer » des longs formulaires remonte au-dessus de la barre de masse. */
body.wj-bulk-open .wj-sticky-actions {
    bottom: calc(var(--wj-bulk-space, 0px) + 1rem);
}

@media (max-width: 575.98px) {
    .wj-bulk-bar {
        left: 0.5rem;
        right: 0.5rem;
        bottom: calc(0.5rem + var(--wj-bulk-stack, 0px));
        transform: none;
        width: auto;
        max-width: none;
    }
}

/* Onglets de fiche site */
.wj-site-tabs .nav-link {
    display: inline-flex;
    align-items: center;
}

/* Pages hors session */
.wj-guest {
    background: radial-gradient(circle at top, #e8eefc 0%, var(--wj-body-bg) 60%);
}

.wj-guest-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.wj-guest-card {
    width: 100%;
    max-width: 26rem;
}

.wj-guest-brand {
    color: var(--wj-navbar-bg);
}

.wj-guest-logo {
    width: 2.25rem !important;
    height: 2.25rem !important;
    color: var(--wj-navbar-active);
    margin-bottom: 0.25rem;
}

/* Messages flash */
.wj-flash .alert {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.wj-flash-text {
    flex: 1 1 auto;
    word-break: break-word;
}

/* Bloc rafraîchi automatiquement */
[data-poll].is-polling {
    opacity: 0.85;
    transition: opacity 0.2s;
}
