/* ============================================================
   connexion.css — Page de connexion Connect'ED
   ============================================================ */

:root {
  --purple:       #7c3aed;
  --purple-mid:   #a78bfa;
  --purple-light: #ede9fe;
  --purple-pale:  #faf8ff;
  --purple-dark:  #4b2b78;
  --surface:      #ffffff;
  --muted:        #f9fafb;
  --line:         #e5e7eb;
  --line-soft:    #f0eafa;
  --text-main:    #111827;
  --text-muted:   #6b7280;
  --text-hint:    #9ca3af;
}

/* ===== Dark mode variables ===== */
[data-theme="dark"] {
  --purple:       #a78bfa;
  --purple-mid:   #c4b5fd;
  --purple-light: #2d1f5e;
  --purple-pale:  #1a1230;
  --purple-dark:  #ddd6fe;
  --surface:      #1e1e2e;
  --muted:        #252535;
  --line:         #383850;
  --line-soft:    #2e2a45;
  --text-main:    #e2e8f0;
  --text-muted:   #a0aec0;
  --text-hint:    #64748b;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--text-main);
  background: #ece8f5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background .3s ease, color .3s ease;
}

[data-theme="dark"] body,
[data-theme="dark"]body {
  background: #13111e;
}

a { text-decoration: none; color: var(--purple); }
a:hover { text-decoration: underline; }

/* ===== Bouton dark mode (coin supérieur droit) ===== */
#cx-theme-toggle {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .15s;
  flex-shrink: 0;
  padding: 0;
}
#cx-theme-toggle:hover {
  transform: scale(1.07);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
#cx-theme-toggle i {
  font-size: 16px;
  color: #333;
  line-height: 1;
}

[data-theme="dark"] #cx-theme-toggle {
  background: #2c2c2e;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
[data-theme="dark"] #cx-theme-toggle i {
  color: #c4b5fd;
}

/* ===== Wrapper ===== */
.cx-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 40px;
}

/* ===== Carte ===== */
.cx-card {
  display: flex;
  width: 100%;
  max-width: 900px;
  min-height: 520px;
  background: var(--surface);
  border-radius: 16px;
  border: 0.5px solid var(--line);
  overflow: hidden;
  transition: background .3s ease, border-color .3s ease;
}

[data-theme="dark"] .cx-card {
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

/* ===== Panneau gauche ===== */
.cx-panel-left {
  width: 340px;
  flex-shrink: 0;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  border-right: 0.5px solid var(--line-soft);
  background: var(--surface);
  transition: background .3s ease, border-color .3s ease;
}

/* Marque */
.cx-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.cx-brand-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.cx-brand-name    { font-size: 16px; font-weight: 500; color: var(--purple-dark); line-height: 1.1; }
.cx-brand-tagline { font-size: 11px; color: var(--text-hint); }

/* Titres */
.cx-heading    { font-size: 18px; font-weight: 500; color: var(--purple-dark); margin: 0 0 4px; }
.cx-subheading { font-size: 12px; color: var(--text-hint); margin: 0 0 18px; }

/* Séparateur */
.cx-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 12px;
  color: var(--text-hint); font-size: 11px;
}
.cx-divider::before, .cx-divider::after {
  content: ''; flex: 1; height: 0.5px; background: var(--line-soft);
}

/* Lien créer compte */
.cx-register {
  font-size: 11px; color: var(--text-hint);
  text-align: center; line-height: 1.6; margin: 0;
}
.cx-register a { color: var(--purple); }
.cx-register a:hover { text-decoration: underline; }

/* ===== Wrapper du include ===== */
.cx-form-include {
  display: flex;
  flex-direction: column;
}

.cx-form-include > h2,
.cx-form-include .inscription-formulaire h5 { display: none; }

.cx-form-include .inscription-formulaire {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  width: 100%;
}

.cx-form-include form br   { display: none; }
.cx-form-include form > p  { margin: 0; }

/* Input email */
.cx-form-include input[type="email"] {
  width: 100%;
  padding: 9px 12px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-main);
  background: var(--muted);
  outline: none; appearance: none;
  font-family: inherit;
  margin-bottom: 10px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cx-form-include input[type="email"]:focus {
  border-color: var(--purple-mid);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--purple-light);
}

/* Wrapper password */
.cx-form-include .password-input {
  position: relative;
  margin-bottom: 0;
}

/* Input password */
.cx-form-include input.formu_connect[type="password"] {
  width: 100%;
  padding: 9px 38px 9px 12px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-main);
  background: var(--muted);
  outline: none; appearance: none;
  font-family: inherit;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cx-form-include input.formu_connect[type="password"]:focus {
  border-color: var(--purple-mid);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--purple-light);
}

/* Icône oeil */
.cx-form-include .toggle-password {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
  cursor: pointer; font-size: 14px;
}

/* Bouton Se connecter */
.cx-form-include .button2 {
  width: 100%;
  padding: 11px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit; appearance: none;
  transition: background .15s;
  margin: 12px 0 0;
}
.cx-form-include .button2:hover { background: #6d28d9; }

[data-theme="dark"] .cx-form-include .button2:hover { background: #7c3aed; }

/* Lien mot de passe oublié */
.cx-form-include a[href="motdepasserecup.php"] {
  display: block;
  font-size: 12px;
  color: var(--purple-mid);
  text-align: right;
  text-decoration: none;
  margin-top: 10px;
}
.cx-form-include a[href="motdepasserecup.php"]:hover {
  color: var(--purple);
  text-decoration: underline;
}

.cx-form-include > p,
.cx-form-include > form { display: none; }

/* ===== Panneau droit ===== */
.cx-panel-right {
  flex: 1;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  background: var(--purple-pale);
  transition: background .3s ease;
}

.cx-section-title {
  font-size: 11px; font-weight: 500;
  color: var(--text-hint);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 0 0 16px;
}

.cx-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.cx-action {
  background: var(--surface);
  border: 0.5px solid var(--line-soft);
  border-radius: 12px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, background .15s;
  text-decoration: none; color: inherit; cursor: pointer;
}
.cx-action:hover {
  border-color: #c4b5fd;
  background: var(--purple-light);
  text-decoration: none;
}

[data-theme="dark"] .cx-action:hover {
  background: #2a1f4e;
  border-color: var(--purple-mid);
}

.cx-action-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--purple-light);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2px;
}
.cx-action-icon i { font-size: 15px; color: var(--purple); }

.cx-action-name { font-size: 13px; font-weight: 500; color: var(--purple-dark); line-height: 1.2; }
.cx-action-desc { font-size: 11px; color: var(--text-hint); line-height: 1.4; }

/* Contact */
.cx-contact {
  margin-top: auto;
  padding-top: 20px;
  border-top: 0.5px solid var(--line-soft);
  font-size: 12px; color: var(--text-hint); line-height: 1.6;
}
.cx-contact strong {
  display: block; font-weight: 500;
  color: var(--text-muted); margin-bottom: 4px;
}

/* ===== Footer ===== */
.cx-footer {
  text-align: center; padding: 12px;
  font-size: 10px; color: var(--text-hint);
}

/* ===== Banner PWA ===== */
#add-to-home {
  position: fixed;
  bottom: 10px; left: 10px; right: 10px;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center; font-size: 13px;
  z-index: 9999; display: none;
}
#add-to-home p { margin: 0 0 10px; color: var(--text-muted); }
#close-add-to-home {
  background: var(--purple); color: #fff;
  border: none; border-radius: 7px;
  padding: 7px 16px; font-size: 12px; cursor: pointer;
}
#close-add-to-home:hover { background: #6d28d9; }

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .cx-wrapper { padding: 70px 12px 24px; align-items: flex-start; }
  .cx-card { flex-direction: column; border-radius: 12px; }
  .cx-panel-left { width: 100%; padding: 28px 22px; border-right: none; border-bottom: 0.5px solid var(--line-soft); }
  .cx-panel-right { padding: 24px 22px; }
  .cx-actions { grid-template-columns: 1fr; }
  .cx-brand { margin-bottom: 20px; }
  #cx-theme-toggle { top: 12px; right: 12px; }

  /* iOS : un champ à font-size < 16px déclenche un zoom auto au focus.
     On force 16px sur mobile (zoom pincé conservé, accessibilité OK). */
  .cx-form-include input[type="email"],
  .cx-form-include input.formu_connect[type="password"] {
    font-size: 16px;
  }
}

/* ===== Modale création de compte ===== */
.cx-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.cx-modal-overlay.open {
  opacity: 1;
  visibility: visible;
  transition: opacity .2s ease;
}

.cx-modal {
  background: var(--surface);
  border-radius: 16px;
  border: 0.5px solid var(--line);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  transform: translateY(8px) scale(.98);
  transition: transform .2s ease, background .3s ease;
}
.cx-modal-overlay.open .cx-modal {
  transform: translateY(0) scale(1);
}

[data-theme="dark"] .cx-modal {
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Bouton fermeture */
.cx-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 0.5px solid var(--line);
  background: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  transition: background .15s;
}
.cx-modal-close:hover { background: var(--line); }

/* En-tête modale */
.cx-modal-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--purple-dark);
  margin: 0 0 4px;
}
.cx-modal-sub {
  font-size: 12px;
  color: var(--text-hint);
  margin: 0 0 24px;
}

/* Champs dans la modale */
.cx-modal-field {
  margin-bottom: 18px;
}
.cx-modal-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 5px;
  width: auto; float: none; cursor: default;
}
.cx-modal-field input[type="email"],
.cx-modal-field input[type="text"],
.cx-modal-field select {
  width: 100%;
  padding: 9px 12px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-main);
  background: var(--muted);
  outline: none; appearance: none;
  font-family: inherit;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cx-modal-field input:focus,
.cx-modal-field select:focus {
  border-color: var(--purple-mid);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--purple-light);
}
.cx-modal-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

[data-theme="dark"] .cx-modal-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0aec0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.cx-modal-hint {
  font-size: 11px;
  color: var(--text-hint);
  line-height: 1.5;
  margin: 8px 0 16px;
  font-style: italic;
}

/* Bouton submit modale */
.cx-modal-submit {
  width: 100%;
  padding: 11px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
  appearance: none;
  transition: background .15s;
  margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cx-modal-submit:hover { background: #6d28d9; }
.cx-modal-submit:disabled { background: var(--purple-mid); cursor: not-allowed; }

/* Spinner */
.cx-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cx-spin .6s linear infinite;
  display: none;
}
.cx-modal-submit.loading .cx-spinner { display: inline-block; }
.cx-modal-submit.loading .cx-btn-label { opacity: .7; }
@keyframes cx-spin { to { transform: rotate(360deg); } }

/* Alertes */
.cx-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  line-height: 1.4;
}
.cx-alert-error   { background: #fef2f2; color: #991b1b; border: 0.5px solid #fca5a5; }
.cx-alert-success { background: #f0fdf4; color: #166534; border: 0.5px solid #bbf7d0; }

[data-theme="dark"] .cx-alert-error   { background: #2d1414; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .cx-alert-success { background: #142d1e; color: #86efac; border-color: #166534; }

#cx-modal-result { margin-bottom: 8px; }

/* Responsive modale */
@media (max-width: 700px) {
  .cx-modal { padding: 24px 18px; border-radius: 12px; }
  /* iOS : pas de zoom auto au focus (police >= 16px) */
  .cx-modal-field input[type="email"],
  .cx-modal-field input[type="text"],
  .cx-modal-field select,
  .cx-modal-field textarea {
    font-size: 16px;
  }
}

/* ===== Spinner connexion ===== */
#cx-login-spinner {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
#cx-login-spinner.active {
  opacity: 1;
  visibility: visible;
  transition: opacity .2s ease;
}

.cx-login-spinner-box {
  background: var(--surface);
  border-radius: 14px;
  border: 0.5px solid var(--line);
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.cx-login-spinner-ring {
  width: 42px;
  height: 42px;
  border: 3px solid var(--purple-light);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: cx-spin .7s linear infinite;
}

.cx-login-spinner-text {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}