/* ═══════════════════════════════════════
   TOKENS & THEME DETECTION
═══════════════════════════════════════ */
:root {
  /* Elegant Light Mode (Cream/Sand Minimalist Premium Aesthetic) */
  --bg:           #fbfaf7;
  --surface:      #ffffff;
  --surface2:     #f4f2eb;
  --border:       rgba(28, 25, 23, 0.08);
  --border-focus: rgba(28, 25, 23, 0.35);
  --text:         #1c1917;
  --muted:        #78716c;
  --accent:       #000000; /* Pure Black instead of Gold */
  --accent-dim:   #27272a;
  --green:        #16a34a;
  --red:          #dc2626;

  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --transition:   0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-focus: 0 0 0 3px rgba(28, 25, 23, 0.05);
  --shadow-btn: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-btn-hover: 0 8px 28px rgba(0, 0, 0, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Mode (High Tech Cyber Minimalist Dark Aesthetic from User Model) */
    --bg:           #0d0d0d;
    --surface:      #141414;
    --surface2:     #1a1a1a;
    --border:       rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 255, 255, 0.35);
    --text:         #f2f0ed;
    --muted:        #6b6b6b;
    --accent:       #ffffff; /* Pure White instead of Gold */
    --accent-dim:   #e4e4e7;
    --green:        #3ecf8e;
    --red:          #f04438;
    --shadow-focus: 0 0 0 3px rgba(255, 255, 255, 0.05);
    --shadow-btn: 0 4px 20px rgba(255, 255, 255, 0.03);
    --shadow-btn-hover: 0 8px 28px rgba(255, 255, 255, 0.06);
  }
}

/* ═══════════════════════════════════════
   RESET
═══════════════════════════════════════ */
*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}
html { 
  scroll-behavior: smooth; 
  overflow-x: hidden;
}
body {
  font-family: var(--font-body);
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}
input, select, textarea, button { 
  font: inherit; 
  outline: none; 
  border: none; 
  background: none; 
}
button { 
  cursor: pointer; 
}
img, svg { 
  display: block; 
  max-width: 100%; 
}
a { 
  color: inherit; 
  text-decoration: none; 
}
select option { 
  background: var(--surface2); 
  color: var(--text);
}

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.page {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

/* ─ Header ─ */
.header {
  padding: 2.5rem 2rem 0;
  display: flex;
  justify-content: center;
  animation: fadeDown 0.6s ease both;
}
.header svg {
  width: 168px;
  height: auto;
  color: var(--text);
  opacity: 0.95;
  transition: color 0.3s ease;
}

/* ─ Hero text ─ */
.hero {
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
  animation: fadeDown 0.7s 0.1s ease both;
}
.hero .eyebrow {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1rem;
}
.hero p {
  font-size: 0.975rem;
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 300;
}

/* ─ Form card ─ */
.form-wrap {
  width: 95%;
  max-width: 620px;
  margin: 0 auto 5rem;
  animation: fadeUp 0.7s 0.2s ease both;
}

/* ─ Section labels ─ */
.section-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  transition: background-color 0.3s ease;
}

/* ─ Field ─ */
.field {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  transition: border-color var(--transition), box-shadow var(--transition), background-color 0.3s ease;
  overflow: hidden;
}
.field:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.field label {
  position: absolute;
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--muted);
  pointer-events: none;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 36px);
}
.field.active label,
.field:focus-within label,
.field:has(select) label {
  top: 13px;
  transform: none;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 500;
}
.field .input {
  width: 100%;
  height: 58px;
  padding: 22px 18px 8px;
  font-size: 16px;
  color: var(--text);
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  display: block;
}
textarea.input {
  height: auto;
  min-height: 58px;
  resize: none;
  padding-top: 26px;
  padding-bottom: 10px;
  line-height: 1.5;
}
select.input {
  cursor: pointer;
}
.field.error {
  border-color: var(--red);
}
.field.error label { 
  color: var(--red); 
}

/* ─ Row ─ */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.row .field { 
  margin-bottom: 0; 
}
@media (max-width: 480px) {
  .row { 
    grid-template-columns: 1fr; 
    gap: 16px;
  }
  .row .field {
    margin-bottom: 0;
  }
  .field .input {
    padding-left: 12px;
    padding-right: 12px;
  }
  .field label {
    left: 12px;
    max-width: calc(100% - 24px);
  }
  .field.active label,
  .field:focus-within label,
  .field:has(select) label {
    left: 12px;
  }
}

/* Date picker wrapper */
.date-row {
  display: grid;
  grid-template-columns: 0.8fr 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 480px) {
  .date-row { 
    grid-template-columns: 1fr 1fr 1fr; 
    gap: 8px; /* Tighter gap on mobile devices to prevent horizontal overflow */
  }
}

/* ─ Submit button ─ */
.btn-submit {
  margin-top: 1.75rem;
  width: 100%;
  height: 56px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-btn);
}
.btn-submit:hover {
  background: var(--accent-dim);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-hover);
}
.btn-submit:active { 
  transform: translateY(0); 
}
.btn-submit:disabled {
  background: var(--surface2);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* spinner */
.spinner-icon {
  width: 20px; 
  height: 20px;
  animation: spin 0.8s linear infinite;
  display: none;
}
@keyframes spin { 
  to { transform: rotate(360deg); } 
}

/* ─ Footer note ─ */
.form-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1.25rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   TOASTS
═══════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: fit-content;
  max-width: 92vw;
}
.toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.855rem;
  font-weight: 500;
  color: #fff;
  opacity: 0;
  transform: translateY(-16px) scale(0.92);
  transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { 
  opacity: 1; 
  transform: translateY(0) scale(1); 
}
.toast.success { 
  background: #166534; 
  border: 1px solid rgba(22, 163, 74, 0.2); 
}
.toast.error { 
  background: #7f1d1d; 
  border: 1px solid rgba(239, 68, 68, 0.2); 
}
.toast.info { 
  background: #1e3a5f; 
  border: 1px solid rgba(59, 130, 246, 0.2); 
}
.toast .toast-icon { 
  flex-shrink: 0; 
  width: 16px; 
  height: 16px; 
}

/* ═══════════════════════════════════════
   SUCCESS MODAL
═══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 400px;
  width: 100%;
  overflow: hidden;
  transform: scale(0.88) translateY(16px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), background-color 0.3s ease;
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}
.modal-body {
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.modal-icon {
  width: 60px;
  height: 60px;
  background: rgba(62,207,142,0.12);
  border: 1px solid rgba(62,207,142,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: popIn 0.4s 0.15s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal-icon svg {
  width: 28px;
  height: 28px;
  color: var(--green);
}
.modal-icon.error {
  background: rgba(240,68,56,0.12);
  border-color: rgba(240,68,56,0.2);
}
.modal-icon.error svg {
  color: var(--red);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.modal-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 300;
  max-width: 280px;
}
.modal-footer {
  border-top: 1px solid var(--border);
  display: flex;
}
.modal-btn {
  flex: 1;
  padding: 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  transition: background var(--transition), color var(--transition);
  text-align: center;
}
.modal-btn.primary {
  background: var(--text);
  color: var(--bg);
}
.modal-btn.primary:hover { 
  background: #ffffff; 
  color: #000000;
}

/* ═══════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════ */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─ Decorative divider ─ */
.divider-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--border), transparent);
  margin: 0 auto;
}
