/* ========================== */
/*        STYLES GÉNÉRAUX     */
/* ========================== */

html,
body {
    box-sizing: border-box;
    width: 100%;
    position: fixed;
    background: linear-gradient(135deg, #1e2a38, #2c3e50);
}

body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* ========================== */
/*       CONTAINER PRINCIPAL  */
/* ========================== */

.container {
    overflow: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: rgb(147, 141, 141);

    border-radius: 10px;
    box-sizing: border-box;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 100%;
    height: 100dvh;
    max-width: 65%;
    margin: auto;
}

h2 {
    color: #2c3e50;

}

/* ========================== */
/*       FORMULAIRE AJOUT     */
/* ========================== */

#auth-form,
#product-form {
    display: flex;
    flex-direction: column;
    width: 100%;
}

#product-section {
    padding-bottom: 20px;
}

input,
.styled-select {
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;

}


/* ========================== */
/*       BOUTONS GÉNÉRAUX     */
/* ========================== */

button {
    background: #1e2a38;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
    width: 100%;
}

button:hover {
    background: #2c3e50;
}

.hidden {
    display: none;
}

/* ========================== */
/*       BOUTON DÉCONNEXION   */
/* ========================== */

#logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#logout-btn:hover {
    background: #c0392b;
}

/* ========================== */
/*       BOUTON AJOUTER       */
/* ========================== */

#add-product-btn {
    background: #0dc03a;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#add-product-btn:hover {
    background: #087b40;
}

/* ========================== */
/*       BOUTON VOIR LISTE    */
/* ========================== */

#view-list-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#view-list-btn:hover {
    background: #2980b9;
}


/* ========================== */
/*       SECTION LISTE        */
/* ========================== */


#list-section ul {
    list-style: none;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 350px;
}

#list-section li {
    display: flex;
    padding: 5px 10px;
    background: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    gap: 10px;
}

#list-section h2 {
    position: relative;
    top: 0;
    background: white;
    z-index: 10;
    padding: 10px;
    border-bottom: 2px solid #ccc;
}

#list-section {
    position: relative;
    gap: 20px;
}



/* ========================== */
/*       PRODUITS (LISTE)     */
/* ========================== */

.product-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Informations produit */
.product-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    word-wrap: break-word;
    overflow-wrap: break-word;
    gap: 5px;
    width: 87%;
    height: 100%;

}

/* Type de produit (catégorie au-dessus du nom) */
.product-type {
    font-size: 14px;
    font-weight: bold;
    color: #34495e;
    background-color: #3498db;
    padding: 2px 5px;
    border-radius: 5px;
    font-size: 0.5em;
}

/* Nom du produit */
.product-name {
    width: 100%;
    height: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 1em;
    padding-bottom: 15px;
}

/* ========================== */
/*       BOUTONS PRODUITS     */
/* ========================== */

.button-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    transform: translate(0, -5%);

}

/* Bouton de statut (Icône Achat) */
.status-btn {
    width: 30px;
    height: 30px;
    text-align: center;
    font-size: 16px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f39c12;
    border: none;
    cursor: pointer;
}

.status-btn.acheté {
    background: #2ecc71;
    /* Passe au vert si acheté */
}

/* Bouton de suppression (Icône Corbeille) */
.delete-item-btn {

    text-align: center;
    background: red;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px;
    cursor: pointer;
    position: relative;
    right: 30px;
    transform: translate(100%, 0);
    width: 30px;
    height: 30px;
}

/* ========================== */
/*       BOUTONS BAS          */
/* ========================== */

/* Conteneur des boutons RESET, CLEAR et RETOUR */
.button-group-bottom {
    position: sticky;
    bottom: 0px;
    display: flex;
    gap: 40px;
    z-index: 100;
    width: 104%;

    justify-self: center;
    justify-content: center;
    background: rgb(147, 141, 141);
    background: linear-gradient(0deg, rgba(147, 141, 141, 1) 0%, rgba(147, 141, 141, 1) 70%, rgba(255, 0, 0, 0) 100%);
    padding-bottom: 15px;
    height: 50px;
    pointer-events: none;
}


/* Boutons RESET, CLEAR et RETOUR (Réduction de taille + FontAwesome) */
#reset-list-btn,
#delete-list-btn,
#back-to-products-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    pointer-events: all;
}

/* Bouton RESET */
#reset-list-btn {
    background: #0dc03a;
    color: white;
}

#reset-list-btn:hover {
    background: #087b40;
}

/* Bouton CLEAR */
#delete-list-btn {
    background: #e74c3c;
    color: white;
}

#delete-list-btn:hover {
    background: #c0392b;
}

/* Bouton RETOUR */
#back-to-products-btn {
    background: #3498db;
    color: white;
}

#back-to-products-btn:hover {
    background: #2980b9;
}

#product-message {

    overflow-wrap: break-word;
    max-width: 300px;

}

@media (max-width: 600px) {
    .body {
        padding: 0;
    }

    .container {
        width: 100dvw;
        height: 100dvh;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
    }

    #logout-btn {
        margin-top: 20px;
    }

    #auth-form,
    #product-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 90%;
        max-width: 400px;
    }

    #product-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 90%;
        max-width: 400px;
        margin: auto;
    }

    #product-form input,
    #product-form select,
    #product-form button {
        width: 100%;
        max-width: 300px;
        font-size: 1em;
    }
}

@media (min-width: 1024px) {
    .container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #auth-form,
    #product-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 400px;
        margin: auto;
    }



    #view-list-btn,
    #add-product-btn {
        width: 100%;
        max-width: 300px;
        display: flex;
        justify-content: center;
    }

    /* Centrage horizontal + espace équilibré */
    .form-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        /* Centrage horizontal */
        justify-content: center;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        /* Centrage total */
    }
}