/* ===================================================
   AUTH.CSS — Pages Login & Register
   Même DA que hero: dark card + form blanc
   =================================================== */

.auth-section {
  margin-top: 72px;
  padding: 24px;
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  max-width: 1000px;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 580px;
  box-shadow: var(--shadow-lg);
}

/* ---- Panneau visuel gauche ---- */
.auth-visual {
  background: linear-gradient(135deg, #2d2b3d 0%, #3a3554 30%, #4a4268 60%, #2d2b3d 100%);
  padding: 56px 44px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.auth-visual-content {
  position: relative;
  z-index: 2;
  animation: heroFadeIn 0.8s ease forwards;
}

.auth-visual-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.auth-visual-title em {
  font-style: italic;
  color: #b8acf6;
}

.auth-visual-text {
  font-size: 0.92rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.65);
  max-width: 320px;
}

.auth-visual-deco {
  position: absolute;
  bottom: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 74, 208, 0.25) 0%, transparent 70%);
  z-index: 1;
}

/* ---- Panneau formulaire droite ---- */
.auth-form-side {
  background: var(--surface);
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--section);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  transition: var(--transition);
  text-align: center;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.active) { color: var(--text); }

/* Message feedback */
.auth-message {
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  min-height: 0;
}

.auth-message:empty { display: none; }

.auth-message.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.auth-message.success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ---- Formulaire ---- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.form-group label .optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--section);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  outline: none;
  width: 100%;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #94a3b8;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(94, 74, 208, 0.1);
}

.form-group select {
  appearance: none;
  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 d='M2 4l4 4 4-4' stroke='%23475569' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
}

/* Password toggle */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  padding: 4px;
  color: var(--muted);
  transition: var(--transition);
}

.password-toggle:hover { color: var(--primary); }
.password-toggle svg { width: 18px; height: 18px; }

/* Passkey button */
.btn-passkey {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  margin-bottom: 4px;
}
.btn-passkey-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: var(--primary);
}
.btn-passkey:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(94,74,208,.04);
  box-shadow: 0 2px 10px rgba(94,74,208,.12);
}
.btn-passkey:disabled { opacity: .7; cursor: not-allowed; }

/* Divider between passkey and password */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: .8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Submit button */
.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 50px;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(94, 74, 208, 0.3);
  margin-top: 6px;
  min-height: 50px;
  position: relative;
}

.btn-auth:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(94, 74, 208, 0.35);
}

.btn-auth:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loader */
.btn-auth-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-auth.loading .btn-auth-text { display: none; }
.btn-auth.loading .btn-auth-loader { display: inline-block; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Terms checkbox */
.auth-terms {
  margin-bottom: 4px;
}
.auth-terms-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
  cursor: pointer;
}
.auth-terms-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.auth-terms-label a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-terms-label a:hover { text-decoration: underline; }

/* Switch link */
.auth-switch {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ---- Verification email notice ---- */
.auth-verify-wrap {
  margin-top: 72px;
  min-height: calc(100vh - 72px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
}
.auth-verify-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 44px;
  max-width: 460px; width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.06);
}
.auth-verify-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #7c6fe0);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.auth-verify-icon svg { width: 28px; height: 28px; stroke: #fff; }
.auth-verify-title {
  font-size: 1.4rem; font-weight: 800; color: var(--text);
  margin-bottom: 14px;
}
.auth-verify-desc {
  font-size: .9rem; color: var(--muted); line-height: 1.65;
  margin-bottom: 8px;
}
.auth-verify-note {
  font-size: .82rem; color: var(--muted); margin-bottom: 14px;
}
.auth-verify-box .btn-auth { width: 100%; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .auth-card {
    grid-template-columns: 1fr;
    max-width: 500px;
  }
  .auth-visual { padding: 32px 28px; }
  .auth-visual-title { font-size: 1.4rem; }
  .auth-form-side { padding: 32px 28px; }
}

@media (max-width: 600px) {
  .auth-section { padding: 16px; align-items: flex-start; padding-top: 24px; }
  .auth-visual { padding: 24px 20px; }
  .auth-form-side { padding: 24px 20px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---- Sélecteur de rôle inscription ---- */
.reg-role-picker { margin-bottom: 20px; }
.reg-role-label  { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }

.reg-role-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.reg-role-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 12px; border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background .15s;
  text-align: center;
}

.reg-role-btn svg       { width: 24px; height: 24px; stroke: var(--muted); transition: stroke .15s; }
.reg-role-name          { font-size: .88rem; font-weight: 700; color: var(--text); }
.reg-role-desc          { font-size: .72rem; color: var(--muted); line-height: 1.3; }

.reg-role-btn.active {
  border-color: var(--primary);
  background: rgba(94,74,208,.05);
  box-shadow: 0 0 0 3px rgba(94,74,208,.1);
}
.reg-role-btn.active svg { stroke: var(--primary); }
.reg-role-btn.active .reg-role-name { color: var(--primary); }
