/* ============================================================
   KeyZen — Authentification admin (v11.1)
   ============================================================ */

/* ---- État de chargement (spinner) ---- */
.admin-gate-loading {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  color: var(--text-soft);
}
.admin-gate-spinner {
  width: 36px;
  height: 36px;
  border: 2.5px solid rgba(9, 71, 19, 0.15);
  border-top-color: var(--accent, #094713);
  border-radius: 50%;
  animation: admin-gate-spin 0.85s linear infinite;
}
@keyframes admin-gate-spin {
  to { transform: rotate(360deg); }
}

/* ---- Écran de login plein écran ---- */
.admin-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem clamp(1rem, 4vw, 2rem);
  background: linear-gradient(180deg, var(--sand-50, #f5f0e6) 0%, var(--sand-100, #ebe2cf) 100%);
}
.admin-gate-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 16px;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  box-shadow: 0 4px 12px rgba(9, 71, 19, 0.06), 0 24px 64px rgba(9, 71, 19, 0.12);
  border: 1px solid rgba(9, 71, 19, 0.08);
}
.admin-gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-serif, Fraunces, serif);
  font-size: 1rem;
  color: var(--text, #1a1a1a);
}
.admin-gate-brand img {
  width: 40px;
  height: 40px;
  display: block;
}
.admin-gate-title {
  font-family: var(--font-serif, Fraunces, serif);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 0.75rem;
  color: var(--text, #1a1a1a);
}
.admin-gate-lead {
  color: var(--text-soft, #5a5751);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 1.75rem;
}
.admin-gate-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.admin-gate-label {
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft, #5a5751);
  font-weight: 600;
  margin-bottom: -0.35rem;
}
.admin-gate-input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-family: var(--font-sans, Inter, sans-serif);
  background: var(--sand-50, #f5f0e6);
  border: 1.5px solid rgba(9, 71, 19, 0.15);
  border-radius: 10px;
  color: var(--text, #1a1a1a);
  transition: all 180ms;
  letter-spacing: 0.08em;
}
.admin-gate-input:focus {
  outline: none;
  border-color: var(--accent, #094713);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #094713) 12%, transparent);
}
.admin-gate-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.admin-gate-error {
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, #b13a2a 8%, transparent);
  border: 1px solid color-mix(in srgb, #b13a2a 30%, transparent);
  border-radius: 8px;
  color: #7a2519;
  font-size: 0.88rem;
  line-height: 1.4;
}
.admin-gate-submit {
  width: 100%;
  justify-content: center;
  padding: 0.95rem 1.25rem;
  font-size: 0.92rem;
  margin-top: 0.5rem;
}
.admin-gate-hint {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(9, 71, 19, 0.08);
  font-size: 0.78rem;
  color: var(--text-soft, #5a5751);
  line-height: 1.55;
}
.admin-gate-hint code {
  background: rgba(9, 71, 19, 0.06);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent, #094713);
}

/* ---- Badge session + boutons dans la topbar admin ---- */
.admin-auth-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.admin-auth-status-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(9, 71, 19, 0.15);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-soft, #5a5751);
  cursor: pointer;
  transition: all 150ms;
  font-family: inherit;
}
.admin-auth-status-btn:hover:not(:disabled) {
  color: var(--accent, #094713);
  border-color: var(--accent, #094713);
  background: color-mix(in srgb, var(--accent, #094713) 5%, transparent);
}
.admin-auth-status-logout:hover:not(:disabled) {
  color: #b13a2a;
  border-color: #b13a2a;
  background: color-mix(in srgb, #b13a2a 5%, transparent);
}
.admin-auth-status-btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 600px) {
  .admin-auth-status-btn { padding: 0.4rem 0.6rem; font-size: 0.72rem; }
  .admin-auth-status-btn span[aria-hidden] { display: none; }
}

/* ---- Modale changement de mot de passe ---- */
.change-password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 71, 19, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: cpw-fade-in 180ms ease-out;
}
@keyframes cpw-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.change-password-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 14px;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.28);
  animation: cpw-slide-up 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
  max-height: calc(100vh - 2.5rem);
  overflow-y: auto;
}
@keyframes cpw-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.change-password-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-soft, #5a5751);
  transition: background 150ms;
}
.change-password-close:hover {
  background: rgba(9, 71, 19, 0.08);
  color: var(--text, #1a1a1a);
}
.change-password-title {
  font-family: var(--font-serif, Fraunces, serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--text, #1a1a1a);
}
.change-password-lead {
  color: var(--text-soft, #5a5751);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 1.5rem;
}
.change-password-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.change-password-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.change-password-field label {
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft, #5a5751);
  font-weight: 600;
}
.change-password-field input {
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-family: var(--font-sans, Inter, sans-serif);
  background: var(--sand-50, #f5f0e6);
  border: 1.5px solid rgba(9, 71, 19, 0.15);
  border-radius: 8px;
  transition: all 150ms;
  color: var(--text, #1a1a1a);
}
.change-password-field input:focus {
  outline: none;
  border-color: var(--accent, #094713);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #094713) 10%, transparent);
}
.change-password-strength {
  font-size: 0.75rem;
  font-weight: 500;
  padding-left: 0.25rem;
}
.change-password-error {
  padding: 0.7rem 0.9rem;
  background: color-mix(in srgb, #b13a2a 8%, transparent);
  border: 1px solid color-mix(in srgb, #b13a2a 25%, transparent);
  border-radius: 8px;
  color: #7a2519;
  font-size: 0.85rem;
  line-height: 1.4;
}
.change-password-success {
  padding: 1rem 1.15rem;
  background: color-mix(in srgb, #2f5a36 8%, transparent);
  border: 1px solid color-mix(in srgb, #2f5a36 25%, transparent);
  border-radius: 8px;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.change-password-success > span {
  font-size: 1.35rem;
  line-height: 1;
}
.change-password-success strong {
  display: block;
  color: #1e3d24;
  margin-bottom: 0.15rem;
}
.change-password-success p {
  margin: 0;
  color: var(--text-soft, #5a5751);
  font-size: 0.85rem;
}
.change-password-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
@media (max-width: 480px) {
  .change-password-actions { flex-direction: column-reverse; }
  .change-password-actions .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   Bandeau d'alerte "Mode local uniquement" (v11.1)
   ============================================================ */
.admin-local-banner {
  background: linear-gradient(90deg, #7a2519 0%, #b13a2a 100%);
  color: #fff;
  padding: 1rem clamp(1rem, 3vw, 1.5rem);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  box-shadow: 0 4px 12px rgba(122, 37, 25, 0.25);
}
.admin-local-banner-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}
.admin-local-banner-body { flex: 1; min-width: 0; }
.admin-local-banner-title {
  font-family: var(--font-serif, Fraunces, serif);
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
  color: #fff;
}
.admin-local-banner-text {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
}
.admin-local-banner-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.admin-local-banner-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: 999px;
}
.admin-local-banner-actions .btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: #fff;
}
.admin-local-banner-actions .btn-primary {
  background: #fff;
  color: #7a2519;
  border-color: #fff;
  font-weight: 600;
}
.admin-local-banner-actions .btn-primary:hover {
  background: #f5f0e6;
  color: #7a2519;
}

/* ============================================================
   Bandeau succès migration (v11.1)
   ============================================================ */
.admin-migrate-result {
  padding: 0.9rem 1.15rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.admin-migrate-result-ok {
  background: color-mix(in srgb, #2f5a36 10%, transparent);
  border: 1px solid color-mix(in srgb, #2f5a36 30%, transparent);
  color: #1e3d24;
}
.admin-migrate-result-err {
  background: color-mix(in srgb, #b13a2a 10%, transparent);
  border: 1px solid color-mix(in srgb, #b13a2a 30%, transparent);
  color: #7a2519;
}
.admin-migrate-result strong { display: block; margin-bottom: 0.2rem; }
