/*
 * 차 찾기 · 견적 · 내 견적 (Task 3). 색·글자·간격은 demo.css 토큰만 쓴다.
 * 부품: .field(입력 칸) · .find__*(브랜드 고르기·월 금액으로 찾기) · .q-*(견적 화면) · .cond__*(조건 버튼 줄) · .trims__*(트림 창) · .saved*(내 견적)
 * Task 7: 회색 바탕 위 흰 카드는 demo.css의 .sec·.panel. 여기 카드(.q-card·.saved)는 흰 카드 안에 놓여 선으로만 나눈다.
 */

/* ───────── 입력 칸 ───────── */
.field {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}
.field:focus-within { border-color: var(--brand); }
.field .icon { flex: none; width: 20px; height: 20px; color: var(--muted); }
.field__input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 휴대폰에서 확대되지 않게 16px 이상 */
  outline: 0;
}
.field__input::placeholder { color: var(--muted); }
.field__input::-webkit-search-cancel-button { cursor: pointer; }
.field__unit { flex: none; color: var(--muted); font-size: var(--t-sm); }
.field__error { color: var(--hot-ink); font-size: var(--t-sm); font-weight: 600; }
/* 회색 바탕 위 검색창은 흰 면 + 카드 그림자(누르면 테두리가 초록) */
.field--search { margin: var(--s-3) 0 var(--s-1); border-color: var(--bg); box-shadow: var(--card-shadow); }

/* ───────── 차 찾기 ───────── */
.find__label { margin-bottom: var(--s-2); color: var(--muted); font-size: var(--t-sm); font-weight: 700; }
.find__brands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.find__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 52px;
  padding: 0 var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-weight: 700;
  transition: transform 0.15s ease-out;
}
.find__brand:active:not(:disabled) { transform: scale(0.97); }
.find__brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.find__brand-count { flex: none; color: var(--muted); font-size: var(--t-sm); font-weight: 500; font-variant-numeric: tabular-nums; }
.find__browse > .fine { margin-top: var(--s-4); }
.find__results { margin-top: var(--s-2); }
.find__note { margin-top: var(--s-3); }
.find__sort { margin: var(--s-2) 0 var(--s-1); }
/* 보기 고르기(브랜드로 찾기 · 월 금액으로 찾기): 특별전 탭(.seg, deals.css)과 같은 모양 */
.find__views { margin: var(--s-3) 0 0; }
.find__filter { margin-top: var(--s-2); gap: 6px; }
.find__views + .find__browse > .find__filter:first-child { margin-top: var(--s-4); }
.find__more { width: 100%; margin-top: var(--s-3); }
.find__basis { margin: var(--s-1) 0 0; }
/* 모델 행 오른쪽: 월 금액 한 줄(‘부터’는 같은 줄) + 차량 가격 작은 줄 */
.find__side .price { color: var(--brand); }
.find__side .price__from { display: inline; margin: 0 0 0 4px; }
.find__car-price { display: block; margin-top: 2px; color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ───────── 견적: 차와 차량 가격(흰 카드 .panel) ───────── */
.q-head__art { width: min(240px, 72%); margin: 0 auto var(--s-3); }
.q-head__name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.q-head__title { font-size: var(--t-xl); font-weight: 800; line-height: 1.3; letter-spacing: -0.02em; }
.q-head__trim { min-height: 28px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.q-head__meta { margin-top: 2px; color: var(--muted); font-size: var(--t-sm); }

.q-price {
  display: grid;
  gap: 6px;
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.q-price__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); font-size: var(--t-sm); }
.q-price__row strong { font-size: var(--t-md); font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-price__row .badge { margin-left: 4px; vertical-align: 1px; }
.q-price__row--total strong { color: var(--brand); }
.q-price__foot { display: grid; gap: var(--s-2); margin-top: 2px; }
.q-price__btns { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.q-price__btn { flex: none; min-height: 36px; padding: 0 var(--s-3); font-size: var(--t-sm); }

/* ───────── 견적: 큰 금액(초록 면 카드) ───────── */
.q-best {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 112px;
  margin-top: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-lg);
  background: var(--brand-soft);
  box-shadow: var(--card-shadow);
}
.q-best__label { font-size: var(--t-sm); font-weight: 700; }
.q-best__amount { color: var(--brand); }
.q-best__side { color: var(--muted); font-size: var(--t-sm); }
.q-best__skel { width: 58%; height: 34px; margin: 4px 0; background: var(--bg); }
.q-best .skel { background: var(--bg); }
.q-best__none { display: grid; gap: 2px; padding: var(--s-2) 0; }
.q-best__none strong { font-size: var(--t-lg); }
.q-best__none span { color: var(--muted); font-size: var(--t-sm); }
.q-status { margin-top: 6px; }

/* 로그인 전: 금융사별 비교 대신 한 칸(카카오 로그인 버튼) */
.q-lock { display: flex; flex-direction: column; gap: var(--s-3); }
.q-lock__text { font-size: var(--t-sm); font-weight: 600; line-height: 1.55; }

/* ───────── 견적: 조건 버튼 줄(흰 카드 .panel) ───────── */
.cond { display: grid; gap: var(--s-4); }
.cond__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: 6px; }
.cond__label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); font-weight: 700; }
.cond__help {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: var(--t-xs);
  font-weight: 800;
  line-height: 1;
}
.cond__help::after { content: ""; position: absolute; inset: -11px; } /* 22px 원을 44px 누르는 자리로 넓힌다 */
.cond__side { color: var(--brand); font-size: var(--t-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.cond__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cond__chips--4, .cond__chips--5 { display: grid; }
.cond__chips--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cond__chips--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cond__chips .chip { padding: 0 4px; white-space: nowrap; }

/* ───────── 견적: 금융사별 비교 ───────── */
.q-sort { margin-bottom: var(--s-3); }
.q-sort__hint { margin-bottom: 6px; }
.q-list { display: grid; gap: var(--s-3); }
.q-card {
  display: grid;
  gap: 6px;
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.q-card--pending {
  min-height: 72px;
  place-items: center;
  border-style: dashed;
  color: var(--muted);
  font-size: var(--t-sm);
}
.q-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.q-card__name { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-md); font-weight: 800; }
/* 순위 숫자: 1위만 짙은 초록, 나머지는 옅은 면 */
.q-card__rank {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--ink);
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
}
.q-list > .q-card:first-child .q-card__rank { background: var(--brand); color: var(--on-brand); }
.q-card__total { font-size: var(--t-sm); }
.q-card__total strong { color: var(--brand); font-variant-numeric: tabular-nums; }
.q-card__summary { color: var(--muted); font-size: var(--t-sm); }

.q-why { margin-top: 2px; border-top: 1px solid var(--line); }
.q-why__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  color: var(--brand);
  font-size: var(--t-sm);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.q-why__summary::-webkit-details-marker { display: none; }
.q-why__summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: 0 4px 3px 0;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}
.q-why[open] .q-why__summary::after { margin-bottom: -3px; transform: rotate(-135deg); }
.q-why__lines { display: grid; gap: 4px; padding: var(--s-1) 0 var(--s-2); }
.q-why__line { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--t-sm); }
.q-why__line dt { color: var(--muted); }
.q-why__line dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.q-why__line--total { padding-top: 4px; border-top: 1px dashed var(--line); font-weight: 700; }
.q-why__line--total + .q-why__line--total { padding-top: 0; border-top: 0; }
.q-why__line--total dt { color: var(--ink); }
.q-why__notes { display: grid; gap: 2px; padding-bottom: var(--s-2); color: var(--muted); font-size: var(--t-xs); }

.q-hidden:empty { display: none; }
.q-missing { margin-top: var(--s-3); border-radius: var(--r-md); background: var(--soft); }
.q-missing__summary { padding: var(--s-3) var(--s-4); color: var(--muted); font-size: var(--t-sm); cursor: pointer; }
.q-missing__list { display: grid; gap: 4px; padding: 0 var(--s-4) var(--s-3); font-size: var(--t-sm); }
.q-notes { display: grid; gap: 4px; margin-top: var(--s-5); }

/* ───────── 트림 바꾸기 창 ───────── */
.trims { display: grid; gap: var(--s-1); }
.trims__year { margin-top: var(--s-2); color: var(--muted); font-size: var(--t-sm); font-weight: 700; }
.trims__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--s-3);
  align-items: center;
  padding: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: transform 0.15s ease-out;
}
.trims__item:active:not(:disabled) { transform: scale(0.97); }
.trims__item[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); }
.trims__name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 700; }
.trims__sub { grid-column: 1; color: var(--muted); font-size: var(--t-xs); }
.trims__price { grid-column: 2; grid-row: 1 / span 2; font-size: var(--t-sm); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ───────── 내 견적 ───────── */
.my__sec { margin-top: var(--s-3); }
.saved-list { display: grid; gap: var(--s-3); }
.saved {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.saved__open { flex: 1; min-width: 0; display: grid; gap: 3px; transition: transform 0.15s ease-out; }
.saved__open:active:not(:disabled) { transform: scale(0.97); }
.saved__name { font-weight: 800; }
.saved__cond, .saved__date { color: var(--muted); font-size: var(--t-sm); }
.saved__price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: var(--t-lg); }
.saved__price .price { color: var(--brand); }
.saved__lender { color: var(--muted); font-size: var(--t-sm); }
.saved__del {
  flex: none;
  min-height: 36px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--muted);
  font-size: var(--t-xs);
}
.my__title { margin-bottom: var(--s-2); font-size: var(--t-md); font-weight: 800; }
.my__consults { display: grid; gap: var(--s-2); }
.my__consults li { display: grid; gap: 1px; font-size: var(--t-sm); }
.my__consults span { color: var(--muted); }
.my__fine { margin-top: var(--s-4); }

@media (hover: hover) {
  .find__brand:hover, .trims__item:hover, .saved__open:hover .saved__name { color: var(--brand); }
  .find__brand:hover { border-color: var(--brand); }
}
