/* Layout + page-specific styles */

/* FIX 2026-08-05 — ฟอนต์ทั้งหน้า user เป็น LINE Seed Sans TH Game (ไฟล์เดียวกับ Post Builder) */
@font-face {
  font-family: 'LINE Seed Sans TH Game';
  src: url('../assets/fonts/LINESeedSansTH_G_Bd.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LINE Seed Sans TH Game';
  src: url('../assets/fonts/LINESeedSansTH_W_Rg.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
:root {
  --font-display: 'LINE Seed Sans TH Game', sans-serif;
  --font-body: 'LINE Seed Sans TH Game', sans-serif;
  --font-en: 'LINE Seed Sans TH Game', sans-serif;
}

/* FIX 2026-08-05 ข้อ 2 — ตัวเลขในกรอบสรุปผลใหญ่ขึ้น */
.summary-lines { font-size: 15px; }
.summary-lines div span:last-child {
  font-size: 17px;
  font-weight: 700;
}

/* FIX 2026-08-05 ข้อ 3 — ป้ายเหลืองข้อความขนาดเดียวทั้งก้อน */
.big-answer .eq-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.5;
}

.app-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .panel-grid {
    grid-template-columns: 1fr 2fr;
    align-items: start;
  }
}

.card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--c-border);
}

.legal-banner {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 10px 0;
}
.legal-banner.ok {
  background: #e5f1e5;
  color: var(--c-green);
}
.legal-banner.warn {
  background: #fdf1de;
  color: var(--c-amber);
}

.explainer-note {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 8px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---- Mobile responsive fixes (Phase 7 T2) ----
   Root cause of the reported overflow: flex/grid children (summary-line
   values, stat tiles, field-row number inputs) had no min-width:0 / wrap
   rule, so long numbers pushed their container wider than the viewport;
   body's overflow-x:hidden (theme.css) then clipped that overflow instead
   of allowing scroll, which is why values looked "cut off" with no way to
   reveal them via pinch-zoom. */
.app-main,
.app-header,
.app-footer {
  max-width: 100vw;
  overflow-x: hidden;
}

.card,
.panel-grid,
.field-row {
  min-width: 0;
}

.summary-lines div {
  flex-wrap: wrap;
  min-width: 0;
}
.summary-lines div span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stat-tiles {
  min-width: 0;
}
.stat-tile {
  min-width: 0;
}

.table-scroll {
  max-width: 100%;
}

@media (max-width: 480px) {
  .app-main { padding: 12px; }

  .field-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .field-row input {
    padding: 8px 6px;
    font-size: 14px;
  }

  .summary-lines div {
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 0;
    gap: 2px;
  }
  .summary-lines div span:last-child {
    font-weight: 700;
    color: var(--c-charcoal);
  }

  .stat-tiles {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }
  .stat-tile .stat-value {
    font-size: 16px;
  }

  .big-answer .value {
    font-size: clamp(24px, 10vw, 34px);
  }
}

/* HOUSING V2 (2026-08-10) — Eff./ค่าพัฒนาโครงการ ปุ่มระดับ + คำอธิบาย + แถบเตือนลิงก์เก่า */
.field-hint {
  font-size: 12px;
  color: var(--c-muted);
  margin: 4px 0 0;
  line-height: 1.5;
}

.dev-range-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.dev-range-btn {
  border: 1px solid var(--c-border);
  background: var(--c-white);
  color: var(--c-muted);
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1.4;
}
.dev-range-btn span {
  font-weight: 400;
  font-size: 10px;
}
.dev-range-btn.active {
  background: var(--c-amber);
  color: var(--c-white);
  border-color: var(--c-amber);
}
.dev-range-detail {
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--c-white);
  border: 1px solid var(--c-border);
  font-size: 11px;
  color: var(--c-muted);
  line-height: 1.6;
}
.dev-range-detail strong {
  color: var(--c-amber);
}

.banner-warning {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  background: #fdf1de;
  color: var(--c-amber);
  border: 1px solid var(--c-amber);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
}
.banner-warning .banner-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

.housing-cost-steps {
  font-size: 13px;
  margin: 10px 0;
}
.housing-cost-steps div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--c-border);
}
.housing-cost-steps div:last-child {
  border-bottom: none;
  font-weight: 700;
}

@media print {
  .no-print { display: none !important; }
}

/* ---- Bonus FAR toggle (ตั้ม 2026-09-02) --------------------------------
   เหตุผลเดียวกับ post.css F1: theme.css `.field label {display:block}` (0,2,0)
   ชนะ `.row-toggle` (0,1,0) → checkbox จะไปอยู่คนละบรรทัดกับข้อความและเป็นตัวพิมพ์ใหญ่
   และ `.field input {width:100%}` จะยืด checkbox เต็มแถว — ต้องรีเซ็ตทั้งสองกฎ
   (ห้ามแก้ theme.css เพราะใช้ร่วมทั้งเว็บ) */
.field .row-toggle,
.field label.row-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: inherit;
  margin: 8px 0 0;
  cursor: pointer;
}
.field .row-toggle input { flex-shrink: 0; margin: 0; width: auto; }
.field .row-toggle span { line-height: 1.4; }

.field-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-muted);
}
.field-note[hidden] { display: none; }
