/* =========================================================
   Kholo.ai Beta Access Application form
   Matches landing page aesthetic, green accent for conversion
   ========================================================= */

:root {
  --ap-bg: #05060a;
  --ap-bg-2: #0a0c14;
  --ap-text: rgba(255, 255, 255, 0.96);
  --ap-muted: rgba(255, 255, 255, 0.62);
  --ap-faint: rgba(255, 255, 255, 0.44);
  --ap-stroke: rgba(255, 255, 255, 0.08);
  --ap-stroke-strong: rgba(255, 255, 255, 0.14);
  --ap-surface: rgba(255, 255, 255, 0.02);
  --ap-surface-2: rgba(255, 255, 255, 0.04);
  --ap-surface-3: rgba(255, 255, 255, 0.06);

  --ap-green: #34d399;
  --ap-green-2: #2bb585;
  --ap-purple: #7c5cff;
  --ap-cyan: #00d4ff;
  --ap-danger: #ef4444;

  --ap-font: "Inter var", "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* Ensure the HTML `hidden` attribute always wins over display:flex etc. */
[hidden] { display: none !important; }

body.apply-page {
  font-family: var(--ap-font);
  font-feature-settings: "cv11", "ss01";
  background: var(--ap-bg);
  color: var(--ap-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background layers */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, #000 40%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

.glow-a {
  top: -200px;
  left: -100px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.18), transparent 70%);
}

.glow-b {
  top: 200px;
  right: -200px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.14), transparent 70%);
}

/* Nav */
.apply-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: rgba(5, 6, 10, 0.6);
  border-bottom: 1px solid var(--ap-stroke);
}

.apply-nav-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.apply-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ap-text);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 16px;
}

.apply-brand img {
  border-radius: 7px;
}

.apply-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ap-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  transition: all 160ms ease;
}

.apply-nav-back:hover {
  color: var(--ap-text);
  background: var(--ap-surface-2);
}

/* Main shell */
.apply-main {
  position: relative;
  z-index: 1;
  padding: 48px 20px 80px;
}

.apply-wrap {
  max-width: 680px;
  margin: 0 auto;
}

/* Intro */
.apply-intro {
  text-align: center;
  margin-bottom: 48px;
}

.apply-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ap-green);
  letter-spacing: 0.02em;
  margin-bottom: 24px;
}

.green-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ap-green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.apply-title {
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0 0 20px;
}

.apply-title-grad {
  background: linear-gradient(135deg, #6ee7b7 0%, #34d399 50%, #00d4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.apply-lead {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ap-muted);
  margin: 0 auto;
  max-width: 520px;
}

/* Form */
.apply-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  padding: 28px;
  background: linear-gradient(180deg, var(--ap-surface-2), var(--ap-surface));
  border: 1px solid var(--ap-stroke);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.form-section.highlight {
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.06), rgba(52, 211, 153, 0.02));
  border-color: rgba(52, 211, 153, 0.2);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ap-stroke);
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-stroke-strong);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ap-muted);
  font-variant-numeric: tabular-nums;
}

.form-section.highlight .section-num {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--ap-green);
}

/* Fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-row .field {
  margin-bottom: 0;
}

.field label,
.field-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-text);
  letter-spacing: -0.005em;
  line-height: 1.45;
}

.field-heading {
  display: block;
  margin: 0;
}

.req {
  color: var(--ap-green);
  font-weight: 700;
}

.field-note {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--ap-faint);
  line-height: 1.4;
}

.field input[type="text"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--ap-stroke);
  border-radius: 10px;
  color: var(--ap-text);
  font-family: var(--ap-font);
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(52, 211, 153, 0.5);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--ap-font);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='rgba(255,255,255,0.5)' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Checkbox group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--ap-stroke);
  border-radius: 9px;
  cursor: pointer;
  transition: all 140ms ease;
}

.checkbox-item:hover {
  background: var(--ap-surface-2);
  border-color: var(--ap-stroke-strong);
}

.checkbox-item input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  accent-color: var(--ap-green);
  cursor: pointer;
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-label {
  color: var(--ap-text);
}

.checkbox-item:has(input:checked) {
  background: rgba(52, 211, 153, 0.06);
  border-color: rgba(52, 211, 153, 0.3);
}

.checkbox-label {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ap-muted);
  user-select: none;
}

/* Radio group */
.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.radio-item {
  flex: 1;
  min-width: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--ap-stroke);
  border-radius: 9px;
  cursor: pointer;
  transition: all 140ms ease;
  text-align: center;
}

.radio-item:hover {
  background: var(--ap-surface-2);
  border-color: var(--ap-stroke-strong);
}

.radio-item input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--ap-green);
  cursor: pointer;
}

.radio-item:has(input:checked) {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.4);
}

.radio-item:has(input:checked) .radio-label {
  color: var(--ap-text);
}

.radio-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ap-muted);
  user-select: none;
}

/* Field errors */
.field-error {
  font-size: 12px;
  color: #fca5a5;
  display: none;
  padding-top: 2px;
}

.field-error.visible {
  display: block;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Submit */
.form-submit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

.btn-apply {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 340px;
  padding: 16px 28px;
  background: linear-gradient(180deg, #3ad9a3, #2bb585);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #052d21;
  font-family: var(--ap-font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 10px 24px rgba(52, 211, 153, 0.35);
  transition: all 160ms ease;
}

.btn-apply:hover {
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 14px 32px rgba(52, 211, 153, 0.45);
}

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

.btn-apply:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.btn-loader {
  display: none;
  animation: spin 1s linear infinite;
}

.btn-apply.is-loading .btn-text {
  visibility: hidden;
}

.btn-apply.is-loading .btn-loader {
  display: inline-flex;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

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

.submit-note {
  font-size: 12.5px;
  color: var(--ap-faint);
  margin: 0;
  text-align: center;
}

/* Success state */
.success-state {
  text-align: center;
  padding: 64px 32px;
  background: linear-gradient(180deg, var(--ap-surface-2), var(--ap-surface));
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.3);
}

.success-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 50%;
  color: var(--ap-green);
  margin-bottom: 20px;
  animation: successPop 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes successPop {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.success-state h2 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin: 0 0 12px;
}

.success-state p {
  font-size: 16px;
  color: var(--ap-muted);
  margin: 0 0 32px;
  line-height: 1.6;
}

.btn-ghost-large {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-stroke-strong);
  border-radius: 10px;
  color: var(--ap-text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 160ms ease;
}

.btn-ghost-large:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Footer */
.apply-footer {
  position: relative;
  z-index: 1;
  padding: 28px 24px;
  border-top: 1px solid var(--ap-stroke);
}

.apply-footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.apply-footer small {
  font-size: 12px;
  color: var(--ap-faint);
}

.apply-footer a {
  color: var(--ap-muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.apply-footer a:hover {
  color: var(--ap-text);
  border-bottom-color: var(--ap-green);
}

/* Focus visible */
body.apply-page *:focus-visible {
  outline: 2px solid var(--ap-green);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 640px) {
  .apply-main {
    padding: 32px 16px 60px;
  }

  .apply-intro {
    margin-bottom: 32px;
  }

  .form-section {
    padding: 22px 18px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .field-row .field {
    margin-bottom: 18px;
  }

  .field-row .field:last-child {
    margin-bottom: 0;
  }

  .radio-group {
    flex-direction: column;
  }

  .radio-item {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
