/* ============ Sor-sõngo — Module Authentification (CSS) ============ */

.sc-auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000; /* Toujours au-dessus des boutons flottants et autres modales */
  background: rgba(0, 0, 0, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
}

@media (min-width: 580px) {
  .sc-auth-backdrop {
    align-items: center;
    padding: 20px;
  }
}

.sc-auth-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.sc-auth-modal {
  width: 100%;
  max-width: 480px;
  background: var(--card, #ffffff);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  padding: 20px 24px 32px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.05);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  color: var(--text, #1f2937);
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 580px) {
  .sc-auth-modal {
    border-radius: 28px;
    transform: translateY(20px) scale(0.96);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  }
  .sc-auth-backdrop.show .sc-auth-modal {
    transform: translateY(0) scale(1);
  }
}

.sc-auth-backdrop.show .sc-auth-modal {
  transform: translateY(0);
}

/* Fix mode sombre & ardoise : fond complètement adapté au thème */
:root[data-theme="dark"] .sc-auth-modal,
:root[data-theme="dimmed"] .sc-auth-modal,
:root[data-theme="slate"] .sc-auth-modal {
  background: var(--page-solid, #1e293b) !important;
  color: var(--text, #f8fafc) !important;
  border: 1.5px solid var(--border-theme, rgba(255, 255, 255, 0.12)) !important;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sc-auth-modal {
    background: var(--page-solid, #1e293b) !important;
    color: var(--text, #f8fafc) !important;
    border: 1.5px solid var(--border-theme, rgba(255, 255, 255, 0.12)) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
  }
}

.sc-auth-handle {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: rgba(128, 128, 128, 0.3);
  margin: 0 auto 16px;
}

.sc-auth-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.sc-auth-title-group h3 {
  margin: 0 0 4px 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.sc-auth-title-group p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.sc-auth-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.08);
  color: var(--danger, #dc2626);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.sc-auth-close-btn:hover {
  background: rgba(220, 38, 38, 0.18);
  transform: scale(1.08);
}

.sc-auth-close-btn:active {
  transform: scale(0.92);
}

/* Commutateur de mode (Tabs) */
.sc-auth-tabs {
  display: flex;
  background: var(--track, #ecebe7);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 20px;
  position: relative;
}

.sc-auth-tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  outline: none;
}

.sc-auth-tab-btn.active {
  background: var(--card, #ffffff);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-weight: 700;
}

:root[data-theme="dark"] .sc-auth-tab-btn.active {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Formulaire & Champs */
.sc-auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sc-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.sc-auth-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sc-auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.sc-auth-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-soft);
  pointer-events: none;
  z-index: 2;
}

/* Bouton oeil mot de passe */
.sc-auth-eye-btn {
  position: absolute;
  right: 12px;
  z-index: 2;
  background: transparent;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.sc-auth-eye-btn:hover {
  color: var(--text);
  background: rgba(128, 128, 128, 0.15);
}

.sc-auth-input {
  width: 100%;
  padding: 12px 42px 12px 42px;
  font-size: 0.95rem;
  border-radius: 14px;
  border: 1.5px solid var(--border, #d4d0c7);
  background: var(--track, #ecebe7);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
}

/* Raffinement de l'épaisseur du focus (2px subtil) */
.sc-auth-input:focus {
  border-color: var(--accent, #1f7a5c);
  background: var(--card, #ffffff);
  box-shadow: 0 0 0 2px var(--accent-glow, rgba(31, 122, 92, 0.25));
}

.sc-auth-input.error {
  border-color: var(--danger, #d64545) !important;
  box-shadow: 0 0 0 2px rgba(214, 69, 69, 0.2) !important;
}

/* Feedback d'erreur ou d'info */
.sc-auth-feedback {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 10px;
  line-height: 1.35;
}

.sc-auth-feedback.show {
  display: flex;
}

.sc-auth-feedback.error {
  background: var(--danger-soft, #fdecec);
  color: var(--danger, #d64545);
  border: 1px solid rgba(214, 69, 69, 0.3);
}

.sc-auth-feedback.success {
  background: var(--accent-soft, #e3f0ea);
  color: var(--accent, #1f7a5c);
  border: 1px solid rgba(31, 122, 92, 0.3);
}

/* Boutons de soumission - sans surbrillance / sans ombre externe */
.sc-auth-submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 16px;
  border: none;
  background: var(--accent, #1f7a5c);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none !important; /* Retrait de la surbrillance / brillance */
  transition: transform 0.18s ease, background-color 0.18s ease;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sc-auth-submit-btn:hover {
  background: var(--accent-hi, #27946f);
  transform: translateY(-1px);
  box-shadow: none !important;
}

.sc-auth-submit-btn:active {
  transform: scale(0.98);
}

.sc-auth-toggle-link {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-top: 14px;
}

.sc-auth-toggle-link button {
  background: none;
  border: none;
  color: var(--accent, #1f7a5c);
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
  font-size: inherit;
}

/* Bouton Flottant de Test */
.sc-auth-test-fab {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 30px;
  background: var(--accent, #1f7a5c);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 24px var(--accent-glow, rgba(31, 122, 92, 0.4));
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 700;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

.sc-auth-test-fab:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 10px 30px var(--accent-glow, rgba(31, 122, 92, 0.5));
}

.sc-auth-test-fab:active {
  transform: scale(0.94);
}

.sc-auth-test-fab svg {
  width: 20px;
  height: 20px;
}

/* Styles spécifiques au mode clair uniquement */
:root:not([data-theme="dark"]):not([data-theme="dimmed"]):not([data-theme="slate"]) .sc-auth-modal {
  background: #ffffff !important;
  border-radius: 28px 28px 0 0 !important;
  padding: 24px 22px 36px !important;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  color: #1e293b !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

:root:not([data-theme="dark"]):not([data-theme="dimmed"]):not([data-theme="slate"]) .sc-auth-handle {
  width: 44px !important;
  height: 5px !important;
  border-radius: 3px !important;
  background: #cbd5e1 !important;
  margin: 0 auto 20px !important;
}

:root:not([data-theme="dark"]):not([data-theme="dimmed"]):not([data-theme="slate"]) .sc-auth-title-group h3 {
  font-size: 1.22rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
}

:root:not([data-theme="dark"]):not([data-theme="dimmed"]):not([data-theme="slate"]) .sc-auth-input {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 16px !important;
  padding: 14px 44px 14px 44px !important;
  font-size: 0.95rem !important;
  color: #0f172a !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02) !important;
  transition: all 0.2s ease !important;
}

:root:not([data-theme="dark"]):not([data-theme="dimmed"]):not([data-theme="slate"]) .sc-auth-input:focus {
  background: #ffffff !important;
  border-color: var(--accent, #0284c7) !important;
  box-shadow: 0 0 0 4px var(--accent-soft, rgba(2, 132, 199, 0.15)) !important;
}

:root:not([data-theme="dark"]):not([data-theme="dimmed"]):not([data-theme="slate"]) .sc-auth-submit-btn {
  background: linear-gradient(135deg, var(--accent, #0284c7) 0%, color-mix(in srgb, var(--accent) 85%, #000000 15%) 100%) !important;
  color: #ffffff !important;
  border-radius: 18px !important;
  padding: 14px 20px !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  box-shadow: 0 6px 20px var(--accent-soft, rgba(2, 132, 199, 0.35)) !important;
  border: none !important;
}
