/* =====================================================
   SIMPLE, UNIFORM FIELD-TOOL STYLES
   -----------------------------------------------------
   Goal:
   - no oversized images
   - same image treatment everywhere
   - calm and easy layout for installers
   - centered regular text
   - lists stay left aligned
   - text should feel contained, not floating
   - bottom navigation should sit centered
   ===================================================== */

:root {
  --bg-top: #0f172a;
  --bg-bottom: #eef3f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #dbe3ee;
  --primary: #0f62fe;
  --primary-dark: #0b4fd1;
  --surface-soft: #f8fafc;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --warning-bg: #fff7ed;
  --warning-border: #fdba74;

  /* Slight yellow tint for tips */
  --tip-bg: #fffbea;
  --tip-border: #f5d76e;

  --shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  --soft-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius: 18px;

  /* Shared image sizes */
  --image-ratio: 4 / 3;
  --hero-image-width: 320px;
  --choice-image-width: 250px;
  --start-image-width: 340px;
  --guide-image-width: 380px;
  --mode-image-width: 220px;

  /* Shared button sizes for footer controls */
  --footer-btn-min-width: 160px;
  --footer-btn-max-width: 220px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: linear-gradient(
    180deg,
    var(--bg-top),
    #1e293b 40%,
    #e8eef6 40%,
    var(--bg-bottom) 100%
  );
  color: var(--text);
}

body {
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  color: #fff;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.15;
}

.lang-switcher {
  display: inline-flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.lang-btn {
  border: 0;
  background: transparent;
  color: #fff;
  padding: 10px 12px;
  border-radius: 999px;
  min-width: 52px;
  cursor: pointer;
}

.lang-btn.active {
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.container {
  padding-bottom: 30px;
}

.progress-wrap {
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, var(--primary));
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-text {
  margin: 8px 2px 0;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.card {
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 18px;
  border: 1px solid var(--border);
}

.screen-title {
  margin: 0 0 10px;
  font-size: 1.5rem;
  line-height: 1.15;
  text-align: center;
}

.screen-text {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.small-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

#screen > h3 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  line-height: 1.3;
  text-align: center;
}

/* -----------------------------------------------------
   IMAGE SYSTEM
   ----------------------------------------------------- */
.app-image {
  width: 100%;
  aspect-ratio: var(--image-ratio);
  object-fit: contain;
  margin: 0 auto;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.hero-image {
  max-width: var(--hero-image-width);
}

.choice-image {
  max-width: var(--choice-image-width);
  margin-bottom: 12px;
}

.start-image {
  max-width: var(--start-image-width);
}

.guide-image {
  max-width: var(--guide-image-width);
  margin-bottom: 12px;
}

.mode-image {
  max-width: var(--mode-image-width);
}

/* Used when one card shows two product images */
/* Used when one card shows two product images
   Important:
   - For the VA + VAS button we want the two images to behave like
     one centered visual group, not like two stretched grid columns.
   - width: fit-content + margin auto keeps the whole pair centered.
*/
.multi-image-grid {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin: 0 auto 12px;
}

/* Override the default full-width image rule only inside the combined card.
   This keeps both images compact and centered as one unit. */
.multi-image-grid .app-image {
  width: 120px;
  max-width: 120px;
  margin: 0;
  flex: 0 0 auto;
}

/* -----------------------------------------------------
   GRID / LAYOUT SECTIONS
   ----------------------------------------------------- */
.choice-grid {
  display: grid;
  gap: 12px;
}

.action-row,
.result-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.dual-image-grid,
.image-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.start-card {
  display: grid;
  gap: 16px;
}

/* -----------------------------------------------------
   BUTTON SYSTEM
   ----------------------------------------------------- */
/* Selection cards should fill the grid */
.choice-btn {
  width: 100%;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  text-align: center;
  background: #fff;
  border: 2px solid var(--border);
  transition:
    transform 0.12s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.choice-btn:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(15, 98, 254, 0.08);
}

.choice-btn strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
  text-align: center;
}

.choice-btn span {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}

/* Standard action buttons */
.primary-btn,
.secondary-btn,
.ghost-btn,
.nav-btn {
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  text-align: center;
  transition:
    transform 0.12s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.nav-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--primary-dark);
}

.secondary-btn {
  border: 0;
  background: #eef4ff;
  color: var(--primary);
  font-weight: 700;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* -----------------------------------------------------
   FOOTER NAVIGATION
   Important:
   - center the whole button group
   - do NOT stretch buttons full width
   ----------------------------------------------------- */
.footer-nav {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.footer-nav .primary-btn,
.footer-nav .secondary-btn,
.footer-nav .ghost-btn,
.footer-nav .nav-btn {
  width: min(100%, var(--footer-btn-max-width));
  min-width: var(--footer-btn-min-width);
  flex: 0 1 var(--footer-btn-max-width);
}

/* Two-button step navigation should feel natural:
   - Back stays on the left
   - Next stays on the right
   - Keep both visible on one row when possible */
.footer-nav.two-col-nav {
  justify-content: space-between;
  flex-wrap: nowrap;
}

.footer-nav.two-col-nav .ghost-btn,
.footer-nav.two-col-nav .nav-btn,
.footer-nav.two-col-nav .secondary-btn,
.footer-nav.two-col-nav .primary-btn {
  flex: 0 1 calc(50% - 6px);
  width: auto;
  max-width: none;
}

/* Result screen buttons can stay wider and balanced */
.result-actions .primary-btn,
.result-actions .secondary-btn {
  width: 100%;
}

/* -----------------------------------------------------
   CONTENT BOXES
   ----------------------------------------------------- */
.info-box,
.warning-box,
.mode-box,
.tip-box {
  border-radius: 16px;
  padding: 14px;
  margin-top: 14px;
  box-shadow: var(--soft-shadow);
  text-align: center;
}

.info-box {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
}

.warning-box {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
}

.mode-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.tip-box {
  background: var(--tip-bg);
  border: 1px solid var(--tip-border);
}

.info-box h3,
.warning-box h3,
.mode-box h3,
.tip-box h3,
.image-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-align: center;
}

.info-box p,
.warning-box p,
.mode-box p,
.tip-box p,
.image-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

/* -----------------------------------------------------
   IMAGE CARDS
   ----------------------------------------------------- */
.image-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  margin-top: 14px;
  box-shadow: var(--soft-shadow);
}

.image-card-vertical {
  display: grid;
  gap: 12px;
}

.image-body {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

/* -----------------------------------------------------
   LISTS
   Lists should stay left aligned for readability
   ----------------------------------------------------- */
.checklist {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
  text-align: left;
}

.checklist li {
  text-align: left;
}

hr.section-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.hidden {
  display: none;
}
/* -----------------------------------------------------
   RESET LIST
   Important:
   - Reset steps should always be left aligned
   - This overrides the general centered box text
   ----------------------------------------------------- */
.info-box-reset {
  text-align: left;
}

.info-box-reset h3 {
  text-align: left;
}

.info-box-reset p {
  text-align: left;
}

.reset-list {
  margin: 10px 0 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.6;
  text-align: left;
}

.reset-list li {
  margin-bottom: 8px;
  text-align: left;
}

.reset-list li:last-child {
  margin-bottom: 0;
}
@media (min-width: 640px) {
  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* When there are 3 options, the last one can span full width for balance */
  .choice-grid-three > *:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .dual-image-grid,
  .result-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .lang-switcher {
    align-self: flex-start;
  }

  .card {
    padding: 16px;
  }

  .screen-title {
    font-size: 1.35rem;
  }

  .choice-btn,
  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .nav-btn {
    padding: 15px;
  }

  .footer-nav {
    flex-direction: column;
    align-items: center;
  }

  .footer-nav .primary-btn,
  .footer-nav .secondary-btn,
  .footer-nav .ghost-btn,
  .footer-nav .nav-btn {
    width: 100%;
    max-width: 320px;
  }

  /* Keep the VA + VAS images side by side on mobile too,
     while scaling them down a bit to fit comfortably. */
  .multi-image-grid {
    gap: 8px;
  }

  .multi-image-grid .app-image {
    width: 92px;
    max-width: 92px;
  }
}

/* -----------------------------------------------------
   MODE CHECK VISUAL STATES
   -----------------------------------------------------
   Purpose:
   - Show which programming mode is correct right now.
   - Wrong mode is greyed out and marked with a red cross.
   - Correct mode keeps normal visibility.
   ----------------------------------------------------- */
.mode-visual {
  position: relative;
  width: fit-content;
  margin: 0 auto;
}

/* Keep the correct mode clean and slightly emphasized. */
.mode-state-active .app-image {
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.12);
}

/* Wrong mode should look clearly inactive. */
.mode-state-disabled .app-image {
  filter: grayscale(1) opacity(0.38);
}

/* Red cross badge shown only on the wrong mode. */
.mode-state-disabled::after {
  content: "✕";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #ef4444;
  color: #dc2626;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  pointer-events: none;
}
