/* Cabanas — Standalone CSS */
@import url('../booking-links/booking-links.css');

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.section-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-header);
}

/* ===== DASHBOARD STAT CARDS ===== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.stat-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #e0e7ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons {
  font-size: 24px;
  color: var(--color-primary);
}

.stat-icon.revenue {
  background: #d1fae5;
}

.stat-icon.revenue .material-icons {
  color: #059669;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-header);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== FILTERS BAR ===== */
.filters-bar {
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.filter-group {
  min-width: 140px;
}

.filter-group .form-label {
  margin-bottom: 4px;
}

.filter-group .form-input {
  margin-bottom: 0;
}

/* ===== DATA TABLE ===== */
.data-table-wrap {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: var(--color-header);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.data-table tr.clickable {
  cursor: pointer;
}

.data-table tr.clickable:hover td {
  background: #eef2ff;
}

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-new { background: #e0e7ff; color: #3730a3; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #d1fae5; color: #065f46; }
.status-completed { background: #dbeafe; color: #1e40af; }
.status-used { background: #dbeafe; color: #1e40af; }
.status-canceled, .status-cancelled { background: #fee2e2; color: #991b1b; }
.status-refunded { background: #fce7f3; color: #9d174d; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-declined { background: #fee2e2; color: #991b1b; }
.status-scheduled { background: #dbeafe; color: #1e40af; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 13px;
  color: var(--color-text-secondary);
  border-top: 1px solid var(--color-border);
}

.pagination-info {
  font-weight: 500;
}

.pagination-btns {
  display: flex;
  gap: var(--spacing-sm);
}

.pagination-btns button {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
}

.pagination-btns button:hover:not(:disabled) {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination-btns button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

body.modal-open { overflow: hidden; }

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-header);
}

.modal-close {
  width: 32px; height: 32px;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--color-bg-page);
  color: var(--color-danger);
}

.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn-approve { background: #059669; color: #fff; border: none; font-weight: 600; }
.btn-approve:hover { background: #047857; }
.btn-decline { background: #dc2626; color: #fff; border: none; font-weight: 600; }
.btn-decline:hover { background: #b91c1c; }

/* ===== FORM STYLES ===== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.form-row-full { grid-template-columns: 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 12px; font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 12px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-primary);
  color: var(--color-text-primary);
  background: var(--color-bg-input);
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.form-group textarea { min-height: 80px; resize: vertical; }

/* ===== DETAIL VIEW ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

.detail-field { margin-bottom: var(--spacing-xs); }

.detail-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.detail-value {
  font-size: 14px;
  color: var(--color-text-primary);
  font-weight: 500;
}

.detail-section {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
}

.detail-section-title {
  font-size: 14px; font-weight: 700;
  color: var(--color-header);
  margin-bottom: var(--spacing-md);
}

/* ===== ACTION BUTTONS ===== */
.action-btns { display: flex; gap: 4px; }

.action-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.action-btn .material-icons { font-size: 16px; }

/* ===== PRICE FORMATTING ===== */
.price { font-weight: 600; color: var(--color-header); }
.price-sm { font-size: 12px; color: var(--color-text-secondary); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.toast.success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.toast.error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.toast.info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  padding: var(--spacing-xl);
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.empty-state .material-icons {
  font-size: 48px;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
  display: block;
}

/* ===== GUEST LOOKUP ===== */
.guest-lookup { position: relative; margin-bottom: 8px; }
.guest-lookup-search { position: relative; }
.guest-lookup-search label { display: block; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 4px; }

.gl-input { width: 100%; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 13px; background: var(--color-bg); transition: border-color 0.15s; }
.gl-input:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1); }

.gl-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--color-bg-card, #fff); border: 1px solid var(--color-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); max-height: 280px; overflow-y: auto; z-index: 100; margin-top: 4px; }
.gl-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-secondary); padding: 8px 12px 4px; border-top: 1px solid var(--color-border); }
.gl-section-label:first-child { border-top: none; }
.gl-result-item { padding: 8px 12px; cursor: pointer; transition: background 0.1s; }
.gl-result-item:hover { background: var(--color-bg-hover, #f5f7fa); }
.gl-result-main { font-size: 13px; font-weight: 600; color: var(--color-text); }
.gl-result-sub { font-size: 11px; color: var(--color-text-secondary); margin-top: 2px; }
.gl-empty { padding: 16px; text-align: center; color: var(--color-text-secondary); font-size: 12px; }

.gl-selected-card { background: var(--color-bg-hover, #f0f7ff); border: 1px solid var(--color-primary, #3b82f6); border-radius: 8px; padding: 10px 14px; }
.gl-selected-title { font-size: 14px; font-weight: 600; color: var(--color-text); }
.gl-selected-sub { font-size: 12px; color: var(--color-text-secondary); margin-top: 2px; }
.gl-guest-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.gl-guest-chip { display: inline-block; background: var(--color-bg-card, #fff); border: 1px solid var(--color-border); border-radius: 12px; padding: 2px 8px; font-size: 11px; color: var(--color-text-secondary); }

.gl-actions { margin-top: 4px; }
.btn-link { background: none; border: none; color: var(--color-primary); font-size: 12px; cursor: pointer; padding: 2px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-xs { font-size: 11px; padding: 2px 6px; }

.gl-manual .form-row { margin-bottom: 6px; }
.gl-manual .form-group label { font-size: 11px; }
.gl-manual input { width: 100%; padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 12px; }

.dd-bk-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.05em; padding: 4px 10px; border-radius: var(--radius-sm); white-space: nowrap; text-transform: uppercase; }
.dd-bk-badge-on { background: #34d399; color: #064e3b; }
.dd-bk-badge-off { background: #fbbf24; color: #78350f; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 22px; }
  .data-table-wrap { overflow-x: auto; }
  .modal { max-width: calc(100vw - 32px); }
  .modal-overlay { padding: 20px 8px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; }
  .filter-group { width: 100%; min-width: unset; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
}

/* =========================================================================
   WI-522 — Cabana × Date calendar grid
   18 cabanas down (sticky first column), dates across (horizontally scrollable).
   Each reservation is one absolutely-positioned bar that spans its date range.
   ========================================================================= */
.cb-grid-month-label {
  font-size: 13px;
  color: var(--color-text-muted, #64748b);
  font-weight: 500;
  margin-left: 12px;
}
.cb-grid-wrap {
  position: relative;
  background: var(--color-bg-card, #fff);
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.cb-grid-scroll {
  /* Vertical scroll happens inside the grid so the date header stays in view
     (position:sticky needs a scrolling ancestor — page-level scroll breaks it). */
  overflow: auto;
  max-width: 100%;
  max-height: calc(100vh - 280px);
  min-height: 360px;
  scroll-behavior: smooth;
}
.cb-grid {
  --cb-cell-w: 84px;
  --cb-row-h: 44px;
  --cb-col-w: 96px;
  --cb-head-h: 76px;
  position: relative;
  display: grid;
  grid-template-columns: var(--cb-col-w) repeat(var(--cb-day-count, 60), var(--cb-cell-w));
  grid-template-rows: var(--cb-head-h);
  grid-auto-rows: var(--cb-row-h);
  width: max-content;
  font-size: 12px;
  color: var(--color-text, #1e293b);
}
/* Sticky cabana column header + body cells */
.cb-grid-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  border-right: 2px solid #cbd5e1;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 8px 8px;
  font-weight: 700;
  color: var(--color-header, #1a365d);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.cb-grid-day-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 18px 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  text-align: center;
  user-select: none;
  line-height: 1;
}
.cb-grid-day-head .cb-grid-day-dow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted, #64748b);
  letter-spacing: 0.03em;
  line-height: 1.1;
}
.cb-grid-day-head .cb-grid-day-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-header, #1a365d);
  line-height: 1.1;
}
.cb-grid-day-head .cb-grid-day-mon {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted, #64748b);
  text-transform: uppercase;
  line-height: 1.1;
  letter-spacing: 0.03em;
}
.cb-grid-day-head--weekend {
  background: #f1f5f9;
}
.cb-grid-day-head--today {
  background: #eff6ff;
}
.cb-grid-day-head--today .cb-grid-day-num {
  color: #2563eb;
}
.cb-grid-day-head--today::after {
  content: 'Today';
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #2563eb;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Hover-pick today button + inline jump-to-date picker (WI-522 follow-up).
   The Today button stays the click target (jumps to today). The picker
   anchored to it opens on hover so the user can pick any date to scroll to. */
.cb-grid-today-wrap {
  position: relative;
  display: inline-block;
}
.cb-grid-jump-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  left: 0;
  bottom: 0;
}
/* Tweaks to flatpickr's calendar so it sits cleanly under the Today button. */
.cb-grid-jump-cal.flatpickr-calendar {
  z-index: 60;
}
.cb-grid-cabana-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f8fafc;
  border-right: 2px solid #cbd5e1;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-header, #1a365d);
  font-size: 13px;
}
.cb-grid-day-cell {
  position: relative;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  transition: background 0.1s ease;
}
.cb-grid-day-cell:hover {
  background: #f1f5f9;
}
.cb-grid-day-cell--weekend { background: #f8fafc; }
.cb-grid-day-cell--today {
  background: #eff6ff;
  box-shadow: inset 2px 0 0 #2563eb, inset -1px 0 0 #2563eb;
}
.cb-grid-day-cell--past { background: repeating-linear-gradient(45deg,#f8fafc,#f8fafc 4px,#f1f5f9 4px,#f1f5f9 8px); }
.cb-grid-day-cell--blocked {
  background: repeating-linear-gradient(45deg,#e2e8f0,#e2e8f0 6px,#cbd5e1 6px,#cbd5e1 12px);
  cursor: not-allowed;
}
.cb-grid-day-cell--blocked:hover { background: repeating-linear-gradient(45deg,#e2e8f0,#e2e8f0 6px,#cbd5e1 6px,#cbd5e1 12px); }

/* Reservation bar — placed by inline grid-row + grid-column / span. */
.cb-grid-bar {
  position: relative;
  margin: 4px 3px;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  z-index: 1;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cb-grid-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  z-index: 5;
}
.cb-grid-bar-name {
  font-weight: 700;
  font-size: 12px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.cb-grid-bar-sub {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
/* Confirmed (charged) — solid blue, "Paid" */
.cb-grid-bar--confirmed {
  background: #2563eb;
  color: #fff;
  border: 1px solid #1d4ed8;
}
/* Booking-flow paid, awaiting ops confirm — solid green */
.cb-grid-bar--awaiting {
  background: #059669;
  color: #fff;
  border: 1px solid #047857;
}
/* Admin-created card-on-file, NOT charged — striped yellow outline */
.cb-grid-bar--pending {
  background: repeating-linear-gradient(45deg,#fef3c7,#fef3c7 6px,#fde68a 6px,#fde68a 12px);
  color: #92400e;
  border: 1.5px dashed #d97706;
}

/* Closure overlay — diagonal gray, click disabled */
.cb-grid-closure-bar {
  position: relative;
  margin: 4px 3px;
  border-radius: 4px;
  background: repeating-linear-gradient(45deg,#94a3b8,#94a3b8 4px,#64748b 4px,#64748b 8px);
  border: 1px solid #475569;
  color: #fff;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 1;
  transition: filter 120ms ease;
}
.cb-grid-closure-bar:hover { filter: brightness(1.1); }
.cb-grid-closure-bar:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

/* Legend strip beneath grid */
.cb-grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 11px;
  color: var(--color-text-muted, #64748b);
}
.cb-grid-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cb-grid-legend-swatch {
  width: 18px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.cb-grid-legend-swatch--confirmed { background: #2563eb; border: 1px solid #1d4ed8; }
.cb-grid-legend-swatch--awaiting { background: #059669; border: 1px solid #047857; }
.cb-grid-legend-swatch--pending {
  background: repeating-linear-gradient(45deg,#fef3c7,#fef3c7 4px,#fde68a 4px,#fde68a 8px);
  border: 1.5px dashed #d97706;
}
.cb-grid-legend-swatch--closed {
  background: repeating-linear-gradient(45deg,#94a3b8,#94a3b8 3px,#64748b 3px,#64748b 6px);
  border: 1px solid #475569;
}

@media (max-width: 768px) {
  .cb-grid { --cb-cell-w: 64px; --cb-col-w: 80px; }
}

/* Reservation/Closure mode toggle inside the new-from-cell modal. */
.ncbg-mode-btn {
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #475569;
  font-weight: 600;
}
.ncbg-mode-btn.ncbg-mode-active {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #fff;
}
.ncbg-mode-btn.ncbg-mode-active .material-icons { color: #fff; }
