/* --- 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);
}

/* --- 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;
  height: auto;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 10px;
  position: relative;
  display: block;
  overflow: hidden; 
  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 ease-in-out, transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
    padding 0.5s ease;
}

.section-card.active .section-content {
  max-height: 2000px;
  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 {
  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;
  margin: 0;
  min-width: 0;
  box-sizing: border-box;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 0, 109, 0.1);
}
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
}

/* --- TUILES QUALIFICATIONS --- */
.qualif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.qualif-item { position: relative; height: 100%; }
.qualif-item input {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 10;
}
.qualif-label {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: #f8f8f8; border: 1px solid #ddd; padding: 15px 10px;
  border-radius: 6px; font-size: 0.85rem; font-weight: 600; height: 100%;
  transition: all 0.2s; line-height: 1.2; color: #444; user-select: none;
}
.qualif-item input:checked + .qualif-label {
  background: #3369a9; color: white; border-color: #3369a9;
  box-shadow: 0 4px 10px rgba(51, 105, 169, 0.3); transform: translateY(-2px);
}

/* --- HABILITATIONS --- */
.hab-item {
  background: #f9f9f9; padding: 15px; border-radius: 8px;
  border: 1px solid #eee; margin-bottom: 10px;
}
.hab-flex { display: flex; gap: 15px; align-items: flex-end; }
.hab-select-container { width: 35%; }
.hab-date-container { width: 65%; display: none; }
.hab-date-container.visible { display: block; animation: fadeIn 0.3s; }

/* --- UPLOAD --- */
.upload-area {
  border: 2px dashed #ccc; padding: 30px; text-align: center;
  border-radius: 8px; background: #fafafa; cursor: pointer; transition: all 0.3s;
}
.upload-area:hover { border-color: var(--primary); background: #fff; }
.upload-text { margin-bottom: 15px; color: #555; }
.upload-btn-style {
  background: #333; color: white; padding: 10px 20px;
  border-radius: 4px; font-weight: 600; display: inline-block;
}
.file-list { margin-top: 15px; }
.file-item {
  background: white; border: 1px solid #eee; padding: 10px;
  margin-bottom: 8px; border-radius: 4px; display: flex;
  justify-content: space-between; align-items: center; font-size: 0.9rem;
}
.btn-remove {
  color: red; background: none; border: none; cursor: pointer;
  font-weight: bold; font-size: 1.2rem; padding: 0 10px;
}

/* --- 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;
}

/* --- SUBMIT --- */
.submit-container { margin-top: 20px; }
.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: 15px;
}
.btn-submit:hover { background-color: var(--primary-hover); }
.btn-submit:disabled { background-color: #ccc; cursor: not-allowed; }
.btn-submit.loading {
  background-color: #ffffff !important; color: var(--primary) !important;
  border-color: var(--primary) !important; cursor: wait; opacity: 1;
}
.btn-spinner {
  width: 24px; height: 24px; border: 3px solid #eee;
  border-top: 3px solid var(--primary); border-radius: 50%;
  animation: spin 1s linear infinite; display: none;
}
.btn-submit.loading .btn-spinner { display: block; }

/* --- MODAL SUCCÈS --- */
.modal-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #ffffff; z-index: 100; display: flex;
  justify-content: center; align-items: flex-start; padding-top: 50px;
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease;
}
.modal-overlay.visible { opacity: 1; visibility: visible; }

/* --- MODE SUCCÈS (FIX REDIMENSIONNEMENT) --- */
.container.success-mode #candidatureForm { display: none !important; }

.container.success-mode .modal-overlay {
  position: relative !important; height: auto !important;
  min-height: 0 !important; top: auto !important; left: auto !important;
  padding-bottom: 20px; background: transparent !important;
}
.container.success-mode .modal-content { margin-top: 0; }

/* --- MODAL CONTENT AVEC OMBRE PORTÉE --- */
.modal-content {
  background: white; 
  padding: 40px 30px; 
  border-radius: 12px;
  /* ICI : OMBRE PORTÉE RENFORCÉE */
  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 cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.visible .modal-content { transform: translateY(0); }
.modal-icon { color: var(--primary); margin-bottom: 20px; }
.modal-icon svg { width: 64px; height: 64px; }
.modal-content h2 {
  font-family: "Bebas Neue", sans-serif; font-size: 2.5rem;
  color: var(--text-dark); margin: 0 0 15px 0; line-height: 1;
}
.modal-content p { font-size: 1.1rem; color: #333; margin: 5px 0; }
.modal-content p.sub-text {
  font-size: 0.95rem; color: #666; margin-top: 10px;
  margin-bottom: 30px; line-height: 1.5;
}
.btn-modal-home {
  display: inline-flex; align-items: center; justify-content: center;
  background-color: var(--primary); color: white; text-decoration: none;
  font-family: "Bebas Neue", sans-serif; font-size: 1.4rem;
  padding: 12px 30px; border-radius: 8px; transition: background-color 0.3s;
}
.btn-modal-home:hover { background-color: var(--primary-hover); }

@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; }
  .qualif-grid { grid-template-columns: 1fr 1fr; }
  .hab-flex { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hab-select-container, .hab-date-container { width: 100%; }
}