/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body.login-page {
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #F2F4F7;
}

/* ── Subtle warm pattern background ─────────── */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 15% 85%, rgba(37, 99, 235, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 10%, rgba(30, 58, 95, 0.05) 0%, transparent 50%),
    #F2F4F7;
}

@keyframes bgPulse {
  0%   { opacity: 1; }
  100% { opacity: 0.85; }
}

/* ── Wrapper ──────────────────────────────────── */
.login-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 520px;
  padding: 16px;
}

/* ── Login Card ───────────────────────────────── */
.login-card {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.05),
    0 10px 40px rgba(30, 58, 95, 0.10);
  overflow: visible;
  animation: cardEntrance 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── Title Card (pops up on submit) ──────────── */
.title-card {
  background: linear-gradient(160deg, #243B55 0%, #1E3A5F 45%, #162C47 100%);
  border-radius: 18px;
  padding: 22px 28px 20px;
  margin: -1px -1px 0 -1px;
  text-align: center;
  color: #EBF4FF;
  position: relative;
  overflow: hidden;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.5s ease;
  box-shadow: 0 4px 20px rgba(30, 58, 95, 0.35);
}

.title-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  border-radius: inherit;
}

/* The "pop up" state – triggered by JS on submit */
.title-card.pop-up {
  transform: translateY(-28px) scale(1.04);
  box-shadow:
    0 32px 64px rgba(37, 99, 235, 0.35),
    0 0 0 1px rgba(235, 244, 255, 0.2) inset;
}

.title-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.title-card.pop-up .title-icon {
  transform: scale(1.15) rotate(-6deg);
}

.title-card h5 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin-bottom: 3px;
}

.title-card p {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Shimmer sweep on pop-up */
.title-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0s;
}
.title-card.pop-up::after {
  left: 160%;
  transition: left 0.6s ease 0.1s;
}

/* ── Login Body ───────────────────────────────── */
.login-body {
  padding: 28px 36px 36px;
}

/* ── Form Labels ──────────────────────────────── */
.form-label {
  font-family: 'DM Sans', sans-serif;
  color: #374151;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Input Groups ─────────────────────────────── */
.input-group {
  position: relative;
}

.input-group-text {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-right: none;
  color: #475569;
  font-size: 1.05rem;
  padding: 0 14px;
  transition: all 0.2s;
}

.form-control {
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  border-left: none !important;
  color: #111827 !important;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 12px 14px;
  transition: all 0.25s;
}

.form-control::placeholder {
  color: #64748B;
}

.form-control:focus {
  background: #ffffff !important;
  border-color: #2563EB !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
  outline: none;
}

.form-control:focus + .input-group-text,
.input-group:focus-within .input-group-text {
  border-color: #2563EB;
  color: #2563EB;
  background: #ffffff;
}

/* ── Alert (light-mode friendly) ─────────────── */
.alert-danger {
  background: #fff0f0;
  border: 1px solid #f5b8b8;
  color: #c0392b;
  border-radius: 10px;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
}

/* Inline field error (below a specific input) */
.field-error {
  display: block;
  margin-top: 5px;
  font-size: 0.8rem;
  color: #c0392b;
  font-family: 'DM Sans', sans-serif;
}

/* ── Submit Button ────────────────────────────── */
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 60%, #1E40AF 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.35);
}

.btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

.btn-login:active {
  transform: translateY(0);
}

/* Loading spinner state */
.btn-login.loading .btn-text { opacity: 0; }
.btn-login.loading .btn-spinner { opacity: 1; }

.btn-text { transition: opacity 0.2s; }
.btn-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Ripple */
.btn-login .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: rippleAnim 0.6s linear;
  pointer-events: none;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── Divider ──────────────────────────────────── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: #94A3B8;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #E2E8F0;
}

/* ── Input border-radius fix ─────────────────── */
.input-group > .input-group-text:first-child { border-radius: 10px 0 0 10px; }
.input-group > .form-control:last-child       { border-radius: 0 10px 10px 0; }

/* ── Success overlay (after pop-up) ──────────── */
.success-check {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #16A34A;
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 12px;
  animation: fadeSlideUp 0.4s ease both;
}
.success-check.show { display: flex; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
