/* Ultra compact room grid */
.room-card {
  border-radius: 6px;
  min-height: 56px;
  width: 64px;
}

/* Palette variables for easy theme tweaks */
:root{
  /* Teal / Amber palette */
  --brand-ink: #082032; /* deep teal */
  --brand-accent: #FFB703; /* warm amber */
  --muted-bg: #f7fbfc; /* light neutral */
  --vacant-bg: #e6f7f2; /* light mint */
  --vacant-border: #cfefe2;
  --occupied-bg: #fff7e6; /* pale warm */
  --occupied-border: #ffe6c7;
  --sidebar-bg: #052231; /* dark teal/navy */
  --sidebar-text: #e9f6fb;
  --nav-active: #FFB703; /* amber */
}

/* (topbar removed) */

.room-link {
  text-decoration: none;
  color: inherit;
}

.room-card .card-body {
  padding: 6px 2px;
}

/* Big room number */
.room-number {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

/* Small room type */
.room-type {
  font-size: 10px;
  line-height: 1.1;
  opacity: 0.8;
}

/* Compact group block for dashboard */
.room-group {
  display: inline-block;
  vertical-align: top;
  min-width: 80px;
  max-width: 280px;
  margin-right: 8px;
}
.room-group-header {
  text-align: left;
  padding-left: 4px;
}
.room-item { display: inline-block; }
.room-item .room-card { margin: 2px; }

/* bathroom type label on card */
.room-bathroom {
  font-size: 10px;
  line-height: 1;
  opacity: 0.85;
  margin-top: 2px;
}

/* Status dot / letter */
/* Strong status colours */
.room-card.vacant {
  background-color: var(--vacant-bg);
  border: 1px solid var(--vacant-border);
  color: #08301a;
}

.room-card.occupied {
  background-color: var(--occupied-bg);
  border: 1px solid var(--occupied-border);
  color: #5a3400;
}

/* stronger card visuals */
.room-card { box-shadow: 0 2px 6px rgba(3,17,26,0.06); transition: transform 120ms ease, box-shadow 120ms ease; }
.room-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(3,17,26,0.12); }
.room-number { font-size: 16px; font-weight: 700; }

/* Text contrast */
.room-card.vacant,
.room-card.occupied {
  color: #000;
}

/* Reduce spacing between cards */
.row.g-2 {
  --bs-gutter-x: 6px;
  --bs-gutter-y: 6px;
}

/* Sidebar */
.sidebar {
  width: 140px; /* reduced width for compact sidebar */
  min-height: 100vh;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0.75rem; /* override the p-3 to keep it compact */
}

.sidebar .nav-link {
  color: rgba(230,240,250,0.9);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.9rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .nav-link:hover { background-color: rgba(255,255,255,0.04); color: var(--sidebar-text); }
.sidebar .nav-link.active { background-color: var(--nav-active); color: #072024; box-shadow: 0 6px 18px rgba(3,17,26,0.12); }

/* Mobile adjustments */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    min-height: auto;
  }
}

/* Compact checkin/edit form styles */
.compact-form {
  max-width: 760px;
  padding: 0.5rem !important;
  background: #fff;
  border-radius: 6px;
  font-size: 0.95rem;
}

.compact-form h6 {
  font-size: 0.9rem;
  margin-bottom: 0.22rem;
}

.compact-form .form-control,
.compact-form .form-select {
  padding: 0.25rem 0.4rem;
  height: auto;
  font-size: 0.88rem;
}

.compact-form .row.mb-2 {
  margin-bottom: 0.18rem !important;
}

.compact-form .btn {
  padding: 0.34rem 0.5rem;
  font-size: 0.9rem;
}

/* Notes area should scroll internally if content grows */
.compact-form textarea {
  max-height: 80px;
  overflow: auto;
  resize: vertical;
}

/* Transient inline error overlay (does not affect layout) */
.mobile-input-wrap { position: relative; }
.transient-error {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 0.22rem 0.5rem;
  border-radius: 4px;
  font-size: 0.82rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  z-index: 1100;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms linear;
}
.mobile-input-wrap .invalid-feedback {
  position: absolute !important;
  top: 100%;
  left: 0;
  margin-top: 6px;
  z-index: 1115;
  display: block; /* when Bootstrap toggles it visible, keep it absolutely positioned */
  white-space: nowrap;
}

/* Floating toast overlay for transient notices */
.toast-overlay {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  font-size: 0.92rem;
  transition: opacity 180ms ease, transform 180ms ease;
  opacity: 1;
}
.toast-item.hide { opacity: 0; transform: translateY(-6px); }
.transient-error.hide { opacity: 0; }

/* Allow main content to expand; avoid clipping form vertically */
.flex-grow-1 {
  max-height: none;
}

/* Edit stay two-column layout: form + narrow side-panel */
.edit-grid {
  gap: 1rem;
}
.edit-grid .left {
  flex: 1 1 760px;
  max-width: 760px;
}
.edit-grid .side-panel {
  flex: 0 0 260px;
  width: 260px;
}
.side-panel .btn {
  padding: 0.35rem 0.5rem;
}

@media (max-width: 992px) {
  .edit-grid { flex-direction: column; }
  .edit-grid .side-panel { width: auto; flex: none; }
}

/* Mobile: transform side-panel into a fixed bottom bar with icon actions */
@media (max-width: 768px) {
  .side-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    padding: 0.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.08);
    z-index: 1080;
  }

  /* show only the compact mobile bar actions inside side-panel */
  .side-panel > *:not(.mobile-bottom-bar) { display: none; }
  .mobile-bottom-bar { display: flex; gap: 0.5rem; width: 100%; justify-content: space-around; align-items: center; }

  .mobile-action { background: transparent; border: none; text-align: center; color: #212529; font-size: 12px; }
  .mobile-action .icon { display: block; font-size: 18px; line-height: 1; }
  .mobile-action small { display: block; margin-top: 2px; font-size: 11px; color: #495057; }

  /* On mobile show payment history as a fixed overlay above the checkout button and mobile nav
     so the list can scroll independently without pushing Checkout out of view. */
  .payment-history.open {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 140px; /* sits above checkout and mobile nav */
    height: calc(100vh - 220px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    padding: 0.5rem;
    border-radius: 8px;
    z-index: 1110; /* above form but below checkout */
    display: block;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  }

  /* Checkout button should remain in normal flow; overlay will be positioned above it */
  .checkout-btn {
    position: static;
    bottom: auto;
    z-index: auto;
  }
}

/* Mobile bottom navigation for main sidebar links */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  border-top: 1px solid rgba(11,37,69,0.06);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1090;
}
.mobile-bottom-nav .mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #495057;
  font-size: 12px;
  padding: 4px 6px;
}
.mobile-bottom-nav .mobile-nav-item .icon { font-size: 18px; line-height: 1; }
.mobile-bottom-nav .mobile-nav-item .label { font-size: 11px; margin-top: 2px; }

/* ensure main content isn't hidden behind mobile nav */
@media (max-width: 768px) {
  .flex-grow-1 { padding-bottom: 140px; }
}

/* Raised mobile nav used on edit pages to avoid overlapping Save button */
.mobile-bottom-nav.raised-on-edit { bottom: 120px; }

/* Ensure inputs inside a small inline flex row don't force wrap */
.compact-form .d-flex > .form-control {
  flex: 1 1 auto;
  min-width: 0; /* allow shrinking */
}

.compact-form .d-flex > small {
  white-space: nowrap;
}

/* Make payment history compact and scroll internally when long */
.payment-history {
  max-height: 120px;
  overflow: auto;
  margin-bottom: 0.5rem;
  display: none; /* start collapsed to save vertical space */
}

.payment-history.open {
  display: block;
}

/* Desktop: make the right-side payment history larger when opened so it can show ~10 entries */
@media (min-width: 768px) {
  #paymentBoxDesktop.payment-history.open {
    max-height: 420px; /* approx 10 items */
    overflow: auto;
    display: block;
  }
}

/* No forced hide for the mobile payments toggle; visibility is controlled by template/JS */

/* Make mobile number field wider on desktop for better readability */
@media (min-width: 768px) {
  .mobile-input-wrap .form-control[type="tel"],
  #edit_guest_mobile,
  #guest_mobile {
    min-width: 220px;
    max-width: 100%;
    flex: 1 1 220px;
  }
}

.payment-history .list-group-item {
  padding: 0.25rem 0.5rem;
  font-size: 0.86rem;
}

/* Reduce hr spacing site-wide */
hr {
  margin: 0.5rem 0;
}

/* Additional-guest chips: visible red close (×) at top-right corner */
#additional_guests_chips > span,
#additional_guests_chips_edit > span {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 0.5rem;
  margin-bottom: 0.25rem;
  padding-right: 0.6rem; /* leave space for absolute close */
}

#additional_guests_chips .badge,
#additional_guests_chips_edit .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding-right: 0.3rem;
}

/* Make the close button a small red circle positioned top-right */
#additional_guests_chips .btn-close,
#additional_guests_chips_edit .btn-close {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc3545; /* bootstrap danger red */
  color: #fff;
  border: none;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

/* Remove default btn-close pseudo background if present */
#additional_guests_chips .btn-close::before,
#additional_guests_chips_edit .btn-close::before { content: none; }

/* Active stays table styles */
.active-stays-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
.active-stays-table thead th {
  border-bottom: 1px solid rgba(11,37,69,0.06);
  background: linear-gradient(90deg, rgba(255,183,3,0.12), rgba(246,249,250,0.6));
  font-weight: 700;
  padding: 0.6rem 0.75rem;
  color: #072024;
}
.active-stays-table tbody td {
  padding: 0.45rem 0.75rem;
  vertical-align: middle;
}
.active-stays-table .btn {
  margin-right: 0.35rem;
}

/* subtle primary outline tweak to match palette */
.btn-outline-primary {
  color: var(--brand-accent);
  border-color: rgba(31,111,235,0.15);
}
.btn-outline-primary:hover {
  color: #fff;
  background: var(--brand-accent);
  border-color: var(--brand-accent);
}

/* make action buttons stand out a bit */
.btn-sm { border-radius: 6px; }

/* highlight overdue stays (no checkout and longer than 24 hours) */
.active-stays-table tr.overdue { background: rgba(255,235,238,0.6); }
.active-stays-table tr.warning { background: rgba(255,249,230,0.6); }

/* Keep Primary Guest + Age on single line; hide labels on very narrow screens to save space */
.no-wrap-row { display:flex; gap:8px; align-items:flex-end; flex-wrap:nowrap; }
.no-wrap-row .flex-grow-1 { min-width:0; }
.no-wrap-row .flex-grow-1 input { min-width:0; }
.no-wrap-row .age-col { width:86px; min-width:70px; flex:0 0 auto; }

@media (max-width: 576px) {
  /* Show compact labels but reduce their footprint so inputs stay on one line */
  .no-wrap-row label { display:block; font-size:0.72rem; margin-bottom:4px; color: #495057; }
  .no-wrap-row .form-control { font-size:0.9rem; }
  /* limit name input width so Age fits on single row */
  .no-wrap-row .flex-grow-1 input { max-width: calc(100% - 92px); }
}

