/* ================== */
/* Corps de la page   */
/* ================== */

:root {
    --clr-bleu-clair: #8AB7F2;
    --clr-bleu-clair-hover: #3285F0;
    --clr-nav: #34495e;
    --font-base: Arial, Helvetica, sans-serif;
    --shadow-box: 0 6px 20px rgba(0, 0, 0, 0.08);
    --radius: 0.5rem;
    --radius-table: 0.75rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
}

body,
html {
    font-family: var(--font-base);
    height: 100%;
}

html {
    scroll-behavior: smooth;
}

#content {
    padding: 20px;
}

main {
    flex-grow: 1;
    position: relative;
    overflow: auto;
    padding: 20px;
}

button {
    background-color: var(--clr-bleu-clair);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s, transform 0.2s;
    margin: 0 2px;
}

button:hover {
    background-color: var(--clr-bleu-clair-hover);
    transform: translateY(-2px);
}

button:active {
    background-color: var(--clr-bleu-clair-hover);
    transform: translateY(1px);
}

/*
button+button {
    margin-top: 10px;
    margin-bottom: 10px;
}*/

input[type="checkbox"] {
    margin: 0;
}

input[type="text"] {
    width: 100%;
    margin-bottom: 10px;
}

label {
    display: block;
}

#container {
    position: relative;
}

span {
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}


/* ============================= */
/* CSS de la navigation          */
/* ============================= */

.header-wrapper {
    position: relative;
    width: 60px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: visible;
    transition: max-width 0.3s ease, width 0.3s ease;
    background-color: var(--clr-nav);
}


.header-wrapper.open #nav>ul {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.1s;
}

.header-content {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    background-color: var(--clr-nav);
    padding: 0 20px;
    height: 60px;
    box-sizing: border-box;
    flex-shrink: 0;
    position: relative;
}

#navBtn {
    width: 60px;
    position: absolute;
    margin: 0px;
    font-size: 30px;
    background: var(--clr-nav);
    color: white;
    cursor: pointer;
    z-index: 100;
    padding: 0 0px;
    text-align: center;
}

#nav {
    margin-top: 40px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    z-index: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#nav>ul {
    list-style: none;
    padding: 0 20px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.header-wrapper.open {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
}

.header-wrapper.open #nav>ul {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.3s;
}

.header-wrapper:not(.open) #nav::-webkit-scrollbar {
    display: none;
}

.header-wrapper:not(.open) #nav {
    scrollbar-width: none;
}

#nav ul li {
    padding: 10px 0;
    color: white;
    cursor: pointer;
    user-select: none;
    list-style: none;
    overflow: hidden;
    text-overflow: ellipsis;
}

#nav ul ul {
    padding-left: 20px;
    margin: 0;
    list-style: none;
}

#nav ul li:hover {
    color: var(--clr-bleu-clair);
}

/* ----------------------------------- */
/* Scrollbar pour Chrome, Edge, Safari */
/* ----------------------------------- */

#nav::-webkit-scrollbar {
    width: 6px;
}

#nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#nav::-webkit-scrollbar-track {
    background: transparent;
}


/* ============================= */
/* CSS du loader                 */
/* ============================= */

#globalLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--clr-nav);
    color: white;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    visibility: visible;
}

/* ============================= */
/* CSS des lignes d'un tableau   */
/* ============================= */

.element-row {
    border-bottom: 1px solid #ddd;
}

.element-cell {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: center;
}

.pieces-cell {
    padding: 6px;
    text-align: center;
}

.toggle-btn {
    cursor: pointer;
    background: var(--clr-bleu-clair);
    border: none;
    font-size: 14px;
    border-radius: var(--radius);
    color: white;
}

.expand-row {
    background: #f9f9f9;
}

.expand-cell {
    border: none;
    padding: 0;
}

.expand-container {
    padding: 8px;
}

.hidden {
    display: none;
}

.box-input {
    position: absolute;
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 4px;
    border-radius: var(--radius);
    cursor: move;
}

.img-preview {
    max-width: 100px;
    display: block;
    margin: 5px 0;
}

/* ========================= */
/* CSS Modal et Formulaire   */
/* ========================= */


.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#contratModal>.modal-form,
#contratDetailModal>.modal-form {
    min-width: 1200px;
}


.modal-form {
    background: #fff;
    padding: 30px 40px;
    border-radius: var(--radius);
    min-width: 500px;
    box-shadow: var(--shadow-box);
    font-family: var(--font-base);
    color: #333;
    flex-direction: column;

    max-height: 90vh;
    overflow-y: auto;

    scrollbar-width: thin;
    scrollbar-color: rgba(100, 100, 100, 0.5) transparent;
}



.modal-form h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #2c3e50;
}

.modal-form label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #555;
    display: block;
}

.modal-form input[type="text"],
.modal-form input[type="date"],
.modal-form input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.modal-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    cursor: pointer;
}


.modal-form button {
    background: var(--clr-bleu-clair);
    color: white;
    border: none;
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.modal-form button:hover {
    background: var(--clr-bleu-clair-hover);
    transform: scale(1.03);
}

.modal-form::-webkit-scrollbar {
    width: 6px;
}

.modal-form::-webkit-scrollbar-thumb {
    background-color: rgba(100, 100, 100, 0.5);
    border-radius: 3px;
}

.modal-form::-webkit-scrollbar-track {
    background: transparent;
}




/* ================ */
/* CSS Plan étage   */
/* ================ */

#plan {
    width: 100%;
}

svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
}

/* =============== */
/* CSS Box etage   */
/* =============== */

.sizeForeignObject {
    width: 96px;
    height: 48px;
}

.boxCellule {
    display: inline-block;
    /* prend la taille de son contenu */
    padding: 4px;
    height: auto;
    font-size: 12px;
    font-weight: bold;
    position: relative;
    border-radius: var(--radius);
    transition: background-color 0.3s, transform 0.2s;
}


.boxCellule p {
    margin: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.boxCellule:hover {
    background: #DCDCDC;
    transform: scale(1.05);
    cursor: pointer;
}

.popupOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.popupModal {
    background: #fff;
    padding: 25px 35px 45px;
    height: auto;
    border-radius: var(--radius-table);
    box-shadow: var(--shadow-box);
    position: relative;
    font-family: var(--font-base);
    color: #333;
    line-height: 1.6;
    text-align: left;
    animation: fadeIn 0.25s ease-out;
}

.popupClose {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 20px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
}

.popupClose:hover {
    color: red;
}

.popupModal p {
    margin: 6px 0;
    padding-left: 10px;
    font-size: 15px;
    border-left: 3px solid var(--clr-bleu-clair);
    background: #f9f9f9;
    border-radius: 4px;
    padding: 6px 10px;
}

.popupOkBtn {
    display: block;
    margin: 25px auto 0;
    padding: 10px 25px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background-color: var(--clr-bleu-clair);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.popupOkBtn:hover {
    background-color: #1565c0;
    transform: translateY(-1px);
}

.popupOkBtn:active {
    background-color: #0d47a1;
    transform: translateY(0);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popupModalImg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 95vw;
    max-height: 90vh;
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ======================== */
/* Image dans les tableau   */
/* ======================== */

.imgTableauElement,
.imgTableauPieces {
    width: 70px;
    height: 70px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgb(204, 204, 204);
    border-radius: 4px;
    background-color: rgb(240, 240, 240);
    object-fit: contain;
}

.imgZoom {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    margin: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

/* ======================== */
/* Tableau css          */
/* ======================== */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font-base);
    font-size: 16px;
    color: #2c3e50;
    background: #ffffff;
    border-radius: var(--radius-table);
    overflow: hidden;
    box-shadow: var(--shadow-box);
    margin: 30px 0;
    transition: box-shadow 0.3s ease;
}

th,
td {

    text-align: left;
    padding: 12px 18px;
    font-weight: 400;
    font-size: 16px;
    color: #3a4a5a;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    letter-spacing: 0.1px;
    text-transform: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

td {
    border: 1px solid #ddd;
}

th {
    background-color: var(--clr-bleu-clair);
    color: #ffffff;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

@media (max-width: 640px) {
    table thead {
        display: none;
    }

    table tbody tr {
        display: block;
        margin-bottom: 14px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: var(--radius-table);
        background: #ffffff;
        box-shadow: var(--shadow-box);
        overflow: hidden;
        padding: 10px 0;
    }

    table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        font-size: 14px;
        border-bottom: none;
    }

    table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #1a2c47;
        width: 50%;
        text-align: left;
    }
}

/* ======================== */
/* OpenLibrary css          */
/* ======================== */

.library-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.lib-content {
    background: #ffffff;
    width: 600px;
    max-height: 80vh;
    padding: 25px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.lib-content>label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.lib-content>input {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.lib-content>input:focus {
    border-color: #888;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    outline: none;
}

.lib-content>hr {
    border: none;
    height: 1px;
    background-color: #ccc;
    margin: 20px 0;
    border-radius: 2px;
}

.lib-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: thin;
    scrollbar-color: #888 #f0f0f0;
}

.lib-grid::-webkit-scrollbar {
    height: 8px;
}

.lib-grid::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.lib-grid::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 4px;
    border: 2px solid #f0f0f0;
}

.lib-wrapper {
    position: relative;
    /* ✅ nécessaire pour positionner le bouton */
    flex: 0 0 100px;
    height: 100px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f0f0f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.lib-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.lib-img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 6px;
}

/* ✅ Bouton delete bien intégré */
.lib-delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: var(--clr-bleu-clair);
    border: none;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 5px;
    line-height: 1;
    opacity: 1;
    transition: opacity 0.2s, background 0.2s, transform 0.2s;
    z-index: 5;
}

.lib-delete-btn:hover {
    background-color: var(--clr-bleu-clair-hover);
    color: white;
    transform: scale(1.1);
}


/* ============================= */
/* Css de la pagination          */
/* ============================= */

#container_badge,
#container_historique,
#container_cannons,
#container_contrats {
    width: 100%;
    overflow-x: auto;
    flex-direction: column;
    min-height: calc(100vh - 80px);
    padding-bottom: 80px;
    box-sizing: border-box;
}

#container_badge table,
#container_historique table,
#container_cannons table {
    width: 100%;
    border-collapse: collapse;
}

#container_badge td,
#container_historique td,
#container_cannons td {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    white-space: normal;
    height: 32px;
    padding: 4px 10px;
    max-width: 220px;
}

#container_badge th,
#container_historique th,
#container_cannons th {
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
    white-space: normal;
    height: 32px;
    padding: 12px 18px;
    max-width: 220px;
}

#container_badge th:hover {
    background-color: var(--clr-bleu-clair-hover);
}

#container_badge tbody tr:nth-child(odd),
#container_historique tbody tr:nth-child(odd),
#container_cannons tbody tr:nth-child(odd) {
    background-color: #f9f9f9;
}

#search_badge input,
#search_soc input,
#search_cannons input,
#search_contrats input {
    padding: 5px;
    width: 300px;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.filter-select {
    padding: 5px;
    width: auto;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border: 1px solid #ccc;

}

main .pagination {
    position: relative;
    /* ✅ au lieu de absolute */
    bottom: unset;
    left: unset;
    transform: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    /* moins intrusif */
    width: fit-content;
    margin: 1rem auto;
    /* ✅ centrage propre sous le tableau */
}


main .pagination button {
    padding: 6px 10px;
    border: 1px solid #007bff;
    background-color: #fff;
    color: #007bff;
    cursor: pointer;
    border-radius: 4px;
    min-width: 36px;
    text-align: center;
    transition: all 0.2s;
}

main .pagination button:hover {
    background-color: #007bff;
    color: #fff;
}

main .pagination button.active {
    background-color: #007bff;
    color: #fff;
    font-weight: bold;
    border-color: #0056b3;
}

main .pagination button:disabled {
    background-color: #eee;
    color: #888;
    cursor: not-allowed;
    border-color: #ccc;
}


/* ================================== */
/* Css de l'authentification          */
/* ================================== */

.login-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Poppins', sans-serif;
    padding: 20px;
    box-sizing: border-box;
}

.login-wrapper h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 800;
    font-size: 2.5rem;
    color: #333;
}

.login-wrapper #loginForm {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.8s ease forwards;
}

.login-wrapper #loginForm label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.login-wrapper #loginForm input {
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    background: #fdfdfd;
    color: #333;
    transition: all 0.3s ease;
}

.login-wrapper #loginForm input::placeholder {
    color: #aaa;
}

.login-wrapper #loginForm input:focus {
    border-color: #007BFF;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
    outline: none;
}

.login-wrapper #loginForm button {
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(45deg, #007BFF, #0056b3);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-wrapper #loginForm button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 123, 255, 0.3);
}

#error {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #d9534f;
    text-align: center;
}

@keyframes slideIn {
    0% {
        transform: translateY(-30px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================= */
/* Autre css                     */
/* ============================= */

@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
    .modal {
        background-color: rgba(0, 0, 0, 0.8);
    }
}

button,
.boxCellule,
.popupModal,
.lib-wrapper {
    will-change: transform;
}

/* ============================================ */
/* CSS Navigation transfert                     */
/* ============================================ */

.modalTransfer {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    /* légèrement plus marqué */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
}

.modalTransferContent {
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

/* Animation apparition modal */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* NAVIGATION DYNAMIQUE */
.navTransfer {
    font-family: var(--font-base, Arial, sans-serif);
    font-size: 15px;
    color: #2c2c2c;
    line-height: 1.6;
}

.navTransfer div {
    border-radius: 6px;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* Batiments */
.batiment-line {
    font-weight: 600;
    padding: 4px;
    margin-top: 6px;
    cursor: pointer;
}

.batiment-line:hover {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.08), rgba(26, 115, 232, 0.15));
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
    transform: translateX(3px);
}

/* Etages */
.etage-line {
    font-weight: 500;
    padding: 6px 12px;
    margin-left: 18px;
    cursor: pointer;
    border-radius: 6px;
}

.etage-line:hover {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.06), rgba(26, 115, 232, 0.12));
    box-shadow: 0 1px 6px rgba(26, 115, 232, 0.12);
    transform: translateX(2px);
}

/* Cellules */
.cellule-line {
    font-weight: 400;
    padding: 6px 12px;
    margin-left: 32px;
    color: #1a73e8;
    cursor: pointer;
    position: relative;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.cellule-line:hover,
.clickable:hover {
    background: linear-gradient(90deg, rgba(26, 115, 232, 0.1), rgba(26, 115, 232, 0.15));
    transform: translateX(4px) scale(1.02);
    box-shadow: 0 2px 10px rgba(26, 115, 232, 0.15);
}

.cellule-line:active {
    background-color: rgba(26, 115, 232, 0.2);
    transform: translateX(2px) scale(0.99);
}

.cellule-line::before {
    color: #1a73e8;
    font-size: 18px;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
}

.clickable {
    color: #1a73e8;
    cursor: pointer;
}

/* Containers internes */
.etages-container,
.cellules-container {
    margin-top: 4px;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    text-align: center;
}

.modal-subtitle {
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    color: #555;
}

.modal-close {
    margin: 6px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    max-width: 100px;
}

/* ============================================ */
/* CSS Modal du transfert                       */
/* ============================================ */


.transfer-info {
    font-family: var(--font-base);
    font-size: 15px;
    color: #2c2c2c;
    line-height: 1.6;
    margin-bottom: 20px;
}

.transfer-info h3 {
    font-weight: 600;
    margin-bottom: 10px;
}

.transfer-info ul {
    padding-left: 20px;
    margin: 0;
    list-style-type: disc;
}

.transfer-info ul li {
    padding: 4px 0;
}


.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.modal-validate {
    margin: 6px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
}

/* ============================================ */
/* CSS Modal du transfert                       */
/* ============================================ */

/* --- CONTAINER PRINCIPAL --- */
[id^="container_societe"],
[id^="container_cannons"],
[id^="container_contrats"] {
    max-width: 90%;
    margin: 30px auto;
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    font-family: "Segoe UI", sans-serif;
    color: #333;
}

/* --- BARRE D'ACTIONS --- */
.action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.action-bar button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.action-bar button:hover {
    background: #0056b3;
}

/* --- BARRE DE RECHERCHE --- */
#search_soc,
#search_badge,
#search_cannons,
#search_contrats {
    display: flex;
    margin-bottom: 20px;
}

#search_soc input,
#search_badge input,
#search_cannons input,
#search_contrats input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.stock-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* --- LISTE DES SOCIÉTÉS --- */
#societe {
    margin-top: 10px;
}

.societe-item,
.cannon-item,
.contrat-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    margin-bottom: 12px;
    overflow: hidden;
    transition: background 0.2s;
}

.societe-item:hover,
.cannon-item:hover,
.contrat-item:hover {
    background: #eef5ff;
}

/* --- HEADER SOCIÉTÉ --- */
.societe-header,
.cannon-header,
.contrat-header {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #f4f7fb;
}

.societe-header strong,
.cannon-header strong,
.contrat-header strong {
    color: #007bff;
    font-size: 1.1em;
}

.societe-header .toggle-btn,
.cannon-header .toggle-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #555;
}

/* --- CONTENU DÉPLIABLE --- */
.societe-content,
.cle-content {
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid #ddd;
}

/* --- ONGLETS --- */
.tab-container {
    margin-top: 10px;
}

.tab-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.tab-buttons button {
    flex: 1;
    background: var(--clr-bleu-clair);
    border: 1px solid #ccc;
    border-radius: 5px 5px 0 0;
    padding: 8px 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-buttons button:hover {
    background: #dce3ed;
}

.tab-buttons button.active {
    background: #007bff;
    color: #fff;
    border-bottom: 1px solid #fff;
}

.tab-contents {
    border: 1px solid #ccc;
    border-radius: 0 0 5px 5px;
    padding: 12px;
    background: #fff;

    box-sizing: border-box;
}

.tab-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    word-wrap: break-word;
}

.tab {
    display: none;
}

/* --- BARRE D’ACTIONS SOUS-TABLE --- */
.sub-action-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.sub-action-bar button {
    background: #007bff;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.sub-action-bar button:hover {
    background: #0056b3;
}


.suggestions {
    border: 1px solid #ccc;
    max-height: 150px;
    overflow-y: auto;
    background: white;
    position: relative;
    z-index: 10;
}

.suggestion-item {
    padding: 5px 8px;
    cursor: pointer;
}

.suggestion-item:hover {
    background-color: #eee;
}

/* ============================================ */
/* CSS Sous tableau clé                       */
/* ============================================ */

.subtable {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin: 0;
}

.subtable th,
.subtable td {
    border: 1px solid #ccc;
    padding: 4px 6px;
    text-align: left;
    white-space: nowrap;
    /* évite de casser les colonnes */
}



/* ==== iFrame ==== */
.modal-content iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}

/* ==== Optional: Scrollbars for iframe content ==== */
.modal-content iframe::-webkit-scrollbar {
    width: 10px;
}

.modal-content iframe::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.modal-content iframe::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.05);
}

.form-row-dates {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row-dates .form-group {
    flex: 1;
    min-width: 180px;
}

hr {
    border: none;
    height: 2px;
    background: #ccc;
    margin: 20px 0;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ============================================ */
/* CSS Contrat                                  */
/* ============================================ */

.contrat-item {
    padding: 12px 18px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #ddd;
    margin-bottom: 10px;
    transition: box-shadow 0.2s ease;
}

.contrat-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.contrat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.contrat-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ececec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #666;
    font-size: 16px;
    flex-shrink: 0;
}

.contrat-text {
    display: flex;
    flex-direction: column;
}

.contrat-title {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 2px;
}

.contrat-subtitle {
    font-size: 13px;
    color: #777;
}

.contrat-checkbox {
    margin-left: auto;
    width: 20px;
    height: 20px;
    cursor: pointer;
}





/* ======================== */
/* File Browser Modal CSS   */
/* ======================== */

#fileBrowserModal .modal-form {
    min-width: 600px;
    max-width: 800px;
    width: 80%;
    max-height: 70vh;
}

#file-browser {
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 400px;
}

#file-browser .folder,
#file-browser .file {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

#file-browser .folder:hover,
#file-browser .file:hover {
    background: #f0f0f0;
}

#file-browser .folder::before,
#file-browser .file::before {
    content: none;
}

#file-browser .back-btn {
    background-color: #f9f9f9;
    font-weight: bold;
    color: #555;
}

#file-browser .file.selected {
    background: #e0e0e0;
    font-weight: 500;
}

/* ======================== */
/* Contrat Documents css    */
/* ======================== */

.contrat-documents {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.doc-item {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-color: var(--clr-bleu-clair);
    color: var(--clr-bleu-clair);
}

.doc-item.empty {
    opacity: 0.5;
    background-color: #f0f0f0;
    cursor: default;
    border-color: transparent;
}

.doc-item.empty:hover {
    transform: none;
    box-shadow: none;
    color: #888;
}

/* Specific colors for document types (optional) */
.doc-item[data-type="contrat"] {
    border-left: 4px solid #3498db;
}

.doc-item[data-type="etat_des_lieux_in"] {
    border-left: 4px solid #2ecc71;
}

.doc-item[data-type="etat_des_lieux_out"] {
    border-left: 4px solid #e74c3c;
}

.doc-item[data-type="badge"] {
    border-left: 4px solid #f1c40f;
}

.doc-item[data-type="cles"] {
    border-left: 4px solid #9b59b6;
}

/* Modal Preview */
.modal-doc-preview {
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
}

.modal-doc-preview iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #eee;
}

.modal-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.modal-doc-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-doc-actions {
    display: flex;
    gap: 10px;
}

/* ======================== */
/* Inventaire CSS           */
/* ======================== */

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-closed {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.inventory-actions {
    display: flex;
    gap: 5px;
}

.inventory-actions button {
    padding: 6px 12px;
    font-size: 14px;
}