/* ══════════════════════════════════════════════════════════════════
   LOGIN & NO-ACCESS
   ══════════════════════════════════════════════════════════════════ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: var(--sp-6);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--sp-10) var(--sp-8) var(--sp-8);
  width: 400px;
  text-align: center;
  box-shadow: var(--sh-2);
}
/* Same assets/logo.svg as the header, just larger. */
.login-mark {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto var(--sp-4);
  border-radius: var(--r-lg);
  object-fit: contain;
}
.login-card .logo {
  justify-content: center;
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-2);
}
.login-card p.tagline {
  color: var(--muted);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-6);
}
.google-btn {
  width: 100%;
  padding: var(--sp-3);
  font-size: var(--fs-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
}
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: var(--sp-5) 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.login-card input[type="email"] {
  width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-3);
  transition: border-color var(--dur-1) var(--ease-out);
}
.login-card input[type="email"]:hover {
  border-color: var(--muted);
}
.primary-btn {
  width: 100%;
  padding: var(--sp-3);
}
.login-msg {
  font-size: var(--fs-sm);
  margin-top: var(--sp-3);
  min-height: 18px;
}
.login-msg.ok {
  color: var(--ok);
}
.login-msg.err {
  color: var(--danger);
}
.noaccess-msg {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: var(--sp-3);
  color: var(--ink);
  word-break: break-all;
}

/* ══════════════════════════════════════════════════════════════════
   EMPTY & LOADING STATES — teach the interface, don't say "nothing".
   ══════════════════════════════════════════════════════════════════ */

.loading-note {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
}
.empty-state {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
}
.empty-state h3 {
  font-size: var(--fs-lg);
  margin-bottom: var(--sp-2);
}
.empty-state p {
  color: var(--muted);
  font-size: var(--fs-md);
  max-width: 46ch;
  margin: 0 auto;
  text-wrap: pretty;
}

/* Skeleton placeholder — a calm shimmer while data loads. */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 37%,
    var(--surface-2) 63%
  );
  background-size: 400% 100%;
  border-radius: var(--r-sm);
  animation: skeleton-shimmer 1.4s ease infinite;
}
@keyframes skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
.roster-skeleton {
  padding: var(--sp-2) 0;
}
.sk-title {
  height: 22px;
  width: 46%;
  margin-bottom: var(--sp-4);
}
.sk-row {
  height: 40px;
  margin-bottom: var(--sp-2);
}
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* Visible to screen readers only — announces state without showing text. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ══════════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-backdrop);
  padding: var(--sp-6);
}
.modal-backdrop.open {
  display: flex;
  animation: backdrop-in var(--dur-2) var(--ease-out);
}
.modal-card {
  position: relative;
  z-index: var(--z-modal);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: var(--sp-6) var(--sp-6) var(--sp-5);
  width: 460px;
  max-width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--sh-3);
  animation: modal-in var(--dur-3) var(--ease-out);
}
.modal-card h3 {
  font-size: var(--fs-xl);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-5);
}
.modal-field {
  margin-bottom: var(--sp-4);
}
.modal-field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: var(--sp-2);
}
/* Rounded pill-ish fields with a Term-style custom chevron + focus ring,
   instead of the boxy native control. The open list is still OS-drawn. */
.modal-field select,
.modal-field input {
  width: 100%;
  padding: 11px var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  font-size: var(--fs-md);
  color: var(--ink-2);
  background: var(--surface);
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}
.modal-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.modal-field select:hover,
.modal-field input:hover {
  border-color: var(--muted);
  background: var(--surface-2);
}
.modal-field select:focus,
.modal-field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.09);
}

/* Custom dropdown (cselectHtml) — a styled, rounded replacement for the
   native <select> so the OPEN list is rounded too, not just the field. */
.cselect {
  position: relative;
}
.cselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  padding: 11px var(--sp-4);
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink-2);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition:
    border-color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out),
    background-color var(--dur-1) var(--ease-out);
}
.cselect-trigger:hover {
  border-color: var(--muted);
  background: var(--surface-2);
}
.cselect-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.09);
}
.cselect-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Placeholder prompts (before a real choice) are bold to draw the eye:
   the closed field's "(Please select…)" label, its list option, and the
   text-input placeholders. Applies to every custom dropdown (Add class too). */
.cselect-value.is-placeholder,
.cselect-option[data-value=""] {
  font-weight: 700;
}
.modal-field input::placeholder {
  font-weight: 600;
}
/* In the Add reservation form, bold EVERY dropdown value (not only the
   placeholders). Scoped to .modal-reservation so the Add class modal is
   unaffected. */
.modal-reservation .cselect-value {
  font-weight: 700;
}
/* Locked dropdown — Room/Session fixed by the grid slot the user clicked.
   Greyed, not clickable, and the chevron is hidden so it doesn't look
   openable. */
.cselect-locked .cselect-trigger,
.cselect-trigger:disabled {
  cursor: not-allowed;
  background: var(--surface-2);
  color: var(--muted);
}
.cselect-locked .cselect-trigger:hover {
  border-color: var(--line-strong);
}
.cselect-locked .cselect-chevron {
  display: none;
}
.cselect-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--muted);
  transition: transform var(--dur-2) var(--ease-out);
}
.cselect-trigger[aria-expanded="true"] .cselect-chevron {
  transform: rotate(180deg);
}
.cselect-menu {
  position: fixed;
  margin: 0;
  inset: auto;
  padding: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  max-height: 46vh; /* fallback — JS clamps it to the real space on screen */
  overflow-y: auto;
  min-width: 200px;
  /* Reaching the end of the list must NOT hand the leftover scroll to the
     page behind (scroll chaining) — that outside scroll would instantly
     close the menu. */
  overscroll-behavior: contain;
}
.cselect-menu:popover-open {
  animation: term-menu-in var(--dur-2) var(--ease-out);
}
.cselect-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: var(--fs-md);
  color: var(--ink-2);
  background: none;
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out);
}
.cselect-option:hover,
.cselect-option:focus-visible {
  background: var(--surface-2);
}
.cselect-option:focus-visible {
  outline-offset: -2px;
}
.cselect-check {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--accent);
  opacity: 0;
}
.cselect-option[aria-selected="true"] {
  background: var(--surface-3);
  font-weight: 600;
  color: var(--ink);
}
.cselect-option[aria-selected="true"] .cselect-check {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .cselect-menu:popover-open {
    animation: none;
  }
}

.modal-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}
.modal-actions button {
  padding: 10px var(--sp-5);
  font-size: var(--fs-md);
  border-radius: var(--r-lg);
}
.modal-actions .delete {
  margin-right: auto;
}
.modal-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-ring);
  color: var(--warn-strong);
  font-size: var(--fs-base);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
}
/* Red (blocking) variant — a room clash stops the save, unlike the yellow
   advisory warnings. */
.modal-warn.modal-warn-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}

/* A required field left empty gets a red ring; typing/choosing clears it. */
.field-invalid,
.cselect-trigger.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.14) !important;
}

/* Shake — draws the eye to a blocked action. Restarted from JS (shakeEl). */
@keyframes pop-shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(2px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }
  40%,
  60% {
    transform: translateX(4px);
  }
}
.shake {
  animation: pop-shake 0.5s var(--ease-out);
}

/* ── App popup (alertPopup / confirmPopup) — floats above any modal ──
   A [popover] element sits in the browser's top layer, so no z-index war.
   The default popover UA style centers it; we only style the card. */
.app-popup {
  width: 400px;
  max-width: calc(100vw - 40px);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-3);
}
.app-popup::backdrop {
  background: rgba(15, 23, 42, 0.4);
}
.app-popup.tone-danger {
  border-top: 4px solid var(--danger);
}
.app-popup-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.app-popup-head svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.tone-danger .app-popup-head {
  color: var(--danger);
}
.app-popup-head h4 {
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}
.app-popup p {
  color: var(--ink-2);
  font-size: var(--fs-md);
  line-height: 1.55;
}
.app-popup-actions {
  margin-top: var(--sp-5);
}
/* In the popup the danger button sits on the RIGHT next to Cancel (unlike a
   modal's Delete, which .modal-actions pushes to the far left). */
.app-popup-actions .delete {
  margin-right: 0;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

/* ══════════════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  background: var(--ink);
  color: var(--accent-ink);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 500;
  box-shadow: var(--sh-3);
  z-index: var(--z-toast);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
