/* ============================================================
   稻花香 訂房系統  —  Design tokens + components + screens
   ============================================================ */

:root {
  /* high contrast monochrome */
  --primary: #000000;
  --primary-700: #000000;
  --primary-600: #111111;
  --primary-100: #d9d9d9;
  --primary-50: #f2f2f2;
  --accent: #000000;
  --accent-600: #000000;
  --accent-50: #f2f2f2;
  --success: #000000;
  --success-50: #f2f2f2;
  --warning: #000000;
  --warning-50: #f2f2f2;
  --error: #000000;
  --error-50: #f2f2f2;

  /* warm neutrals */
  --ink: #000000;
  --ink-2: #222222;
  --muted: #5f5f5f;
  --line: #d8d8d8;
  --line-2: #eeeeee;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --sh-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --sh: 0 4px 14px rgba(0, 0, 0, 0.08);
  --sh-lg: 0 18px 48px rgba(0, 0, 0, 0.16);

  --font-sans: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-serif: "Noto Serif TC", "Songti TC", serif;

  --accent-dynamic: #000000; /* overridden by tweak */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--primary-100); }

/* ============================================================
   PROTOTYPE LAYOUT
   ============================================================ */
.app-root { 
  height: 100vh; 
  display: flex; 
  flex-direction: column; 
  background: var(--bg);
}
.app-root.dev-mobile {
  max-width: 430px;
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.scroller { 
  width: 100%; 
  flex: 1; 
  min-height: 0; 
  overflow-y: auto; 
  overflow-x: hidden; 
  -webkit-overflow-scrolling: touch; 
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.serif { font-family: var(--font-serif); }
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-600);
  font-weight: 700;
}

/* ============================================================
   PLACEHOLDER IMAGERY
   ============================================================ */
.ph {
  position: relative;
  background-color: #f2f2f2;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(0, 0, 0, 0.08) 0 10px,
    rgba(0, 0, 0, 0.02) 10px 20px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #666666;
}
.ph .ph-tag {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #666666;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(162, 123, 92, 0.22);
  border-radius: var(--r-pill);
  padding: 4px 11px;
  white-space: nowrap;
}
.ph.round { border-radius: var(--r); }
.ph.corner { align-items: flex-end; justify-content: flex-start; }
.ph.corner .ph-tag { margin: 14px; }

/* ============================================================
   BUTTONS  (spec ch.9)
   ============================================================ */
.btn {
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 15px;
  padding: 13px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #000000; color: #ffffff; border-color: #000000; box-shadow: none; }
.btn-primary:hover { background: #222222; border-color: #222222; }
.btn-secondary { background: #ffffff; color: #000000; border-color: #000000; }
.btn-secondary:hover { background: #f2f2f2; }
.btn-ghost { background: transparent; color: #000000; }
.btn-ghost:hover { background: #f2f2f2; }
.btn-accent { background: #000000; color: #ffffff; border-color: #000000; box-shadow: none; }
.btn-accent:hover { background: #222222; filter: none; }
.btn-block { width: 100%; }
.btn-lg { font-size: 16px; padding: 16px 26px; }
.btn-sm { font-size: 13px; padding: 9px 14px; }
.btn:disabled, .btn.disabled {
  background: #e6e6e6 !important;
  color: #8a8a8a !important;
  border-color: #e6e6e6 !important;
  cursor: not-allowed;
  box-shadow: none;
}
.btn .spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   INPUTS  (spec ch.9)
   ============================================================ */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 7px;
}
.field .req { color: var(--error); margin-left: 3px; }
.field .opt { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.input, .textarea, .select {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--ink);
  padding: 12px 14px;
  transition: border 0.15s, box-shadow 0.15s;
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: #8a8a8a; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
.field.error .input, .field.error .textarea, .field.error .select { border-color: var(--error); }
.field.error .input:focus { box-shadow: 0 0 0 3px var(--error-50); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.field .err-msg { font-size: 12.5px; color: var(--error); margin-top: 6px; display: flex; align-items: center; gap: 5px; }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238c867b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* ============================================================
   STEPPER (quantity)  (spec ch.9)
   ============================================================ */
.stepper { display: inline-flex; align-items: center; gap: 0; border: 1.5px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.stepper button {
  width: 42px; height: 42px;
  border: none; background: var(--surface);
  font-size: 20px; color: var(--primary-700); font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.stepper button:hover:not(:disabled) { background: var(--primary-50); }
.stepper button:disabled { color: #9a9a9a; cursor: not-allowed; }
.stepper .val { min-width: 42px; text-align: center; font-weight: 700; font-size: 15px; }

/* ============================================================
   TAGS / BADGES  (spec ch.9)
   ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-2);
}
.tag.accent { background: var(--accent-50); color: var(--accent-600); }
.tag.primary { background: var(--primary-50); color: var(--primary-700); }
.tag.full { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.tag.success { background: var(--success-50); color: var(--success); }
.tag.warning { background: var(--warning-50); color: var(--warning); }
.tag.hot { background: var(--accent-dynamic); color: #fff; }

/* ============================================================
   ALERTS  (spec ch.9)
   ============================================================ */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  border-radius: var(--r); padding: 13px 15px;
  font-size: 13.5px; line-height: 1.55;
  border: 1px solid;
}
.alert .ic { flex-shrink: 0; margin-top: 1px; }
.alert-info { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.alert-success { background: var(--success-50); border-color: #d8d8d8; color: #000000; }
.alert-warning { background: var(--warning-50); border-color: #d8d8d8; color: #000000; }
.alert-error { background: var(--error-50); border-color: #d8d8d8; color: #000000; }
.alert b { font-weight: 700; }

/* ============================================================
   PROGRESS STEPS  (spec ch.9 進度指引)
   ============================================================ */
.steps { display: flex; align-items: center; gap: 0; }
.steps .step { display: flex; align-items: center; gap: 9px; flex: 1; }
.steps .step:last-child { flex: 0; }
.steps .bub {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
  background: var(--surface-2); color: var(--muted);
  border: 1.5px solid var(--line);
  transition: all 0.2s;
}
.steps .step.done .bub { background: var(--success); border-color: var(--success); color: #fff; }
.steps .step.active .bub { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-50); }
.steps .lbl { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.steps .step.active .lbl { color: var(--primary-700); }
.steps .step.done .lbl { color: var(--ink-2); }
.steps .bar { flex: 1; height: 2px; background: var(--line); margin: 0 10px; border-radius: 2px; }
.steps .step.done .bar { background: var(--success); }
.steps.compact .lbl { display: none; }

/* ============================================================
   CARD (room) + skeleton + empty handled in components
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
}
.card.hoverable:hover { transform: translateY(-4px); box-shadow: var(--sh-lg); }

.skel { background: linear-gradient(100deg, #e6e6e6 30%, #f5f5f5 50%, #e6e6e6 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-mask {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(35, 32, 27, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  animation: fade 0.18s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); width: 100%; max-width: 420px;
  animation: pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }

/* ============================================================
   GENERIC LAYOUT HELPERS
   ============================================================ */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.muted { color: var(--muted); }
.divider { height: 1px; background: var(--line); border: none; margin: 0; }
.price { font-family: var(--font-serif); font-weight: 700; }

@media print { .shell-bar { display: none; } }
