﻿:root {
    --primary-color: #be1f43;
    --primary-color-hover: #b51217;
    --sidebar-bg: #f1f1f1;
    --sidebar-color: #6c757d;
    --sidebar-width: 70px;
    --sidebar-width-expanded: 220px;
}

/* GLOBAL */
html, body {
    font-size: 14px;
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y:hidden;
}
body {
    position: relative;
    margin-bottom: 60px;
}

.d-flex {
    display: flex;
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width-expanded);
    flex-grow: 1;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
}
    .main-content table,
    .main-content form,
    .main-content .table-responsive {
        width: 100% !important;
        max-width: 100%;
    }

/* SIDEBAR FIXE */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width-expanded);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 0.5rem;
    z-index: 1000;
    transition: transform 0.3s ease;
}
    .sidebar .logo {
        width: 100%;
        text-align: center;
        margin-bottom: 1rem;
    }
        .sidebar .logo img {
            max-height: 80px;
            max-width: 90%;
        }

    .sidebar .nav-link {
        display: flex;
        align-items: center;
        gap: 1rem;
        width: 100%;
        padding: 0.75rem 1rem;
        color: var(--sidebar-color);
        font-weight: 500;
        border-radius: 0.25rem;
        text-decoration: none;
    }

        .sidebar .nav-link i {
            font-size: 1.3rem;
            min-width: 25px;
            text-align: center;
        }

        .sidebar .nav-link span {
            white-space: nowrap;
        }

        .sidebar .nav-link:hover {
            background-color: #e0e0e0;
            color: var(--primary-color-hover);
        }

        .sidebar .nav-link.selected {
            background-color: var(--primary-color-hover);
            color: white;
        }

/* ajuster la table pour les petits écrans */
.table-responsive {
    overflow-x: auto;
}
.card-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* Formulaire boutons sur desktop */
form.desktop-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap; /* tout sur une ligne */
    justify-content: flex-start;
    width: 100%;
}

    form.desktop-buttons .btn {
        white-space: nowrap; /* texte complet visible */
        flex: 1 1 auto; /* boutons proportionnels */
        min-width: 0; /* empêche débordement */
        box-sizing: border-box;
        overflow: hidden;
    }


/* FOOTER */
.footer {
    background: #f1f1f1;
    color: #6c757d;
    font-size: 0.85rem;
    border-top: 1px solid #e0e0e0;
    padding: 0.5rem 1rem;
    margin-left: var(--sidebar-width-expanded); /* aligné avec le contenu */
    margin-top: auto; /* colle le footer en bas */
}

/* MOBILE */
@media (max-width: 992px) {
    .sidebar {
        width: var(--sidebar-width-expanded);
        transform: translateX(-100%);
        z-index: 1050;
    }

        .sidebar.expanded {
            transform: translateX(0);
        }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    .hamburger {
        display: inline-block;
        background: none;
        border: none;
        font-size: 1.4rem;
        margin: 0.5rem;
    }

    .footer {
        margin-left: 0 !important;
        width: 100%;
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

        .overlay.active {
            display: block;
        }

    form.desktop-buttons {
        flex-wrap: wrap; /* les boutons peuvent passer à la ligne */
        justify-content: flex-start;
        margin-bottom: 0.25rem;
    }

        form.desktop-buttons .btn {
            flex: 1 1 100%; /* prend toute la largeur */
            min-width: 0;
        }
}

/* DESKTOP : cacher overlay */
@media (min-width: 993px) {
    .overlay {
        display: none !important;
    }
}

.table-vitesses {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.9rem;
}
    .table-vitesses th,
    .table-vitesses td {
        border: 1px solid #ccc;
        padding: 4px;
    }

        .table-vitesses th.groupe-P,
        .table-vitesses th.groupe-M,
        .table-vitesses th.groupe-K,
        .table-vitesses th.groupe-N,
        .table-vitesses th.groupe-S,
        .table-vitesses th.groupe-H {
            font-weight: bold;
        }

        .table-vitesses td.groupe-P,
        .table-vitesses td.groupe-M,
        .table-vitesses td.groupe-K,
        .table-vitesses td.groupe-N,
        .table-vitesses td.groupe-S,
        .table-vitesses td.groupe-H {
            font-weight: bold;
        }

    .table-vitesses .header-main {
        background-color: #bfbfbf;
        font-size: 0.9rem;
    }

/* --- Édition inline --- */
.editable, .editable-vitesse {
    cursor: text;
    transition: outline 0.2s;
}

    .editable.editing, .editable-vitesse.editing {
        outline: 2px solid #ffc107; /* jaune pendant édition */
    }

    .editable.success, .editable-vitesse.success {
        outline: 2px solid #28a745; /* vert quand succès */
    }

    .editable.error, .editable-vitesse.error {
        outline: 2px solid #dc3545; /* rouge si erreur */
    }

th small, label small {
    font-size: 0.75em;
}


.sticky-header th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
}

.table-scroll th:hover {
    background-color: #e9ecef;
}

.table-scroll {
    position: relative;
    display: block;
    width: 100%;
    overflow-x: auto; 
    overflow-y: auto; 
    max-height: 85vh; 
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
    .table-scroll table {
        border-collapse: separate;
        /* min-width: max-content;*/    
    }

    .table-scroll::-webkit-scrollbar {
        height: 8px;
        width: 8px;
    }
        .table-scroll::-webkit-scrollbar-thumb {
            background: #c1c1c1;
            border-radius: 4px;
        }
            .table-scroll::-webkit-scrollbar-thumb:hover {
                background: #a1a1a1;
            }

    .table-scroll thead.sticky-header th {
        position: sticky;
        top: 0;
        z-index: 1000; 
        background-color: #f8f9fa;
        box-shadow: 0 2px 2px rgba(0,0,0,0.08);
    }
        .table-scroll thead.sticky-header th[class^="groupe-"],
        .table-scroll thead.sticky-header th[class*=" groupe-"] {
            background-color: inherit; 
            color: inherit;
            z-index: 1010;
        }

        .table-scroll thead.sticky-header th.groupe-P,
        .table-scroll tbody td.groupe-P {
            background-color: #0070c0 !important;
            color: #fff !important;
        }

        .table-scroll thead.sticky-header th.groupe-M,
        .table-scroll tbody td.groupe-M {
            background-color: #ffff00 !important;
            color: #000 !important;
        }

        .table-scroll thead.sticky-header th.groupe-K,
        .table-scroll tbody td.groupe-K {
            background-color: #c00000 !important;
            color: #fff !important;
        }

        .table-scroll thead.sticky-header th.groupe-N,
        .table-scroll tbody td.groupe-N {
            background-color: #00b050 !important;
            color: #fff !important;
        }

        .table-scroll thead.sticky-header th.groupe-S,
        .table-scroll tbody td.groupe-S {
            background-color: #bf9000 !important;
            color: #fff !important;
        }

        .table-scroll thead.sticky-header th.groupe-H,
        .table-scroll tbody td.groupe-H {
            background-color: #7f7f7f !important;
            color: #fff !important;
        }

    .table-scroll tbody td[class^="groupe-"],
    .table-scroll tbody td[class*=" groupe-"] {
        position: relative;
        z-index: 2;
    }

    .table-scroll thead.sticky-header th {
        z-index: 1000;
    }

    .table-scroll .table-striped tbody tr td,
    .table-scroll .table-hover tbody tr td {
        background-clip: padding-box;
    }

    .table-scroll thead.sticky-header th:not([class*="groupe-"]) {
        background-color: #d9d9d9; /* gris clair */
    }

.highlight-transform * {
    outline: 1px dashed rgba(255,0,0,0.2);
}


.btn-outline-secondary {
    border: 2px solid #b51217;
}

    .btn-outline-secondary:hover {
        background-color: #e8e8e8;
        color: #000;
        border-color: #b5b5b5;
    }

@media (max-width: 768px) {
    .btn-outline-secondary {
        width: 100%;
    }
    
    #step3 .step-left,
    #step3 .step-right {
        flex: 0 0 100%;
    }

    .label-cond {
        text-align: left;
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 768px) {
.save-modal
    {
        width: 95% !important;
    }
}
@media (min-width: 1200px) {
.save-modal {
        max-width: 1000px !important;
    }
}

input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus,
button.btn:focus {
    border-color: #b51217;
    box-shadow: 0 0 4px rgba(181, 18, 23, 0.3);
    outline: none;
}

.hint-text {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
    margin-top: 6px;
}
