/* ─── 기본 변수 ─────────────────────────────────── */
:root {
  --bg:        #1E2A33;
  --surface:   #253342;
  --border:    #334455;
  --text:      #F4EFE6;
  --text-muted:#8FA3B0;
  --accent:    #DB6B3E;
  --accent-dim:#B85530;

  --low:       #4CAF7D;
  --medium:    #E6A817;
  --high:      #E07340;
  --critical:  #D94F4F;

  --radius:    8px;
  --radius-sm: 4px;
  --shadow:    0 2px 8px rgba(0,0,0,0.28);
}

/* ─── 리셋 ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── 레이아웃 ──────────────────────────────────── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ─── 헤더 ──────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
  margin-bottom: 32px;
}
.header-inner {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.logo-accent { color: var(--accent); }
.tagline {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── 폼 ─────────────────────────────────────────── */
.form-section {
  margin-bottom: 40px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 120ms;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder { color: var(--text-muted); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238FA3B0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-error {
  color: var(--critical);
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid var(--critical);
  border-radius: var(--radius-sm);
}

/* ─── 버튼 ──────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  transition: background 120ms;
  margin-top: 4px;
}
.btn-primary:hover  { background: var(--accent-dim); }
.btn-primary:active { background: var(--accent-dim); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 9px 20px;
  transition: border-color 120ms, color 120ms;
  margin-top: 8px;
}
.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ─── 결과 영역 ─────────────────────────────────── */
.results-section { margin-bottom: 48px; }

/* 추천 카드 */
.recommend-card {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  background: var(--surface);
}
.recommend-meta {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.recommend-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.recommend-reasons {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.recommend-reasons li {
  font-size: 14px;
  color: var(--text-muted);
  padding-left: 12px;
  position: relative;
}
.recommend-reasons li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* 점수 행 */
.result-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.block-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.block-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}
.score-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.score-label {
  font-size: 13px;
  width: 100px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.score-label.is-winner { color: var(--text); font-weight: 600; }
.score-track {
  flex: 1;
  background: var(--border);
  border-radius: 2px;
  height: 6px;
  overflow: hidden;
}
.score-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--border);
  transition: width 400ms ease;
}
.score-bar.is-winner { background: var(--accent); }
.score-num {
  font-size: 13px;
  font-weight: 600;
  width: 32px;
  text-align: right;
  color: var(--text-muted);
}
.score-num.is-winner { color: var(--accent); }

/* 2열 그리드 */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* 주차 혼잡 */
.parking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.level-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
}
.level-badge.low      { color: var(--low);      border-color: var(--low); }
.level-badge.medium   { color: var(--medium);   border-color: var(--medium); }
.level-badge.high     { color: var(--high);     border-color: var(--high); }
.level-badge.critical { color: var(--critical); border-color: var(--critical); }
.parking-percent-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.bar-track {
  background: var(--border);
  border-radius: 2px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}
.bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 400ms ease;
}
.bar-fill.low      { background: var(--low); }
.bar-fill.medium   { background: var(--medium); }
.bar-fill.high     { background: var(--high); }
.bar-fill.critical { background: var(--critical); }

/* 출발 시간 */
.departure-big {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.departure-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.meta-label { font-size: 12px; color: var(--text-muted); }
.meta-val   { font-size: 13px; font-weight: 600; color: var(--text); }

/* 비용 테이블 */
.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.cost-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 0 8px 0;
  border-bottom: 1px solid var(--border);
}
.cost-table th:last-child { text-align: right; }
.cost-table td {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  vertical-align: middle;
}
.cost-table tr:last-child td { border-bottom: none; }
.cost-table td:nth-child(2) {
  text-align: right;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cost-table td:last-child {
  text-align: right;
  font-size: 11px;
  width: 64px;
}
.cost-row-winner td { color: var(--text); }
.cost-row-winner td:first-child { font-weight: 600; }
.tag-cheapest {
  color: var(--low);
  font-weight: 600;
}
.tag-recommended {
  color: var(--accent);
  font-weight: 600;
}

/* AI 리포트 */
.report-text {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: keep-all;
}

/* ─── 푸터 ──────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── 반응형 ─────────────────────────────────────── */
@media (max-width: 520px) {
  .field-row   { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .departure-big { font-size: 22px; }
}
