/* Roomly admin: forms, dialogs, room picker, availability bar and the bookings list. Loaded after admin.css. */

/* ------------------------------------------------------------------ Page actions and buttons */
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn--danger { background: var(--s-occupied); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #b03f2f; }
.btn--danger-ghost { background: var(--paper); border-color: color-mix(in srgb, var(--s-occupied) 30%, var(--line)); color: var(--s-occupied); }
.btn--danger-ghost:hover { background: var(--s-occupied-soft); }
.icon--sm { font-size: 16px; }

/* ------------------------------------------------------------------ Form layout */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.form-panel { display: grid; gap: 6px; padding: 8px 26px 0; min-width: 0; margin: 0; }
fieldset.form-panel { border: 1px solid var(--line); }
fieldset.form-panel:disabled { opacity: .7; }
.form-section { border: 0; margin: 0; padding: 20px 0; display: grid; gap: 16px; min-width: 0; border-top: 1px solid var(--line); }
.form-panel > .form-section:first-of-type { border-top: 0; }
.form-section legend, .form-section .legend { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; padding: 0; margin: 0 0 4px; float: left; width: 100%; }
.form-section legend + * { clear: both; }
.step {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 800;
  transition: background .3s, color .3s, transform .4s var(--ease-spring);
}
.form-section:focus-within .step { background: var(--brand); color: #fff; transform: rotate(-8deg) scale(1.08); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; }
.field select, .select-wrap select {
  width: 100%; height: 46px; padding: 0 38px 0 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2374807a' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center;
  appearance: none; font-weight: 500; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field select:focus, .select-wrap select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field-hint { font-weight: 500; font-size: 12px; min-height: 16px; transition: color .2s; }
.field-hint.is-warn { color: var(--s-occupied); }
[data-repeat-until]:not([hidden]) { animation: slide-down .3s var(--ease-out); }

.form-actions--sticky {
  position: sticky; bottom: 0; z-index: 2; gap: 10px;
  margin: 0 -26px; padding: 14px 26px; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 0 0 var(--radius) var(--radius);
}
.form-aside { display: grid; gap: 12px; position: sticky; top: 92px; }
.aside-label { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ------------------------------------------------------------------ Inputs */
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper input {
  width: 84px; height: 46px; text-align: center; border-radius: 12px; border: 1.5px solid var(--line);
  font-weight: 800; font-size: 16px; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.stepper input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.stepper .icon-btn { width: 40px; height: 40px; border: 1.5px solid var(--line); background: var(--paper); }
.stepper input.bump { animation: pop .3s var(--ease-spring); }

.check-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip > span {
  display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .25s var(--ease-spring), padding .25s var(--ease-spring);
}
.check-chip-tick { font-size: 0 !important; width: 0; overflow: hidden; transition: font-size .25s var(--ease-spring), width .25s var(--ease-spring); }
.check-chip:hover > span { border-color: #c8d0de; }
.check-chip input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); padding-left: 10px; }
.check-chip input:checked + span .check-chip-tick { font-size: 17px !important; width: 18px; }
.check-chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check-chip:active > span { transform: scale(.95); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch > span {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sw); color: #fff;
  transition: transform .3s var(--ease-spring), box-shadow .25s;
}
.swatch .icon { font-size: 18px; transform: scale(0); transition: transform .3s var(--ease-spring); }
.swatch:hover > span { transform: scale(1.06); }
.swatch input:checked + span { transform: scale(1.12); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--sw); }
.swatch input:checked + span .icon { transform: scale(1); }
.swatch input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 4px; }

.switch { position: relative; display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch > span:last-child { display: grid; gap: 2px; }
.switch small { font-size: 12.5px; }
.switch-track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 999px; background: #d3d9e4; transition: background .25s; margin-top: 2px; }
.switch-track span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .35s var(--ease-spring); }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track span { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ Room form preview and danger zone */
.preview-card { pointer-events: none; }
.preview-card .room-card-body { position: relative; }
.accent-bar { position: absolute; left: 16px; right: 16px; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--accent); transition: background .3s; }
.preview-card .is-typing { animation: summary-flash .5s ease; }

.danger {
  margin-top: 10px; padding: 16px; border-radius: 14px; display: grid; gap: 8px; justify-items: start;
  border: 1px solid color-mix(in srgb, var(--s-occupied) 25%, var(--line));
  background: color-mix(in srgb, var(--s-occupied-soft) 45%, #fff);
}
.danger h3 { font-size: 14px; }
.danger p { font-size: 13px; }

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; animation: rise .5s var(--ease-out) both, shake .5s ease .3s; }
.alert--danger { background: var(--s-occupied-soft); color: #8e2f22; border: 1px solid color-mix(in srgb, var(--s-occupied) 30%, transparent); }
.alert strong { display: block; margin-bottom: 2px; }
.alert p { font-size: 13px; }

/* ------------------------------------------------------------------ Room picker */
.room-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.room-option { position: relative; --accent: var(--brand); }
.room-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; }
.room-option-card {
  height: 100%; display: grid; gap: 4px; align-content: start; justify-items: start;
  padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); border-left: 5px solid var(--accent); background: var(--paper);
  transition: border-color .25s, background .25s, transform .3s var(--ease-spring), box-shadow .25s;
}
.room-option-top { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 6px; }
.room-option-top strong { font-size: 13.5px; }
.room-option-card small { display: flex; align-items: center; gap: 3px; font-size: 12px; }
.room-option-card small .icon { font-size: 15px; }
.room-option-card .pill { font-size: 11px; padding: 2px 8px 2px 6px; margin-top: 2px; }
.room-option-tick { color: var(--accent); font-variation-settings: 'FILL' 1; transform: scale(0); transition: transform .35s var(--ease-spring); }
.room-option:hover .room-option-card { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); border-left-color: var(--accent); transform: translateY(-2px); }
.room-option input:checked + .room-option-card {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.room-option input:checked + .room-option-card .room-option-tick { transform: scale(1); }
.room-option input:focus-visible + .room-option-card { outline: 3px solid var(--focus); outline-offset: 2px; }
.room-option.is-paused .room-option-card { background: repeating-linear-gradient(-45deg, #f9fafc 0 8px, #f0f3f8 8px 16px); }

.durations { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.chip--sm { height: 30px; padding: 0 12px; font-size: 12.5px; cursor: pointer; }
button.chip { font-family: inherit; }
button.chip.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* ------------------------------------------------------------------ Availability bar */
.avail { display: grid; gap: 6px; padding: 14px; border-radius: 14px; background: #f6f8fb; border: 1px solid var(--line); transition: border-color .3s, background .3s; }
.avail.is-free { border-color: color-mix(in srgb, var(--s-available) 30%, var(--line)); }
.avail.has-clash { border-color: color-mix(in srgb, var(--s-occupied) 35%, var(--line)); background: color-mix(in srgb, var(--s-occupied-soft) 40%, #fff); }
.avail-bar { position: relative; height: 34px; border-radius: 10px; background: #e2f5ec; overflow: hidden; transition: opacity .25s; }
.avail.is-loading .avail-bar { opacity: .5; }
.avail-busy {
  position: absolute; top: 0; bottom: 0; border-left: 2px solid #fff; border-right: 2px solid #fff;
  background: repeating-linear-gradient(-45deg, #c8cfdc 0 6px, #d8dee8 6px 12px);
  animation: fade .4s ease both;
}
.avail-busy.is-blocked { background: repeating-linear-gradient(-45deg, #cad9ef 0 6px, #dbe5f4 6px 12px); }
.avail-past { position: absolute; top: 0; bottom: 0; left: 0; background: rgba(13, 21, 38, .1); }
.avail-selection {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 7px; z-index: 2;
  background: color-mix(in srgb, var(--s-available) 82%, transparent);
  box-shadow: 0 4px 12px -4px var(--s-available);
  transition: left .45s var(--ease-out), width .45s var(--ease-out), background .3s, box-shadow .3s;
}
.avail.has-clash .avail-selection { background: color-mix(in srgb, var(--s-occupied) 85%, transparent); box-shadow: 0 4px 12px -4px var(--s-occupied); }
.avail.shake .avail-selection { animation: shake .45s ease; }
.avail-scale { position: relative; height: 16px; }
.avail-scale span { position: absolute; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--muted); }
.avail-scale span:first-child { transform: none; }
.avail-scale span:last-child { transform: translateX(-100%); }
.avail-msg { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-height: 20px; }
.avail-msg .icon { font-size: 18px; }
.avail.is-free .avail-msg { color: var(--s-available); }
.avail.has-clash .avail-msg { color: var(--s-occupied); }
.avail-msg span { animation: slide-down .3s var(--ease-out); }

/* ------------------------------------------------------------------ Booking summary */
.summary { padding: 18px; border-radius: var(--radius); background: var(--sidebar); color: #dbe3f5; display: grid; gap: 10px; box-shadow: var(--shadow-lg); }
.summary-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.summary-row .icon { color: #00a3ff; font-size: 19px; }
.summary .flash { animation: summary-flash .6s ease; }
@keyframes summary-flash { from { color: #00a3ff; } }
.summary-title { margin-top: 6px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 18px; font-weight: 800; color: #fff; overflow-wrap: anywhere; }
.small-facts dd { font-size: 13px; }

/* ------------------------------------------------------------------ Dialog */
.dialog {
  width: min(460px, calc(100vw - 32px)); padding: 26px; border: 0; border-radius: 20px;
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(6, 12, 28, .5);
}
.dialog[open] { animation: dialog-in .45s var(--ease-spring); }
.dialog.is-closing { animation: dialog-out .2s ease forwards; }
.dialog::backdrop { background: rgba(6, 12, 28, .45); backdrop-filter: blur(3px); animation: fade .3s ease; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.94); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
.dialog form { display: grid; gap: 14px; }
.dialog h2 { font-size: 20px; font-weight: 800; }
.dialog-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; animation: pop .5s var(--ease-spring) .1s both; }
.dialog-icon .icon { font-size: 24px; }
.dialog-icon--danger { background: var(--s-occupied-soft); color: var(--s-occupied); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.radio-list { display: grid; gap: 8px; }
.radio-list label { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; }
.radio-list label:has(input:checked) { border-color: var(--s-occupied); background: var(--s-occupied-soft); }
.radio-list input { accent-color: var(--s-occupied); }

/* ------------------------------------------------------------------ Bookings list */
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: #e8ebf2; }
.segmented a { padding: 7px 16px; border-radius: 9px; font-weight: 700; font-size: 13px; text-decoration: none; color: var(--ink-2); transition: background .25s, box-shadow .25s; }
.segmented a.is-active { background: var(--paper); box-shadow: var(--shadow-sm); color: var(--ink); }
.filters { display: flex; gap: 10px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
.input-wrap--sm { height: 42px; width: min(280px, 100%); }
.select-wrap select { height: 42px; min-width: 170px; }
.day-group { overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.day-head > span:nth-child(2) { flex: 1; display: grid; line-height: 1.3; }
.day-head small { font-size: 12.5px; }
.day-badge { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; align-content: center; background: var(--brand-soft); color: var(--brand-dark); line-height: 1.05; }
.day-badge strong { font-size: 18px; }
.day-badge small { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.booking-list { list-style: none; margin: 0; padding: 0; }
.booking-row {
  --accent: var(--brand);
  position: relative; display: grid; grid-template-columns: 130px minmax(0, 1fr) 190px 110px 36px; align-items: center; gap: 14px;
  padding: 12px 18px; border-top: 1px solid var(--line); transition: background .2s;
}
.booking-row:first-child { border-top: 0; }
.booking-row::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent);
  transform: scaleY(.3); opacity: 0; transition: transform .3s var(--ease-out), opacity .3s;
}
.booking-row:hover { background: #f6f8fc; }
.booking-row:hover::before, .booking-row.is-live::before { transform: none; opacity: 1; }
.booking-time { display: flex; align-items: center; gap: 8px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.booking-main { display: grid; min-width: 0; text-decoration: none; line-height: 1.35; }
.booking-main strong { display: flex; align-items: center; gap: 4px; }
.booking-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.booking-main:hover strong { text-decoration: underline; }
.booking-room { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.room-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); flex: none; }
.booking-row .icon-btn { transition: transform .25s var(--ease-out); }
.booking-row:hover .icon-btn { transform: translateX(3px); }
.agenda-day { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 2px; }
a.agenda-body { text-decoration: none; }
a.agenda-body:hover strong { text-decoration: underline; }

/* ------------------------------------------------------------------ Schedule navigation and click-to-book */
.date-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.date-nav-label { display: grid; line-height: 1.25; min-width: 150px; text-align: center; }
.date-nav-label strong { font-size: 16px; }
.date-nav-label small { font-size: 12px; }
.icon-btn--outline { border: 1px solid var(--line); background: var(--paper); }
.date-pick { height: 36px; border-radius: 10px; border: 1px solid var(--line); padding: 0 10px; background: var(--paper); font-weight: 600; }
a.event { text-decoration: none; color: var(--ink); }
.timeline-track.is-bookable { cursor: pointer; }
.slot-ghost {
  position: absolute; top: 9px; bottom: 9px; left: 0; width: 0; border-radius: 10px; pointer-events: none; opacity: 0;
  border: 2px dashed var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent);
  transition: left .15s var(--ease-out), opacity .2s;
}
.slot-ghost::after {
  content: attr(data-label); position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11.5px; font-weight: 800; color: var(--brand); white-space: nowrap;
}
.timeline-track.is-bookable:hover .slot-ghost.is-on { opacity: 1; }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 1000px) {
  .form-layout { grid-template-columns: 1fr; }
  .form-aside { position: static; order: -1; }
  .booking-row { grid-template-columns: 110px minmax(0, 1fr) 36px; }
  .booking-room { grid-column: 2; grid-row: 2; }
  .booking-src { display: none; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-panel { padding: 4px 18px 0; }
  .form-actions--sticky { margin: 0 -18px; padding: 12px 18px; }
  .filters { justify-content: stretch; }
  .filters > * { flex: 1 1 100%; width: 100%; }
  .select-wrap select { width: 100%; }
  .booking-row { grid-template-columns: minmax(0, 1fr) 36px; gap: 4px 10px; padding: 12px 14px; }
  .booking-time, .booking-main, .booking-room { grid-column: 1; }
  .booking-main { grid-row: 2; }
  .booking-room { grid-row: 3; }
  .booking-row .icon-btn { grid-column: 2; grid-row: 1 / span 3; }
  .date-nav-label { min-width: 0; text-align: left; }
  .room-picker { grid-template-columns: 1fr 1fr; }
}
