:root {
    --roboto-family: "Roboto", sans-serif;
    --montserrat-family: "Montserrat", sans-serif;
    --bolder: 700;
    --smaller: 300;
    --normal: 500;
    --primary: #007DC5;
    --primary-light: #CCE5F3;
    --secondary: #F05A24;
    --warning: #f7954b;
    --danger: #bf1829;
    --success: #00acab;
    --box-shadow: 0 1px 2px 0 rgb(60 64 67 / 30%), 0 1px 3px 1px rgb(60 64 67 / 15%);
    --box-shadow-hover: 0 2px 4px 0 rgb(60 64 67 / 30%), 0 2px 6px 2px rgb(60 64 67 / 15%);
    --border-radius: 3px;
    --border: 1px solid var(--gray-light);
    --color: #636466;
    --color-dark: #444;
    --color-primary: whitesmoke;
    --gray-light: #ddd;
    --gray: #636466;
    --gray-dark: #444;
    --size-small: 14px;
    --size-regular: 16px;
    --size-large: 22px;
}

button,
a {
    all: unset;
}

a {
    cursor: pointer;
}

button {
    border: 2px solid var(--grey);
    border-radius: 5px;
    padding: 0.2em 0.4em;
    cursor: pointer;
}

.btnSuccess {
    background-color: var(--success);
    border-color: var(--success);
    color: white;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.btnSuccess:hover {
    background-color: white;
    color: var(--success);
}

.btnValid {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.btnError {
    background-color: var(--danger);
    border-color: var(--danger);
    color: white;
    transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.btnError:hover {
    background-color: white;
    color: var(--danger);
}

.btnValid:hover {
    background-color: white;
    color: var(--primary);
}

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    min-height: 100vh;
    max-width: 100vw;
    font-family: var(--montserrat-family);
    font-weight: var(--normal);
    font-size: var(--size-regular);
    color: var(--grey);
}

h1,
h2,
h3,
h4,
h5 {
    font-family: var(--roboto-family);
    font-weight: var(--bolder);
    font-size: var(--size-large);
    color: var(--primary);
    text-transform: capitalize;
}

.btnAdd {
    position: absolute;
    right: 2em;
    bottom: 2em;
    padding: 1em;
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 50%;
    color: white;
    box-shadow: var(--box-shadow);
}

.btnAdd:hover {
    box-shadow: var(--box-shadow-hover);
}

/* navbar */
nav {
    max-width: 100%;
    background-color: var(--secondary);
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    display: inline-flex;
    align-items: center;
}

.nav-logo img {
    border-radius: 5px;
}

.nav-logo a {
    margin-left: 0.5em;
    text-transform: capitalize;
}

#btnMenu {
    border-color: white;
    border: 2px solid white;
    border-radius: 5px;
    padding: 0.2em 0.5em;
}

#btnMenu:hover {
    color: var(--primary);
    border-color: var(--primary);
}

#menu {
    position: absolute;
    height: 85vh;
    width: 30%;
    display: flex;
    flex-direction: column;
    background-color: var(--secondary);
    color: white;
    justify-content: start;
    align-items: end;
    padding-top: 2em;
    transform: scaleX(0);
    transform-origin: left;
    transition: all ease-in-out 0.4s;
    z-index: 5;
}

.open {
    transform: scaleX(1) !important;
}

.link {
    margin-bottom: 0.5em;
    margin-right: 1em;
}

.link:hover {
    color: var(--primary);
}

.active {
    color: var(--primary);
    font-weight: var(--bolder);
}

/* layout */
main {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1em;
    max-width: 600px;
    margin-inline: auto;
    margin-top: 1em;
    padding: 1em;
}

main h1 {
    text-align: center;
    font-size: 30px;
}

/** modal **/

/* The Modal (background) */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    /* Stay in place */
    z-index: 1;
    /* Sit on top */
    padding-top: 10%;
    /* Location of the box */
    left: 0;
    top: 0;
    width: 100%;
    /* Full width */
    height: 100%;
    /* Full height */
    overflow: auto;
    /* Enable scroll if needed */
    background-color: rgb(0, 0, 0);
    /* Fallback color */
    background-color: rgba(0, 0, 0, 0.4);
    /* Black w/ opacity */
}

/* Modal Content */
.modal-content {
    position: relative;
    background-color: #fefefe;
    border-radius: 5px;
    margin: auto;
    padding: 0;
    border: 1px solid #888;
    width: 80%;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    -webkit-animation-name: animatetop;
    -webkit-animation-duration: 0.4s;
    animation-name: animatetop;
    animation-duration: 0.4s
}

/* Add Animation */
@-webkit-keyframes animatetop {
    from {
        top: -300px;
        opacity: 0
    }

    to {
        top: 0;
        opacity: 1
    }
}

@keyframes animatetop {
    from {
        top: -300px;
        opacity: 0
    }

    to {
        top: 0;
        opacity: 1
    }
}

/* The Close Button */
.close {
    color: var(--grey);
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: var(--secondary);
    text-decoration: none;
    cursor: pointer;
}

.modal-header {
    padding-inline: 2rem;
}

.modal-body {
    padding: 1rem 2rem;
}

.modal-footer {
    padding-inline: 2rem;
}

/** formulaire **/

form {
    display: flex;
    flex-direction: column;
    gap: 1em;
    justify-content: center;
}

input,
select {
    padding: 0.5em;
    border-radius: 5px;
    border: 1px solid var(--gray);
    background-color: white;
}

input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: 2px solid var(--primary) !important;
    background-color: lightgray;
}


/** flash message **/
.flash-message {
    padding: 10px;
    margin-top: 20px;
    border-radius: 5px;
    font-size: var(--size-large);
    font-weight: var(--bolder);
    width: 80%;
    margin-inline: auto;
}

.error {
    text-align: center;
    background-color: var(--danger);
    color: white;
}

.success {
    text-align: center;
    background-color: var(--success);
    color: white;
}

.warning {
    text-align: center;
    background-color: var(--warning);
    color: white;
}

.bg-primary {
    text-align: center;
    background-color: var(--primary);
    color: white;
}

.bg-primary-light {
    text-align: center;
    background-color: var(--primary-light);
    color: var(--primary);
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--secondary);
}

.text-error {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

/* Card */
.card-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.card {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 1rem;
    width: 250px;
    box-shadow: var(--box-shadow);
    background: white;
}

.card img {
    width: 100%;
    height: auto;
    border-radius: 5px 5px 0 0;
    object-fit: cover;
    margin-bottom: 0.5rem;
}

.card h3 {
    margin: 0 0 0.5rem;
}

.card p {
    margin: 0.25rem 0;
}

.card-contact {
    background-color: var(--primary-light);
    padding: 0.75rem;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: var(--size-small);
    color: var(--color-dark);
    margin-top: 1rem;
}

.card-contact i {
    margin-right: 0.5rem;
    color: var(--primary);
}

.contact-name {
    font-weight: var(--bolder);
    display: flex;
    align-items: center;
}

.contact-link {
    text-decoration: none;
    color: var(--gray-dark);
    display: flex;
    align-items: center;
    transition: color 0.2s ease-in-out;
}

.contact-link:hover {
    color: var(--secondary);
}

.card-footer {
    margin-top: 1rem;
    text-align: right;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: var(--bolder);
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.btn-link i {
    transition: transform 0.2s ease-in-out;
}

.btn-link:hover {
    color: var(--secondary);
}

.btn-link:hover i {
    transform: translateX(3px);
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--gray-light);
}

.file-item .contact-link {
    flex: 1;
    color: var(--primary);
    text-decoration: underline;
    word-break: break-word;
}

.file-item .delete-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--danger);
    padding: 0;
}

.file-item .contact-link:hover {
    color: var(--secondary);
}

/* Spinner stylé */
.loader {
    display: none;
    border: 6px solid var(--primary-light);
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* contract */
.contract {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
}

/* checkbox template */

.checkbox {
    display: none;
}

.labCheckbox {
    display: inline-block;
    position: relative;
    cursor: pointer;
    height: 2rem;
    width: 4rem;
    border-radius: 1rem;
    background-color: var(--secondary);
    transition: all 0.3s ease-in-out;
}

.labCheckbox::after {
    content: "";
    position: absolute;
    text-align: center;
    font-size: small;
    top: 0.25rem;
    left: 0.25rem;
    height: 1.5rem;
    width: 1.5rem;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease-in-out;
}

.checkbox:checked+.labCheckbox::after {
    content: "";
    transform: translateX(2rem);
}

.checkbox:checked+.labCheckbox {
    background-color: var(--primary);
}

.center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
}

button:disabled {
    background-color: var(--gray-light);
    cursor: not-allowed;
}

.stock-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stock-item {
    border-bottom: 1px solid var(--primary-light);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f9f9f9;
    border: none;
    width: 100%;
    color: var(--primary);
    background-color: var(--primary-light);
}

.accordion-toggle {
    font-size: 1rem;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    flex-grow: 1;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.accordion-header:hover {
    background: var(--gray-light);
}

/* Accordion smooth */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease;
    background: #fff;
    padding: 0 1rem;
    /* Only sides at start */
    font-size: 0.9rem;
}

.accordion-content.open {
    padding: 1rem;
}

.list {
    position: relative;
    margin: 0;
    padding: 0;
    z-index: 5;
}

.list li {
    list-style: none;
    cursor: pointer;
    padding: 0 0 0 0.5em;
    margin-bottom: 0.2em;
}

.list li:hover {
    background-color: var(--primary-light);
}

.table-container {
    background: #fff;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 576px;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f0f0f0;
    font-weight: var(--bolder);
}

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

.inline {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.table-scroll-vertical {
    max-height: 400px;
    /* ou 300px pour ~5 lignes selon la hauteur des lignes */
    overflow-y: auto;
    overflow-x: auto;
}

/* Combine bien les deux overflow */
.table-wrapper {
    overflow-x: auto;
}

.footer-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--secondary);
    border-top: 1px solid var(--gray-light);
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.8rem 1rem;
    z-index: 1000;
}

.footer-buttons button {
    font-size: var(--size-regular);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.id-livraison {
    font-weight: var(--bolder);
    color: var(--primary);
    cursor: pointer;
}

.id-livraison:hover {
    color: var(--secondary);
}

.intervention-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 5px;
    box-shadow: var(--box-shadow);
    background-color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.intervention-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.intervention-header span {
    padding: 0.1rem 0.5rem;
    border-radius: 5px;
    margin-right: 0.5rem;
    font-size: var(--size-small);
}

.intervention-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* exactement 3 colonnes */
    gap: 0.5rem;
    background-color: white;
    padding: 0.5rem;
    border-radius: 5px;
    width: 100%;
    font-size: var(--size-small);
    /* Centrage horizontal et vertical */
    place-items: center;
}

.intStatut:hover {
    cursor: pointer;
    background-color: var(--primary-light);
    color: var(--primary);
}

.statut-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.radioStatut {
    display: none;
}

.statut-label {
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    color: white;
    font-weight: bold;
    font-family: var(--montserrat-family);
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    box-shadow: var(--box-shadow);
    -webkit-user-select: none;
    user-select: none;
}

.attente {
    background-color: var(--danger);
}

.encours {
    background-color: var(--warning);
}

.terminee {
    background-color: var(--success);
}

.radioStatut:checked+.statut-label {
    box-shadow: var(--box-shadow-hover);
    transform: scale(1.05);
    border: 2px solid white;
}

.intervention-container {
    max-height: 500px;
    /* tu peux ajuster cette valeur */
    overflow-y: auto;
    margin: 0.5rem auto;
    padding-right: 0.5rem;
    /* pour ne pas couper les éléments au bord */
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--primary-light);
}

/* Webkit scrollbar styles for Chrome, Safari, Edge, Opera */
.intervention-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.intervention-container::-webkit-scrollbar-track {
    background: var(--primary-light);
    border-radius: 4px;
}

.intervention-container::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.checkbox-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.icon-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--primary-light);
    border: 2px solid transparent;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    color: var(--primary);
    font-size: var(--size-small);
}

.checkbox-item i {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.checkbox-item input:checked+.icon-box {
    border-color: var(--primary);
    background-color: var(--primary);
    color: white;
}

.detailList {
    list-style: none;
    padding: 0.2rem;
    border-radius: var(--border-radius);
    font-style: italic;
}