/*
 * 하단 고정 예약바 (reservation-bar.js)
 * PC(1100px 이상): 한 줄 바에서 날짜 → 시간 → 진료 → 이름·연락처 → 동의 → 신청
 * 모바일·태블릿: 화면 아래 떠 있는 바의 "예약하기" → 아래에서 예약 화면이 올라옴
 */
.rbar-root {
  --rbar-bg: rgba(18, 17, 14, .97);
  --rbar-text: #efe9df;
  --rbar-muted: #a59d90;
  --rbar-line: rgba(237, 230, 218, .12);
  --rbar-gold: #c4a97d;
  --rbar-accent: #a85a2a;
  --rbar-accent-hover: #bf6830;
  --rbar-dark: #26271f;
  --rbar-paper: #f5f0e8;
  --rbar-paper-line: #ddd4c6;
  --rbar-ink: #1b1a17;
  --rbar-ink-muted: #8c8579;
  --rbar-error: #b33a2b;
  --rbar-font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  --rbar-label: "Jost", "Futura", "Helvetica Neue", sans-serif;
  font-family: var(--rbar-font);
}
.rbar-root *, .rbar-root *::before, .rbar-root *::after { box-sizing: border-box; }
.rbar-root [hidden] { display: none !important; }
.rbar-root button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rbar-root button:disabled { cursor: default; }
.rbar-root button:focus-visible, .rbar-root input:focus-visible { outline: 1px solid var(--rbar-gold); outline-offset: 3px; }

.rbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  container: rbar / inline-size;
  color: var(--rbar-text);
  line-height: 1.4;
}

/* ==================== PC ==================== */
.rbar-desk {
  display: none;
  position: relative;
  background: var(--rbar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  border-top: 1px solid rgba(196, 169, 125, .25);
  padding: 0 max(40px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(40px, env(safe-area-inset-left, 0px));
}
.rbar-form, .rbar-done {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  height: 72px;
}
.rbar-brand {
  flex: none; margin-right: 6px; white-space: nowrap;
  font-family: var(--rbar-label);
  font-size: 11px; font-weight: 500; letter-spacing: .22em;
  text-transform: uppercase; color: var(--rbar-gold);
}

.rbar-field { position: relative; }
.rbar-form > .rbar-field:not(.rbar-consent) { flex: 1 1 0; min-width: 118px; }
.rbar-trigger, .rbar-input {
  height: 44px; border-radius: 6px;
  border: 1px solid var(--rbar-line);
  background: rgba(255, 255, 255, .04);
  color: var(--rbar-text);
  transition: border-color .2s, background-color .2s;
}
.rbar-trigger {
  position: relative; display: flex; align-items: center;
  width: 100%; padding: 0 30px 0 14px; text-align: left;
}
.rbar-trigger::after {
  content: ""; position: absolute; right: 13px; top: 50%;
  width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.5px solid var(--rbar-muted); border-bottom: 1.5px solid var(--rbar-muted);
  transform: rotate(45deg); transition: transform .2s, margin-top .2s;
}
.rbar-trigger[aria-expanded="true"]::after { transform: rotate(-135deg); margin-top: -1px; }
.rbar-trigger span { font-size: 14px; font-weight: 500; white-space: nowrap; letter-spacing: -.01em; }
.rbar-trigger span.is-empty { color: var(--rbar-muted); font-weight: 400; font-size: 13px; }
.rbar-trigger:disabled { opacity: .35; }
.rbar-trigger:not(:disabled):hover, .rbar-input:hover { border-color: rgba(237, 233, 225, .35); background: rgba(255, 255, 255, .06); }
.rbar-trigger[aria-expanded="true"] { border-color: var(--rbar-gold); background: rgba(196, 169, 125, .08); }

.rbar-input {
  flex: 1 1 0; min-width: 96px; padding: 0 14px;
  font: inherit; font-size: 14px; font-weight: 400; letter-spacing: -.01em;
}
.rbar-input::placeholder { color: var(--rbar-muted); font-size: 13px; }
.rbar-input:focus { outline: none; border-color: var(--rbar-gold); background: rgba(196, 169, 125, .06); }
.rbar-root [aria-invalid="true"] { border-color: #e0806f !important; box-shadow: 0 0 0 1px #e0806f inset; }

.rbar-consent {
  flex: none; display: flex; align-items: center; gap: 6px;
  padding: 0 4px; white-space: nowrap; font-size: 12px; color: var(--rbar-muted);
}
.rbar-consent label { display: flex; align-items: center; gap: 7px; cursor: pointer; transition: color .2s; }
.rbar-consent label:hover { color: var(--rbar-text); }
.rbar-consent input {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin: 0;
  border: 1px solid var(--rbar-muted); border-radius: 3px;
  background: transparent; cursor: pointer;
  display: grid; place-items: center;
  transition: border-color .2s, background-color .2s;
}
.rbar-consent input::after {
  content: ""; width: 8px; height: 8px; border-radius: 1px;
  background: var(--rbar-gold); transform: scale(0); transition: transform .15s;
}
.rbar-consent input:checked { border-color: var(--rbar-gold); }
.rbar-consent input:checked::after { transform: scale(1); }
.rbar-consent label.is-invalid { color: #f0a090; }
.rbar-consent label.is-invalid input { border-color: #e0806f; }
.rbar-link {
  padding: 4px 2px; border: 0; background: none;
  color: var(--rbar-muted); font-size: 11px;
  text-decoration: underline; text-underline-offset: 3px;
  transition: color .2s;
}
.rbar-link:hover { color: var(--rbar-text); }

.rbar-submit {
  flex: none; height: 44px; padding: 0 28px; border: 0; border-radius: 6px;
  background: var(--rbar-accent); color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: .06em; white-space: nowrap;
  transition: background-color .25s, transform .15s, box-shadow .25s;
  box-shadow: 0 2px 12px rgba(168, 90, 42, .3);
}
.rbar-submit:hover { background: var(--rbar-accent-hover); box-shadow: 0 4px 20px rgba(168, 90, 42, .4); transform: translateY(-1px); }
.rbar-submit:active { transform: translateY(0); }
.rbar-submit:disabled { opacity: .5; transform: none; box-shadow: none; }

.rbar-toast {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%);
  margin: 0; padding: 10px 20px; border-radius: 999px;
  background: rgba(179, 58, 43, .95); color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}

.rbar-done { justify-content: center; gap: 16px; }
.rbar-done-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--rbar-gold); color: var(--rbar-gold); font-size: 14px;
}
.rbar-done p { margin: 0; font-size: 14px; font-weight: 500; }
.rbar-done small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--rbar-muted); }
.rbar-again {
  margin-left: 8px; height: 34px; padding: 0 16px; border-radius: 6px;
  border: 1px solid var(--rbar-line); background: none; color: var(--rbar-text);
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  transition: border-color .2s, background-color .2s;
}
.rbar-again:hover { border-color: var(--rbar-muted); background: rgba(255, 255, 255, .04); }

/* 팝업 (달력·시간·진료·동의 내용) */
.rbar-pop {
  position: absolute; left: 0; bottom: calc(100% + 16px); z-index: 2;
  width: 320px; padding: 22px 22px 18px; white-space: normal;
  background: var(--rbar-paper); color: var(--rbar-ink);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .06);
  animation: rbar-pop .3s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes rbar-pop { from { opacity: 0; transform: translateY(8px); } }
.rbar-pop-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--rbar-ink); }
.rbar-pop-note { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--rbar-paper-line); font-size: 11px; color: var(--rbar-ink-muted); }
.rbar-pop-empty { margin: 0; padding: 14px 0; text-align: center; color: var(--rbar-ink-muted); font-size: 13px; }

.rbar-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rbar-cal-head strong { font-size: 17px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.rbar-cal-navs { display: flex; gap: 2px; }
.rbar-cal-nav {
  position: relative; width: 32px; height: 32px; padding: 0; border: 0;
  background: none; border-radius: 6px; transition: background-color .2s;
}
.rbar-cal-nav:hover { background: var(--rbar-paper-line); }
.rbar-cal-nav::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  border-left: 1px solid var(--rbar-ink); border-bottom: 1px solid var(--rbar-ink);
  transform: translate(-25%, -50%) rotate(45deg);
}
.rbar-cal-nav[data-nav="1"]::before { transform: translate(-75%, -50%) rotate(-135deg); }
.rbar-cal-nav:disabled { opacity: .22; }
.rbar-cal-week, .rbar-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.rbar-cal-week span { padding-bottom: 8px; font-size: 11.5px; color: var(--rbar-ink-muted); }
.rbar-day {
  position: relative; height: 38px; padding: 0; border: 0; background: none;
  color: var(--rbar-ink); font-size: 14px; font-weight: 300; font-variant-numeric: tabular-nums;
}
.rbar-day::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px;
  border: 1px solid transparent; border-radius: 50%; transition: border-color .2s, background-color .2s;
}
.rbar-day:not(:disabled):not(.is-selected):hover::before { border-color: var(--rbar-paper-line); }
.rbar-day.is-selected { font-weight: 500; }
.rbar-day.is-selected::before { border-color: var(--rbar-gold); background: rgba(196, 169, 125, .1); }
.rbar-day:disabled { color: #c9c0b2; }

.rbar-pop-time { width: 340px; }
.rbar-times + .rbar-times { margin-top: 14px; }
.rbar-times p { margin: 0; padding-bottom: 7px; border-bottom: 1px solid var(--rbar-paper-line); font-size: 12px; font-weight: 600; color: var(--rbar-ink-muted); }
.rbar-time-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.rbar-time {
  height: 38px; padding: 0; border: 0; border-bottom: 1px solid #ece5da; background: none;
  color: var(--rbar-ink); font-size: 13.5px; font-weight: 300; font-variant-numeric: tabular-nums;
  transition: background-color .15s, color .15s;
}
.rbar-time:not(:disabled):not(.is-selected):hover { background: #ece5da; }
.rbar-time.is-selected { background: var(--rbar-dark); color: #f2ece2; font-weight: 400; }
.rbar-time:disabled { color: #c9c0b2; text-decoration: line-through; text-decoration-thickness: 1px; }

.rbar-pop-treat { width: 240px; padding: 8px 22px; }
.rbar-opts { display: grid; }
.rbar-opt {
  display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 2px;
  border: 0; border-bottom: 1px solid var(--rbar-paper-line); background: none;
  color: var(--rbar-ink); font-size: 14px; font-weight: 300; text-align: left;
  transition: background-color .15s;
}
.rbar-opt:last-child { border-bottom: 0; }
.rbar-opt::after {
  content: ""; flex: none; width: 14px; height: 14px; border: 1px solid #c9c0b2; border-radius: 50%;
  transition: background-color .2s, border-color .2s, box-shadow .2s;
}
.rbar-opt:hover { background: rgba(0, 0, 0, .03); }
.rbar-opt:hover::after { border-color: var(--rbar-dark); }
.rbar-opt.is-selected { font-weight: 500; }
.rbar-opt.is-selected::after { border-color: var(--rbar-dark); background: var(--rbar-dark); box-shadow: inset 0 0 0 3px var(--rbar-paper); }

.rbar-pop-privacy { left: auto; right: 0; width: 380px; font-size: 12.5px; color: #5d5950; }
.rbar-pop-privacy table { width: 100%; border-collapse: collapse; }
.rbar-pop-privacy th, .rbar-pop-privacy td { padding: 6px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rbar-paper-line); }
.rbar-pop-privacy th { padding-right: 12px; color: var(--rbar-ink); font-weight: 600; white-space: nowrap; }
.rbar-pop-privacy p { margin: 10px 0 0; }
.rbar-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ==================== 모바일·태블릿 ==================== */
.rbar-mob {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0;
  padding: 14px max(20px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  background: rgba(18, 17, 14, .96);
  -webkit-backdrop-filter: blur(24px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.3);
  border-top: 1px solid rgba(196, 169, 125, .2);
}
.rbar-mob-text { min-width: 0; display: flex; align-items: center; gap: 10px; }
.rbar-mob-text strong {
  font-family: var(--rbar-label);
  font-size: 11px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase;
  color: var(--rbar-gold); white-space: nowrap;
}
.rbar-mob-btn {
  flex: 0 0 auto; height: 44px; padding: 0 28px; border: 0; border-radius: 4px;
  background: var(--rbar-accent); color: #fff;
  font-size: 14px; font-weight: 700; letter-spacing: .1em;
  box-shadow: 0 4px 16px rgba(168, 90, 42, .35);
  transition: background-color .25s, box-shadow .25s, transform .15s;
}
.rbar-mob-btn:active { transform: scale(.97); }

@container rbar (min-width: 1100px) {
  .rbar-desk { display: block; }
  .rbar-mob { display: none; }
}
@container rbar (max-width: 1279px) {
  .rbar-form { gap: 8px; }
  .rbar-form > .rbar-field:not(.rbar-consent) { min-width: 104px; }
  .rbar-input { min-width: 88px; }
  .rbar-submit { padding: 0 20px; }
  .rbar-consent-long { display: none; }
  .rbar-consent-short { display: inline; }
}
.rbar-consent-short { display: none; }
@supports not (container-type: inline-size) {
  @media (min-width: 1100px) {
    .rbar-desk { display: block; }
    .rbar-mob { display: none; }
  }
}

/* 아래에서 올라오는 예약 화면 */
.rbar-sheet { position: fixed; inset: 0; z-index: 1000; }
.rbar-backdrop { position: absolute; inset: 0; background: rgba(10, 9, 7, .6); opacity: 0; transition: opacity .35s; }
.rbar-panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: 94%;
  background: var(--rbar-paper); color: var(--rbar-ink);
  border-radius: 16px 16px 0 0; overflow: hidden;
  transform: translateY(100%); transition: transform .45s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .25);
}
.rbar-sheet.is-open .rbar-backdrop { opacity: 1; }
.rbar-sheet.is-open .rbar-panel { transform: none; }
.rbar-close {
  position: absolute; z-index: 3; top: 12px; right: max(12px, env(safe-area-inset-right, 0px));
  width: 44px; height: 44px; padding: 0; border: 0; background: none;
}
.rbar-close::before, .rbar-close::after {
  content: ""; position: absolute; left: 12px; top: 21px; width: 20px; height: 1px;
  background: var(--rbar-ink); transform: rotate(45deg); transition: opacity .2s;
}
.rbar-close::after { transform: rotate(-45deg); }
.rbar-close:hover::before, .rbar-close:hover::after { opacity: .5; }
.rbar-panel-body { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.rbar-panel-inner { min-height: 100%; display: flex; flex-direction: column; }

.rbar-head {
  flex: none;
  padding: 44px max(24px, env(safe-area-inset-right, 0px)) 28px max(24px, env(safe-area-inset-left, 0px));
}
.rbar-head-brand { margin: 0 0 14px; line-height: 1; color: var(--rbar-gold); }
.rbar-head-brand span {
  display: inline-block; white-space: nowrap; font-family: var(--rbar-label);
  font-size: 13px; font-weight: 500; letter-spacing: .2em; margin-right: -.2em;
}
.rbar-head-title { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
.rbar-head-title span { display: inline-block; white-space: nowrap; }
.rbar-head-intro { margin: 12px 0 0; font-size: 13px; line-height: 1.7; color: var(--rbar-ink-muted); word-break: keep-all; }
.rbar-sheet-main { flex: 1 0 auto; display: flex; flex-direction: column; padding: 4px max(22px, env(safe-area-inset-right, 0px)) 0 max(22px, env(safe-area-inset-left, 0px)); }
.rbar-sheet-foot { flex: none; display: grid; justify-items: center; padding: 32px 16px calc(32px + env(safe-area-inset-bottom, 0px)); }
.rbar-sheet-foot img { display: block; width: min(180px, 48%); height: auto; opacity: .7; }
.rbar-panel .rsv {
  --rsv-bg: var(--rbar-paper);
  --rsv-dark: var(--rbar-dark);
  --rsv-accent: var(--rbar-accent);
  --rsv-gold: var(--rbar-gold);
  --rsv-ink: var(--rbar-ink);
  --rsv-muted: var(--rbar-ink-muted);
  --rsv-line: var(--rbar-paper-line);
  --rsv-font: var(--rbar-font);
  --rsv-label: var(--rbar-label);
  flex: 1 0 auto; width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .rbar-backdrop, .rbar-panel { transition: none; }
  .rbar-pop { animation: none; }
}
