@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap');

:root {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e241c;
  background-color: #f0f3f6;
  font-synthesis: none;
  --accent: #e54519;
  --accent-hover: #c9360e;
  --accent-subtle: #fff1eb;
  --ink: #1a1e19;
  --muted: #64748b;
  --line: #e2e8f0;
  --card-bg: #fffefa;
  --border: #cbd5e1;
}

* { box-sizing: border-box; }
[hidden], .skip-link { display: none !important; }

/* Strictly 1-Page Layout: Prevent Any Page Scrolling */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  max-height: 100vh;
  max-height: 100svh;
  overflow: hidden !important;
  position: fixed;
  inset: 0;
}

body {
  display: flex;
  flex-direction: column;
  padding: 10px 24px 8px;
  background-color: #f0f3f6;
  user-select: none;
}

button, input, select, textarea { font: inherit; user-select: auto; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible { outline: 2.5px solid #f97316; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }

/* Background Canvas */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

/* Header */
.site-header {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1140px;
  height: 42px;
  flex-shrink: 0;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.partners {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.official-logo {
  object-fit: contain;
  display: block;
}
.tashtech-logo {
  height: 28px;
  width: auto;
}
.asem-logo-header {
  height: 34px;
  width: auto;
}
.brand-divider {
  color: #94a3b8;
  font-size: 16px;
  font-weight: 300;
}
.header-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: #475569;
}
.header-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

/* Main Layout Card */
.layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  width: 100%;
  max-width: 1140px;
  flex: 1;
  min-height: 0;
  max-height: calc(100svh - 70px);
  margin: 6px auto;
  border-radius: 20px;
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.02);
  overflow: hidden;
}

/* Left Hero Sidebar */
.intro {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 24px 28px 18px;
  border-radius: 20px 0 0 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(ellipse at 55% 65%, rgba(229, 69, 25, 0.2), transparent 70%), #141b17;
  color: #f8fafc;
}
.intro::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
              linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 30px 30px;
  z-index: -1;
  mask-image: linear-gradient(transparent, black);
}
.eyebrow {
  color: #cbd5e1;
  font-size: 8.5px;
  letter-spacing: 1.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.eyebrow > span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ea580c;
}
h1 {
  font-size: clamp(22px, 2.3vw, 32px);
  line-height: 1.15;
  letter-spacing: -1px;
  font-weight: 600;
  margin-top: 10px;
}
h1 > span { color: #f97316; }

.program-affiliation {
  margin-top: 8px;
  font-size: 10.5px;
  line-height: 1.4;
  color: #94a3b8;
  font-weight: 500;
}
.program-facts {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  color: #cbd5e1;
  font-size: 9.5px;
}
.program-facts > span + span::before {
  content: '·';
  color: #64748b;
  margin-right: 8px;
}
.program-facts .free {
  color: #fdba74;
  font-weight: 600;
}

/* Brand Graphic - High-Tech Semiconductor IC Visual */
.brand-scene {
  position: relative;
  isolation: isolate;
  pointer-events: none;
  flex: 1;
  min-height: 100px;
  max-height: 220px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scene-halo {
  position: absolute;
  inset: -15%;
  background: radial-gradient(ellipse at 50% 50%, rgba(234, 88, 12, 0.16), transparent 68%);
  z-index: 0;
}
.ic-scene-svg {
  width: 100%;
  height: 100%;
  max-height: 220px;
  position: relative;
  z-index: 1;
  overflow: visible;
}
.ic-rotator {
  transform-origin: 160px 100px;
}
.ic-rotator-slow {
  animation: ic-spin 45s linear infinite;
}
.ic-rotator-reverse {
  animation: ic-spin-rev 28s linear infinite;
}
.ic-chip-package {
  animation: ic-chip-float 5s ease-in-out infinite;
  transform-origin: 160px 100px;
}
.ic-die-core {
  animation: ic-core-pulse 3.5s ease-in-out infinite;
}
.circuit-pulse-left1,
.circuit-pulse-right1 {
  animation: signal-stream 2.8s linear infinite;
}
.circuit-pulse-left2,
.circuit-pulse-right2 {
  animation: signal-stream 2.2s linear infinite;
  animation-delay: 0.5s;
}
.circuit-pulse-left3,
.circuit-pulse-right3 {
  animation: signal-stream 3.2s linear infinite;
  animation-delay: 1.1s;
}
.scene-shadow {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  width: 100px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  filter: blur(5px);
}
.intro-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.motion-toggle {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: #cbd5e1;
  font-size: 8.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.motion-toggle:hover { color: white; background: rgba(255, 255, 255, 0.15); }
.tagline {
  font-size: 9.5px;
  color: #94a3b8;
}

@keyframes ic-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes ic-spin-rev {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}
@keyframes ic-chip-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3.5px); }
}
@keyframes ic-core-pulse {
  0%, 100% { fill: rgba(234, 88, 12, 0.15); stroke: #ea580c; }
  50% { fill: rgba(249, 115, 22, 0.4); stroke: #fdba74; }
}
@keyframes signal-stream {
  to { stroke-dashoffset: -140; }
}
.motion-paused * { animation-play-state: paused !important; }

/* Right Application Form Card */
.application-card {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 0 20px 20px 0;
  background: #fffefa;
  overflow: hidden;
}

/* Stepper */
.stepper {
  flex-shrink: 0;
  padding: 14px 22px 10px;
  border-bottom: 1px solid #f1f5f9;
}
.stepper ol {
  display: flex;
  list-style: none;
  justify-content: space-between;
  gap: 4px;
  padding: 0;
  margin: 0;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 10px;
  font-weight: 500;
}
.step-number {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  font-size: 9.5px;
  font-weight: 600;
}
.stepper li.active {
  color: var(--accent);
  font-weight: 700;
}
.active .step-number {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}
.done .step-number {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.question-progress {
  height: 2.5px;
  background: #f1f5f9;
  flex-shrink: 0;
}
#question-progress-fill {
  background: var(--accent);
  height: 100%;
  width: 12.5%;
  transition: width 0.25s ease;
}

/* Form Container */
#asem-application-form {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}
.form-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  padding: 16px 24px 12px;
  overflow: hidden;
}

/* Step content: No scrollbar, cleanly centered vertically */
.form-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.section-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.section-meta h2 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.2px;
}
.section-meta > span {
  font-size: 8.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
}

/* Compact Grid & Fields */
.step-fields {
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex-shrink: 0;
}
.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 12px;
}
.col-span-2 { grid-column: 1 / -1; }

.field {
  margin: 0;
  min-width: 0;
}
.field > label, legend {
  display: block;
  padding: 0;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  color: #1e293b;
  margin-bottom: 3.5px;
}
.field label small, legend small {
  font-weight: 400;
  color: #64748b;
}
.field > label > span, legend > span {
  color: var(--accent);
}

input:not([type=radio],[type=checkbox],[type=file]), select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  outline: none;
  min-height: 38px;
  height: 38px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:focus, select:focus, textarea:focus {
  border-color: #ea580c;
  box-shadow: 0 0 0 2.5px rgba(234, 88, 12, 0.12);
}
input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true] {
  border-color: #dc2626;
  background-color: #fef2f2;
}
textarea {
  min-height: 58px;
  height: 64px;
  resize: none;
  line-height: 1.4;
  padding: 7px 10px;
}

.error {
  color: #dc2626;
  font-size: 9.5px;
  font-weight: 600;
  margin-top: 2.5px;
  line-height: 1.2;
}
.error:empty { display: none; }

/* Choice List & Buttons */
.role-field { border: 0; padding: 0; }
.choice-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}
.choice-3col { grid-template-columns: repeat(3, 1fr); }
.choice-2col { grid-template-columns: repeat(2, 1fr); }
.choice-compact {
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 35px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  background: white;
  transition: all 0.12s;
}
.role-option:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.role-option:has(input:checked) {
  border-color: #ea580c;
  background: var(--accent-subtle);
  color: #9a3412;
  font-weight: 600;
}
.role-option input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
}

.confirmation .consent-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  background: white;
}
.confirmation .consent-label:has(input:checked) {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: #9a3412;
}

/* File Upload Zone */
.drop-zone {
  position: relative;
  border: 1.5px dashed #cbd5e1;
  border-radius: 9px;
  padding: 12px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s;
}
.drop-zone:hover {
  border-color: #ea580c;
  background: #fff7ed;
}
.compact-drop {
  padding: 10px;
}
.file-hidden-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.drop-zone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  pointer-events: none;
}
.upload-icon {
  color: #ea580c;
}
.upload-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
}
.upload-sub {
  font-size: 9.5px;
  color: #64748b;
}

.file-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 7px;
  background: white;
  border: 1px solid #e2e8f0;
}
.file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}
.file-badge {
  background: #fee2e2;
  color: #dc2626;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}
.file-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 9.5px;
  color: #64748b;
}
.btn-remove-file {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #475569;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.btn-remove-file:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Actions */
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
}
.primary-button {
  margin-left: auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  min-height: 40px;
  height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(229, 69, 25, 0.2);
  transition: all 0.12s;
}
.primary-button:hover {
  background: var(--accent-hover);
}
#button-arrow { font-size: 15px; line-height: 1; }
.back-button {
  border: 0;
  padding: 8px 10px;
  background: none;
  min-height: 38px;
  font-size: 11.5px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
}
.back-button:hover { color: var(--accent); }

.form-footnote {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  color: #64748b;
  font-size: 9px;
  flex-shrink: 0;
}
.submit-error {
  font-size: 10px;
  padding: 8px;
  border-radius: 6px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  margin-bottom: 8px;
}

/* Success Panel */
.success-panel {
  margin: auto 0;
  padding: 24px;
  text-align: center;
}
.success-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: #dcfce7;
  border-radius: 50%;
  color: #16a34a;
  font-size: 24px;
  margin: 0 auto 12px;
}
.success-panel h2 {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}
#success-message {
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
  margin: 10px auto 16px;
  max-width: 420px;
}
.receipt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 340px;
  margin: 0 auto 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 11.5px;
}
.receipt strong {
  color: var(--accent);
  font-size: 13px;
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1140px;
  height: 20px;
  margin: 4px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #64748b;
  font-size: 9px;
  flex-shrink: 0;
}
.admin-link {
  opacity: 0.12;
  color: #64748b;
  text-decoration: none;
  font-size: 8.5px;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 4px;
  transition: opacity 0.25s ease, color 0.25s ease, background 0.25s ease;
  cursor: pointer;
  user-select: none;
}
.admin-link:hover {
  opacity: 0.85;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & PHONE) - STRICTLY 1-PAGE WITHOUT SCROLL
   ========================================================================== */

/* Tablet & Landscape (Width <= 960px) */
@media (max-width: 960px) {
  body { padding: 8px 16px 6px; }
  .site-header { height: 38px; }
  .layout {
    grid-template-columns: 0.8fr 1.2fr;
    max-height: calc(100svh - 60px);
  }
  .intro { padding: 18px 20px; }
  h1 { font-size: 20px; }
  .brand-scene { max-height: 140px; }
  .form-body { padding: 14px 18px 10px; }
}

/* Phone / Mobile (Width <= 760px) */
@media (max-width: 760px) {
  body {
    padding: 4px 8px 4px;
  }
  .site-header {
    height: 32px;
  }
  .tashtech-logo { height: 22px; }
  .asem-logo-header { height: 26px; }
  .brand-divider { font-size: 13px; }
  .header-note { display: none; }

  /* Stacked into 1 continuous vertical card that fills exactly the remaining height */
  .layout {
    display: flex;
    flex-direction: column;
    margin: 2px auto;
    width: 100%;
    max-width: 100%;
    height: calc(100svh - 46px);
    max-height: calc(100svh - 46px);
    border-radius: 14px;
  }

  /* Compact top header bar for mobile */
  .intro {
    flex: 0 0 auto;
    padding: 8px 12px;
    border-radius: 14px 14px 0 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .eyebrow, .program-facts, .program-affiliation, .brand-scene, .tagline {
    display: none !important;
  }
  .intro h1 {
    font-size: 13.5px;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.3px;
  }
  .intro h1 br { display: none; }
  .intro-bottom {
    margin: 0;
  }
  .motion-toggle {
    font-size: 7.5px;
    padding: 3px 6px;
    border-radius: 10px;
  }

  /* Form Card on Mobile */
  .application-card {
    flex: 1;
    min-height: 0;
    border-radius: 0 0 14px 14px;
  }
  .stepper {
    padding: 8px 12px 6px;
  }
  .stepper .step-label { display: none; }
  .step-number {
    width: 17px;
    height: 17px;
    font-size: 8.5px;
  }

  .form-body {
    padding: 10px 12px 8px;
  }
  .section-meta {
    margin-bottom: 8px;
  }
  .section-meta h2 {
    font-size: 12px;
  }

  /* Compact Mobile Inputs */
  .step-fields { gap: 6px; }
  .compact-grid {
    gap: 6px 8px;
  }
  .field > label, legend {
    font-size: 10.5px;
    margin-bottom: 2px;
  }
  input:not([type=radio],[type=checkbox],[type=file]), select {
    min-height: 34px;
    height: 34px;
    padding: 6px 8px;
    font-size: 12.5px;
  }
  textarea {
    min-height: 48px;
    height: 52px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .choice-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  .choice-3col {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .choice-2col {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }
  .role-option {
    min-height: 32px;
    padding: 4px 6px;
    font-size: 10px;
  }
  .role-option input {
    width: 12px;
    height: 12px;
  }

  .compact-drop {
    padding: 7px;
  }
  .upload-icon {
    width: 20px;
    height: 20px;
  }
  .upload-title {
    font-size: 10.5px;
  }
  .upload-sub {
    font-size: 8.5px;
  }

  .primary-button {
    min-height: 36px;
    height: 36px;
    padding: 6px 12px;
    font-size: 11.5px;
  }
  .back-button {
    min-height: 34px;
    font-size: 10.5px;
    padding: 6px 8px;
  }
  .form-actions {
    padding-top: 6px;
  }
  .form-footnote {
    margin-top: 5px;
    font-size: 8px;
  }
  .site-footer {
    height: 12px;
    font-size: 7.5px;
  }
}
