/* --- VARIABLES --- */
:root {
  --primary: #1a424c;          /* Bleu canard */
  --primary-hover: #13323a;    /* Version sombre */
  --primary-light: #e8f0f2;    /* Fond bleu très clair */
  --primary-border: #d1dde0;   /* Filet bleu canard clair */
  --white: #ffffff;
  --text-dark: #111;
  --text-light: #666;
  --border: #ddd;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --required-star: #bf4870;    /* Nouvelle couleur pour les astérisques */
}

/* --- 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: "Open Sans", 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 var(--primary-border);
  transition: all 0.3s ease;
}

.section-card:hover {
  border-color: var(--primary);
}

.section-card.active {
  border-color: var(--primary);
  box-shadow: 0 6px 12px rgba(26, 66, 76, 0.15);
}

.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 var(--primary-border);
  background-color: var(--primary-light);
}

.section-title {
  font-family: "Oswald", sans-serif;
  font-size: 1.4rem;
  font-weight: 500;
  text-transform: uppercase;
  margin: 0;
  color: var(--text-dark);
}

.section-card.active .section-title {
  color: var(--primary);
}

.section-icon {
  transition: transform 0.3s;
  color: var(--text-light);
}

.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(--required-star); /* Mise à jour ici */
}

input, 
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: "Open Sans", 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(26, 66, 76, 0.1);
}

/* --- 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 var(--border);
  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: var(--primary); 
  color: white; 
  border-color: var(--primary);
  box-shadow: 0 4px 10px rgba(26, 66, 76, 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 var(--primary-border);
  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: var(--primary);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
  font-family: "Oswald", sans-serif;
  text-transform: uppercase;
}

.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: #e63946;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.2rem;
  padding: 0 10px;
}

/* --- ERREUR MESSAGE --- */
.error-message {
  color: var(--primary);
  font-weight: 600;
  background-color: var(--primary-light);
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
  border: 1px solid var(--primary-border);
  display: none; 
  text-align: center;
  animation: fadeIn 0.3s ease;
}

/* --- SUBMIT --- */
.submit-container {
  margin-top: 20px;
}

.btn-submit {
  background-color: var(--primary);
  color: white;
  font-family: "Oswald", sans-serif;
  font-size: 1.6rem;
  text-transform: uppercase;
  border: none;
  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: 2px solid var(--primary) !important;
  cursor: wait;
}

.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;
}

.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;
}

.modal-content {
  background: white; 
  padding: 40px 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 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: "Oswald", sans-serif;
  font-size: 2rem;
  text-transform: uppercase;
  color: var(--text-dark);
  margin: 0 0 15px 0;
  line-height: 1.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: "Oswald", sans-serif;
  font-size: 1.4rem;
  text-transform: uppercase;
  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%;
  }
  .modal-content h2 {
    font-size: 1.7rem;
  }
}