/* WHO OrgChart Builder — static build.
   theme.css is the app's real design system (ported verbatim from the React app's
   prototype-theme.css). Everything below is ported from the React app's App.css +
   the Bootstrap styles the app relies on, so the static build renders EXACTLY
   like the React app. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('theme.css');

* { box-sizing: border-box; }
html, body { margin: 0; overflow-y: auto; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  /* .App { background-color:#00205C } */
  background-color: #00205C;
  min-height: 100vh;
  /* .App { text-align:center } */
  text-align: center;
}

/* ---------- view switching (React conditional render) ---------- */
#landing, #carousel, #app { display: none; }
body.view-landing #landing { display: block; }
body.view-carousel #carousel { display: block; }
body.view-app #app { display: block; }

/* ================= Bootstrap pieces the React app uses ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
  font-family: inherit; font-size: 1rem; font-weight: 400; line-height: 1.5;
  padding: .375rem .75rem; border: 1px solid transparent; border-radius: .375rem;
  cursor: pointer; text-decoration: none; transition: all .15s ease-in-out;
}
.btn-sm { padding: .25rem .5rem; font-size: .875rem; border-radius: .25rem; }
.btn-lg { padding: .5rem 1rem; font-size: 1.25rem; border-radius: .5rem; }
.btn:disabled { opacity: .65; cursor: default; pointer-events: none; }
.btn-outline-light { color: #f8f9fa; border-color: #f8f9fa; background: transparent; }
.btn-outline-light:hover { color: #000; background: #f8f9fa; }
.btn-light { color: #000; background: #f8f9fa; border-color: #f8f9fa; }
.btn-secondary { color: #fff; background: #6c757d; border-color: #6c757d; }
.btn-secondary:hover { background: #5c636a; border-color: #565e64; }
.btn-primary { color: #fff; background: #0d6efd; border-color: #0d6efd; }
.btn-success { color: #fff; background: #198754; border-color: #198754; }
.btn-outline-secondary { color: #6c757d; border-color: #6c757d; background: transparent; }
.btn-outline-secondary:hover { color: #fff; background: #6c757d; }
.text-muted { color: #6c757d; }
.small { font-size: .875em; }

.alert { position: relative; padding: 1rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: .375rem; text-align: left; }
.alert-info { color: #055160; background: #cff4fc; border-color: #b6effb; }
.alert-success { color: #0f5132; background: #d1e7dd; border-color: #badbcc; }
.alert-warning { color: #664d03; background: #fff3cd; border-color: #ffecb5; }
.alert-danger { color: #842029; background: #f8d7da; border-color: #f5c2c7; }

/* ================= Landing (App.css) ================= */
#landing .op-hero-copy { text-align: center; }
#landing .op-hero-copy h1 { margin-left: auto; margin-right: auto; }
#landing .op-lede { margin-left: auto; margin-right: auto; }
#landing .op-actions,
#landing .op-trust,
#landing .op-sample-row { justify-content: center; }
#landing .op-howcard { text-align: center; }

/* ================= Step Carousel (App.css, verbatim) ================= */
.step-carousel {
  background: linear-gradient(135deg, #00205C 0%, #2a5298 100%);
  background-image:
    radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 60% 80%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(135deg, #00205C 0%, #2a5298 100%);
  background-size: 50px 50px, 80px 80px, 30px 30px, 40px 40px, cover;
  min-height: 100vh;
  width: 100vw;
  color: white;
  overflow-y: auto;
}

.carousel-background { padding: 20px 0; }
.carousel-container { max-width: 1320px; margin: 0 auto; padding: 0 12px; width: 100%; }
.carousel-header { margin-bottom: 40px; padding: 0 20px; text-align: left; }
.carousel-logo-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.back-button {
  background: none; border: 0; color: white; text-decoration: none; font-size: 1rem;
  margin-bottom: 20px; display: inline-block; cursor: pointer; font-family: inherit; padding: 0;
}
.back-button:hover { color: #cccccc; }

.progress-section {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 30px;
  backdrop-filter: blur(10px);
}
.steps-indicator {
  display: flex; justify-content: center; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.step-indicator { display: flex; align-items: center; margin: 0 10px; }
.step-circle {
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.3); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 1.2rem; margin-right: 15px;
  transition: all 0.3s ease; flex: 0 0 auto;
}
.step-circle.active { background: #ffffff; color: #00205C; }
.step-circle.completed { background: #28a745; color: white; }
.step-label { text-align: left; }
.step-label .step-title { font-weight: 600; font-size: 1.1rem; margin-bottom: 2px; color: white; }
.step-label .step-desc { font-size: 0.9rem; opacity: 0.8; color: white; }
.step-connector { width: 50px; height: 2px; background: rgba(255, 255, 255, 0.3); margin: 0 15px; }

.progress-bar-custom { height: 8px; background: rgba(255, 255, 255, 0.2); border-radius: .375rem; overflow: hidden; }
.progress-bar-custom .progress-bar { display: block; height: 100%; background: #ffffff; transition: width .6s ease; }

.carousel-content { padding: 0 20px; overflow-y: auto; }
.step-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 40px;
  color: #333;
  backdrop-filter: blur(10px);
  overflow-y: auto;
}
.step-main-title { font-size: 2.5rem; font-weight: 300; margin: 0 0 15px; color: #00205C; text-align: center; }
.step-subtitle { font-size: 1.2rem; color: #666; text-align: center; margin: 0 0 30px; font-weight: 400; }

/* Step 1 — upload (Col md={8} lg={6} centered) */
.upload-col { max-width: 50%; margin: 0 auto; }
@media (max-width: 992px) { .upload-col { max-width: 66.67%; } }
@media (max-width: 768px) { .upload-col { max-width: 100%; } }
.upload-step { text-align: center; }
.upload-area, .config-area { margin: 30px 0; }
.file-upload-inline { padding: 0; background: transparent; }

.file-requirements {
  margin-top: 30px; padding: 20px; background: #f8f9fa; border-radius: 10px; text-align: left;
}
.file-requirements h5 { color: #00205C; margin: 0 0 15px; font-size: 1.25rem; font-weight: 500; }
.file-requirements ul { margin: 0; padding-left: 20px; }
.file-requirements li { margin-bottom: 8px; color: #555; }

/* Step 2 — inline configuration (App.css, verbatim) */
.inline-configuration { background: transparent; max-height: 70vh; overflow-y: auto; padding-right: 10px; text-align: left; }
.config-form-container { background: white; border-radius: 12px; padding: 25px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); }
.rank-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
  margin-bottom: 1rem; padding: .5rem; border-radius: .375rem;
  background: #f6f8fa; font-size: 12px;
}
.rank-legend .lb { display: inline-flex; align-items: center; gap: 4px; }
.rk {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 4px; color: white;
  font-size: 11px; font-weight: 700; flex: 0 0 auto;
}
.config-row { display: flex; gap: 24px; }
.config-col { flex: 1; min-width: 0; }
@media (max-width: 768px) { .config-row { flex-direction: column; } }
.form-group { margin-bottom: 1rem; }
.config-label { font-size: 0.95rem; font-weight: 600; color: #00205C; margin-bottom: 5px; display: inline-block; }
.field-description { font-size: 0.8rem; color: #6c757d; margin-bottom: 8px; font-style: italic; }
.link-note { color: #6c757d; font-size: 11px; margin-top: 4px; }

.field-checkboxes {
  border: 1px solid #e9ecef; border-radius: 6px; padding: 12px;
  background: #f8f9fa; max-height: 200px; overflow-y: auto;
}
.field-checkbox { margin-bottom: 8px; display: flex; align-items: center; }
.field-checkbox input { margin: 0 .5rem 0 0; cursor: pointer; }
.field-checkbox label { font-size: 0.85rem; color: #495057; margin: 0; cursor: pointer; }
.selected-field {
  background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 0.375rem;
  padding: 4px 8px; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between;
}
.selected-field label { flex-grow: 1; text-align: left; }
.field-arrows { display: flex; gap: 4px; margin-left: 8px; }
.field-arrows .btn { padding: 2px 6px; font-size: 12px; line-height: 1; min-width: 24px; }
.field-separator { margin: 16px 0 12px 0; text-align: center; }
.field-separator hr { margin: 8px 0; border: 0; border-top: 2px solid #adb5bd; opacity: 0.8; }
.disabled-field { opacity: 0.6; }
.disabled-field label { color: #6c757d; cursor: default; }
.disabled-field input { cursor: default; }

.config-buttons {
  display: flex; justify-content: center; gap: 15px;
  margin-top: 25px; padding-top: 20px; border-top: 1px solid #e9ecef;
}
.btn-cancel { padding: 10px 25px; font-size: 0.95rem; font-weight: 500; border-radius: 6px; }
.btn-generate { padding: 10px 25px; font-size: 0.95rem; font-weight: 600; background: #00205C; border-color: #00205C; border-radius: 6px; color: #fff; }
.btn-generate:hover { background: #2a5298; border-color: #2a5298; }
.btn-generate:disabled { background: #6c757d; border-color: #6c757d; }

/* RankedFieldSelect — Bootstrap dropdown replica */
.rfs { position: relative; }
.rfs-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  color: #6c757d; border: 1px solid #6c757d; background: #fff; border-radius: .25rem;
  padding: .25rem .5rem; font-size: .875rem; font-family: inherit; cursor: pointer; text-align: left;
}
.rfs-toggle:hover { color: #fff; background: #6c757d; }
.rfs-toggle:hover .rk { outline: 1px solid rgba(255,255,255,.4); }
.rfs-toggle .cap-wrap { display: flex; align-items: center; overflow: hidden; }
.rfs-toggle .cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rfs-toggle::after {
  content: ""; margin-left: .5em; border-top: .3em solid; border-right: .3em solid transparent;
  border-left: .3em solid transparent; flex: 0 0 auto;
}
.rfs .rk { width: 20px; height: 20px; min-width: 20px; border-radius: 5px; font-size: 12px; margin-right: 8px; }
.rfs-menu {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 2px);
  background: #fff; border: 1px solid rgba(0,0,0,.15); border-radius: .375rem;
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.175); max-height: 340px; overflow-y: auto;
  padding: .5rem 0; display: none; text-align: left;
}
.rfs.open .rfs-menu { display: block; }
.rfs-item { display: flex; align-items: flex-start; padding: .5rem 1rem; cursor: pointer; font-size: 1rem; color: #212529; }
.rfs-item:hover { background: #e9ecef; }
.rfs-item.active { background: #0d6efd; color: #fff; }
.rfs-item.active .rfs-reason, .rfs-item.active .rfs-field { color: #fff !important; }
.rfs-item .rfs-field { font-weight: 600; }
.rfs-item .rfs-field.bad { color: #c0392b; }
.rfs-item .rfs-reason { display: block; color: #6c757d; font-size: 12px; line-height: 1.25; }
.rfs-divider { height: 0; margin: .5rem 0; border-top: 1px solid rgba(0,0,0,.15); overflow: hidden; }
.rfs-none { color: #6c757d; }

/* Node preview panel */
.preview-panel { margin-bottom: 1rem; padding: 1rem; border-radius: .375rem; background: #f6f8fa; }
.preview-stack { display: flex; flex-direction: column; align-items: center; gap: 0; }
.pv-conn { width: 2px; height: 22px; background: #b0b7c0; }
.pv-card {
  min-width: 200px; max-width: 240px; background: #fff; border: 1px solid #d0d7de;
  border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); overflow: hidden; font-size: 13px; text-align: left;
}
.pv-stripe { height: 6px; }
.pv-body { padding: 10px 12px; }
.pv-title { font-weight: 700; color: #1f2328; }
.pv-title.vac { color: #b8860b; }
.pv-vac { margin-left: 6px; font-size: 11px; font-weight: 600; color: #b8860b; }
.pv-sub { color: #6c757d; font-size: 11px; margin-top: 2px; }
.pv-fields { margin-top: 8px; border-top: 1px solid #eee; padding-top: 6px; }
.pv-row { display: flex; justify-content: space-between; gap: 8px; line-height: 1.5; }
.pv-row .l { color: #6c757d; font-size: 11px; }
.pv-row .v { font-size: 11px; text-align: right; }
.pv-ok { color: #198754; font-size: .875em; margin-top: .5rem; text-align: center; }
.pv-bad { color: #c0392b; font-size: .875em; margin-top: .5rem; text-align: center; }
.pv-empty { color: #6c757d; font-size: .875em; border: 1px dashed #ccc; border-radius: 8px; padding: 1rem; text-align: center; }

/* Step 2 revisit — "Continue with Current Settings" */
.continue-existing { text-align: center; margin-top: 30px; }
.continue-existing .btn-success { background: #198754; border: 0; }
.continue-existing p { font-size: 0.9rem; color: #666; margin-top: 10px; }

/* Step 3 — final step (App.css, verbatim) */
.final-step { max-width: none; }
.chart-header { text-align: center; margin-bottom: 30px; }
.chart-actions { margin: 20px 0; }
.finish-button {
  background: #28a745; color: #fff; border: none; padding: 15px 30px;
  font-size: 1.1rem; border-radius: 8px; font-weight: 400; cursor: pointer; font-family: inherit;
}
.finish-button:hover { background: #218838; }
.chart-preview {
  background: white; border-radius: 10px; padding: 20px; margin-top: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* ================= Main app view (App.tsx Navbar + App.css) ================= */
.who-navbar {
  background: linear-gradient(135deg, #001640 0%, #00205C 55%, #0a3a78 100%);
  box-shadow: 0 2px 14px rgba(0, 32, 92, 0.28);
  display: flex; align-items: center;
  padding: .5rem 1.5rem;
}
.who-navbar .navbar-brand { display: flex; align-items: center; padding: 0; margin: 0; }
.who-navbar .nav-spacer { flex: 1; }
.who-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.who-navbar .btn { border-radius: 999px; font-weight: 600; letter-spacing: .01em; }
.who-navbar .btn-outline-light { border-color: rgba(255,255,255,.45); }
.who-navbar .btn-outline-light:hover { background: rgba(255,255,255,.14); border-color: #fff; color: #fff; }
.who-cta { box-shadow: 0 2px 10px rgba(0,0,0,.18); color: var(--navy) !important; }

/* Light working surface under the toolbar (prototype-theme.css .app-main)
   + Container fluid py-3 */
#app .app-main { padding: 1rem 12px; }

.welcome-wrap { margin: 3rem 0; }
.welcome-message { padding: 60px 20px; color: #666; }
.welcome-message h3 { color: #00205C; margin: 0 0 15px; font-size: 1.75rem; font-weight: 500; }
.welcome-message p { margin: 0; }

/* OrgChart component (OrgChart.tsx render + App.css) */
.org-chart-container { position: relative; padding: 10px; }
.chart-card {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 30px;
  border: 1px solid rgba(0,0,0,.125);
}
.chart-card .card-body { padding: 1rem; }
.org-chart { width: 100%; height: 85vh; overflow: auto; background-color: white; cursor: grab; }
.org-chart:active { cursor: grabbing; }
.org-chart svg { display: block; }
.org-chart .node { cursor: pointer; }
.org-chart .node text { font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif; }
.node-info { font-size: 10px; fill: #666; }

/* Legend — exact inline styles from OrgChart.tsx */
.location-legend {
  position: absolute; top: 14px; right: 14px; background: #fff;
  padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 12px;
  max-height: 70vh; overflow-y: auto; z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,32,92,0.12); min-width: 150px;
  font-family: 'Inter', system-ui, sans-serif; text-align: left;
}
.location-legend .lg-head { margin-bottom: 10px; line-height: 1.15; }
.location-legend .lg-title { font-weight: 800; color: #00205C; font-size: 13px; word-break: break-word; }
.location-legend .lg-sub { font-weight: 600; color: #5b6b82; font-size: 11px; }
.location-legend .lg-items { display: flex; flex-direction: column; gap: 4px; }
.legend-item { display: flex; align-items: center; padding: 3px 4px; }
.legend-item .sw {
  width: 16px; height: 16px; flex: 0 0 auto; margin-right: 9px;
  border: 1px solid rgba(0,0,0,0.18); border-radius: 4px;
}
.legend-item span { font-weight: 600; font-size: 12px; color: #1f2937; }

/* ================= Settings modal (ChartSettings.tsx / Bootstrap Modal lg) ================= */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1050; }
.modal-dialog {
  position: fixed; z-index: 1055; left: 50%; top: 28px; transform: translateX(-50%);
  width: 800px; max-width: calc(100vw - 2rem);
}
.modal-content {
  background: #fff; border: 1px solid rgba(0,0,0,.2); border-radius: .5rem;
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); text-align: left;
  max-height: calc(100vh - 56px); display: flex; flex-direction: column;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid #dee2e6; }
.modal-title { font-size: 1.25rem; font-weight: 500; margin: 0; }
.modal-close { background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: #000; opacity: .5; }
.modal-close:hover { opacity: 1; }
.modal-body { padding: 1rem; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .75rem; border-top: 1px solid #dee2e6; }

.nav-tabs { display: flex; list-style: none; margin: 0 0 1rem; padding: 0; border-bottom: 1px solid #dee2e6; }
.nav-tabs button {
  background: none; border: 1px solid transparent; border-radius: .375rem .375rem 0 0;
  padding: .5rem 1rem; font-family: inherit; font-size: 1rem; color: #0d6efd; cursor: pointer;
  margin-bottom: -1px;
}
.nav-tabs button:hover { border-color: #e9ecef #e9ecef #dee2e6; }
.nav-tabs button.active { color: #495057; background: #fff; border-color: #dee2e6 #dee2e6 #fff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.form-label { display: inline-block; margin-bottom: .5rem; }
.form-select {
  display: block; width: 100%; padding: .375rem 2.25rem .375rem .75rem;
  font-size: 1rem; font-family: inherit; color: #212529; background-color: #fff;
  border: 1px solid #ced4da; border-radius: .375rem; appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px;
}
.form-text { font-size: .875em; color: #6c757d; }
.border-box { border: 1px solid #dee2e6; border-radius: .375rem; padding: .5rem; }
.form-check { display: flex; align-items: center; gap: .5rem; margin-bottom: .125rem; text-align: left; }
.form-check label { cursor: pointer; }
.color-scheme-preview { padding: 1rem; border: 1px solid #dee2e6; border-radius: .375rem; }
.color-scheme-preview h6 { margin: 0 0 .25rem; font-size: 1rem; font-weight: 500; }
.swatch-row { display: flex; flex-wrap: wrap; margin-top: 1rem; }
.swatch-cell { margin-right: 1rem; margin-bottom: 1rem; display: flex; flex-direction: column; align-items: center; }
.swatch-cell .sw { width: 36px; height: 36px; border-radius: 4px; border: 1px solid #444; }
.swatch-cell span { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875em; margin-top: .25rem; }

/* Bootstrap spinner */
.spinner-border {
  display: inline-block; width: 2rem; height: 2rem; vertical-align: -.125em;
  border: .25em solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spinner-border .75s linear infinite;
}
.spinner-border.spinner-sm { width: 1rem; height: 1rem; border-width: .2em; }
.spinner-border.spinner-primary { color: #0d6efd; }
@keyframes spinner-border { to { transform: rotate(360deg); } }

/* export status toast (OrgChart.tsx exportChartAsImage) */
.export-status {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  padding: 16px 22px; background: rgba(0,32,92,0.92); color: #fff;
  border-radius: 10px; z-index: 10000; font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600; font-size: 14px; box-shadow: 0 12px 32px rgba(0,0,0,0.32);
}

/* Responsive (App.css) */
@media (max-width: 768px) {
  .step-main-title { font-size: 2rem; }
  .steps-indicator { flex-direction: column; text-align: center; }
  .step-connector { transform: rotate(90deg); width: 30px; margin: 10px 0; }
  .step-indicator { flex-direction: column; margin: 10px 0; }
  .step-circle { margin-right: 0; margin-bottom: 10px; }
  .step-content { padding: 20px; }
  .location-legend { position: static; margin-bottom: 15px; max-width: 100%; }
  .org-chart { height: 70vh; }
}
