/*
 * application.css — Design system + component styles
 */

/* ═══════════════════════════════════════════════
   Design Tokens
   ═══════════════════════════════════════════════ */
:root {
  --bg:           oklch(0.965 0.016 76);
  --bg-2:         oklch(0.945 0.02  74);
  --surface:      oklch(0.995 0.005 86);
  --surface-2:    oklch(0.97  0.013 76);
  --ink:          oklch(0.28  0.018 52);
  --ink-soft:     oklch(0.44  0.02  55);
  --muted:        oklch(0.6   0.018 60);
  --faint:        oklch(0.72  0.014 65);
  --line:         oklch(0.905 0.014 74);
  --line-2:       oklch(0.86  0.018 72);
  --terra:        oklch(0.63  0.132 42);
  --terra-d:      oklch(0.55  0.13  41);
  --terra-wash:   oklch(0.955 0.028 52);
  --terra-line:   oklch(0.86  0.06  48);
  --ocean:        oklch(0.57  0.072 222);
  --ocean-wash:   oklch(0.955 0.02  220);
  --green:        oklch(0.58  0.1   158);
  --green-wash:   oklch(0.95  0.035 160);
  --amber-wash:   oklch(0.965 0.04  86);
  --amber-line:   oklch(0.86  0.07  82);
  --amber-ink:    oklch(0.5   0.085 62);
  --shadow-card:  0 1px 2px rgba(60,40,25,0.04), 0 6px 18px -8px rgba(60,40,25,0.10);
  --shadow-pop:   0 8px 30px -8px rgba(50,30,15,0.22);
}

/* ═══════════════════════════════════════════════
   Base
   ═══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

input, select, button, textarea { font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; }

.serif { font-family: 'Newsreader', Georgia, serif; }

.noscroll::-webkit-scrollbar { width: 0; height: 0; }
.noscroll { scrollbar-width: none; }
[data-role="slider"]::-webkit-scrollbar,
.room-slider-track::-webkit-scrollbar { display: none; }

/* ═══════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes flashInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes popIn {
  0%   { transform: scale(0.82); }
  55%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}

/* ═══════════════════════════════════════════════
   Layout Components
   ═══════════════════════════════════════════════ */
.page-wrap {
  max-width: 448px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 8px;
  flex-shrink: 0;
}

.topbar-btn {
  width: 40px; height: 40px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--ink-soft);
}
.topbar-btn:active { background: var(--surface-2); }

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 24px;
}

.bottom-bar {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px -12px rgba(50,30,15,0.18);
  padding: 13px 16px 24px;
}

/* ═══════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.card-inner { padding: 18px 17px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
  color: var(--terra);
}
.section-title .label {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════ */
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 54px;
  border: none; border-radius: 16px; cursor: pointer;
  background: linear-gradient(180deg, oklch(0.66 0.135 44), var(--terra));
  color: #fff; font-size: 16px; font-weight: 700; letter-spacing: 0.2px;
  box-shadow: 0 6px 18px -5px oklch(0.55 0.13 41 / 0.6);
  transition: all .12s;
  text-decoration: none;
}
.btn-primary:active {
  transform: translateY(1px) scale(0.993);
  box-shadow: 0 1px 4px rgba(120,50,20,0.3);
}
.btn-primary:hover { text-decoration: none; }

.btn-ghost {
  border: none; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-block;
}
.btn-ghost:hover { color: var(--ink-soft); text-decoration: none; }

/* ═══════════════════════════════════════════════
   Form fields
   ═══════════════════════════════════════════════ */
.field-wrap { display: block; }

.field-label-row {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 7px;
}
.field-label {
  font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); letter-spacing: 0.1px;
}
.field-required { color: var(--terra); font-size: 13px; font-weight: 700; }
.field-hint { font-size: 12px; color: var(--faint); font-weight: 500; margin-left: auto; }
.field-error { font-size: 12.5px; color: var(--terra-d); font-weight: 600; margin-top: 6px; }

.field-input {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: 14px; padding: 0 14px; height: 50px;
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus-within {
  border-color: var(--ocean);
  box-shadow: 0 0 0 3.5px oklch(0.57 0.072 222 / 0.13);
}
.field-input .fi-icon { color: var(--faint); display: flex; flex-shrink: 0; transition: color .15s; }
.field-input:focus-within .fi-icon { color: var(--ocean); }
.field-input input {
  flex: 1; min-width: 0; border: none; background: transparent;
  font-size: 16px; font-weight: 500; color: var(--ink); padding: 13px 0;
}
.field-input input::placeholder { color: var(--faint); }

/* ═══════════════════════════════════════════════
   Segmented control
   ═══════════════════════════════════════════════ */
.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 14px; padding: 4px; gap: 4px;
  border: 1px solid var(--line);
}
.segmented a, .segmented button, .segmented span {
  flex: 1; border: none; cursor: pointer;
  border-radius: 11px; height: 38px;
  font-size: 14.5px; font-weight: 600; letter-spacing: 0.1px;
  color: var(--ink-soft); background: transparent;
  transition: all .18s ease;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.segmented a.active, .segmented button.active, .segmented span.active {
  color: #fff; background: var(--terra);
  box-shadow: 0 2px 8px -2px oklch(0.55 0.13 41 / 0.5);
  display: flex; align-items: center; justify-content: center;
}

/* ═══════════════════════════════════════════════
   Status badges
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  border-radius: 99px; padding: 4px 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge-booked    { background: var(--amber-wash); color: var(--amber-ink); border: 1px solid var(--amber-line); }
.badge-checkin   { background: var(--green-wash);  color: var(--green);    border: 1px solid oklch(0.82 0.06 158); }
.badge-checkout  { background: var(--ocean-wash);  color: var(--ocean);    border: 1px solid oklch(0.82 0.04 222); }
.badge-cancelled { background: var(--terra-wash);  color: var(--terra-d);  border: 1px solid var(--terra-line); }

/* ═══════════════════════════════════════════════
   Copyable value
   ═══════════════════════════════════════════════ */
.copyable-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; cursor: pointer; padding: 0;
}

/* ═══════════════════════════════════════════════
   Calendar Sheet  (terracotta theme)
   ═══════════════════════════════════════════════ */
.cal-sheet {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
.cal-sheet.open { opacity: 1; pointer-events: all; }

.cal-overlay {
  position: absolute; inset: 0;
  background: rgba(40,25,15,0.42);
  backdrop-filter: blur(2px);
}

.cal-panel {
  position: relative; width: 100%;
  max-width: 480px; margin: 0 auto;
  background: var(--bg);
  border-radius: 26px 26px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 24px);
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -10px 40px rgba(40,25,15,0.25);
}
.cal-sheet.open .cal-panel { transform: translateY(0); }

.cal-handle {
  width: 40px; height: 4.5px;
  background: var(--line-2); border-radius: 99px;
  margin: 10px auto 0;
}

.cal-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px 2px;
}
.cal-sheet-title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 20px; font-weight: 600; color: var(--ink);
}

.cal-text-btn {
  background: none; border: none;
  font-size: 14px; font-weight: 600;
  padding: 6px 10px; border-radius: 9px;
  cursor: pointer; color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}
.cal-text-btn.confirm { color: var(--terra); }
.cal-text-btn:active { background: var(--surface-2); }

.cal-month-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 18px 4px;
}
.cal-month-label {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px; font-weight: 600; white-space: nowrap;
}

.cal-nav-btn {
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-soft);
  -webkit-tap-highlight-color: transparent;
}
.cal-nav-btn:active { background: var(--surface-2); }

.cal-weekdays {
  display: grid; grid-template-columns: repeat(7,1fr);
  padding: 4px 18px 0;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11.5px; font-weight: 700; color: var(--faint);
  padding-bottom: 4px;
}

.cal-grid {
  display: grid; grid-template-columns: repeat(7,1fr);
  padding: 0 18px 4px; row-gap: 2px;
}

/* Day cell */
.cd {
  position: relative; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.cd span {
  position: relative; z-index: 2;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  font-size: 15px; color: var(--ink); font-weight: 500;
}
.cd::before {
  content: ''; position: absolute;
  top: 5px; bottom: 5px; left: 0; right: 0;
  background: transparent; z-index: 1;
}

/* States */
.cd:not(.past):not(.s):not(.e):hover span { background: var(--terra-wash); color: var(--terra-d); }
.cd.today span { border: 2px solid var(--ocean); color: var(--ocean); font-weight: 700; }
.cd.r::before    { background: var(--terra-wash); }
.cd.s:not(.e)::before { background: linear-gradient(to right, transparent 50%, var(--terra-wash) 50%); }
.cd.e:not(.s)::before { background: linear-gradient(to left,  transparent 50%, var(--terra-wash) 50%); }
.cd.s span, .cd.e span {
  background: var(--terra); color: #fff; font-weight: 700;
  box-shadow: 0 4px 10px -3px oklch(0.55 0.13 41 / 0.55);
}
.cd.r span { color: var(--terra-d); }
.cd.past { opacity: 0.35; pointer-events: none; }

.cal-hint {
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
  padding: 8px 16px 6px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.cal-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.cal-dot.terra { background: var(--terra); }
.cal-dot.light { background: var(--terra-wash); border: 1px solid var(--terra-line); }
