/* ============================= */
/*   COMPONENTS / DECORATIONS    */
/* ============================= */




/* ============================= */
/*             SIDEBARS          */
/* ============================= */

.sidebar_left {
    background: #354A35;
    padding: 20px;
    display: flex;
    flex-direction: column;
    color: white;
}

/* Mobile standard */
@media (max-width: 399px) {
    .sidebar_left {
        position: fixed;
        background: white;
        border-radius: 2vw;
        box-shadow: 0 0 4vw rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        opacity: 0.97;
        z-index: 1000;

        top: calc(0.3vh + 0.2vh + var(--topBarHeight) * 2);
        min-height: 30vh;
        max-height: 95vh;
        overflow-y: auto;
        width: var(--sidebar_left_Width);
        /* pour gauche par défaut */
        transform: translateX(calc(-100% - 2vw));
    }
}

/* Mobile large / Phablet */
@media (min-width: 400px) and (max-width: 599px) {
    .sidebar_left {
        position: fixed;
        background: white;
        border-radius: 2vw;
        box-shadow: 0 0 4vw rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        opacity: 0.97;
        z-index: 1000;
        top: calc(0.3vh + 0.2vh + var(--topBarHeight) * 2);
        min-height: 30vh;
        max-height: 95vh;
        overflow-y: auto;
        width: var(--sidebar_left_Width);
        /* pour gauche par défaut */
        transform: translateX(calc(-100% - 2vw));
    }
}

/* Tablette portrait */
@media (min-width: 600px) and (max-width: 899px) {
    .sidebar_left {
        position: fixed;
        background: white;
        border-radius: 2vw;
        box-shadow: 0 0 4vw rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        opacity: 0.97;
        z-index: 1000;

        top: calc(0.3vh + 0.2vh + var(--topBarHeight) * 2);
        min-height: 30vh;
        max-height: 95vh;
        overflow-y: auto;
        width: var(--sidebar_left_Width);
        /* pour gauche par défaut */
        transform: translateX(calc(-100% - 2vw));
    }
}

/* Desktop */
@media (min-width: 1200px) {
    .sidebar_left {}
}

/* Dark Mode automatique, changeable via bouton thème */
html.dark_mode .sidebar_left {}

.sidebar_right {
    background: #84A7c3;
    padding: 20px;
    display: flex;
    flex-direction: column;
    color: rgb(255, 255, 255);
}

/* Mobile standard */
@media (max-width: 399px) {
    .sidebar_right {
        position: fixed;
        background: white;
        border-radius: 2vw;
        box-shadow: 0 0 4vw rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        opacity: 0.97;
        z-index: 1000;

        top: calc(0.3vh + 0.2vh + var(--topBarHeight) * 2);
        min-height: 30vh;
        max-height: 95vh;
        overflow-y: auto;
        width: var(--sidebar_left_Width);
        /* pour gauche par défaut */
        transform: translateX(calc(-100% - 2vw));

                width: var(--sidebar_right_Width);
        left: auto;
        right: 2vw;
        transform: translateX(calc(100% + 2vw));
    }
}

/* Mobile large / Phablet */
@media (min-width: 400px) and (max-width: 599px) {
    .sidebar_right {
        position: fixed;
        background: white;
        border-radius: 2vw;
        box-shadow: 0 0 4vw rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        opacity: 0.97;
        z-index: 1000;

        top: calc(0.3vh + 0.2vh + var(--topBarHeight) * 2);
        min-height: 30vh;
        max-height: 95vh;
        overflow-y: auto;
        width: var(--sidebar_left_Width);
        /* pour gauche par défaut */
        transform: translateX(calc(-100% - 2vw));

                width: var(--sidebar_right_Width);
        left: auto;
        right: 2vw;
        transform: translateX(calc(100% + 2vw));
    }
}

/* Tablette portrait */
@media (min-width: 600px) and (max-width: 899px) {
    .sidebar_right {
        position: fixed;
        background: white;
        border-radius: 2vw;
        box-shadow: 0 0 4vw rgba(0, 0, 0, 0.2);
        transition: transform 0.3s ease;
        opacity: 0.97;
        z-index: 1000;

        top: calc(0.3vh + 0.2vh + var(--topBarHeight) * 2);
        min-height: 30vh;
        max-height: 95vh;
        overflow-y: auto;
        width: var(--sidebar_left_Width);
        /* pour gauche par défaut */
        transform: translateX(calc(-100% - 2vw));

                width: var(--sidebar_right_Width);
        left: auto;
        right: 2vw;
        transform: translateX(calc(100% + 2vw));
    }
}

/* Desktop */
@media (min-width: 1200px) {
    .sidebar_lesidebar_rightft {}
}

/* Dark Mode automatique, changeable via bouton thème */
html.dark_mode .sidebar_right {}

.article_on_sidebar_left {
    margin-bottom: 15px;
    padding: 10px;
    background: #513030;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ============================= */
/*           MAIN CONTENT        */
/* ============================= */


.main_content h2 {
    margin-top: 30px;
    margin-bottom: 10px;
    color: #333;
    text-align: left;
}

.main_content pre {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    color: #333;
    white-space: pre-wrap;
}

/* ============================= */
/*        FORM & CONTAINERS      */
/* ============================= */

.db_container,
.login_container {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
    text-align: center;
    margin-top: 50px;
    transition: background 0.3s ease, color 0.3s ease;
    color: black;
}

.db_container ul {
    list-style: none;
    padding: 0;
}

.db_container h2,
.login_container h2 {
    margin-bottom: 25px;
}

/* Inputs */
.login_form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* Buttons */
.login_form button,
.db_container .action_buttons button {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: none;
    background: #4CAF50;
    color: white;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

/* Bouton Changer le mot de passe */
#changePasswordBtn {
    width: auto;
    padding: 12px 24px;
    margin: 10px auto;
    border: 1px solid #4CAF50;
    background: #b4890a;
    color: #333;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

#changePasswordBtn:hover {
    background: #4CAF50;
    color: white;
}

html.dark_mode #changePasswordBtn {
    border-color: #a36b03;
    background: #867b02;
    color: #feffff;
}

html.dark_mode #changePasswordBtn:hover {
    background: #66bb6a;
    color: #000;
}

/* Bouton Déconnecter */
.logout_button {
    display: inline-block;
    padding: 12px 24px;
    border: 1px solid #d9534f;
    background: #ffeaea;
    color: #d9534f;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.logout_button:hover {
    background: #d9534f;
    color: white;
}

html.dark_mode .logout_button {
    border-color: #ff7676;
    background: #3a1f1f;
    color: #ff7676;
}

html.dark_mode .logout_button:hover {
    background: #ff7676;
    color: #000;
}

/* ============================= */
/*        THEME TOGGLE BTN       */
/* ============================= */

.theme_toggle {
    padding: 8px 15px;
    background: #222;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* ============================= */
/*        BOUTON PROFIL     */
/* ============================= */

/*  ---- DESKTOP ----- */
@media (min-width: 769px) {
    .profil_button {
        display: flex;
        /* centre le texte */
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        white-space: nowrap;
        /* empêche le texte de sauter à la ligne */
        transition:
            transform 0.15s ease,
            box-shadow 0.2s ease;
        /* Transition fluide */
    }

    /* Effet au survol */
    .profil_button:hover {
        transform: translateY(-2px);
        /* le bouton "monte" légèrement */
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    }

    /* Effet lors du clic */
    .profil_button:active {
        transform: translateY(0);
        /* revient à plat */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    }
}

/*  ---- MOBILE  ----- */
@media (max-width: 768px) {
    .profil_button {
        background: transparent;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        white-space: nowrap;
        /* empêche le texte de sauter à la ligne */
    }
}

/* ============================= */
/*        BOUTON GROUPE         */
/* ============================= */

/*  ---- DESKTOP ----- */
@media (min-width: 769px) {
    .groupe_choose_button {
        display: flex;
        /* centre le texte */
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        padding: 8px 16px;
        color: white;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
        /* empêche le texte de sauter à la ligne */
        transition:
            transform 0.15s ease,
            box-shadow 0.2s ease,
            background 0.2s ease;
        /* Transition fluide */
    }

    /* Effet au survol */
    .groupe_choose_button:hover {
        transform: translateY(-2px);
        /* le bouton "monte" légèrement */
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        background: rgba(255, 255, 255, 0.15);
    }

    /* Effet lors du clic */
    .groupe_choose_button:active {
        transform: translateY(0);
        /* revient à plat */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
        background: rgba(255, 255, 255, 0.2);
    }
}

/*  ---- MOBILE  ----- */
@media (max-width: 768px) {
    .groupe_choose_button {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px;
        padding: 6px 12px;
        color: white;
        text-decoration: none;
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
        /* empêche le texte de sauter à la ligne */
    }
}

/* ============================= */
/*        BARRE DE RECHERCHE     */
/* ============================= */

.search_bar_container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 100%;
}

.search_icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.search_bar {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    color: #333;
}



/* ============================= */
/*    IMAGE DE PRÉSENTATION      */
/* ============================= */
.image_de_présentation {
    width: 50%;
    height: auto;
    object-fit: contain;
    display: block;
}



/* ============================= */
/*      SECTION PROFIL          */
/* ============================= */
.profile_section {
    width: 100%;
    max-width: 520px;
}

.profile_section form label {
    color: #333;
}

/* Dark Mode automatique, changeable via bouton thème */
html.dark_mode .profile_section form label {
    color: #e0e0e0;
}

/* Inputs readonly */
input[readonly] {
    background-color: #cbcbcb !important;
    color: #131313 !important;
    cursor: not-allowed !important;
}

html.dark_mode input[readonly] {
    background-color: #a5a5a5 !important;
    color: #000000 !important;
}

/* Inputs readonly */
.login_form input[readonly] {
    background-color: #f0f0f0;
    color: #999;
    cursor: not-allowed;
}

html.dark_mode .login_form input[readonly] {
    background-color: #2a2a2a;
    color: #666;
}



/* Mobile standard */
@media (max-width: 399px) {
    .profile_section {
     
    }
}

/* Mobile large / Phablet */
@media (min-width: 400px) and (max-width: 599px) {
    .profile_section {

    }
}

/* Tablette portrait */
@media (min-width: 600px) and (max-width: 899px) {
    .profile_section {
       
    }
}

/* Desktop */
@media (min-width: 1200px) {
    .profile_section {}
}

/* Dark Mode automatique, changeable via bouton thème */
html.dark_mode .profile_section {

}

/* ============================= */
/*    MODAL CHANGER MOT PASSE    */
/* ============================= */
.password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.password-modal.show {
    display: flex;
}

.password-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    position: relative;
    margin: auto;
    box-sizing: border-box;
}

.password-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.password-modal-close:hover {
    color: #333;
}

.password-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.password-modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    box-sizing: border-box;
}

.password-modal-content button {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.password-modal-content button:hover {
    background: #45a049;
}

html.dark_mode .password-modal {
    background-color: rgba(0, 0, 0, 0.7);
}

html.dark_mode .password-modal-content {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

html.dark_mode .password-modal-content h3 {
    color: #e0e0e0;
}

html.dark_mode .password-modal-content input {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
}

/* ============================= */
/*         GROUP PROFILE         */
/* ============================= */

.group-info-display {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.group-info-display .group-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.group-info-display .group-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.group-info-display .group-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 20px;
}

.group-info-text h4 {
    margin: 0;
}

.group-info-text small {
    color: #666;
}

.group-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 14px;
}

/* Styles pour forcer le texte noir en mode sombre */
@media (prefers-color-scheme: dark) {
    .group-info-display {
        color: #000 !important;
    }
    .group-info-display * {
        color: #000 !important;
    }
    .group-info-text h4 {
        color: #000 !important;
    }
    .group-info-text small {
        color: #333 !important;
    }
    .group-details-grid div {
        color: #000 !important;
    }
    .group-details-grid strong {
        color: #000 !important;
    }
}

/* ============================= */
/*         ERROR MESSAGES        */
/* ============================= */

.error-message {
    color: #d32f2f;
    background: #ffebee;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

/* ============================= */
/*         FOOTER LINKS          */
/* ============================= */

.footer-links {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

/* ============================= */
/*        GROUP USERS TABLE      */
/* ============================= */

.group-users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-family: inherit;
}

.group-users-table th,
.group-users-table td {
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #ddd;
}

.group-users-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ccc;
}

.group-users-table tbody tr:hover {
    background-color: #f5f5f5;
}

.group-users-section h4 {
    margin-bottom: 10px;
    color: #333;
}

/* Assurer que la page s'étend correctement pour le tableau */
body {
    min-height: 100vh !important;
    height: auto !important;
}

html {
    height: auto !important;
}

/* Réduire la largeur des champs du formulaire de groupe */
.group-form #groupe_name,
.group-form #image,
.group-form #code_postal {
    max-width: 300px;
    width: 100%;
}

/* Réduire la largeur des champs du formulaire utilisateur */
.login-form #prenom,
.login-form #nom,
.login-form #email,
.login-form #groupe {
    max-width: 300px;
    width: 100%;
}

/* Style du bouton Enregistrer pour le formulaire de groupe */
.login-form.group-form #saveGroupBtn {
    background: #A0442C !important;
    background-image: none !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    width: auto !important;
    max-width: 200px !important;
    margin: 0 auto !important;
    display: block !important;
}

.login-form.group-form #saveGroupBtn:hover {
    background: #8B3A24 !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.login-form.group-form #saveGroupBtn:disabled {
    background: #999 !important;
    background-image: none !important;
    cursor: not-allowed !important;
}

/* Style du bouton Enregistrer pour le formulaire utilisateur */
.login-form #saveBtn {
    background: #A0442C !important;
    background-image: none !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    width: auto !important;
    max-width: 200px !important;
    margin: 0 auto !important;
    display: block !important;
}

.login-form #saveBtn:hover {
    background: #8B3A24 !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.login-form #saveBtn:disabled {
    background: #999 !important;
    background-image: none !important;
    cursor: not-allowed !important;
}

/* ============================= */
/*    FORMULAIRE NOUVEL ITEM     */
/* ============================= */

/* Affichage des informations du groupe en haut du formulaire */
.group-info-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 25px;
    color: #333;
}

.group-info-display p {
    margin: 5px 0;
    font-size: 14px;
}

/* Styles du formulaire de nouvel item */
.new-item-form {
    max-width: 600px;
    margin: 0 auto;
}

.new-item-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.new-item-form input,
.new-item-form select,
.new-item-form textarea {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.new-item-form input:focus,
.new-item-form select:focus,
.new-item-form textarea:focus {
    border-color: #A0442C;
    outline: none;
    box-shadow: 0 0 0 2px rgba(160, 68, 44, 0.1);
}

.new-item-form textarea {
    resize: vertical;
    min-height: 80px;
}

.new-item-form select {
    background-color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 40px;
}

.new-item-form input[disabled],
.new-item-form select[disabled],
.new-item-form textarea[disabled] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Bouton de création d'item */
.new-item-form #createItemBtn {
    background: #A0442C !important;
    background-image: none !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 4px !important;
    font-size: 16px !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    width: auto !important;
    max-width: 200px !important;
    margin: 20px auto 0 auto !important;
    display: block !important;
}

.new-item-form #createItemBtn:hover {
    background: #8B3A24 !important;
    background-image: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.new-item-form #createItemBtn:disabled {
    background: #999 !important;
    background-image: none !important;
    cursor: not-allowed !important;
}

/* Messages de succès et d'erreur */
.new-item-form #createItemMessage {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
}

.new-item-form #createItemMessage.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.new-item-form #createItemMessage.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Mode sombre pour le formulaire nouvel item */
html.dark_mode .group-info-display {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

html.dark_mode .new-item-form label {
    color: #e0e0e0;
}

html.dark_mode .new-item-form input,
html.dark_mode .new-item-form select,
html.dark_mode .new-item-form textarea {
    background: #2d2d2d;
    border-color: #555;
    color: #e0e0e0;
}

html.dark_mode .new-item-form input:focus,
html.dark_mode .new-item-form select:focus,
html.dark_mode .new-item-form textarea:focus {
    border-color: #A0442C;
    box-shadow: 0 0 0 2px rgba(160, 68, 44, 0.2);
}

html.dark_mode .new-item-form #createItemMessage.success {
    background: #1e4b26;
    color: #a3d9a5;
    border-color: #2d5a32;
}

html.dark_mode .new-item-form #createItemMessage.error {
    background: #4b1e1e;
    color: #f5a5a5;
    border-color: #5a2d2d;
}
