/* ============================================================
   FORGOT PASSWORD MODAL — styles
   ============================================================
   THEME MATCHING:
   These rules read your existing design tokens first, and only
   fall back to defaults if your login page doesn't define them.
   If your CSS already has e.g. --primary-color, this file will
   automatically match it. Otherwise, edit the fallback values
   below (the second argument in each var(...)) to your palette.
   ============================================================ */

:root {
  --fp-primary: var(--primary-color, var(--primary, #6c63ff));
  --fp-primary-dark: var(--primary-color-dark, var(--primary-dark, #5548e0));
  --fp-text: var(--text-color, var(--text-dark, #1f2333));
  --fp-text-muted: var(--text-muted, var(--text-secondary, #6b7280));
  --fp-surface: var(--surface-color, var(--card-bg, #ffffff));
  --fp-error: var(--error-color, var(--danger-color, #e5484d));
  --fp-success: var(--success-color, #22c55e);
  --fp-radius: var(--border-radius, 16px);
  --fp-font: var(--font-family, "Segoe UI", system-ui, -apple-system, sans-serif);
}

/* ---------------- Overlay ---------------- */
.fp-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 17, 26, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  font-family: var(--fp-font);
}

.fp-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* ---------------- Modal card (glassmorphism) ---------------- */
.fp-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px 32px 30px;
  border-radius: var(--fp-radius);
  background: color-mix(in srgb, var(--fp-surface) 78%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 20px 60px rgba(20, 20, 40, 0.25),
    0 2px 8px rgba(20, 20, 40, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  transform: scale(0.9) translateY(12px);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.28s ease;
}

.fp-overlay.is-open .fp-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ---------------- Close button ---------------- */
.fp-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(120, 120, 140, 0.1);
  color: var(--fp-text-muted);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.fp-close:hover {
  background: rgba(229, 72, 77, 0.12);
  color: var(--fp-error);
  transform: rotate(90deg);
}

/* ---------------- Icon badge ---------------- */
.fp-icon-badge {
  width: 60px;
  height: 60px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--fp-primary), var(--fp-primary-dark));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--fp-primary) 45%, transparent);
  animation: fp-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fp-icon-badge-success {
  background: linear-gradient(135deg, var(--fp-success), #16a34a);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4);
}

@keyframes fp-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------------- Text ---------------- */
.fp-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fp-text);
}

.fp-subtitle {
  margin: 0 0 4px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--fp-text-muted);
}

.fp-subtitle-muted {
  margin-top: 10px;
  font-size: 13px;
}

.fp-sent-email {
  margin: 6px 0 2px;
  text-align: center;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fp-primary);
  word-break: break-all;
}

/* ---------------- Field ---------------- */
.fp-field {
  margin-top: 24px;
}

.fp-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fp-text);
}

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

.fp-input-icon {
  position: absolute;
  left: 16px;
  font-size: 14px;
  color: var(--fp-text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.fp-input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border-radius: 999px;
  border: 1.5px solid rgba(120, 120, 140, 0.22);
  background: rgba(255, 255, 255, 0.55);
  font-size: 14.5px;
  color: var(--fp-text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.fp-input::placeholder {
  color: color-mix(in srgb, var(--fp-text-muted) 70%, transparent);
}

.fp-input:focus {
  border-color: var(--fp-primary);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fp-primary) 15%, transparent);
}

.fp-input-wrap:focus-within .fp-input-icon {
  color: var(--fp-primary);
}

/* Invalid state */
.fp-input-wrap.is-invalid .fp-input {
  border-color: var(--fp-error);
  background: color-mix(in srgb, var(--fp-error) 6%, white);
}

.fp-input-wrap.is-invalid .fp-input-icon {
  color: var(--fp-error);
}

.fp-input-wrap.is-shake {
  animation: fp-shake 0.4s ease;
}

@keyframes fp-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* Inline error message */
.fp-error {
  max-height: 0;
  margin: 0;
  overflow: hidden;
  font-size: 12.5px;
  color: var(--fp-error);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.25s ease;
}

.fp-error.is-visible {
  max-height: 40px;
  margin-top: 7px;
  opacity: 1;
  transform: translateY(0);
}

.fp-error .fa-solid {
  margin-right: 5px;
}

/* ---------------- Buttons ---------------- */
.fp-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

.fp-actions-center {
  justify-content: center;
}

.fp-btn {
  flex: 1;
  position: relative;
  padding: 13px 18px;
  border: none;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.fp-btn:active {
  transform: scale(0.97);
}

.fp-btn-secondary {
  background: rgba(120, 120, 140, 0.1);
  color: var(--fp-text);
}

.fp-btn-secondary:hover {
  background: rgba(120, 120, 140, 0.18);
}

.fp-btn-primary {
  background: linear-gradient(135deg, var(--fp-primary), var(--fp-primary-dark));
  color: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--fp-primary) 40%, transparent);
}

.fp-btn-primary:hover {
  box-shadow: 0 8px 20px color-mix(in srgb, var(--fp-primary) 50%, transparent);
}

.fp-btn-primary:disabled,
.fp-btn-secondary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.fp-btn-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s ease;
}

/* Loading spinner swap */
.fp-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.fp-btn-primary.is-loading .fp-btn-content {
  opacity: 0;
}

.fp-btn-primary.is-loading .fp-spinner {
  opacity: 1;
  visibility: visible;
  animation: fp-spin 0.7s linear infinite;
}

@keyframes fp-spin {
  to { transform: rotate(360deg); }
}

/* ---------------- Panel swap ---------------- */
.fp-panel {
  animation: fp-fade-in 0.3s ease;
}

@keyframes fp-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- Toasts ---------------- */
.fp-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.fp-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 12px;
  background: rgba(30, 32, 45, 0.92);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(10px);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.fp-toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.fp-toast.fp-toast-error i { color: var(--fp-error); }
.fp-toast.fp-toast-success i { color: var(--fp-success); }
.fp-toast i { margin-top: 1px; font-size: 15px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 480px) {
  .fp-modal {
    padding: 30px 22px 24px;
    border-radius: 20px;
  }

  .fp-actions {
    flex-direction: column-reverse;
  }

  .fp-toast-container {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  .fp-modal,
  .fp-icon-badge,
  .fp-panel,
  .fp-toast,
  .fp-close {
    animation: none !important;
    transition: none !important;
  }
}
