/**
 * Style du formulaire d'ajout/modification produit — Redesign Premium
 * @author Shawn Dutil
 */

/* ===========================
   LAYOUT
=========================== */
.container_contenu_formulaire {
    display: flex;
    justify-content: center;
    padding: 52px 32px;
    background: var(--creme);
    min-height: calc(100vh - var(--navbar-h));
    width: 100%;
    box-sizing: border-box;
}

.container_formulaire_ajout {
    width: 100%;
    max-width: 780px;
    display: flex;
    flex-direction: column;
}

/* ===========================
   TITRE
=========================== */
.ajout-produit-wrapper > h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 400;
    font-style: italic;
    color: var(--vert-profond);
    text-align: center;
    margin: 0 0 32px 0;
}

.ajout-produit-wrapper > h2::after {
    content: '';
    display: block;
    width: 70px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--or), transparent);
    margin: 14px auto 0;
}

/* ===========================
   SECTIONS DU FORMULAIRE
=========================== */
.form-section,
.form-section-container {
    background: #fff;
    border-radius: 2px;
    border-left: 3px solid rgba(201, 168, 76, 0.35);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 24px 28px;
    margin-bottom: 16px;
    text-align: left;
    cursor: default;
    transition: border-left-color 0.2s ease;
}

.form-section:hover,
.form-section-container:hover {
    border-left-color: var(--or);
}

/* Labels généraux */
.form-label,
.form-label-type-ajout {
    font-family: 'Raleway', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--vert-profond);
    margin-top: 0;
    margin-bottom: 8px;
    display: block;
}

/* ===========================
   INPUTS TEXTE
=========================== */
.section_nom input,
.section-largeur-longueur input,
.etape-installation input,
.section_nom_realisation input,
.input-longueur-largeur,
.section-description input,
.descriptionSupplementaire {
    font-family: 'Raleway', sans-serif;
    font-size: 0.88rem;
    color: var(--texte-sombre);
    background: var(--creme);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 2px;
    padding: 11px 14px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.section_nom input:focus,
.section_categorie select:focus,
.section-largeur-longueur input:focus,
.etape-installation input:focus,
.section_nom_realisation input:focus,
.input-longueur-largeur:focus,
.section-description input:focus,
.descriptionSupplementaire:focus {
    border-color: var(--or);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
    outline: none;
}

/* Select */
select {
    font-family: 'Raleway', sans-serif;
    font-size: 0.88rem;
    color: var(--texte-sombre);
    background: var(--creme);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 2px;
    padding: 11px 14px;
    box-sizing: border-box;
    outline: none;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.section_categorie select {
    width: 100%;
}

select:focus {
    border-color: var(--or);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

/* ===========================
   RADIO TYPE D'AJOUT
=========================== */
.checkbox {
    margin-bottom: 0;
}

.type-ajout-options {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 16px;
    margin-bottom: 8px;
}

.ajout-option {
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    user-select: none;
    font-family: 'Raleway', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--vert-profond);
}

.ajout-option .type_ajout {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.custom-radio {
    position: absolute;
    left: 0;
    top: 1px;
    height: 18px;
    width: 18px;
    background: var(--creme);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    transition: border-color 0.2s ease;
}

.ajout-option:hover .custom-radio { border-color: var(--or); }

.ajout-option input:checked ~ .custom-radio {
    background: var(--vert-profond);
    border-color: var(--vert-profond);
}

.custom-radio::after {
    content: "";
    position: absolute;
    display: none;
    top: 4px; left: 4px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--or);
}

.ajout-option input:checked ~ .custom-radio::after { display: block; }

/* ===========================
   NOM + CATÉGORIE
=========================== */
.section_nom_categorie {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.section_nom,
.section_categorie {
    flex: 1;
    min-width: 220px;
    margin: 0;
}

.section_nom label,
.section_categorie label,
.section_nom_realisation label {
    display: block;
    margin-left: 0;
    margin-bottom: 6px;
}

/* ===========================
   DIMENSIONS
=========================== */
.form-description-largeur-longueur {
    display: flex;
    justify-content: flex-start;
    gap: 32px;
    flex-wrap: wrap;
}

.section-largeur-longueur {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.section-largeur label,
.section-longueur label {
    display: block;
    margin-left: 0;
}

.input-unite {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.input-longueur-largeur { flex: 1; }

.unite {
    font-family: 'Raleway', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--vert-profond);
    white-space: nowrap;
}

/* ===========================
   UPLOAD MÉDIAS
=========================== */
.images-upload-wrapper { text-align: left; }

.images-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.images-left p {
    font-family: 'Raleway', sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    color: #999;
    margin: 0;
    font-style: italic;
}

.input-images,
.input-image { display: none; }

.preview-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.image-preview-wrapper {
    position: relative;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.preview-images img,
.image-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
    border-radius: 2px;
}

.video-preview { max-height: 120px; }

/* Bouton suppression image */
.btn-suppression-formulaireProduit,
.btn-remove-nom,
.btn-supprimer-description,
.btn-remove-etape {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(28, 46, 28, 0.75);
    color: var(--or);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.2s ease;
}

.btn-suppression-formulaireProduit:hover,
.btn-remove-nom:hover,
.btn-supprimer-description:hover,
.btn-remove-etape:hover {
    background: #c0392b;
    color: #fff;
}

.btn-remove-nom { position: static; margin-left: 6px; }

.btn-suppression-container {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ===========================
   DESCRIPTION SUPPLÉMENTAIRE
=========================== */
.section-description {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 28px;
    padding-top: 16px;
}

.description-wrapper {
    position: relative;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 2px;
    overflow: hidden;
    width: 100%;
}

.descriptionSupplementaire {
    border: none;
    border-radius: 0;
    width: 100%;
}

/* ===========================
   ÉTAPES INSTALLATION
=========================== */
.installation-steps-section {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s ease, opacity 0.3s ease;
    padding: 0 28px;
    opacity: 0;
    visibility: hidden;
}

.installation-steps-section.show {
    max-height: 2000px;
    padding: 24px 28px;
    opacity: 1;
    visibility: visible;
}

.installation-steps-section.hidden {
    max-height: 0;
    padding: 0 28px;
    opacity: 0;
    visibility: hidden;
}

.etape-installation {
    position: relative;
    padding: 16px 44px 16px 16px;
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 2px;
    margin-bottom: 12px;
    background: var(--creme);
}

.etape-installation input {
    margin-bottom: 8px;
    margin-top: 8px;
}

.video-etape-modification {
    width: 100%;
    max-width: 560px;
    border-radius: 2px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    margin: 12px 0;
    display: block;
}

/* ===========================
   BOUTONS "AJOUTER"
=========================== */
.btn-ajout-description {
    font-family: 'Raleway', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--vert-profond);
    background: transparent;
    border: 1px solid rgba(28, 46, 28, 0.3);
    border-radius: 2px;
    padding: 9px 18px;
    cursor: pointer;
    margin-top: 12px;
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-ajout-description:hover {
    background: var(--vert-profond);
    color: var(--or-clair);
    border-color: var(--vert-profond);
}

/* ===========================
   RÉALISATION — NOMS
=========================== */
#nomsRealisationContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.section_nom_realisation {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.section_nom_realisation input {
    flex: 1;
    width: auto;
}

/* ===========================
   ACTIONS (submit / annuler)
=========================== */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.btn-stylish-primary {
    font-family: 'Raleway', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--vert-profond);
    background: linear-gradient(135deg, var(--or) 0%, var(--or-clair) 100%);
    border: none;
    border-radius: 2px;
    padding: 14px 32px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 3px 14px rgba(201, 168, 76, 0.35);
    text-decoration: none;
    display: inline-block;
}

.btn-stylish-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--or-clair) 0%, var(--or) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.btn-stylish-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(201, 168, 76, 0.5);
}

.btn-stylish-primary:hover::before { opacity: 1; }

.btn-stylish-secondary {
    font-family: 'Raleway', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--vert-profond);
    background: transparent;
    border: 1px solid rgba(28, 46, 28, 0.25);
    border-radius: 2px;
    padding: 14px 32px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-stylish-secondary:hover {
    background: var(--vert-profond);
    color: #fff;
    border-color: var(--vert-profond);
}

/* ===========================
   MESSAGES
=========================== */
.message-erreur {
    font-family: 'Raleway', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    background: #fdf0f0;
    color: #8b2020;
    border-left: 3px solid #e53935;
    padding: 12px 18px;
    border-radius: 2px;
    margin-bottom: 20px;
}

.message-erreur-produit {
    font-family: 'Raleway', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    background: #fdf0f0;
    color: #8b2020;
    border-left: 3px solid #e53935;
    padding: 12px 18px;
    border-radius: 2px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.message-erreur-produit p { color: #8b2020; }

.message-success {
    font-family: 'Raleway', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    background: #edf7ed;
    color: #2d6a2d;
    border-left: 3px solid #4caf50;
    padding: 12px 18px;
    border-radius: 2px;
    margin-bottom: 20px;
}

/* Erreurs inline */
.error-container {
    display: flex;
    justify-content: flex-start;
    min-height: 18px;
}

.error-message {
    font-family: 'Raleway', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    color: #c0392b;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

/* Paragraphes dans form */
p { color: #555; }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 1024px) {
    .container_contenu_formulaire { padding: 40px 20px; }
    .section_nom_categorie { flex-direction: column; gap: 0; }
    .form-description-largeur-longueur { flex-direction: column; gap: 16px; }
    .section-description { grid-template-columns: 1fr; }
    .type-ajout-options { flex-direction: column; align-items: flex-start; gap: 12px; }
    .form-actions { flex-direction: column; }
    .btn-stylish-primary,
    .btn-stylish-secondary { width: 100%; text-align: center; }
    .video-etape-modification { max-width: 100%; }
}

@media (max-width: 600px) {
    .container_contenu_formulaire { padding: 28px 12px; }
    .form-section,
    .form-section-container { padding: 18px 16px; }
    .btn-ajout-description { width: 100%; justify-content: center; }
    .preview-images img,
    .image-preview { width: 90px; height: 90px; }
    .ajout-produit-wrapper > h2 { font-size: 1.6rem; }
}