/* --- VARIABLES --- */
:root {
  --primary: #e5006d;
  --primary-hover: #c4005d;
  --white: #ffffff;
  --text-dark: #111;
  --text-light: #666;
  --border: #ddd;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --warning-bg: #fff3cd;
  --warning-border: #ffc107;
  --warning-text: #856404;
}

/* --- RESET & BASE --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  background-color: transparent; margin: 0; padding: 0;
  color: var(--text-dark); font-family: "Inter", sans-serif;
  width: 100%; overflow: hidden;
}

.container {
  width: 100%; max-width: 800px; margin: 0 auto;
  padding: 10px; position: relative; padding-bottom: 20px;
}

/* --- ACCORDÉON --- */
.section-card {
  background: var(--white); border-radius: 8px; margin-bottom: 15px;
  box-shadow: var(--shadow); overflow: hidden; border: 1px solid transparent;
  transition: all 0.3s ease;
}
.section-card.active { border-color: var(--primary); }

.section-header {
  padding: 15px 20px; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center;
  background: var(--white); border-bottom: 1px solid transparent;
}
.section-card.active .section-header {
  border-bottom: 1px solid #eee; background-color: #fff0f6;
}

.section-title {
  font-family: "Bebas Neue", sans-serif; font-size: 1.4rem;
  margin: 0; color: var(--text-dark);
}
.section-card.active .section-title { color: var(--primary); }

.section-icon { transition: transform 0.3s; }
.section-card.active .section-icon {
  transform: rotate(180deg); color: var(--primary);
}

.section-content {
  max-height: 0; opacity: 0; transform: translateY(-10px);
  overflow: hidden; padding: 0 20px;
  transition: max-height 0.5s cubic-bezier(0.25, 1, 0.5, 1),
              opacity 0.4s, transform 0.4s, padding 0.5s;
}
.section-card.active .section-content {
  max-height: 2500px; opacity: 1; transform: translateY(0); padding: 20px;
}

/* --- FORMULAIRE --- */
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.full-width { grid-column: span 2; }
.form-group { margin-bottom: 5px; }

label {
  display: block; font-size: 0.8rem; text-transform: uppercase;
  font-weight: 700; margin-bottom: 8px; color: #444;
}
label.required::after { content: " *"; color: var(--primary); }

input, select, textarea {
  width: 100%; padding: 12px; border: 1px solid var(--border);
  border-radius: 6px; font-family: "Inter", sans-serif; font-size: 16px;
  background: #fff; transition: border 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}
textarea { resize: vertical; min-height: 100px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 0, 109, 0.1);
}

/* --- UPLOAD ZONES --- */
.upload-area {
  border: 2px dashed #ccc; padding: 25px; text-align: center;
  border-radius: 8px; background: #fafafa; cursor: pointer;
  transition: all 0.3s; margin-bottom: 10px;
}
.upload-area:hover { border-color: var(--primary); background: #fff; }

/* Style spécifique zone Facture */
.upload-area.required-zone {
  border-color: rgba(229, 0, 109, 0.3); background: rgba(229, 0, 109, 0.02);
}
.upload-area.required-zone:hover { border-color: var(--primary); }

.upload-text { margin-bottom: 15px; color: #555; font-size: 0.9rem; line-height: 1.4; }

.upload-btn-style {
  color: white; padding: 10px 20px; border-radius: 4px;
  font-weight: 600; display: inline-block; font-size: 0.9rem;
}
.btn-primary-style { background: var(--primary); }
.btn-secondary-style { background: #666; }

.file-list { margin-top: 5px; margin-bottom: 15px; }
.file-item {
  background: white; border: 1px solid #eee; padding: 8px 12px;
  margin-bottom: 6px; border-radius: 4px; display: flex;
  justify-content: space-between; align-items: center; font-size: 0.85rem;
}
.file-item strong { color: var(--primary); margin-left: 5px; }
.btn-remove {
  color: red; background: none; border: none; cursor: pointer;
  font-weight: bold; font-size: 1.2rem; padding: 0 5px;
}

/* --- ERREUR MESSAGE (NOUVEAU) --- */
.error-message {
  color: var(--primary);
  font-weight: 600;
  background-color: #fff0f6;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
  border: 1px solid rgba(229, 0, 109, 0.2);
  display: none; /* Caché par défaut */
  text-align: center;
  animation: fadeIn 0.3s ease;
}

/* --- WARNING BOX & CHECKBOX --- */
.warning-box {
  margin-top: 20px; padding: 15px; background: var(--warning-bg);
  border-left: 4px solid var(--warning-border); color: var(--warning-text);
  font-size: 0.9rem; border-radius: 4px; line-height: 1.4;
}

.checkbox-container {
  margin-top: 20px; display: flex; align-items: flex-start; gap: 12px;
}
.checkbox-container input {
  width: 20px; height: 20px; margin-top: 2px; cursor: pointer;
}
.checkbox-container label {
  text-transform: none; font-weight: 400; font-size: 0.95rem;
  cursor: pointer; color: var(--text-dark); line-height: 1.4;
}

/* --- SUBMIT --- */
.submit-container { margin-top: 25px; }
.btn-submit {
  background-color: var(--primary); color: white;
  font-family: "Bebas Neue", sans-serif; font-size: 1.6rem;
  border: 2px solid transparent; border-radius: 8px; padding: 15px 40px;
  cursor: pointer; width: 100%; transition: all 0.3s;
  display: flex; justify-content: center; align-items: center; gap: 10px;
}
.btn-submit:hover { background-color: var(--primary-hover); }
.btn-submit:disabled { background-color: #ccc; cursor: not-allowed; }

.btn-spinner {
  width: 20px; height: 20px; border: 2px solid #fff;
  border-top: 2px solid transparent; border-radius: 50%;
  animation: spin 1s linear infinite; display: none;
}
.btn-submit.loading .btn-spinner { display: block; }
.btn-submit.loading .btn-text { display: none; }

/* --- MODAL SUCCÈS --- */
.modal-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: white; z-index: 100; display: flex;
  justify-content: center; align-items: flex-start; padding-top: 40px;
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
}
.modal-content {
  background: white; padding: 30px; border-radius: 12px;
  border: 1px solid #eee; border-top: 6px solid var(--primary);
  text-align: center; max-width: 450px; width: 100%;
  transform: translateY(20px); transition: transform 0.4s;
}
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-overlay.visible .modal-content { transform: translateY(0); }

.modal-icon { color: var(--primary); margin-bottom: 15px; }
.modal-icon svg { width: 50px; height: 50px; }
.modal-content h2 {
  font-family: "Bebas Neue", sans-serif; font-size: 2.2rem;
  margin: 0 0 10px 0; color: var(--text-dark);
}
.modal-content p { font-size: 1rem; color: #333; margin: 5px 0; }
.sub-text { font-size: 0.9rem; color: #666; margin-bottom: 25px; }

/* --- BOUTONS MODALE --- */
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 15px; /* Espace entre les deux boutons */
  margin-top: 20px;
}

.btn-modal {
  display: flex; 
  justify-content: center; 
  align-items: center;
  width: 100%;
  padding: 12px 20px;
  border-radius: 6px;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.3rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid var(--primary); /* Bordure identique pour alignement parfait */
  box-sizing: border-box;
}

/* STYLE 1 : NOUVELLE DEMANDE (Fond Rose, Texte Blanc) */
.btn-primary {
  background-color: var(--primary);
  color: white;
}

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

/* STYLE 2 : RETOUR ACCUEIL (Fond Blanc, Texte Rose) */
.btn-secondary {
  background-color: white;
  color: var(--primary);
}

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

/* Mode Succès pour Iframe */
.container.success-mode #savForm { display: none !important; }
.container.success-mode .modal-overlay {
  position: relative !important; height: auto !important;
  background: transparent !important; padding-top: 0;
}

@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: span 1; }
}