/* ClientEngine Waitlist Web Style Guide */
/* Core Theme & Typography - Light Atmosphere by Default */
:root, html[data-theme="light"] {
  --bg: #F3F4F6;
  --bg-card: rgba(255, 255, 255, 0.76);
  --bg-input: #FFFFFF;
  --border: rgba(15, 23, 42, 0.08);
  --border-focus: rgba(47, 107, 255, 0.6);
  
  --brand: #2F6BFF;
  --brand-dim: rgba(47, 107, 255, 0.1);
  --brand-glow: rgba(47, 107, 255, 0.15);
  
  --text-1: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;
  --success: #059669;
  --error: #E11D48;
  
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

/* Dark Theme Overrides */
html[data-theme="dark"] {
  --bg: #06090e;
  --bg-card: rgba(28, 41, 62, 0.97);
  --bg-input: rgba(8, 12, 20, 0.95);
  --border: rgba(255, 255, 255, 0.22);
  --border-focus: rgba(47, 107, 255, 0.5);
  
  --brand: #2F6BFF;
  --brand-dim: rgba(47, 107, 255, 0.12);
  --brand-glow: rgba(47, 107, 255, 0.25);
  
  --text-1: #F3F4F6;
  --text-2: #A0AEC0;
  --text-3: #4A5568;
  --success: #10F0A0;
  --error: #FF4A5A;
}

/* Smooth theme transitioning */
body, 
.form-card, 
.social-card, 
input[type="text"], 
input[type="email"], 
select,
label,
.multiselect-trigger,
.multiselect-dropdown,
.multiselect-option {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Constellation Canvas Layer */
#cvs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto; /* Enable mouse hover/interaction */
}

/* Top Fixed Navbar (Logo Mismatch Fix - Always Dark #06090e) */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: #06090e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.navbar-logo {
  display: flex;
  align-items: center;
}

.navbar-logo img {
  height: 32px;
  width: auto;
  display: block;
}

/* Controls inside Fixed Navbar (Always Dark background, so buttons remain styled light) */
.navbar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #A0AEC0;
}

.theme-toggle-btn:hover {
  color: #2F6BFF;
  border-color: rgba(47, 107, 255, 0.5);
  background: rgba(47, 107, 255, 0.12);
}

.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Sun/Moon visibilities based on root theme */
html[data-theme="light"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }

.lang-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 3px;
}

.lang-btn {
  background: none;
  border: none;
  color: #718096;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  font-family: var(--font);
}

.lang-btn.active {
  background: #2F6BFF;
  color: #FFF;
  box-shadow: 0 2px 8px rgba(47, 107, 255, 0.25);
}

/* Main Container Setup */
.container {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 64px 60px 0 60px; /* Top padding to prevent overlapping with fixed navbar */
  align-items: center;
}

/* Two Column Layout (63% Left space for animation, 37% Right space for form card) */
.left-col {
  width: 63%;
  height: 100%;
  pointer-events: none; /* Let pointer events pass through to canvas */
}

.right-col {
  width: 37%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}

/* Flex Wrapper for right column content (Form Card + Social Card) */
.right-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 410px;
  z-index: 5;
}

/* Centered Discrete Page Footer */
.page-footer {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
  font-family: var(--font);
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.page-footer a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.page-footer a:hover {
  color: var(--brand);
}

.footer-separator {
  color: var(--border);
  user-select: none;
}

/* Right Column - Registration Form Card */
.form-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-height: 520px;
  position: relative;
}

.form-header {
  margin-bottom: 16px;
}

.form-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  color: var(--text-1);
  text-align: center;
}

.form-subtitle {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.45;
}

/* Simplified Stacking Form Controls */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-2);
}

input[type="text"],
input[type="email"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-1);
  font-family: var(--font);
  font-size: 13.5px;
  width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(47, 107, 255, 0.12);
}

/* Custom Multiselect Elements */
.multiselect-container {
  position: relative;
}

.multiselect-trigger {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23A0AEC0' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}

html[data-theme="light"] .multiselect-trigger {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

.multiselect-dropdown {
  position: absolute;
  bottom: 100%; /* Opens upwards to prevent overflow in restricted card height */
  left: 0;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  border-radius: 8px;
  margin-bottom: 6px;
  max-height: 160px;
  overflow-y: auto;
  z-index: 15;
  display: none;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.4);
  padding: 6px;
}

.multiselect-dropdown.open {
  display: block;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
}

.multiselect-option:hover {
  background: var(--brand-dim);
  color: var(--text-1);
}

.multiselect-option input {
  cursor: pointer;
}

/* Checkbox Styles */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--brand);
}

.checkbox-label a {
  color: var(--brand);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.checkbox-label a:hover {
  opacity: 0.8;
}

/* Submit Button */
.btn-submit {
  width: 100%;
  background: var(--brand);
  color: #FFF;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--brand-dim);
}

.btn-submit:hover {
  background: #407BFF;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--brand-glow);
}

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

.btn-submit:disabled {
  background: var(--text-3);
  color: var(--text-2);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Secondary Social Cards Row & Buttons */
.social-cards-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.social-card-btn {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.social-card-btn:hover {
  color: #FFF;
  border-color: var(--brand);
  background: var(--brand-dim);
  transform: translateY(-3px);
  box-shadow: 0 12px 24px var(--brand-glow);
}

html[data-theme="light"] .social-card-btn:hover {
  color: var(--brand);
  background: var(--brand-dim);
}

.social-card-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  transition: transform 0.3s ease, color 0.3s ease;
}

/* Success & Error Messages */
.response-msg {
  display: none;
  padding: 11px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 12px;
}

.response-msg.success {
  display: flex;
  background: rgba(16, 240, 160, 0.08);
  border: 1px solid rgba(16, 240, 160, 0.25);
  color: var(--success);
}

.response-msg.error {
  display: flex;
  background: rgba(255, 74, 90, 0.08);
  border: 1px solid rgba(255, 74, 90, 0.25);
  color: var(--error);
}

/* Loading Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #FFF;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

/* Collapsible Form for Mobile Devices */
.form-collapsible {
  overflow: visible;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s ease, 
              margin-bottom 0.4s ease;
}

/* Responsive Adaptations */
@media (max-width: 1024px) {
  .container {
    padding: 64px 40px 0 40px;
  }
  .left-col {
    width: 55%;
  }
  .right-col {
    width: 45%;
  }
}

@media (max-width: 820px) {
  body {
    overflow: hidden;
  }
  .navbar {
    padding: 0 24px;
    height: 56px;
  }
  .navbar-logo img {
    height: 26px;
  }
  .navbar-controls {
    gap: 8px;
  }
  .theme-toggle-btn {
    width: 32px;
    height: 32px;
  }
  .lang-toggle {
    padding: 2px;
  }
  .lang-btn {
    padding: 4px 10px;
    font-size: 10px;
  }
  .container {
    flex-direction: column;
    justify-content: center;
    padding: 72px 24px 24px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .left-col {
    display: none;
  }
  .right-col {
    width: 100%;
    height: auto;
    min-height: 100%;
    justify-content: center;
    display: flex;
    align-items: center;
  }
  .right-content-wrapper {
    max-width: 380px;
    gap: 12px;
    width: 100%;
  }
  .form-card {
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .form-collapsible {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-bottom: 0;
    pointer-events: none;
  }
  .form-collapsible.expanded {
    max-height: 520px;
    opacity: 1;
    overflow: visible;
    margin-bottom: 16px;
    pointer-events: auto;
  }
  .social-card-btn {
    width: 52px;
    height: 52px;
  }
  .social-card-btn svg {
    width: 20px;
    height: 20px;
  }
  .page-footer {
    bottom: 12px;
    font-size: 10.5px;
    padding: 6px 16px;
    width: auto;
    max-width: calc(100% - 32px);
  }
}

/* Legal Page Styling (Two-column sidebar & cards layout) */
.legal-body {
  height: auto;
  overflow-y: auto;
  background: var(--bg);
}

.legal-nav {
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: #06090e;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
}

.legal-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.legal-container {
  max-width: 1280px;
  margin: 80px auto 0;
  padding: 24px 40px 80px;
}

.legal-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.legal-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-1);
}

.legal-meta {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--mono);
}

.legal-layout {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  align-items: flex-start;
}

.legal-sidebar {
  width: 280px;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
}

.legal-sidebar::-webkit-scrollbar {
  width: 4px;
}
.legal-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar-link {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.sidebar-link:hover {
  background: var(--brand-dim);
  color: var(--text-1);
}

.sidebar-link.active {
  background: var(--brand);
  color: #FFF;
  box-shadow: 0 4px 12px var(--brand-glow);
}

.legal-content-area {
  flex: 1;
  max-width: 880px;
}

.legal-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.02);
  scroll-margin-top: 96px; /* Offset for smooth scroll top alignment */
}

.legal-card h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-1);
  margin-top: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.legal-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin-top: 18px;
  margin-bottom: 8px;
}

.legal-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 12px;
}

.legal-card p.legal-intro {
  font-size: 14px;
  line-height: 1.65;
}

.legal-card ul, .legal-card ol {
  margin-left: 20px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}

.legal-card li {
  margin-bottom: 6px;
}

.legal-card strong {
  color: var(--text-1);
}

.legal-card code {
  font-family: var(--mono);
  background: var(--brand-dim);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--brand);
}

@media (max-width: 820px) {
  .legal-nav-inner {
    padding: 0 24px;
  }
  .legal-container {
    padding: 20px 24px 80px;
  }
  .legal-layout {
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
  }
  .legal-sidebar {
    width: 100%;
    position: sticky;
    top: 64px;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    max-height: none;
    overflow-y: visible;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 8px;
    margin-left: -24px;
    width: calc(100% + 48px);
    padding-left: 24px;
    padding-right: 24px;
  }
  .sidebar-link {
    display: inline-block;
    margin-bottom: 0;
    padding: 6px 12px;
    font-size: 12px;
  }
  .legal-card {
    padding: 24px 20px;
    margin-bottom: 16px;
  }
}
