@import url('../css/config.css');

/* Styles généraux */
html, body {
    margin: 0;
    padding: 0;
    height: 100vh; /* Prend exactement 100% de la fenêtre visible */
    overflow: hidden; /* Empêche tout débordement vertical */
}

body {
    display: flex;
    flex-direction: column;
    font-family: var(--font-body), sans-serif;
    background-color: var(--color-beige-earth);
}

strong{
    font-weight: bold;
}

div.top {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Écarte les éléments */
    position: relative; /* Permet de centrer le H1 visuellement */
    height: 70px;
    padding: 10px;
}

div.top > h1 {
    position: absolute; /* Le H1 reste centré dans le conteneur */
    left: 50%; /* Point de référence au milieu */
    transform: translateX(-50%); /* Recentre en fonction de sa largeur */
    margin: 0; /* Retire les marges par défaut */
}

div.top > div {
    font-family: var(--font-title), sans-serif;
    font-size: 2.5em;
    margin: 0; /* Retire les marges du bouton "retour" */
    font-weight: bold;
    color: var(--color-text);
}

h1 {
    font-family: var(--font-title), sans-serif;
    text-align: center;
    color: var(--color-text);
    font-size: 2.5em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 20px;
}

/* Conteneur principal pour deux colonnes */
.main-container {
    flex: 1; /* Remplit l'espace restant */
    display: grid;
    grid-template-columns: 3fr 1fr; /* Fabricants : 3/4, Détails : 1/4 */
    gap: 20px;
    box-sizing: border-box;
    height: 100%; /* S'étend pour remplir le body */
    overflow: hidden; /* Empêche les débordements */
}

/* Colonnes des fabricants */
.columns-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 colonnes */
    gap: 15px;
    overflow-y: auto; /* Défilement vertical local */
    padding: 10px 10px; /* Ajout de padding en haut et en bas pour éviter la coupure */
    box-sizing: border-box; /* Inclure le padding dans la taille totale */
}


.column {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
}

.column h2, .sticky-details h2 {
    font-family: var(--font-title), sans-serif;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
    color: var(--color-text);
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
    margin-top: 0;
}

/* Items */
.item-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    border: 1px solid #ddd;
    margin: 5px 0;
    padding: 5px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    color: #555;

    transition: background-color 0.3s, box-shadow 0.3s;
}

.item-container:hover {
    background-color: #f1f8ff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.item-container img {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 5px;
    background: #f9f9f9;
    padding: 5px;
    border: 1px solid #ccc;
}

.item-container p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: #444;
}

/* Colonne sticky (détails) */
.sticky-details {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 15px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    margin-right: 10px;
    margin-top: 10px;
}

.sticky-details h3 {
    margin-top: 0;
    color: #007BFF;
    font-size: 1.2em;
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
}

.sticky-details img {
    display: block;
    /*margin: 0 auto 15px;*/
    max-width: 100px;
    height: auto;
    border-radius: 10px;
}

#itemDetails{
    margin-bottom: 10px;
}

/* Conteneur pour l'image et les détails */
.details-container {
    display: flex;
    gap: 20px; /* Espacement entre les colonnes */
    align-items: center; /* Aligne verticalement les éléments */
}

/* Colonne de l'image */
.details-container img {
    max-width: 100px; /* Limite la taille de l'image */
    height: auto; /* Conserve les proportions */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Colonne du texte */
.details-container .details-text {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Espacement entre les paragraphes */
}

.details-container .details-text p {
    margin: 0;
    font-size: 14px;
    color: #333;
}

/* Étapes de fabrication et ressources */
.crafting-resources {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Étapes de fabrication */
.crafting-steps, .total-resources {
    list-style: none;
    padding: 0;
}

/*.crafting-steps li, */.total-resources li {
    margin: 5px 0;
    padding: 5px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    color: #555;
}

.crafting-steps ul, .crafting-steps li{
    list-style: none;
}

.crafting-steps-data {
    margin: 5px 0;
    padding: 10px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    color: #555;
}

/* Ressources nécessaires avec images */
.resource-item {
    display: flex;
    align-items: center;
    gap: 10px;
    /*padding: 10px;*/
    /*border-bottom: 1px solid #ddd;*/
}

.resource-item img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background: #f9f9f9;
    padding: 5px;
    border: 1px solid #ccc;
}

.resource-item span {
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

/* Styles pour les accordéons */
.accordion-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.accordion-item {
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    text-align: left;

    display: flex;
    align-items: center;
    cursor: pointer;
    border: none;
    /*margin: 5px 0;*/
    padding: 5px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    color: #555;

    transition: background-color 0.3s;
}

.accordion-header img {
    width: 40px;
    height: 40px;
    margin-right: 15px;
    border-radius: 5px;
    background: #f9f9f9;
    padding: 5px;
    border: 1px solid #ccc;
}

.accordion-header:hover {
    background-color: #e9e9e9;
}

.accordion-content {
    display: none; /* Fermé par défaut */
    padding: 10px;
    background-color: #fefefe;
    border-top: 1px solid #ddd;
}

.accordion-header[data-target]:before {
    content: '+';
    /*margin-right: 10px;*/
    /*font-weight: bold;*/
}

.accordion-header[data-target][aria-expanded="true"]:before {
    content: '-';
}

.nested-list {
    list-style: none;
    padding-left: 20px;
}

.nested-list .crafting-steps-data {
    margin: 5px 0;
    font-size: 14px;
    color: #555;
}

/* ------------------------------------- */
/* ------------ --POP-in ---------------- */
/* ------------------------------------- */
/* Pop-in styles */
.mobile-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Fond semi-transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.mobile-popup.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none; /* Empêche les interactions */
}


.popup-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5em;
    font-weight: bold;
    color: #555;
    cursor: pointer;
}

#popupDetails {
    overflow-y: auto;
    max-height: 80vh; /* Pour éviter que le contenu déborde */
}


/* ------------------------------------- */
/* ------------ --ADMIN ---------------- */
/* ------------------------------------- */
.admin-container {
    width: 50%;
    margin: 0 auto;
    background-color: #fefefe;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.admin-container form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-container input, .admin-container textarea, .admin-container button {
    font-size: 1em;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.admin-container button {
    background-color: #007BFF;
    color: white;
    cursor: pointer;
}

.admin-container button:hover {
    background-color: #0056b3;
}

/* Responsivité pour mobile */
@media (max-width: 768px) {
    html, body {
        overflow: auto; /* Permet le défilement global */
    }

    div.top > h1{
        font-size: 1.8em;
    }

    .main-container {
        grid-template-columns: 1fr; /* Une seule colonne */
        height: auto; /* Autorise une hauteur dynamique */
        overflow: visible;
    }

    .columns-container {
        grid-template-columns: 1fr; /* Une seule colonne pour les fabricants */
        overflow-y: visible; /* Autorise l'extension dynamique */
    }

    #fixedDetails {
        display: none; /* Cache la 4ème colonne */
    }

    .sticky-details {
        position: relative; /* Ne reste pas fixe sur mobile */
        max-height: none; /* Supprime la hauteur limitée */
        margin-top: 20px; /* Ajoute un espacement entre les colonnes */
    }
}