/* =========================================================
   DFC Framework — stylesheet
   ========================================================= */

/* ----- Custom Properties ----- */
:root {
  --primary:       #3B82F6;
  --primary-dark:  #1D4ED8;
  --bg:            #F1F5F9;
  --surface:       #FFFFFF;
  --text:          #1E293B;
  --text-muted:    #64748B;
  --border:        #E2E8F0;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.10);
}

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }

/* =========================================================
   HEADER
   ========================================================= */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.logo-link {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.logo-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-link.active {
  color: var(--primary);
  background: #EFF6FF;
  font-weight: 600;
}

/* =========================================================
   MAIN / FOOTER
   ========================================================= */
.main {
  flex: 1;
  padding: 2.5rem 1.5rem;
}

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) { transform: scale(0.98); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #CBD5E1;
}

.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-large {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

/* =========================================================
   INTRO / HERO
   ========================================================= */
#intro-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px - 120px);
  padding: 2rem 1rem;
}

.hero {
  max-width: 560px;
  width: 100%;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  background: #EFF6FF;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.15;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
}

.hero-form input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.hero-form input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.hero-form .btn-primary { width: 100%; justify-content: center; }

.field-error {
  color: #EF4444;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  text-align: left;
}

/* =========================================================
   EVALUATION SECTION
   ========================================================= */
#eval-section {
  max-width: 720px;
  margin: 0 auto;
}

.eval-wrap { padding-bottom: 3rem; }

/* Progress bar */
#progress-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

#progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}

.step-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.25rem;
}

/* Dimension card */
.dimension-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.dim-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.dim-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.weight-badge {
  background: #EFF6FF;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.scale-legend {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Skip dimension toggle */
.skip-dim-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-track input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-track input:checked + .toggle-slider {
  background: #F59E0B;
}

.toggle-track input:checked + .toggle-slider::after {
  transform: translateX(18px);
}

/* Params container */
.params-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: opacity 0.2s, pointer-events 0.2s;
}

.params-container.is-skipped {
  opacity: 0.3;
  pointer-events: none;
}

.param-item { }

.param-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.param-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}

/* Score buttons */
.score-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.score-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.score-btn:hover { border-color: #94A3B8; background: var(--bg); }
.score-btn:active { transform: scale(0.95); }

/* Active score colors */
.score-btn[data-val="1"].active { background: #10B981; border-color: #10B981; color: #fff; }
.score-btn[data-val="2"].active { background: #84CC16; border-color: #84CC16; color: #fff; }
.score-btn[data-val="3"].active { background: #F59E0B; border-color: #F59E0B; color: #fff; }
.score-btn[data-val="4"].active { background: #F97316; border-color: #F97316; color: #fff; }
.score-btn[data-val="5"].active { background: #EF4444; border-color: #EF4444; color: #fff; }
.score-btn.skip.active           { background: #94A3B8; border-color: #94A3B8; color: #fff; }

/* Nav wrap */
#nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  gap: 1rem;
}

.step-counter {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* =========================================================
   RESULTS SECTION
   ========================================================= */
#results-section {
  max-width: 720px;
  margin: 0 auto;
}

.result-header {
  margin-bottom: 2rem;
  text-align: center;
}

.result-product-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.result-date {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* CF display */
.cf-display {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.cf-number {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.cf-classification {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.cf-bar-track {
  height: 12px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 400px;
}

.cf-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease, background 0.3s;
}

/* Breakdown table */
.breakdown-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.breakdown-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.breakdown-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.breakdown-table th.num { text-align: right; }

.breakdown-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.breakdown-table td.num { text-align: right; }

.breakdown-table tr:last-child td { border-bottom: none; }

.score-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  min-width: 52px;
  text-align: center;
}

.skip-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Export buttons */
.export-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.restart-wrap {
  text-align: center;
  padding-top: 0.5rem;
}

.restart-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.restart-btn:hover {
  background: var(--bg);
  color: var(--text);
}

/* =========================================================
   COMPARE PAGE
   ========================================================= */
.compare-page {
  max-width: 880px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.97rem;
  max-width: 560px;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.upload-zone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: #F0F7FF;
}

.upload-zone.has-file {
  border-color: #10B981;
  background: #F0FDF4;
}

.upload-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.upload-label {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  /* hidden but still receives native file dialog via JS click */
  display: none;
}

.upload-filename {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  word-break: break-all;
}

.upload-zone.has-file .upload-filename {
  color: #059669;
  font-weight: 600;
}

.compare-actions {
  margin-bottom: 2rem;
}

/* Compare result card */
.compare-result-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: 1.5rem;
}

.compare-header-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2rem;
  text-align: center;
}

.compare-side-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.compare-product-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.compare-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.compare-cf {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.compare-classification {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.compare-delta-col {
  text-align: center;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  min-width: 80px;
}

.compare-delta-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.compare-delta-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.compare-delta-arrow {
  font-size: 1.4rem;
  line-height: 1;
}

/* Compare table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.compare-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.compare-table th.num-col { text-align: right; }

.compare-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.compare-table td.num-col { text-align: right; font-variant-numeric: tabular-nums; }
.compare-table tr:last-child td { border-bottom: none; }

.arrow-cell { font-weight: 700; }

.skip-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.compare-legend {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 640px) {
  .main { padding: 1.5rem 1rem; }

  .logo-sub { display: none; }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-header-grid {
    grid-template-columns: 1fr;
  }

  .compare-delta-col {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
  }

  #nav-wrap {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .step-counter {
    order: -1;
    width: 100%;
    text-align: center;
  }

  #btn-prev, #btn-next {
    flex: 1;
    justify-content: center;
  }

  .export-buttons {
    flex-direction: column;
  }

  .export-buttons .btn-primary,
  .export-buttons .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .hero-title { font-size: 2rem; }
}
