/* 富藝居 客變選材系統 — Design Tokens & Styles
   富邦建設 FUBON LAND · v1.1 · 2026.05
   Palette: 富藝居 coral × champagne gold × Fubon teal */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700&family=Noto+Serif+TC:wght@500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@400;500;600;700&display=swap');

/* ================================================================
   DESIGN TOKENS
================================================================ */
:root {
  /* Background */
  --bg:            #f8f6f2;
  --bg-subtle:     #f0ede8;
  --surface:       #ffffff;
  --surface-alt:   #faf8f5;

  /* Border */
  --border:        #e5e0d8;
  --border-strong: #ccc5b9;

  /* Ink */
  --ink:           #1a1714;
  --ink-2:         #3d3830;
  --ink-3:         #7a726a;
  --ink-4:         #a89f96;

  /* Fubon Brand — teal */
  --fubon:         #007fab;
  --fubon-deep:    #005f82;
  --fubon-soft:    #e8f4f9;

  /* 富藝居 accent — coral */
  --coral:         #c8573c;
  --coral-deep:    #a6421e;
  --coral-soft:    #faf0ec;

  /* Champagne gold (price display) */
  --gold:          oklch(0.66 0.08 78);
  --gold-deep:     oklch(0.5 0.07 65);
  --gold-soft:     oklch(0.94 0.025 82);
  --gold-rich:     #c4a052;

  /* Status */
  --success:       oklch(0.58 0.09 155);
  --success-soft:  oklch(0.95 0.03 155);
  --warn:          oklch(0.7 0.11 60);
  --warn-soft:     oklch(0.96 0.04 75);
  --danger:        oklch(0.58 0.14 30);
  --danger-soft:   oklch(0.96 0.04 30);

  /* Typography — 全站統一為 Noto Sans TC 黑體 */
  --font-sans:    "Noto Sans TC", "Inter", -apple-system, "Helvetica Neue", system-ui, sans-serif;
  --font-serif:   var(--font-sans);
  --font-display: var(--font-sans);
  --font-mono:    var(--font-sans);

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 18px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(26,23,20,.05);
  --shadow-md: 0 4px 16px rgba(26,23,20,.07), 0 1px 3px rgba(26,23,20,.04);
  --shadow-lg: 0 16px 48px rgba(26,23,20,.12), 0 2px 8px rgba(26,23,20,.05);
  --shadow-xl: 0 32px 80px rgba(26,23,20,.16), 0 4px 12px rgba(26,23,20,.06);

  /* Layout */
  --header-h:    68px;
  --strip-top:   68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ================================================================
   RESET & BASE
================================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
  letter-spacing: 0.01em;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }
input  { font: inherit; }
a      { color: inherit; text-decoration: none; }
img    { max-width: 100%; height: auto; display: block; }
h1,h2,h3,h4 { margin: 0; }
p { margin: 0; }

/* ================================================================
   TYPOGRAPHY
================================================================ */
.serif   { font-family: var(--font-serif); letter-spacing: 0.02em; }
.display { font-family: var(--font-display); letter-spacing: 0.03em; }
.mono    { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.tabular { font-variant-numeric: tabular-nums; }
.serif, .field-label, .mono { word-break: keep-all; line-break: strict; overflow-wrap: normal; }
.nowrap  { white-space: nowrap; }

/* ================================================================
   BUTTONS
================================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r-md);
  font-weight: 500; font-size: 14px;
  transition: all .18s ease; white-space: nowrap;
  border: 1px solid transparent; line-height: 1;
}
.btn:focus-visible { outline: 2px solid var(--fubon); outline-offset: 2px; }

/* Primary — Fubon teal */
.btn-primary { background: var(--fubon); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--fubon-deep); }
.btn-primary:disabled { background: var(--ink-4); cursor: not-allowed; }

/* Gold — price actions */
.btn-gold { background: var(--gold-rich); color: #fff; letter-spacing: 0.04em; }
.btn-gold:hover:not(:disabled) { background: var(--gold-deep); }
.btn-gold:disabled { opacity: 0.45; cursor: not-allowed; }

/* Coral — submit / confirm */
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover:not(:disabled) { background: var(--coral-deep); }
.btn-coral:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--ink-3); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-text { padding: 10px 14px; color: var(--ink-3); border-radius: var(--r-md); }
.btn-text:hover:not(:disabled) { color: var(--ink); background: var(--bg-subtle); }

/* ================================================================
   FORMS
================================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); letter-spacing: 0.1em; text-transform: uppercase; }
.field-input {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  padding: 13px 16px;
  border-radius: var(--r-md);
  font-size: 15px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  outline: none; width: 100%;
  -webkit-appearance: none;
}
.field-input:focus { border-color: var(--fubon); box-shadow: 0 0 0 3px rgba(0,127,171,.12); }
.field-input::placeholder { color: var(--ink-4); }
.field-hint  { font-size: 12px; color: var(--ink-4); }
.field-error { font-size: 12.5px; color: var(--danger); font-weight: 500; }

/* ================================================================
   CARDS
================================================================ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-hover { transition: border-color .18s, box-shadow .18s, transform .18s; }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }

/* ================================================================
   CHIPS
================================================================ */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 11px; font-weight: 500; border-radius: 3px; letter-spacing: 0.04em; white-space: nowrap; line-height: 1.4; }
.chip-gold    { background: var(--gold-soft); color: var(--gold-deep); }
.chip-neutral { background: var(--bg-subtle); color: var(--ink-3); border: 1px solid var(--border); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warn    { background: var(--warn-soft); color: oklch(0.42 0.08 60); }
.chip-danger  { background: var(--danger-soft); color: var(--danger); }
.chip-teal    { background: var(--fubon-soft); color: var(--fubon-deep); }
.chip-coral   { background: var(--coral-soft); color: var(--coral-deep); }

/* ================================================================
   DIVIDERS
================================================================ */
.divider-h { height: 1px; background: var(--border); width: 100%; flex-shrink: 0; }
.divider-v { width: 1px; background: var(--border); height: 100%; flex-shrink: 0; }

/* ================================================================
   MATERIAL SWATCH
================================================================ */
.swatch {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  border-radius: var(--r-md); overflow: hidden;
  background-color: var(--bg-subtle);
  background-size: cover; background-position: center;
  isolation: isolate;
}
.swatch::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg,rgba(255,255,255,.05) 0%,transparent 30%,transparent 70%,rgba(0,0,0,.05) 100%);
  pointer-events: none;
}

/* ================================================================
   PROGRESS BAR
================================================================ */
.progress-track { background: var(--bg-subtle); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--fubon) 0%, var(--fubon-deep) 100%); transition: width .5s cubic-bezier(.2,.8,.3,1); border-radius: 999px; }

/* ================================================================
   TOAST
================================================================ */
.toast-wrap { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fbf8f2; padding: 12px 22px; border-radius: 999px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease both; max-width: calc(100vw - 40px); }
.toast.toast-success { background: var(--success); }
.toast.toast-error   { background: var(--danger); }
@keyframes toastIn { from { opacity:0; transform:translateY(8px) scale(.96); } to { opacity:1; transform:translateY(0) scale(1); } }

/* ================================================================
   MODAL
================================================================ */
.modal-backdrop { background: rgba(26,23,20,.45); backdrop-filter: blur(8px); animation: fadeIn .2s ease; overflow-y: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-xl); animation: modalIn .25s cubic-bezier(.2,.8,.3,1); flex-shrink: 0; }
@keyframes modalIn { from { opacity:0; } to { opacity:1; } }

/* ================================================================
   DEMO BANNER
================================================================ */
.mock-banner { background: var(--fubon-soft); color: var(--fubon-deep); font-size: 11.5px; padding: 6px 14px; text-align: center; letter-spacing: 0.04em; border-bottom: 1px solid #c8e4ef; line-height: 1.4; }

/* ================================================================
   BOTTOM ACTION BAR
================================================================ */
.bottom-bar { position: sticky; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255,255,255,.95); backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 14px 24px calc(14px + var(--safe-bottom)); }
.bottom-bar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ================================================================
   PAGE ENTER ANIMATION
================================================================ */
.page-enter { animation: pageIn .22s cubic-bezier(.2,.8,.3,1) both; }
@keyframes pageIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ================================================================
   LOADING / SKELETON
================================================================ */
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--fubon); border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes previewFadeIn { from { opacity: 0; } to { opacity: 1; } }
.skeleton { background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border) 50%, var(--bg-subtle) 75%); background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.skeleton-text { height: 14px; border-radius: 4px; }
.skeleton-title { height: 24px; border-radius: 6px; }
.skeleton-swatch { aspect-ratio: 4/3; border-radius: var(--r-md); }
.loading-full { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: var(--bg); }
.loading-section { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 80px 24px; color: var(--ink-3); }

/* ================================================================
   STATE BOXES
================================================================ */
.state-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 64px 24px; }
.state-icon { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.state-icon-warn    { background: var(--warn-soft); color: var(--warn); }
.state-icon-neutral { background: var(--bg-subtle); color: var(--ink-3); }
.state-icon-danger  { background: var(--danger-soft); color: var(--danger); }
.state-title { font-size: 17px; font-weight: 600; color: var(--ink); }
.state-desc  { font-size: 14px; color: var(--ink-3); line-height: 1.6; max-width: 320px; }

/* ================================================================
   LOGIN PAGE — 富藝居 Editorial Style
================================================================ */
.login-root { min-height: 100vh; display: flex; flex-direction: column; background: #f8f6f2; }
.login-grid { flex: 1; display: grid; grid-template-columns: 1.1fr 0.9fr; }

/* Left hero panel */
.login-hero {
  position: relative;
  background: #f8f5ef;
  display: flex; flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  min-height: 560px;
  padding: 0;
}
.login-hero-bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(160deg, rgba(248,245,239,.0) 0%, rgba(200,87,60,.04) 60%, rgba(196,160,82,.06) 100%);
}
/* Watermark grid lines */
.login-hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(26,23,20,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,23,20,.025) 1px, transparent 1px);
  background-size: 56px 56px;
}
/* Hero content area */
.login-hero-content {
  position: relative; z-index: 2;
  padding: 56px 64px 64px;
  display: flex; flex-direction: column; gap: 32px;
}
.login-hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  color: var(--fubon); text-transform: uppercase;
}
.login-hero-tag::before {
  content: ""; display: block;
  width: 24px; height: 1.5px; background: var(--fubon);
}
.login-hero-title {
  font-family: var(--font-serif);
  font-size: 62px; font-weight: 600;
  line-height: 1.1; letter-spacing: 0.06em;
  color: var(--ink);
}
.login-hero-title span { color: var(--coral); }
.login-hero-sub {
  font-family: var(--font-display);
  font-size: 18px; color: var(--ink-3);
  letter-spacing: 0.14em;
  display: flex; align-items: center; gap: 12px;
}
.login-hero-sub::before,
.login-hero-sub::after {
  content: ""; flex: 1; height: 1px; background: var(--border-strong); max-width: 28px;
}
.login-hero-size {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-3); letter-spacing: 0.06em;
}
.login-hero-size b { color: var(--ink); font-weight: 600; font-family: var(--font-mono); }
.login-hero-footer {
  position: absolute; bottom: 28px; left: 64px; right: 64px;
  display: flex; justify-content: space-between; align-items: flex-end;
  z-index: 2;
}
.login-hero-footer-brand { display: flex; flex-direction: column; gap: 4px; }
.login-hero-footer-brand span:first-child { font-size: 10.5px; letter-spacing: 0.14em; color: var(--ink-4); text-transform: uppercase; }

/* Right form panel */
.login-form-pane { display: flex; align-items: center; justify-content: center; padding: 60px 48px; background: #fff; border-left: 1px solid var(--border); overflow-y: auto; }
.login-form-inner { width: 100%; max-width: 400px; }

/* ================================================================
   HEADER
================================================================ */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40; }
.app-header-inner { max-width: 1280px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-brand { display: flex; align-items: center; gap: 14px; min-width: 0; flex-shrink: 0; }
.header-meta  { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.header-col   { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }

/* ================================================================
   SPACE STRIP
================================================================ */
.space-strip { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: var(--strip-top); z-index: 20; }
.space-strip-inner { max-width: 1440px; margin: 0 auto; padding: 0 24px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.space-strip-inner::-webkit-scrollbar { display: none; }
.space-strip-row { display: flex; gap: 4px; padding: 10px 0; width: max-content; min-width: 100%; }

/* ================================================================
   SELECTION PAGE
================================================================ */
.selection-layout { flex: 1; display: grid; grid-template-columns: 1.4fr 1fr; max-width: 1440px; margin: 0 auto; width: 100%; align-items: stretch; }
.preview-pane { position: sticky; top: calc(var(--strip-top) + 49px); background: #1a1714; width: 100%; aspect-ratio: 1448 / 1086; max-height: calc(100vh - 120px); overflow: hidden; align-self: start; }
.picker-wrapper { position: relative; align-self: stretch; border-left: 1px solid var(--border); background: var(--surface); }
.picker-pane  { position: absolute; inset: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }

/* ================================================================
   DASHBOARD
================================================================ */
.dashboard-top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.space-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ================================================================
   SUMMARY / SUCCESS
================================================================ */
.summary-main { max-width: 960px; margin: 0 auto; padding: 40px 24px 100px; width: 100%; }
.success-main { max-width: 640px; margin: 0 auto; padding: 80px 24px; text-align: center; flex: 1; }

/* ================================================================
   ALERT
================================================================ */
.alert { padding: 14px 16px; border-radius: var(--r-md); font-size: 13.5px; line-height: 1.6; display: flex; gap: 10px; align-items: flex-start; }

/* ================================================================
   UTILITIES
================================================================ */
.flex { display: flex; } .col { flex-direction: column; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.center  { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.items-center { align-items: center; } .items-start { align-items: flex-start; }
.grow { flex: 1; min-width: 0; } .shrink-0 { flex-shrink: 0; } .wrap { flex-wrap: wrap; }
.text-xs { font-size: 11.5px; } .text-sm { font-size: 13px; } .text-md { font-size: 15px; } .text-lg { font-size: 17px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 26px; } .text-3xl { font-size: 34px; } .text-4xl { font-size: 44px; }
.weight-400 { font-weight: 400; } .weight-500 { font-weight: 500; } .weight-600 { font-weight: 600; } .weight-700 { font-weight: 700; }
.muted { color: var(--ink-3); } .muted-2 { color: var(--ink-2); }
.gold { color: var(--gold-deep); } .teal { color: var(--fubon); } .coral { color: var(--coral); }
.uppercase { text-transform: uppercase; } .tracking { letter-spacing: 0.08em; } .tracking-wide { letter-spacing: 0.14em; }
.leading { line-height: 1.6; } .text-center { text-align: center; } .text-right { text-align: right; }
.mt-1{margin-top:4px} .mt-2{margin-top:8px} .mt-3{margin-top:12px} .mt-4{margin-top:16px} .mt-5{margin-top:20px} .mt-6{margin-top:24px} .mt-8{margin-top:32px}
.mb-2{margin-bottom:8px} .mb-3{margin-bottom:12px} .mb-4{margin-bottom:16px}
.overflow-hidden { overflow: hidden; } .overflow-x-auto { overflow-x: auto; } .pointer { cursor: pointer; } .relative { position: relative; } .w-full { width: 100%; } .min-w-0 { min-width: 0; }

/* ================================================================
   SCROLLBAR
================================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }
:focus-visible { outline: 2px solid var(--fubon); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ================================================================
   RESPONSIVE — 980px
================================================================ */
@media (max-width: 980px) {
  :root { --header-h: 86px; --strip-top: 86px; }
  .selection-layout { grid-template-columns: 1fr !important; align-items: stretch !important; }
  .preview-pane { position: relative !important; top: 0 !important; aspect-ratio: 16/9 !important; max-height: 56vw !important; }
  .picker-wrapper { position: static !important; border-left: none !important; border-top: 1px solid var(--border); }
  .picker-pane { position: static !important; inset: auto !important; }
  .dashboard-top { grid-template-columns: 1fr !important; }
  .header-col.hide-mobile { display: none; }
}

/* ================================================================
   RESPONSIVE — 768px mobile
================================================================ */
@media (max-width: 768px) {
  :root { --header-h: 78px; --strip-top: 78px; }
  .login-grid { grid-template-columns: 1fr !important; }
  .login-hero { min-height: auto !important; }
  .login-hero-content { padding: 36px 28px 40px !important; }
  .login-hero-title { font-size: 42px !important; }
  .login-hero-footer { left: 28px !important; right: 28px !important; }
  .login-form-pane { padding: 36px 24px !important; border-left: none !important; border-top: 1px solid var(--border); }
  .app-header-inner { padding: 12px 16px; }
  .bottom-bar { padding: 12px 16px calc(12px + var(--safe-bottom)); }
  .summary-main { padding: 24px 16px 100px; }
  .space-grid { grid-template-columns: 1fr 1fr; }
  .preview-pane { aspect-ratio: 4/3 !important; max-height: 70vw !important; }
  .picker-pane { padding: 20px 16px !important; gap: 16px !important; }
  .modal { width: calc(100% - 32px) !important; }
  .toast-wrap { bottom: calc(76px + var(--safe-bottom)); }
}

@media (max-width: 400px) {
  .space-grid { grid-template-columns: 1fr !important; }
  .login-hero-title { font-size: 34px !important; }
}

@media print {
  .app-header,.bottom-bar,.mock-banner,.space-strip,.toast-wrap,.modal-backdrop { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  body { background: white; color: black; }
}
