/* PC 견적 추천 - Plain CSS, mobile-first */

:root {
  --bg: #0b1020;
  --surface: rgba(30, 41, 59, 0.5);
  --surface-border: #334155;
  --text: #e6e9f2;
  --text-muted: #94a3b8;
  --accent: #0891b2;
  --accent-hover: #06b6d4;
  --error-bg: rgba(127, 29, 29, 0.3);
  --error-border: #991b1b;
  --error-text: #fecaca;
  --safe-left: env(safe-area-inset-left, 0);
  --safe-right: env(safe-area-inset-right, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  padding-bottom: var(--safe-bottom);
}

input, select, textarea, button {
  font: inherit;
}

@media (max-width: 640px) {
  input, select, textarea, button {
    font-size: 16px;
  }
}

/* Layout */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  padding-left: max(1rem, var(--safe-left));
  padding-right: max(1rem, var(--safe-right));
}

.container {
  width: 100%;
  max-width: 42rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

@media (min-width: 640px) {
  .page { padding: 1.5rem; }
  .container { gap: 1.5rem; }
}

/* Ad placeholder */
.ad-placeholder {
  width: 100%;
  max-width: 728px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--surface-border);
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.4);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.ad-placeholder-bottom {
  margin-top: 0.5rem;
}

/* Header */
.header {
  text-align: center;
  width: 100%;
}

.title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.025em;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

@media (min-width: 640px) {
  .title { font-size: 1.5rem; }
  .subtitle { font-size: 0.875rem; }
}

/* Cards */
.card {
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 1rem;
}

@media (min-width: 640px) {
  .card { padding: 1.5rem; }
}

/* Form */
.spec-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .spec-form { gap: 1.5rem; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field label,
.field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input[type="text"],
.field textarea {
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  padding: 0.75rem 1rem;
  min-height: 44px;
}

.field textarea {
  min-height: 88px;
  resize: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.field select {
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  padding: 0.75rem 1rem;
  min-height: 44px;
  cursor: pointer;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.monitor-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
}

.monitor-fields .field-full {
  grid-column: 1 / -1;
}

.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.9;
}

/* Usage grid */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .usage-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
}

@media (min-width: 768px) {
  .usage-grid { grid-template-columns: repeat(4, 1fr); }
}

.usage-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.75rem;
  min-height: 44px;
  border: 1px solid var(--surface-border);
  border-radius: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.usage-chip:hover {
  border-color: #64748b;
}

.usage-chip:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.usage-chip input {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.usage-chip span,
.usage-chip .label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .usage-chip {
    padding: 0.625rem 1rem;
    min-height: 0;
    font-size: 0.875rem;
  }
}

/* Submit button */
.btn-submit {
  width: 100%;
  min-height: 48px;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
  touch-action: manipulation;
}

.btn-submit:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

/* Error message */
.error-message {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--error-border);
  border-radius: 0.75rem;
  background: var(--error-bg);
  color: var(--error-text);
  font-size: 0.875rem;
}

.error-message[hidden] {
  display: none;
}

/* Result section */
.result-card {
  display: block;
}

.result-card[hidden] {
  display: none;
}

.result-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 1rem;
}

@media (min-width: 640px) {
  .result-title { font-size: 1.125rem; }
}

.result-block {
  margin-bottom: 1.5rem;
}

.result-block:last-of-type {
  margin-bottom: 0;
}

.result-block-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--surface-border);
}

/* 결과 페이지 전용 */
.page-result .container {
  max-width: 52rem;
}

.header-result {
  position: relative;
  padding-top: 0.25rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* 그룹별 세분화 (주요 부품 / 주변기기) */
.spec-group {
  margin-bottom: 1.25rem;
}

.spec-group:last-child {
  margin-bottom: 0;
}

.spec-group-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.spec-group .result-table-wrap {
  margin-bottom: 0;
}

/* 성능 그룹 (게이밍·3D / 크리에이티브 / 시스템) */
.perf-group {
  margin-bottom: 1.25rem;
}

.perf-group:last-child {
  margin-bottom: 0;
}

.perf-group-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.perf-group .perf-chart {
  margin-top: 0.5rem;
}

.result-table-wrap {
  border: 1px solid var(--surface-border);
  border-radius: 0.75rem;
  background: rgba(30, 41, 59, 0.6);
  overflow: hidden;
  overflow-x: auto;
}

.spec-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8125rem;
  table-layout: fixed;
}

.spec-table th:nth-child(1),
.spec-table td:nth-child(1) {
  width: 30%;
}

.spec-table th:nth-child(2),
.spec-table td:nth-child(2) {
  width: 45%;
}

.spec-table th:nth-child(3),
.spec-table td:nth-child(3) {
  width: 25%;
}

.spec-table .spec-price,
.spec-table th.spec-price,
.spec-table td.spec-price {
  text-align: right;
  white-space: nowrap;
}

.spec-table td.spec-price {
  color: var(--text-muted);
  font-weight: 500;
}

@media (min-width: 640px) {
  .spec-table { font-size: 0.875rem; }
}

.spec-table th,
.spec-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--surface-border);
  vertical-align: top;
}

.spec-table thead tr {
  background: rgba(30, 41, 59, 0.8);
}

.spec-table th {
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.spec-table .spec-category {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.spec-table .spec-value {
  color: var(--text);
  word-break: break-word;
}

/* 성능 · 퍼포먼스 바 차트 */
.perf-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.4;
}

.perf-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.perf-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.perf-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.perf-label {
  font-size: 0.8125rem;
  color: var(--text);
  font-weight: 500;
}

.perf-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  max-width: 200px;
}

.perf-bar-track {
  flex: 1;
  min-width: 60px;
  height: 10px;
  background: rgba(51, 65, 85, 0.6);
  border-radius: 4px;
  overflow: hidden;
}

.perf-bar-wrap .perf-bar {
  height: 100%;
  min-width: 0;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.perf-bar-wrap .perf-score {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 1.5rem;
  text-align: right;
}

@media (min-width: 640px) {
  .perf-bar-wrap { max-width: 260px; }
  .perf-bar-track { height: 12px; }
}

.result-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-border);
  border-radius: 0.75rem;
  background: rgba(30, 41, 59, 0.8);
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.result-total strong {
  font-size: 1.125rem;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 저장하기 버튼 */
.result-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.btn-save {
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-save:hover {
  background: var(--accent);
  color: #fff;
}

.save-message {
  margin: 0;
  font-size: 0.875rem;
  color: var(--accent);
}

.save-message[hidden] {
  display: none;
}
