/* ────────────────────────────────────────────────────────────────
   COMMUNICATION CARD — Progressive / Stepped Form
   style.css
   ──────────────────────────────────────────────────────────────── */

:root {
  --purple: #6b2ca6;
  --purple-light: #8b4bc4;
  --purple-dark: #4a1a75;
  --purple-darker: #3a1560;
  --purple-bg: #f5eeff;
  --green: #27ae60;
  --grey: #888;
  --border: #e4e0ec;
  --radius: 12px;
  --transition: 0.3s;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f3f5f9;
  color: #222;
}

.text-purple { color: var(--purple) !important; }

/* ─── NAVBAR ─── */
.navbar { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.navbar .navbar-brand { color: var(--purple) !important; font-weight: 700; }
.btn-primary { background: var(--purple-dark); border-color: var(--purple-dark); }
.btn-primary:hover { background: var(--purple-darker); border-color: var(--purple-darker); }

/* Download buttons — dark-purple outline with a fill-on-hover effect */
#btnDownloadFull, #btnDownloadLanyard {
  color: var(--purple-dark) !important;
  border-color: var(--purple-dark) !important;
  background: transparent !important;
  transition: background-color var(--transition), color var(--transition), box-shadow var(--transition);
}
#btnDownloadFull:hover:not(:disabled), #btnDownloadLanyard:hover:not(:disabled),
#btnDownloadFull:focus-visible, #btnDownloadLanyard:focus-visible {
  color: #fff !important;
  background: var(--purple-dark) !important;
  border-color: var(--purple-dark) !important;
  box-shadow: 0 2px 8px rgba(74, 26, 117, 0.4);
}
#btnDownloadFull:disabled, #btnDownloadLanyard:disabled {
  color: var(--purple-dark) !important;
  border-color: var(--purple-dark) !important;
  opacity: 0.45;
  /* Let hover reach the wrapper span so its tooltip still shows while disabled */
  pointer-events: none;
}

/* ─── STEPPER ─── */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  overflow-x: auto;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  cursor: default;
}

.step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #eee;
  color: #aaa;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  border: 2px solid #eee;
}

.step.active .step-dot {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}

.step.done .step-dot {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.step.locked .step-dot {
  background: #f5f5f5;
  color: #ccc;
  border-color: #e8e8e8;
}

.step-label {
  font-size: 0.72rem;
  color: #aaa;
  font-weight: 600;
  white-space: nowrap;
}

.step.active .step-label { color: var(--purple); }
.step.done .step-label { color: var(--green); }

.step-sep {
  flex: 1;
  height: 2px;
  background: #eee;
  margin: 0 4px;
  min-width: 12px;
  transition: background var(--transition);
}

.step-sep.done { background: var(--green); }

/* ─── INTRO ─── */
.intro-card {
  border-left: 4px solid var(--purple);
  background: linear-gradient(135deg, #faf8ff 0%, #fff 100%);
}

/* ─── SECTION CARDS ─── */
.section-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.section-card.open {
  border-color: var(--purple-light);
  box-shadow: 0 4px 20px rgba(107,44,166,0.12);
}

/* Locked overlay */
.section-card.locked {
  opacity: 0.65;
  cursor: not-allowed;
}

.section-card.locked .section-body-inner {
  pointer-events: none;
}

/* Section header */
.section-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.section-hdr:hover { background: #faf8ff; }
.section-card.locked .section-hdr { cursor: not-allowed; pointer-events: none; }

.section-hdr-left { flex: 1; min-width: 0; }

.section-hdr .section-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--purple-light);
  margin-bottom: 3px;
}

.section-hdr h2 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--purple);
  margin: 0;
  line-height: 1.3;
}

.section-hdr .sub {
  font-size: 0.73rem;
  color: #aaa;
  font-style: italic;
  margin-top: 2px;
}

.section-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.badge {
  background: #eee;
  color: #aaa;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
  transition: background 0.3s, color 0.3s;
}

.badge.has { background: var(--purple); color: #fff; }
.badge.done { background: var(--green); color: #fff; }
.badge.locked { background: #ddd; color: #bbb; }

/* Toggle button */
.toggle-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--purple-bg);
  color: var(--purple);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.section-card.open .toggle-btn { transform: rotate(180deg); background: var(--purple); color: #fff; }
.section-card.locked .toggle-btn { background: #eee; color: #ccc; }

.padlock {
  font-size: 0.85rem;
  color: #ccc;
}

/* Section body */
.section-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; }
.section-card.open .section-body { max-height: 3000px; }

.section-body-inner { padding: 0 16px 16px; border-top: 1px solid #f0edf5; }

/* ─── NEXT BUTTON ─── */
.next-btn-wrap {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.next-btn {
  background: var(--purple-dark);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition);
}

.next-btn:hover { background: var(--purple-darker); }
.next-btn:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* ─── SKIP ─── */
.skip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #eee;
}

.skip-row label {
  font-size: 0.78rem;
  color: #aaa;
  font-style: italic;
  margin: 0;
  cursor: pointer;
}

.skip-row input { width: 15px; height: 15px; margin: 0; }

/* ─── FORM ELEMENTS ─── */
.form-check-label { font-size: 0.86rem; line-height: 1.55; color: #222; }
.form-control, .input-group-text { font-size: 0.86rem; }

.input-group-text {
  background: var(--purple-bg);
  color: var(--purple);
  font-weight: 600;
  border-color: #ddd4ee;
  font-size: 0.84rem;
}

.form-control:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(107,44,166,0.12); }
.form-check-input:checked { background-color: var(--purple); border-color: var(--purple); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(107,44,166,0.12); }

/* ─── PREVIEW ─── */
.preview-sticky { position: sticky; top: 76px; }

#commCard {
  background: #fff;
  border: 1px solid #e6e6e6;
  padding: 24px;
  margin: 0 auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-radius: 8px;
  max-width: 100%;
}

.preview-empty {
  text-align: center;
  padding: 28px 16px;
  color: #888;
}

.preview-empty .icon { font-size: 2.2rem; opacity: 0.35; margin-bottom: 8px; }
.preview-empty h3 { font-size: 0.9rem; font-weight: 600; color: #666; margin-bottom: 6px; }
.preview-empty p { font-size: 0.8rem; line-height: 1.5; margin: 0; }

/* ─── LANYARD ─── */
.lanyard-page {
  width: 85mm;
  height: 54mm;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #ddd;
  padding: 6mm;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10pt;
  color: #222;
}
.lanyard-name { font-size: 14pt; font-weight: 700; color: var(--purple); }

/* ─── ACCESSIBILITY ─── */
#fontSelect { min-width: 180px; }
.sr-only { position:absolute !important; height:1px; width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; }

/* ─── RESPONSIVE ─── */
@media (max-width: 991px) {
  .preview-sticky { position: static !important; }
  #previewArea { max-height: 420px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; }
  .step-label { display: none; }
  .step-sep { min-width: 6px; }
}

@media (max-width: 575px) {
  main.container { padding-left: 10px; padding-right: 10px; }
  .intro-card .card-body { padding: 14px; }
  .intro-card h1 { font-size: 1rem; }
  .navbar-brand { font-size: 0.9rem !important; }
  .navbar .btn { font-size: 0.78rem; padding: 4px 8px; }
  /* Let the navbar controls wrap onto a second row so the download
     buttons stay visible and usable on small screens. */
  .navbar .container { flex-wrap: wrap; row-gap: 6px; }
  .navbar .ms-auto { flex-wrap: wrap; justify-content: flex-end; width: 100%; }
  .section-hdr h2 { font-size: 0.83rem; }
  .section-body-inner { padding: 0 12px 12px; }
  .form-check-label { font-size: 0.82rem; }
  .step-dot { width: 22px; height: 22px; font-size: 0.65rem; }
  /* Inputs/selects must be ≥16px on mobile or iOS Safari auto-zooms the page
     when a field is focused (and never zooms back out). */
  input.form-control, textarea.form-control, .form-select, .input-group-text {
    font-size: 16px;
  }
}

/* ─── PRINT ─── */
@media print {
  .navbar, .intro-card, .stepper, .action-row, footer, .skip-row, .next-btn-wrap { display: none !important; }
  .col-lg-6:first-child { display: none; }
  .col-lg-6:last-child { width: 100% !important; flex: 0 0 100% !important; }
  .preview-sticky { position: static !important; }
  #previewArea { max-height: none !important; overflow: visible !important; }
  #commCard { box-shadow: none; border: 1px solid #ccc; position: static !important; transform: none !important; width: 100% !important; }
}
