/* startbar */
.startbar {
    /*border: none;*/
}

/* Repère visuel de l'environnement (la production reste inchangée). */
.environment-indicator {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0.3rem 0.65rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
}

.environment-indicator--dev { color: #0d6efd; }
.environment-indicator--test { color: #6f42c1; }
.environment-indicator--recette { color: #b45309; }
.environment-indicator--unknown { color: #dc3545; }

body[data-app-environment="dev"] header {
    border-top: 4px solid #0d6efd;
    background-color: rgba(13, 110, 253, 0.06);
}

body[data-app-environment="test"] header {
    border-top: 4px solid #6f42c1;
    background-color: rgba(111, 66, 193, 0.06);
}

body[data-app-environment="recette"] header {
    border-top: 4px solid #f59e0b;
    background-color: rgba(245, 158, 11, 0.08);
}

.startbar .brand {
    height: auto;
    padding: 20px;
    max-height: 50px;
    /*background-color: #ebebeb;*/
    margin-bottom: 20px;
    /*display: block;*/
}

.startbar .brand .logo-lg {
    max-height: 40px;
}

.startbar .brand .logo-sm {
    height: auto;
    max-height: 40px;
    max-width: 35px;

}


/* dataTables: Fix sorting arrow position on right align th */
table.dataTable th .dt-column-title {
    padding-right: 10px !important;
}

table.dataTable th div.dt-column-header {
    flex-direction: row !important;
}


/* forms */
.permis-group, .restrictions-group {
    /*width: fit-content;*/
}

.permis-group.is-invalid, .restrictions-group.is-invalid {
    border: 1px solid #dc3545;
    border-radius: 4px;
    padding: 10px 12px;
    /*background-color: #fff6f6;*/
}


form:not(.no-label-required) label.required::after {
    content: " *";
    /*color: #dc3545; !* rouge Bootstrap *!*/
    font-weight: bold;
}

.input-group .btn {
    box-shadow: none;
}

.form-switch .form-check {
    padding-left: 0;
}

.form-check a {
    text-decoration: underline;
}

/* summernote */
.note-toolbar {
    background: #f1f1f1 !important;
}

html[data-bs-theme=dark] .note-toolbar {
    background: #646464 !important;
}

.note-toolbar .btn {
    box-shadow: none;
    color: #1e2129;
}

/* dossier mobile */
@media (max-width: 767.98px) {
    /* =========================================
       Transformation du tableau en cartes
       ========================================= */
    .documents-table {
        display: block;
        width: 100%;
        margin-bottom: 0;
    }

    .documents-table thead {
        display: none;
    }

    .documents-table tbody {
        display: grid;
        width: 100%;
        gap: 1rem;
    }

    .documents-table .document-row {
        display: block;
        width: 100%;
        padding: 1rem;
        border: 1px solid var(--bs-border-color);
        border-radius: var(--bs-border-radius-lg);
        background-color: var(--bs-body-bg);
        box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.05);
    }

    /* =========================================
       Cellules génériques
       ========================================= */
    .documents-table .document-cell {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        width: 100%;
        padding: 0.75rem 0;
        border: 0;
        border-bottom: 1px solid var(--bs-border-color);
        text-align: right;
        white-space: normal;
    }

    .documents-table .document-cell::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--bs-secondary-color);
        text-align: left;
    }

    /* =========================================
       Première cellule : document
       ========================================= */
    .documents-table .document-main-cell {
        display: block;
        padding-top: 0;
        text-align: left;
    }

    .documents-table .document-main-cell::before {
        display: none;
    }

    .documents-table .document-main-cell strong {
        display: block;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .documents-table .document-main-cell .fst-italic {
        overflow-wrap: anywhere;
    }

    .documents-table .document-main-cell small {
        display: block;
        margin-top: 0.25rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    /* =========================================
       Statut, modèle et dernier envoi
       ========================================= */
    .documents-table .document-status-cell,
    .documents-table .document-model-cell,
    .documents-table .document-upload-date-cell {
        align-items: center;
    }

    /* Empêche le contenu de dépasser à droite */
    .documents-table .document-status-cell > *,
    .documents-table .document-model-cell > *,
    .documents-table .document-upload-date-cell > * {
        min-width: 0;
    }

    /* =========================================
       Zone Actions
       ========================================= */
    .documents-table .document-actions-cell {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0.75rem 1rem;
        padding-bottom: 0;
        border-bottom: 0;
        text-align: left !important;
    }

    .documents-table .document-actions-cell::before {
        grid-column: 1;
        grid-row: 1;
        content: attr(data-label);
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--bs-secondary-color);
        text-align: left;
    }

    .documents-table .document-upload-form {
        display: flex !important;
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        margin: 0;
    }

    .documents-table .document-upload-btn {
        width: 90px;
        font-size: .775rem;
    }

    /* =========================================
       Fichiers envoyés
       ========================================= */
    .documents-table .document-files-list {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        margin-top: 0.25rem !important;
    }

    .documents-table .document-file-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        width: 100%;
        min-width: 0;
        padding: 0.625rem 0;
        border-top: 1px solid var(--bs-border-color);
    }

    .documents-table .document-filename {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        color: var(--bs-secondary-color);
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .documents-table .document-file-actions {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 0.25rem;
    }

    .documents-table .document-file-actions .btn {
        flex: 0 0 auto;
    }

    /* =========================================
       Cas où aucun document n’est configuré
       ========================================= */
    .documents-table tbody > tr:not(.document-row) {
        display: block;
        width: 100%;
    }

    .documents-table tbody > tr:not(.document-row) td {
        display: block;
        width: 100%;
    }
}
