/* ============================================================
   FerruciSegMed SST — Auth Pages CSS
   Modern Glassmorphism Design
   ============================================================ */

/* ─── Auth Body ──────────────────────────────────────────── */
.auth-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  background-size: 400% 400%;
  position: relative;
  overflow: hidden;
  padding: 1rem;
  animation: gradientShift 12s ease infinite;
}

/* Animated background gradient */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Decorative background orbs */
.auth-body::before,
.auth-body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: floatOrb 8s ease-in-out infinite;
}

.auth-body::before {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(48,71,122,.18) 0%, transparent 70%);
  top: -120px;
  right: -120px;
  animation-delay: 0s;
}

.auth-body::after {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(124,58,237,.15) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  animation-delay: -4s;
}

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

/* ─── Auth Container ─────────────────────────────────────── */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

/* ─── Auth Card ──────────────────────────────────────────── */
.auth-card {
  background: var(--white, #ffffff);
  width: 100%;
  max-width: 420px;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow:
    0 25px 50px -12px rgba(0,0,0,.45),
    0 0 0 1px rgba(255,255,255,.08);
  border: 1px solid rgba(226,232,240,.6);
  position: relative;
  overflow: hidden;
  animation: cardEntrance .45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(48,71,122,.06) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(24px) scale(.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Auth Logo ──────────────────────────────────────────── */
.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #30477a 0%, #4a6aa5 100%);
  border-radius: 16px;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(48,71,122,.4), 0 0 0 4px rgba(48,71,122,.1);
  margin-bottom: .9rem;
  transition: transform .2s ease, box-shadow .2s ease;
}

.auth-logo-icon:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 30px rgba(48,71,122,.5), 0 0 0 4px rgba(48,71,122,.12);
}

.auth-logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--dark, #0f172a);
  letter-spacing: -.6px;
  margin: 0;
  line-height: 1.2;
}

.auth-logo-sub {
  display: block;
  color: var(--secondary, #64748b);
  font-size: .82rem;
  margin-top: .3rem;
  font-weight: 400;
  letter-spacing: .01em;
}

/* ─── Auth Form ──────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-top: 1.5rem;
}

/* Form Group spacing within auth */
.auth-form .form-group {
  margin-bottom: 1rem;
}

/* Form label enhancements */
.auth-form .form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: .4rem;
  letter-spacing: .01em;
}

.form-label-link {
  font-size: .75rem;
  font-weight: 500;
  color: #30477a;
  transition: color .15s;
}

.form-label-link:hover {
  color: #263862;
  text-decoration: underline;
}

/* Form inputs — aligned with app.css design tokens */
.auth-form .form-input {
  width: 100%;
  padding: .6rem .9rem;
  font-size: .9rem;
  background: var(--bg, #f8fafc);
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 10px;
  color: var(--dark, #0f172a);
  transition: border-color .18s, box-shadow .18s, background .18s;
  outline: none;
  line-height: 1.5;
}

.auth-form .form-input:focus {
  background: var(--white, #fff);
  border-color: var(--primary, #30477a);
  box-shadow: 0 0 0 3px rgba(48,71,122,.12);
}

.auth-form .form-input::placeholder {
  color: var(--secondary, #94a3b8); /* contrast ~4.6:1 WCAG AA */
}

/* Input group (password with eye) */
.input-group {
  position: relative;
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  padding-right: 2.8rem;
}

.input-addon {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .95rem;
  color: #94a3b8;
  border-radius: 0 10px 10px 0;
  transition: color .15s;
  padding: 0;
}

.input-addon:hover {
  color: #30477a;
}

/* Primary button full-width */
.btn-full {
  width: 100%;
  justify-content: center;
}

.auth-form .btn-primary,
.auth-form .btn.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  padding: .72rem 1.5rem;
  font-size: .95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #30477a 0%, #263862 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, filter .15s;
  box-shadow: 0 4px 14px rgba(48,71,122,.35);
  letter-spacing: .01em;
  margin-top: .4rem;
}

.auth-form .btn-primary:hover,
.auth-form .btn.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(48,71,122,.45);
}

.auth-form .btn-primary:active,
.auth-form .btn.btn-primary:active {
  transform: translateY(0);
  filter: brightness(.97);
}

.auth-form .btn-primary:disabled,
.auth-form .btn.btn-primary:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

/* ─── Auth Links ─────────────────────────────────────────── */
.auth-links {
  text-align: center;
  margin-top: 1.25rem;
}

.auth-link-small {
  font-size: .78rem;
  color: #94a3b8;
  transition: color .15s;
}

.auth-link-small:hover {
  color: #30477a;
}

/* ─── Auth Footer ────────────────────────────────────────── */
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: rgba(255,255,255,.3);
  font-size: .75rem;
  position: relative;
  z-index: 1;
}

.auth-footer a {
  color: rgba(255,255,255,.4);
}

.auth-footer a:hover {
  color: rgba(255,255,255,.6);
}

/* ─── Alerts inside card ─────────────────────────────────── */
.auth-card .alert {
  padding: .7rem 1rem;
  border-radius: 10px;
  font-size: .85rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}

.auth-card .alert-danger {
  background: var(--color-danger-50, #fef2f2);
  color: var(--color-danger-700, #b91c1c);
  border-color: var(--color-danger-100, #fecaca);
}

.auth-card .alert-success {
  background: var(--color-success-50, #f0fdf4);
  color: var(--color-success-600, #15803d);
  border-color: var(--color-success-100, #bbf7d0);
}

.auth-card .alert-warning {
  background: var(--color-warning-50, #fffbeb);
  color: var(--color-warning-600, #b45309);
  border-color: var(--color-warning-100, #fde68a);
}

.auth-card .alert-info {
  background: var(--color-info-50, #eff6ff);
  color: var(--color-info-600, #1d4ed8);
  border-color: var(--color-info-100, #bfdbfe);
}

/* ─── OTP / 2FA ──────────────────────────────────────────── */
.otp-input {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: .7rem;
  font-family: var(--font-mono, 'SF Mono', 'Fira Code', monospace);
  padding: .8rem 1rem .8rem 1.7rem;
  background: var(--bg, #f8fafc);
  border: 2px solid var(--border, #e2e8f0);
  border-radius: 12px;
  color: var(--dark, #0f172a);
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
}

.otp-input:focus {
  background: var(--white, #fff);
  border-color: var(--primary, #30477a);
  box-shadow: 0 0 0 3px rgba(48,71,122,.12);
  outline: none;
}

.otp-timer {
  text-align: center;
  font-size: .8rem;
  color: #94a3b8;
  margin-top: .6rem;
}

/* ─── Security icon wrapper ──────────────────────────────── */
.auth-security-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #0ea5e9 0%, #30477a 100%);
  border-radius: 16px;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(14,165,233,.4), 0 0 0 4px rgba(14,165,233,.1);
  margin-bottom: .9rem;
}

/* ─── Back link ──────────────────────────────────────────── */
.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 1.5rem;
  transition: color .15s, gap .15s;
  text-decoration: none;
}

.auth-back-link:hover {
  color: #30477a;
  gap: .5rem;
}

.auth-back-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ─── Section Label ─────────────────────────────────────── */
.auth-section-label {
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: -.5rem 0 1.25rem;
  padding: .35rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  display: inline-block;
  width: 100%;
  box-sizing: border-box;
  background: #f8fafc;
}
[data-theme="dark"] .auth-section-label {
  color: #475569;
  border-color: #1e293b;
  background: #0f172a;
}

/* ─── Divider ────────────────────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: #cbd5e1;
  font-size: .75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ─── Dark Mode ──────────────────────────────────────────── */
[data-theme="dark"] .auth-body {
  background: linear-gradient(135deg, #0b1120 0%, #1e2a42 50%, #0b1120 100%);
  background-size: 400% 400%;
}
[data-theme="dark"] .auth-body::before {
  background: radial-gradient(circle, rgba(48,71,122,.18) 0%, transparent 70%);
}
[data-theme="dark"] .auth-body::after {
  background: radial-gradient(circle, rgba(74,106,165,.15) 0%, transparent 70%);
}
[data-theme="dark"] .auth-card {
  background: #0f172a;
  border-color: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.03);
}
[data-theme="dark"] .auth-card::before {
  background: radial-gradient(circle, rgba(48,71,122,.06) 0%, transparent 70%);
}
[data-theme="dark"] .auth-logo-text { color: #e2e8f0; }
[data-theme="dark"] .auth-logo-sub { color: #94a3b8; }
[data-theme="dark"] .auth-form .form-label { color: #cbd5e1; }
[data-theme="dark"] .form-label-link { color: #5b7fc7; }
[data-theme="dark"] .form-label-link:hover { color: #7b9de0; }
[data-theme="dark"] .auth-form .form-input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .auth-form .form-input:focus { background: #1e293b; border-color: #5b7fc7; box-shadow: 0 0 0 3px rgba(91,127,199,.12); }
[data-theme="dark"] .auth-form .form-input::placeholder { color: #475569; }
[data-theme="dark"] .input-addon { color: #64748b; }
[data-theme="dark"] .input-addon:hover { color: #5b7fc7; }
[data-theme="dark"] .auth-form .btn-primary,
[data-theme="dark"] .auth-form .btn.btn-primary { background: linear-gradient(135deg, #30477a 0%, #263862 100%); box-shadow: 0 4px 14px rgba(48,71,122,.35); }
[data-theme="dark"] .auth-form .btn-primary:hover,
[data-theme="dark"] .auth-form .btn.btn-primary:hover { box-shadow: 0 6px 20px rgba(48,71,122,.45); }
[data-theme="dark"] .auth-link-small { color: #64748b; }
[data-theme="dark"] .auth-link-small:hover { color: #5b7fc7; }
[data-theme="dark"] .auth-card .alert-danger { background: #2d1b1b; color: #f87171; border-color: #4a1c1c; }
[data-theme="dark"] .auth-card .alert-success { background: #0d3326; color: #34d399; border-color: #065f46; }
[data-theme="dark"] .auth-card .alert-warning { background: #3d2e0a; color: #fbbf24; border-color: #92400e; }
[data-theme="dark"] .auth-card .alert-info { background: #172554; color: #60a5fa; border-color: #1e40af; }
[data-theme="dark"] .otp-input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .otp-input:focus { background: #1e293b; border-color: #5b7fc7; box-shadow: 0 0 0 3px rgba(91,127,199,.12); }
[data-theme="dark"] .auth-divider { color: #334155; }
[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after { background: #1e293b; }
[data-theme="dark"] .auth-back-link { color: #64748b; }
[data-theme="dark"] .auth-back-link:hover { color: #5b7fc7; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .auth-container { padding: 1rem; align-items: flex-start; padding-top: 2rem; }
  .auth-card {
    padding: 1.75rem 1.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 100%;
  }
  .auth-logo-text { font-size: 1.2rem; }
  .auth-title { font-size: 1.15rem; }
  .auth-subtitle { font-size: .85rem; }
}

@media (max-width: 480px) {
  .auth-container { padding: .75rem; padding-top: 1.5rem; }
  .auth-card {
    padding: 1.5rem 1.25rem;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.1);
  }

  .auth-logo-icon,
  .auth-security-icon {
    width: 52px;
    height: 52px;
    font-size: 1.7rem;
    border-radius: 14px;
  }

  .otp-input {
    font-size: 1.8rem;
    letter-spacing: .5rem;
  }

  /* Prevent iOS font size zoom on focus */
  input, select, textarea { font-size: 1rem !important; }

  .auth-btn { min-height: 48px; font-size: .95rem; }
  .auth-divider { margin: 1rem 0; }
  .auth-back-link { font-size: .82rem; }
}

@media (max-width: 360px) {
  .auth-card { padding: 1.25rem 1rem; }
  .auth-logo-text { font-size: 1rem; }
}
