/* =========================================================================
   tools/target-price/style.css — Pricing helper
   Theme: Palette D Spring — rust (#BC6C25)
   Mood: warm earthy, business, growing — เหมือนตลาดสด พ่อค้าแม่ค้า SME
   Layout: Hero + 2-col + Big Number Card
   ========================================================================= */

/* === Theme override (Palette D — --d-rust) === */
body {
  --blue:         #BC6C25;   /* primary — rust warm */
  --blue-dark:    #9F5A1F;   /* hover / pressed */
  --primary-bg:   #FBF1E6;   /* callout bg อ่อน */
  --primary-mid:  #F4DEC3;   /* card lift bg */
  --primary-tint: rgba(188, 108, 37, 0.13);
  --primary-text: #6B3D14;   /* darkest for text */
  --accent-light: #DDA15E;   /* border highlight (palette D tan) */
  --accent-warm:  #606C38;   /* contrast (palette D olive) */

  /* === Hero background image (Pexels — market/calculator) === */
  --hero-bg: url('https://images.pexels.com/photos/4498608/pexels-photo-4498608.jpeg?auto=compress&cs=tinysrgb&w=1600');
}

/* === Container — edge-to-edge 1400 === */
body .container {
  max-width: 1400px;
  padding: 0;
}
body .site-header-inner {
  max-width: 1400px;
  padding: 0.85rem 1.5rem;
}

/* === Back link === */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin: 1.25rem 0 0 1.5rem;
  padding: 0.5rem 1rem;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-pill);
  transition: color 0.15s;
}
.back-link:hover { color: var(--blue); }

/* ============ Layout — 2 columns ============ */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: stretch;
  margin-top: 1.25rem;
  background: #FAFBFC;
}
.calc-form {
  padding: 2rem 2rem 3rem;
  min-width: 0;
}
.calc-result {
  padding: 2rem 2rem 3rem;
  min-width: 0;
}

.form-card,
.result-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 1.75rem 1.85rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04), 0 6px 18px rgba(15,23,42,0.04);
}

@media (max-width: 768px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-form,
  .calc-result { padding: 1.25rem 1rem 1.5rem; }
  .calc-form { padding-bottom: 0.5rem; }
}
@media (max-width: 480px) {
  .form-card,
  .result-card { padding: 1.25rem 1.1rem; border-radius: 12px; }
}

/* ============ Form ============ */
.page-title {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.page-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Field — underline */
.field { margin-bottom: 2rem; }
.field-label {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.7rem;
  letter-spacing: -0.01em;
}
.field-input {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.45rem;
  transition: border-color 0.15s;
}
.field-input:focus-within { border-color: var(--blue); }
.field-input.field-input-error { border-bottom-color: #EF4444; }
.field-prefix {
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1;
}
.field-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.6rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  padding: 0;
  width: 100%;
  letter-spacing: -0.01em;
  -moz-appearance: textfield;
}
.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-input input::placeholder { color: #CBD5E1; font-weight: 400; }

.error-msg {
  color: #DC2626;
  font-size: 0.85rem;
  margin-top: 0.55rem;
  font-weight: 500;
  display: none;
}
.error-msg.show { display: block; }

/* Segmented control */
.seg-control {
  display: flex;
  background: #F1F5F9;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg-control input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-control label {
  flex: 1;
  text-align: center;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  user-select: none;
  margin: 0;
}
.seg-control label:hover { color: var(--text-soft); }
.seg-control input:checked + label {
  background: #fff;
  color: var(--blue);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
}

/* Primary button */
.btn {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(188, 108, 37, 0.32);
}
.btn:hover {
  background: var(--blue-dark);
  box-shadow: 0 6px 22px rgba(188, 108, 37, 0.42);
  transform: translateY(-1px);
}

/* ============ Result ============ */
.result-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--muted);
}
.result-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.55;
}
.result-empty p { font-size: 0.95rem; }

.result-content { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Summary cards — Big Number style === */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.summary-card {
  padding: 2rem 1.5rem;
  border-radius: 16px;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}
.summary-card-pay {
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,0.5) 0%, transparent 60%),
    linear-gradient(140deg, var(--primary-bg) 0%, var(--primary-mid) 100%);
  border-color: var(--accent-light);
  text-align: center;
}
.summary-card-pay::before {
  content: "";
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 140px;
  height: 80px;
  background-image: radial-gradient(circle, var(--accent-light) 1px, transparent 1.5px);
  background-size: 12px 12px;
  opacity: 0.55;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at right bottom, black 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at right bottom, black 30%, transparent 75%);
}
.summary-card-vat { display: none; }
.summary-card-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-text);
  margin-bottom: 0.35rem;
  letter-spacing: 0;
  opacity: 0.8;
}
.summary-card-value {
  font-size: clamp(2.5rem, 7vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 0.55rem;
  font-variant-numeric: tabular-nums;
  color: var(--primary-text);
}
.summary-card-note {
  font-size: 0.85rem;
  color: var(--primary-text);
  opacity: 0.7;
  font-weight: 500;
}

/* === Mini-stats row — BoA "Rate / APR / Points" style === */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--accent-light);
}
.mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
}
.mini-stat-label {
  font-size: 0.72rem;
  color: var(--text-soft);
  font-weight: 500;
}
.mini-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-text);
  font-variant-numeric: tabular-nums;
}
.mini-stat-value.warm { color: var(--accent-warm); }
@media (max-width: 480px) {
  .mini-stats { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .mini-stat:last-child { grid-column: 1 / -1; padding-top: 0.5rem; border-top: 1px dashed var(--accent-light); }
}

/* ============================================================
   Hero Banner — modern signal with bg image + pill stats
   ============================================================ */
.hero-banner {
  max-width: 1400px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}
.hero-inner {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  padding: 2.5rem 2.75rem;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 220px;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.hero-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(251, 241, 230, 0.96) 0%,
    rgba(244, 222, 195, 0.88) 35%,
    rgba(244, 222, 195, 0.50) 62%,
    rgba(188, 108, 37, 0.20) 100%
  );
  z-index: 0;
}
.hero-inner::after {
  content: "";
  position: absolute;
  bottom: -40%;
  right: -5%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, transparent 65%);
  pointer-events: none;
  z-index: 1;
}
.hero-inner > * { position: relative; z-index: 2; }
.hero-decoration {
  position: absolute;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--accent-light) 1px, transparent 1.5px);
  background-size: 14px 14px;
  opacity: 0.6;
  z-index: 1;
  bottom: -10px;
  left: 24%;
  width: 180px;
  height: 80px;
  -webkit-mask-image: linear-gradient(to right, black, transparent);
  mask-image: linear-gradient(to right, black, transparent);
}
.hero-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  background: #fff;
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(188, 108, 37, 0.30);
}
.hero-body { flex: 1; min-width: 0; }
.hero-title {
  font-size: clamp(1.85rem, 4.5vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--primary-text);
  margin: 0 0 0.5rem;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.hero-tagline {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0 0 1.25rem;
}
.hero-tagline strong { color: var(--primary-text); font-weight: 700; }

.hero-stats {
  display: flex;
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}
.hero-stats li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  line-height: 1.2;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.15s, border-color 0.15s;
}
.hero-stats li:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
}
.hero-stat-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-text);
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.hero-stat-lbl {
  font-size: 0.78rem;
  color: var(--text-soft);
  font-weight: 500;
}
@media (max-width: 768px) {
  .hero-banner { padding: 0 1rem; }
  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.75rem 1.5rem;
    gap: 1.25rem;
    min-height: 0;
    background-position: center top;
  }
  .hero-inner::before {
    background: linear-gradient(
      170deg,
      rgba(251, 241, 230, 0.94) 0%,
      rgba(244, 222, 195, 0.86) 60%,
      rgba(188, 108, 37, 0.18) 100%
    );
  }
  .hero-icon { width: 64px; height: 64px; border-radius: 16px; }
  .hero-icon svg { width: 36px; height: 36px; }
  .hero-stats { gap: 0.4rem; }
}

/* Breakdown */
.breakdown {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.break-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.break-row + .break-row { border-top: 1px dashed #E2E8F0; }
.break-label {
  color: var(--text-soft);
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.break-formula {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}
.break-value {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
}
.break-add    { color: var(--text-soft); font-weight: 500; }
.break-deduct { color: #DC2626; }
.break-row-subtotal {
  background: #F8FAFC;
  margin: 0.25rem -0.5rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  border-radius: 8px;
  border-top: none !important;
}
.break-row-subtotal + .break-row { border-top: none; }
.break-row-subtotal .break-label { font-weight: 500; color: var(--text); }

/* Hint text under field-label */
.hint-text {
  font-size: 0.82rem;
  color: var(--muted);
  margin: -0.4rem 0 0.55rem;
  line-height: 1.5;
}
/* hint ที่อยู่ใต้ seg-control — เว้นบนเพิ่มเติม */
.seg-control + .hint-text {
  margin-top: 0.7rem;
}

/* Seg-control 8 ปุ่ม (WHT rates) — wrap บนมือถือ */
.seg-control-wht {
  flex-wrap: wrap;
}
.seg-control-wht label {
  flex: 1 1 calc(25% - 4px);
  min-width: 0;
  padding: 0.55rem 0.3rem;
  font-size: 0.85rem;
}
@media (min-width: 600px) {
  .seg-control-wht label {
    flex: 1 1 0;
    padding: 0.7rem 0.3rem;
    font-size: 0.85rem;
  }
}

.break-row-final {
  margin-top: 0.5rem;
  padding-top: 1.1rem !important;
  border-top: 2px solid var(--text) !important;
}
.break-row-final .break-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.break-final {
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rate-badge {
  background: var(--primary-tint);
  color: var(--blue);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Summary callout */
.summary-callout {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(180deg, var(--primary-bg) 0%, var(--primary-mid) 100%);
  border: 1px solid var(--accent-light);
  border-radius: 14px;
}
.summary-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1.4;
}
.summary-text {
  color: var(--primary-text);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
}
.summary-text strong {
  font-weight: 700;
  color: var(--primary-text);
  white-space: nowrap;
}

/* ============ Info + FAQ — 2 columns ============ */
.info-grid {
  max-width: 1400px;
  margin: 4rem auto 5rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 0 1rem;
    margin: 3rem auto 4rem;
  }
}
.info-accordion { margin: 0; padding: 0; max-width: none; }
.info-accordion-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 0.5rem;
}
.info-accordion-faq .faq-grid { display: block; }

/* Accordion — Google FAQ flat */
.info-acc {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  margin: 0;
  padding: 0;
}
.info-acc:first-of-type { border-top: 1px solid var(--border-soft); }

.info-acc summary {
  padding: 1.25rem 0.25rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  user-select: none;
  transition: color 0.15s;
}
.info-acc summary::-webkit-details-marker { display: none; }
.info-acc summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  margin-bottom: 4px;
  transition: transform 0.25s, border-color 0.15s;
  flex-shrink: 0;
  opacity: 0.7;
}
.info-acc[open] summary::after {
  transform: rotate(225deg);
  margin-bottom: -4px;
  border-color: var(--blue);
  opacity: 1;
}
.info-acc summary:hover { color: var(--text); }
.info-acc[open] summary { font-weight: 500; color: var(--text); }
.info-acc-body {
  padding: 0 0.25rem 1.4rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.85;
}
.info-acc-body p { margin-bottom: 0.8rem; }
.info-acc-body p:last-child { margin-bottom: 0; }
.info-acc-body strong { color: var(--text); font-weight: 600; }
.info-acc-body em { color: var(--text); font-style: normal; font-weight: 500; }

.rate-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 0.5rem;
}
.rate-list li {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: #F8FAFC;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-soft);
}
.rate-pct {
  flex-shrink: 0;
  min-width: 2.75rem;
  text-align: center;
  background: var(--primary-tint);
  color: var(--blue);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.formula {
  background: #F8FAFC;
  border-radius: 10px;
  padding: 0.95rem 1.15rem;
}
.formula-row {
  padding: 0.45rem 0;
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.7;
}
.formula-row + .formula-row { border-top: 1px dashed var(--border); }

/* ============ Responsive ============ */
@media (max-width: 880px) {
  body .container    { padding: 1rem 1rem 3rem; }
  .calc-layout       { gap: 2rem; }
  .field-input input { font-size: 1.4rem; }
  .field-prefix      { font-size: 1.3rem; }
}
@media (max-width: 480px) {
  .seg-control label { padding: 0.6rem 0.35rem; font-size: 0.8rem; }
  .field             { margin-bottom: 1.5rem; }
  .info-grid         { padding: 0 1rem; }
  .info-acc summary  { padding: 1.1rem 0.25rem; font-size: 0.95rem; }
}
