/* =====================================================
   BASE
   ===================================================== */

html,
body {
    height: 100%;
    margin: 0;
}

/* =====================================================
   BOUTON LOGIN
   ===================================================== */

.btn-login {
    background-color: #1C3457 !important;
    border-color: #1C3457 !important;
    color: #ffffff !important;
}

.btn-login:hover {
    background-color: #162a46 !important;
    border-color: #162a46 !important;
}

.btn-login:active {
    background-color: #0f2036 !important;
    border-color: #0f2036 !important;
}

/* =====================================================
   TOGGLE MOT DE PASSE
   ===================================================== */

.password-toggle {
    cursor: pointer;
    color: #666;
}

.password-toggle:hover {
    color: #1C3457;
}

/* =====================================================
   LOGIN (PAGE SANS SIDEBAR)
   ===================================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

/* =====================================================
   TOASTS
   ===================================================== */

#toast-root {
    position: fixed !important;
    top: 24px !important;
    right: 24px !important;
    z-index: 2147483647 !important;

    display: flex;
    flex-direction: column;
    gap: 12px;

    pointer-events: none;
}

#toast-root .flash-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 360px;
    padding: 14px 18px;
    border-radius: 10px;

    color: #ffffff;
    font-size: 0.95rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);

    animation:
        toast-slide-in 0.5s ease-out,
        toast-fade-out 0.5s ease-in 4.5s forwards;
}

#toast-root .flash-toast.success {
    background-color: #2e7d32;
}

#toast-root .flash-toast.alert {
    background-color: #c62828;
}

#toast-root .flash-toast.info {
    background-color: #1C3457;
}

/* =====================================================
   SIDEBAR (FIXE, PROPRE)
   ===================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;

    width: 240px;
    min-width: 240px;
    height: 100vh;

    overflow-y: auto;

    background-color: #ffffff !important;
    border-right: 1px solid #e1e6ef;
}

/* =====================================================
   CONTENEUR GLOBAL (SANS FLEX)
   ===================================================== */

.app-layout {
    width: 100%;
    min-height: 100vh;
}

/* =====================================================
   CONTENU PRINCIPAL
   ===================================================== */

.content-wrapper {
    margin-left: 240px;
    width: calc(100vw - 240px);
    min-width: 0;

    padding: 24px;
    min-height: 100vh;
}

/* Responsive : mobile */
@media (max-width: 768px) {
    .content-wrapper {
        margin-left: 0;
        width: 100vw;
    }
}

/* =====================================================
   TABLE METRO UI – PLEINE LARGEUR
   ===================================================== */

.content-wrapper .table,
.content-wrapper .table-component {
    width: 100%;
    max-width: 100%;
}

/* =====================================================
   TOGGLE SIDEBAR RESPONSIVE
   ===================================================== */

.sidebar-toggle {
    display: inline-flex;
}

@media (min-width: 768px) {
    .sidebar-toggle {
        display: none;
    }
}

/* =====================================================
   HEADER SIDEBAR (LOGO / TITRES)
   ===================================================== */

.custom-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;

    background-color: #1C3457;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-sidebar-header:hover {
    background-color: #24406b;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.sidebar-logo {
    height: 32px;
    width: auto;
    flex-shrink: 0;
}

.sidebar-title-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.sidebar-title {
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
}

.sidebar-subtitle {
    font-size: 13px;
    color: #cfd8e6;
}

/* Forcer la hauteur du header Metro UI */
.sidebar .sidebar-header.custom-sidebar-header {
    height: 70px !important;
    min-height: 70px !important;
    max-height: 70px !important;
    padding: 6px 10px !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

/* =====================================================
   MENU SIDEBAR (METRO UI)
   ===================================================== */

.sidebar-header-link,
.sidebar-header-link:hover,
.sidebar-header-link:focus,
.sidebar-header-link:active {
    text-decoration: none !important;
}

/* Section header (ADMINISTRATION, etc.) */
.sidebar-menu .item-header {
    list-style: none !important;
    margin: 18px 16px 10px;
    padding: 0;

    display: flex;
    align-items: center;

    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000000;

    pointer-events: none;
}

/* Ligne décorative */
.sidebar-menu .item-header::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    margin-left: 10px;
    background-color: #dfe3eb;
}

/* Nettoyage listes Metro */
.sidebar-menu,
.sidebar-menu li {
    list-style: none !important;
}

/* =====================================================
   MENU SCROLLABLE
   ===================================================== */

.sidebar-menu.hide-scroll {
    height: calc(100vh - 70px) !important;
    max-height: calc(100vh - 70px) !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    box-sizing: border-box !important;
    margin: 0 !important;
    padding-bottom: 12px;
}

/* Forcer le respect des largeurs de colonnes */
.table {
    table-layout: fixed;
}

.page-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    /* ← hauteur FIXE */
    margin-bottom: 32px;
    /* espace sous le titre */
}

.page-header-left {
    width: 200px;
    display: flex;
    justify-content: flex-start !important;
}

.page-header-right {
    width: 200px;
    display: flex;
    justify-content: flex-end !important;
}

.page-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    white-space: nowrap;
}

/* Bouton couleur personnalisée */
.btn-primary-custom {
    background-color: #1C3457 !important;
    color: #ffffff !important;
    border: none;
}

.btn-primary-custom:hover {
    background-color: #162a46 !important;
    /* légèrement plus foncé */
}

@media print {
    .sidebar {
        display: none !important;
    }

    /* Optionnel : enlever les marges liées à la sidebar */
    .content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .no-print {
        display: none !important;
    }
}

/* =========================================================
   METRO UI 5.1 – FIX GLOBAL ALIGNEMENTS TABLES
   ========================================================= */

/* Alignements génériques */
.text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

/* Metro UI Table: le contenu est dans .data-wrapper */
.table-component table td>.data-wrapper,
.table-component table th>.data-wrapper,
table[data-role="table"] td>.data-wrapper,
table[data-role="table"] th>.data-wrapper {
    width: 100% !important;
    display: block !important;
    /* important: sinon parfois flex */
}

/* Quand Metro applique la classe sur le TD/TH (via data-cls-column) */
.table-component table td.text-left>.data-wrapper,
.table-component table th.text-left>.data-wrapper,
.table-component table td.text-center>.data-wrapper,
.table-component table th.text-center>.data-wrapper,
.table-component table td.text-right>.data-wrapper,
.table-component table th.text-right>.data-wrapper {
    text-align: inherit !important;
    /* héritera du td/th */
}

/* =========================================================
   METRO UI – COLONNE MASQUÉE (ROBUSTE)
   ========================================================= */
.col-hidden,
.col-hidden>.data-wrapper {
    display: none !important;
}

/* =========================================================
   PETIT I D'INFORMATION
   ========================================================= */

.info-hover {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 6px;
    border-radius: 50%;
    cursor: help;
}

.info-hover .mif-info {
    font-size: 14px;
    color: #1C3457;
    /* ou fg-blue si tu préfères */
}

/* Optionnel : feedback visuel au survol */
.info-hover:hover {
    background-color: rgba(28, 52, 87, 0.1);
}

/* =========================================================
   FORM GRID - 2 COLONNES
   ========================================================= */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Mobile / tablette */
@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Badge statut lot
   ========================================================= */
.badge-statut {
    padding: 0.25rem 0.5rem;
    /* équivalent px-1 py-1 */
    font-size: 1rem;
    line-height: 1;
}

.badge-statut .mif {
    font-size: 1rem;
}

/* =========================================================
   Limite à N lignes avec ellipsis
   ========================================================= */
.desc-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;

    line-clamp: 3;

    overflow: hidden;
    white-space: normal;
    word-break: break-word;

    font-size: 12px;
    line-height: 1.4;
}

/*  =========================================================
    FILTRE SQL
    ========================================================= */
.filtre-statut-wrapper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.filtre-label {
    font-weight: 600;
    margin-right: 8px;
    white-space: nowrap;
}

.filtre-statut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}