/*
 * INTAKE FORM STYLES
 * File: assets/css/intake.css
 *
 * WHAT THIS FILE DOES:
 *   Controls the look of the sign-up form where a prospect types in their company name,
 *   website, and email — including all the interactive bits like the autocomplete dropdown
 *   and the spinning submit button.
 *
 * USED BY:
 *   index.html (the first page a prospect sees)
 *
 * SECTIONS INSIDE:
 *   - Company name input and autocomplete dropdown
 *   - Candidate company cards (logo thumbnails shown during company selection)
 *   - Confirmation state (green checkmark after a company is chosen)
 *   - Form validation error messages
 *   - Submit button (normal, loading, and disabled states)
 *   - Language toggle pill (English / Thai switcher)
 */

/* ============================================================
   AwareAI Intake + Loading CSS
   Design: matches aware-ai.io — deep navy dark theme
   ============================================================ */

/* ── Design tokens ────────────────────────────────────────── */
:root {
  /* Brand palette — aware-ai.io */
  --deep-bg:       #020C1B;
  --surface:       #0A1628;
  --surface-2:     #0A1628;
  --surface-3:     #0F1E35;
  --border-navy:   #162342;
  --border-hover:  #243860;

  /* Semantic aliases */
  --background:    #020C1B;
  --foreground:    #EEF2FF;
  --card:          #0A1628;
  --border:        #162342;
  --input:         #162342;

  /* Primary — brand red */
  --primary:       #C4261F;
  --primary-light: #E53535;
  --primary-dark:  #A01F19;
  --primary-glow:  rgba(196, 38, 31, 0.3);

  /* Text */
  --text-1:        #EEF2FF;
  --text-2:        #94AABF;
  --text-3:        #3D5070;

  /* States */
  --success:       #10B981;
  --error:         #EF4444;
  --error-bg:      rgba(239, 68, 68, 0.1);

  /* Radii */
  --radius:        0.5rem;
  --radius-sm:     0.5rem;
  --radius-md:     0.75rem;
  --radius-lg:     1rem;

  /* Shadows (dark-mode style) */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:     0 20px 48px rgba(0,0,0,0.5);

  /* Font */
  --font:          'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  --transition:    200ms cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(2, 12, 27, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-navy);
  /* Reset admin sidebar nav overrides from base.css */
  flex: none;
  padding: 0;
  width: 100%;
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-1);
}

.nav-logo svg { flex-shrink: 0; }

.nav-logo-img {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 2px 8px rgba(196, 38, 31, 0.35);
}
.nav-cta:hover { background: var(--primary-light); transform: translateY(-1px); }

.nav-admin-link {
  font-size: 0.75rem;
  color: var(--text-3);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
  transition: opacity var(--transition), color var(--transition);
}
.nav-admin-link:hover { opacity: 1; color: var(--text-2); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  background: none;
  border: 1px solid var(--border-navy);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.lang-toggle:hover { border-color: var(--primary); color: var(--text-1); }

/* ── Main layout ──────────────────────────────────────────── */
.main {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}

/* ── Hero copy ────────────────────────────────────────────── */
.hero { padding-top: 16px; }

.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-1);
  margin-bottom: 20px;
}

.hero-title-accent {
  color: var(--primary-light);
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 420px;
}

.hero-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-points li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.point-icon {
  width: 20px;
  height: 20px;
  color: var(--success);
  flex-shrink: 0;
}

/* ── Form card ────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border-navy);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.form-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 6px;
}

.form-lead {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 28px;
}

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

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-1);
}

.form-input {
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--border-navy);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--text-1);
  background: var(--deep-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}

.form-input::placeholder { color: var(--text-3); }

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input-error { border-color: var(--error); }
.form-input-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.2); }

.form-error {
  font-size: 0.8125rem;
  color: var(--error);
  min-height: 16px;
}

/* ── Company candidate dropdown ───────────────────────────── */
.company-suggestion {
  margin-top: 6px;
}

.company-dropdown,
.company-confirmed {
  background: var(--surface-3);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.company-dropdown-searching,
.company-dropdown-empty {
  padding: 10px 14px;
  font-size: 0.8125rem;
  color: var(--text-2);
  font-style: italic;
}

.company-candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-navy);
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: background var(--transition);
}
.company-candidate:last-child { border-bottom: none; }
.company-candidate:hover { background: rgba(255,255,255,0.04); }

.company-confirmed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-color: rgba(16,185,129,0.4);
  background: rgba(16,185,129,0.05);
}

/* Logo column */
.candidate-logo-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.candidate-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
}
.candidate-logo-fallback {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
  line-height: 1;
}
/* Fallback letter hidden only when logo successfully loaded (JS adds .logo-loaded class) */
.candidate-logo-wrap.logo-loaded .candidate-logo-fallback {
  visibility: hidden;
}

/* Text column */
.candidate-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.candidate-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.candidate-meta {
  font-size: 0.75rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Confirmed check icon */
.confirmed-check {
  color: #10B981;
  flex-shrink: 0;
  margin-left: auto;
}

/* Generate button disabled state */
.form-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.form-submit:disabled:hover {
  background: var(--primary);
  transform: none;
  box-shadow: none;
}

.form-global-error {
  background: var(--error-bg);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.875rem;
  color: var(--error);
}

.form-submit {
  height: 52px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(196, 38, 31, 0.4);
  margin-top: 4px;
}

.form-submit:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(196, 38, 31, 0.5);
}

.form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-arrow { width: 18px; height: 18px; }

.submit-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.form-footnote {
  font-size: 0.75rem;
  color: var(--text-3);
  text-align: center;
  line-height: 1.5;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border-navy);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.footer a {
  color: var(--text-3);
  text-decoration: none;
  transition: color var(--transition);
}
.footer a:hover { color: var(--text-1); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .main { padding: 40px 20px 64px; }
  .hero { padding-top: 0; }
  .hero-subtitle { max-width: none; }
  .form-card { padding: 28px 22px; }
  .footer { gap: 16px; flex-wrap: wrap; justify-content: center; }

  /* iOS: prevent auto-zoom on input focus — font-size must be >= 16px */
  .form-input { font-size: 1rem; }
}

@media (max-width: 480px) {
  .nav-inner { padding: 0 12px; height: 56px; }
  /* Shrink nav CTA on very small screens */
  .nav-cta { padding: 7px 13px; font-size: 0.8125rem; }
  .lang-toggle { padding: 6px 10px; font-size: 0.75rem; }
  .hero-title { font-size: 1.75rem; }
  .form-card { border-radius: var(--radius-md); padding: 24px 18px; }
  /* Minimum 44px touch target for submit */
  .form-submit { height: 52px; }
  /* iOS safe area — avoid home bar overlap */
  .footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* Disable hover transforms on touch devices — prevents sticky hover state */
@media (hover: none) {
  .form-submit:hover:not(:disabled) { transform: none; }
  .nav-cta:hover { transform: none; }
}
