/* ============================================================
   TFP CBT Portal — Welcome Page (responsive, footer in flow)
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: auto;
  min-height: 100%;
}

body {
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0a1628;
  color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}

/* ===== HERO — flex column so footer sits in normal flow ===== */
.hero-section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a1628 0%, #1a2a4a 50%, #0d1f3c 100%);
  overflow: hidden;
  padding: 40px 20px 20px;
}

.hero-background {
  position: absolute; inset: 0;
  background-image: url('../img/ppp2.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.08;
  z-index: 0;
  pointer-events: none;
}

/* ===== PARTICLES + SHAPES ===== */
.particles, .floating-shapes {
  position: absolute; inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(79, 172, 254, 0.05);
  animation: floatUp linear infinite;
}
.particle:nth-child(1) { width: 300px; height: 300px; left: -100px; bottom: -100px; animation-duration: 25s; }
.particle:nth-child(2) { width: 200px; height: 200px; right: -50px; top: -50px; animation-duration: 20s; animation-delay: 5s; }
.particle:nth-child(3) { width: 150px; height: 150px; left: 50%; bottom: -50px; animation-duration: 30s; animation-delay: 10s; }
.particle:nth-child(4) { width: 100px; height: 100px; right: 20%; top: 30%; animation-duration: 18s; animation-delay: 3s; }

@keyframes floatUp {
  0%   { transform: translateY(0) scale(0.5); opacity: 0.3; }
  50%  { opacity: 0.6; }
  100% { transform: translateY(-120vh) scale(1.2); opacity: 0; }
}

.shape {
  position: absolute;
  border: 2px solid rgba(79, 172, 254, 0.06);
  border-radius: 50%;
  animation: pulseShape 8s ease-in-out infinite;
}
.shape:nth-child(1) { width: 400px; height: 400px; top: -100px; right: -100px; }
.shape:nth-child(2) { width: 250px; height: 250px; bottom: 50px; left: 50px; animation-delay: 2s; }
.shape:nth-child(3) { width: 150px; height: 150px; top: 30%; left: 20%; animation-delay: 4s; }

@keyframes pulseShape {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50%      { transform: scale(1.1); opacity: 0.6; }
}

/* ===== CONTENT ===== */
.content-container {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 720px;
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  animation: fadeInUp 0.7s ease-out;
  padding-bottom: 16px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Logo ---- */
.logo-container {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}
.logo-container img {
  height: 42px;
  width: auto;
  filter: brightness(0) invert(1);
}
.logo-fallback {
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(79, 172, 254, 0.12);
  border: 1.5px solid rgba(79, 172, 254, 0.5);
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  color: #4facfe;
}
.logo-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

/* ---- Badge — compact, centered, never full-width ---- */
.badge {
  display: inline-flex;
  align-items: center;
  align-self: center;
  width: auto;
  max-width: max-content;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  padding: 5px 16px;
  border-radius: 50px;
  color: #8bb3ff;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin: 0 auto 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.badge i { margin-right: 6px; color: #4facfe; }

/* ---- Heading ---- */
.main-heading {
  color: #fff;
  font-size: clamp(1.5rem, 3.4vh + 1rem, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.main-heading .highlight {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Subtitle ---- */
.subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.85rem, 1.6vh, 0.95rem);
  font-weight: 400;
  line-height: 1.55;
  max-width: 580px;
  margin: 0 auto 16px;
}

/* ---- Features row ---- */
.features {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 500;
}
.feature-item i { color: #4facfe; font-size: 14px; }

/* ---- Cards ---- */
.code-card,
.login-card,
.form-card,
.instructions-card,
.confirm-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px 22px 16px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  text-align: left;
  margin: 0 auto 16px;
  max-width: 620px;
  width: 100%;
}

.code-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #8bb3ff;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.code-card-head i { color: #4facfe; font-size: 13px; }

.code-help {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  margin-bottom: 12px;
}
.code-help code {
  background: rgba(79, 172, 254, 0.08);
  border: 1px solid rgba(79, 172, 254, 0.18);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 11px;
  color: #a6cbff;
  word-break: break-all;
}
.code-help em { color: #4facfe; font-style: normal; }

.code-input-row { display: flex; gap: 8px; }

.code-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  font-size: 13.5px;
  font-family: 'Consolas', 'Menlo', monospace;
  letter-spacing: 0.05em;
  color: #fff;
  background: rgba(10, 22, 40, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.code-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 0.01em;
  font-family: 'Inter', sans-serif;
}
.code-input:focus {
  border-color: #4facfe;
  background: rgba(10, 22, 40, 0.9);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.15);
}
.code-input.invalid {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.12);
}

.code-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, #4facfe, #00c6fb);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.25s, background 0.25s;
  box-shadow: 0 6px 18px rgba(79, 172, 254, 0.35);
}
.code-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(79, 172, 254, 0.5);
  background: linear-gradient(135deg, #3d9ef0, #00b8e8);
}
.code-submit:active { transform: translateY(0); }
.code-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.code-submit i { transition: transform 0.25s; }
.code-submit:hover i { transform: translateX(3px); }

.code-message {
  min-height: 16px;
  font-size: 12px;
  margin-top: 8px;
  color: #ff8a8a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.code-message:empty { display: none; }
.code-message.ok { color: #7ddfb4; }

.code-divider {
  position: relative;
  text-align: center;
  margin: 14px 0;
}
.code-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}
.code-divider span {
  position: relative;
  background: #12233e;
  padding: 0 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-alt {
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
}
.code-alt i { color: #4facfe; margin-right: 5px; }
.code-alt a {
  color: #8bb3ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(139, 179, 255, 0.4);
  word-break: break-all;
}
.code-alt a:hover { color: #4facfe; border-bottom-color: #4facfe; }

/* ---- Bottom strip ---- */
.bottom-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.4);
}
.bottom-strip .trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bottom-strip .trust-badge i { color: #4facfe; font-size: 12px; }
.bottom-strip .sep {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.12);
}
.bottom-strip .admin-link a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.bottom-strip .admin-link a:hover {
  color: #8bb3ff;
  border-bottom-color: #4facfe;
}
.bottom-strip .admin-link i { margin-right: 4px; }

/* ---- Footer — in normal flow, never overlapping ---- */
.footer {
  position: relative;
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  font-size: 11.5px;
  z-index: 2;
  letter-spacing: 0.02em;
  padding: 18px 12px 6px;
  margin-top: auto;
}
.footer a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  transition: color 0.2s;
}
.footer a:hover { color: rgba(255, 255, 255, 0.75); }
.footer .dot { margin: 0 6px; }

/* ---- Loader ---- */
.page-loader {
  position: fixed;
  inset: 0;
  background: #0a1628;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.page-loader.hidden { opacity: 0; visibility: hidden; }
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #4facfe;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LOGIN PAGE SPECIFIC ===== */
.login-card h2 {
  font-size: 1.3rem;
  margin: 0 0 8px;
  color: #fff;
  font-weight: 700;
}
.login-card .lead {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.55;
  margin: 0 0 22px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #8bb3ff;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.field input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  color: #fff;
  background: rgba(10, 22, 40, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus {
  border-color: #4facfe;
  background: rgba(10, 22, 40, 0.9);
  box-shadow: 0 0 0 4px rgba(79, 172, 254, 0.15);
}
.field input.invalid { border-color: #ff6b6b; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.toggle-pw {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 15px;
  cursor: pointer;
  padding: 10px;
  border-radius: 6px;
  transition: color 0.2s;
}
.toggle-pw:hover { color: #4facfe; }

.btn-login {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #4facfe, #00c6fb);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 172, 254, 0.35);
  transition: transform 0.15s, box-shadow 0.25s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}
.btn-login:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(79, 172, 254, 0.5);
}
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.alert-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: #ff9c9c;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.back-link {
  text-align: center;
  margin-top: 18px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.4);
}
.back-link a {
  color: #8bb3ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(139, 179, 255, 0.3);
}
.back-link a:hover {
  color: #4facfe;
  border-bottom-color: #4facfe;
}

.first-time-hint {
  background: rgba(79, 172, 254, 0.06);
  border: 1px solid rgba(79, 172, 254, 0.15);
  color: rgba(255, 255, 255, 0.6);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.55;
  margin-top: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.first-time-hint i {
  color: #4facfe;
  margin-top: 2px;
  flex-shrink: 0;
}
.first-time-hint code {
  background: rgba(79, 172, 254, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 11.5px;
  color: #a6cbff;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 720px) {
  .hero-section {
    padding: 24px 16px 16px;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .features { gap: 12px; }
  .feature-item { font-size: 11.5px; }

  .code-card,
  .login-card,
  .form-card,
  .instructions-card,
  .confirm-card {
    padding: 18px 16px 14px;
  }

  .code-input-row { flex-direction: column; }
  .code-submit { justify-content: center; width: 100%; }

  .bottom-strip { gap: 10px 14px; font-size: 11px; }
  .bottom-strip .sep { display: none; }

  .logo-container img { height: 36px; }
  .logo-mark { width: 34px; height: 34px; font-size: 12px; }
  .logo-name { font-size: 15px; }

  .main-heading { font-size: clamp(1.4rem, 5vw + 0.6rem, 1.9rem); }
  .subtitle { font-size: 0.9rem; }

  .footer {
    font-size: 11px;
    padding: 16px 12px 6px;
  }
}

@media (max-width: 480px) {
  .hero-section { padding: 18px 12px 12px; }
  .main-heading { font-size: 1.35rem; line-height: 1.2; }
  .subtitle { font-size: 0.85rem; }
  .badge { font-size: 10px; padding: 4px 12px; }
  .footer { font-size: 10.5px; }
  .bottom-strip { gap: 8px 12px; }
  .bottom-strip .sep { display: none; }
  .logo-mark { width: 32px; height: 32px; font-size: 11px; }
  .logo-name { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .particle, .shape, .content-container { animation: none !important; }
}