/* 
 * Onboarding Portal — Stylesheet
 * Custom CSS design utilizing a premium light glassmorphism theme and hardware-accelerated animations.
 */

/* ==========================================================================
   1. Design System & CSS Variables (Light Theme Default)
   ========================================================================== */
:root {
  /* Colors */
  --bg-color: #f8fafc;          /* Slate 50 */
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(148, 163, 184, 0.16); /* Slate 400 with opacity */
  
  --text-primary: #0f172a;      /* Slate 900 */
  --text-secondary: #475569;    /* Slate 600 */
  --text-muted: #94a3b8;        /* Slate 400 */

  /* Accent Colors */
  --accent-primary: #4f46e5;    /* Indigo 600 */
  --accent-secondary: #9333ea;  /* Purple 600 */
  --accent-success: #059669;    /* Emerald 600 */

  /* Glow blob opacity */
  --glow-opacity: 0.08;

  /* Fonts */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Gradients Color Interpolation Space Fallbacks */
  --in-oklab: ;
  --in-oklch: ;
}

@supports (linear-gradient(in oklab, white, black)) {
  :root {
    --in-oklab: in oklab;
    --in-oklch: in oklch;
  }
}

/* Optional Dark Theme override if class is present */
.dark-theme {
  --bg-color: #090a0f;
  --card-bg: rgba(17, 19, 31, 0.65);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-primary: #6366f1;
  --accent-secondary: #a855f7;
  --accent-success: #10b981;
  --glow-opacity: 0.15;
}

/* ==========================================================================
   2. Document Resets & Layout
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glowing Ambient Background Orbs */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: var(--glow-opacity);
  z-index: 0;
  pointer-events: none;
  transition: transform 10s ease-in-out, opacity 0.3s ease;
  will-change: transform;
}

.bg-glow-primary {
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: floatOrb1 25s infinite alternate ease-in-out;
}

.bg-glow-secondary {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
  bottom: -15%;
  right: -10%;
  animation: floatOrb2 30s infinite alternate ease-in-out;
}

@keyframes floatOrb1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, 8%) scale(1.1); }
}

@keyframes floatOrb2 {
  0% { transform: translate(0, 0) scale(1.05); }
  100% { transform: translate(-8%, -5%) scale(0.95); }
}

/* ==========================================================================
   3. Main App Container
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 800px;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 10;
  position: relative;
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Header Styles */
.main-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0.5rem;
}

.logo-area {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* Logo Styles */
.logo-box {
  background-color: #ffffff;
  border-radius: 0.85rem;
  padding: 0.55rem 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 4px 20px rgba(15, 23, 42, 0.05),
    0 1px 2px rgba(15, 23, 42, 0.02);
  border: 1.5px solid #0b0f19;
}

.logo-citecase {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.65rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.logo-cite {
  color: #0b0f19;
  font-weight: 800;
  margin-right: 0.05em;
}

.logo-case-pill {
  display: inline-flex;
  align-items: center;
  background-color: #0b0f19;
  color: #ffffff;
  padding: 0.08em 0.48em 0.12em 0.45em;
  border-radius: 9999px;
  line-height: 1;
}

.logo-case {
  font-weight: 800;
  color: inherit;
}

.page-title {
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  max-width: 480px;
  margin: 1rem auto 0 auto;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   4. Form Card (Glassmorphism Frame)
   ========================================================================== */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 
    0 10px 30px rgba(15, 23, 42, 0.06),
    0 1px 3px rgba(255, 255, 255, 0.6) inset;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.dark-theme .form-card {
  box-shadow: 
    0 4px 30px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(255, 255, 255, 0.05) inset;
}

.form-card:hover {
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 
    0 20px 40px rgba(15, 23, 42, 0.1),
    0 1px 3px rgba(255, 255, 255, 0.8) inset;
}

.dark-theme .form-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(255, 255, 255, 0.08) inset;
}

/* Card Header Status Bar */
.card-header {
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.dark-theme .card-header {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.dark-theme .status-indicator {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  animation: pulseDot 2s infinite;
}

.dark-theme .pulse-dot {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

.status-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@keyframes pulseDot {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(5, 150, 105, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
  }
}

/* Iframe Frame container */
.iframe-container {
  width: 100%;
  position: relative;
  background: transparent;
  min-height: 550px;
}

#tally-iframe {
  display: block;
  width: 100%;
  background: transparent;
}

/* Footer Section */
.main-footer {
  text-align: center;
}

.main-footer p {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.025em;
}

/* ==========================================================================
   5. Redirection Overlay & Success Micro-Animations
   ========================================================================== */
.redirect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(248, 250, 252, 0.85); /* Light Overlay */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  
  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.dark-theme .redirect-overlay {
  background-color: rgba(6, 7, 10, 0.85);
}

/* When activated via JS */
.redirect-overlay.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.redirect-modal {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
  border-radius: 1.5rem;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 460px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: transform;
}

.dark-theme .redirect-modal {
  background: rgba(17, 19, 31, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.redirect-overlay.active .redirect-modal {
  transform: scale(1);
}

/* SVG Checkmark Animations */
.success-icon-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.75rem auto;
}

.checkmark-svg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 3.5;
  stroke: var(--accent-success);
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px var(--accent-success);
  animation: fillCircle .4s ease-in-out .4s forwards, scaleUp .3s ease-in-out .9s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3.5;
  stroke-miterlimit: 10;
  stroke: var(--accent-success);
  fill: none;
  animation: strokeCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: strokeCheck 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
}

@keyframes strokeCircle {
  100% { stroke-dashoffset: 0; }
}

@keyframes strokeCheck {
  100% { stroke-dashoffset: 0; }
}

@keyframes fillCircle {
  100% { box-shadow: inset 0px 0px 0px 40px rgba(5, 150, 105, 0.08); }
}

.dark-theme @keyframes fillCircle {
  100% { box-shadow: inset 0px 0px 0px 40px rgba(16, 185, 129, 0.1); }
}

@keyframes scaleUp {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* Modal text */
.redirect-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.redirect-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Linear Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.06);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.dark-theme .progress-bar-container {
  background-color: rgba(255, 255, 255, 0.08);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 9999px;
  background: linear-gradient(to right var(--in-oklch), var(--accent-success), var(--accent-primary));
  transition: width 3.5s linear; /* Matches the JS delay duration */
}

/* ==========================================================================
   6. Collapsible Help Section
   ========================================================================== */
/* ==========================================================================
   6. Collapsible Info & Disclaimer Panels
   ========================================================================== */
.info-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.5rem;
  width: 100%;
}

.info-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.btn-info-toggle {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-info-toggle:hover {
  background-color: #ffffff;
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.dark-theme .btn-info-toggle:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.chevron-icon {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-info-toggle[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.info-panels {
  width: 100%;
  max-width: 580px;
}

.info-content {
  width: 100%;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              margin-top 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.info-content.active {
  opacity: 1;
  max-height: 400px;
  margin-top: 1rem;
}

.info-content-inner {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.03);
}

/* Steps list */
.help-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.help-steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: left;
}

.step-num {
  background: linear-gradient(135deg var(--in-oklch), var(--accent-primary), var(--accent-secondary));
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1em;
}

.step-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Disclaimer Styling */
.disclaimer-box {
  border-left: 4px solid var(--accent-secondary);
}

.disclaimer-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.warning-icon {
  color: var(--accent-secondary);
  font-size: 1.15rem;
  line-height: 1;
}

.disclaimer-bold-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.disclaimer-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.55;
  text-align: left;
}

/* Responsive Overrides */
@media (max-width: 640px) {
  .app-container {
    padding: 1.5rem 1rem;
    gap: 1.25rem;
  }
  
  .logo-text {
    font-size: 1.3rem;
  }

  .form-card {
    border-radius: 1rem;
  }

  .iframe-container {
    min-height: 500px;
  }

  .redirect-modal {
    padding: 2.25rem 1.5rem;
  }

  .info-content {
    max-width: 100%;
  }
}
