/*
  Guest Dashboard — table/tab styling ported from the Host Dashboard
  (dev-host/public/css/style.css, "Bookings page redesign" block) so both
  dashboards share the same look. Scoped under .gd- / .bk- class names so it
  cannot collide with existing guest styles in style1.css.
*/

:root {
  --bk-ink: #1e1e1e;
  --bk-soft: #5c5c5c;
  --bk-faint: #8a8a8a;
  --bk-line: #e6e2dd;
  --bk-card: #ffffff;
  --bk-brand: #eb2a25;
}

/* Local horizontal-overflow safety net: the site has a pre-existing global
   `html, body { overflow: visible !important; }` rule (style1.css) that
   removes page-level horizontal-scroll protection. Without this, any minor
   overflow anywhere in the dashboard drags the whole page sideways instead of
   clipping locally. Applied on the outer container (not just .up-book) so it
   also contains overflow from .row's own negative gutter margins, one level
   up from where it was previously scoped. Scoped to this page only — not
   touching the global rule. */
.gd-dashboard-container,
.up-book {
  overflow-x: hidden;
}

/* The site's global `.container-fluid { max-width: 1400px; margin: 0 auto; }`
   (style1.css) leaves large empty margins on wide screens. Host's own
   .container-fluid is genuinely fluid (max-width: none) — match that here,
   scoped to the Dashboard only so every other page keeps its 1400px cap. */
.gd-dashboard-container {
  max-width: none;
}

/* The site's global `main { margin-top: 100px; }` (style1.css) compensates
   for the fixed navbar and is calibrated to the taller desktop header — on
   mobile, the header is shorter, leaving excess empty space above the tabs.
   Scoped to the Dashboard only; every other page keeps the sitewide 100px. */
@media (max-width: 767px) {
  .gd-dashboard-main {
    margin-top: 80px;
  }
  .main-papper.spacetop {
    margin-top: 0;
  }
  .gd-tab-content {
    padding-top: 12px;
  }
}

/* ── Tabs — matches Host's real #dashboardTabs style exactly (plain text,
   red underline on active, no filled pill) ───────────────────────────── */
.gd-tabs {
  border-bottom: 2px solid #eb2a25;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.gd-tabs .nav-link {
  color: #495057;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
  background: transparent;
}
.gd-tabs .nav-link.active {
  color: #eb2a25;
  font-weight: 600;
  border-color: #eb2a25 #eb2a25 #fff;
  background: #fff;
}
.gd-tabs .nav-link:hover:not(.active) {
  color: #eb2a25;
  border-color: #e9ecef #e9ecef transparent;
}
.gd-tab-count {
  background: #eb2a25;
  color: #fff;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  margin-left: 6px;
}
.gd-tab-content {
  padding-top: 20px;
}

/* ── Table card ─────────────────────────────────────────────────────── */
.bk-table-card {
  border-radius: 14px;
  border: 1px solid var(--bk-line) !important;
  overflow: visible;
  background: var(--bk-card);
  margin-bottom: 10px;
}
.bk-table-card .table {
  margin-bottom: 0;
  border: none !important;
}
.bk-table-card .table thead th {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bk-faint);
  background: var(--bk-card) !important;
  border-bottom: 1px solid var(--bk-line) !important;
  padding: 12px 16px;
  font-weight: 600;
  vertical-align: middle;
}
.bk-table-card .table thead th:first-child {
  border-top-left-radius: 13px;
}
.bk-table-card .table thead th:last-child {
  border-top-right-radius: 13px;
}
.bk-table-card .table tbody tr {
  transition: background 0.12s;
}
.bk-table-card .table tbody tr:hover {
  background: #fbf7f3 !important;
}
.bk-table-card .table tbody td {
  padding: 14px 16px;
  border-color: var(--bk-line);
  vertical-align: top !important;
}
.bk-table-card .table-striped > tbody > tr:nth-of-type(odd) > * {
  background: var(--bk-card) !important;
  width: 320px !important
}
.bk-table-card .table-striped > tbody > tr:nth-of-type(odd) > .sticky-action-col {
  background: #f8f9fa !important;
}

/* Empty / loading state card */
.bk-empty-card {
  border-radius: 14px;
  border: 1px solid var(--bk-line);
  background: var(--bk-card);
  padding: 32px 16px;
  text-align: center;
  color: var(--bk-soft);
}

/* ── Booking cell (ref + facility/type meta + truncated purpose/reason) ── */
.bk-ref {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--bk-ink);
  cursor: pointer;
}
.bk-ref:hover {
  color: var(--bk-brand);
}
.bk-meta {
  font-size: 12.5px;
  color: var(--bk-soft);
  margin-top: 2px;
}
.bk-recurring-mark {
  color: inherit;
  font-weight: 500;
}
.bk-reason {
  font-size: 12.5px;
  color: var(--bk-faint);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.bk-reason-tooltip .tooltip-inner {
  background-color: var(--bk-ink);
  color: #fff;
  font-size: 12.5px;
  max-width: 320px;
  text-align: left;
}

/* ── Event Date cell ───────────────────────────────────────────────── */
.bk-date {
  font-size: 14px;
  color: var(--bk-ink);
}
.bk-time {
  font-size: 12.5px;
  color: var(--bk-soft);
  margin-top: 2px;
}

/* ── Payment cell amount (bold, matches Host's inline font-weight:bold) ── */
.bk-amount {
  font-size: 14.5px;
  font-weight: bold;
  color: var(--bk-ink);
}

/* ── Sortable headers ───────────────────────────────────────────────── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable-th:hover {
  background: #f8f8f8 !important;
}
.sort-icon {
  margin-left: 5px;
  font-size: 0.72rem;
  color: #bbb;
}
.sort-asc .sort-icon,
.sort-desc .sort-icon {
  color: #eb2a25;
  font-weight: bold;
}

/* ── Sticky Action column — pins to right edge during horizontal scroll ── */
.sticky-action-col {
  position: sticky;
  right: 0;
  background-color: #f8f9fa !important;
  z-index: 2;
  box-shadow: -6px 0 16px -4px rgba(0, 0, 0, 0.12);
}
.bk-table-card thead .sticky-action-col {
  background-color: #e9ecef !important;
  z-index: 3;
}

/* ── Actions button + dropdown — ported verbatim from Host
   (dev-host/public/css/style.css:273-301) for identical design + behaviour ── */
.btn-actions-bk {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--bk-line);
  background: var(--bk-card);
  color: var(--bk-ink);
  transition: border-color .15s, background .15s;
}
.btn-actions-bk:hover {
  border-color: var(--bk-faint);
  background: #fbf7f3;
}
.bk-dots {
  color: var(--bk-faint);
  letter-spacing: 1px;
  font-size: 15px;
}
.bk-action-menu {
  border-radius: 10px !important;
  border: 1px solid var(--bk-line) !important;
  box-shadow: 0 8px 24px rgba(30, 30, 30, 0.1) !important;
  min-width: 190px;
  padding: 6px !important;
}
/* Elevate sticky cell z-index while its dropdown is open */
td.sticky-action-col:has(.dropdown-menu.show),
td.sticky-action-col.dropdown-is-open {
  z-index: 1060 !important;
}
.bk-action-menu .dropdown-item,
.bk-action-menu .dropdown-item-text {
  border-radius: 7px;
  font-size: 13.5px;
  padding: 8px 11px;
  color: var(--bk-ink);
}
.bk-action-menu .dropdown-item:hover {
  background: #fbf7f3;
  color: var(--bk-ink);
}
.bk-action-menu .dropdown-item.text-danger,
.bk-action-menu .dropdown-item.text-danger:hover {
  color: #b91c1c !important;
}
.bk-action-menu .dropdown-item.text-muted {
  cursor: not-allowed;
}

/* ── Payment / status text (matches Host's bk-pay-info / bk-status-text) ── */
.bk-pay-info {
  font-size: 12.5px;
  color: var(--bk-soft);
  margin-top: 2px;
  display: block;
}
/* Label + amount on one line ("Paid online" / "Due ..." / "Deposit"), spread
   apart to match Host's exact flex layout (dev-host index.ejs Payment cell)
   instead of relying on a single space character between them. */
.bk-pay-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.bk-status-text {
  font-size: 14px;
  color: var(--bk-soft);
}
.bk-status-danger {
  color: var(--bk-brand) !important;
  font-weight: 500;
}

/* ── Pagination footer ──────────────────────────────────────────────── */
.bk-dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--bk-line);
  font-size: 13px;
  color: var(--bk-soft);
}
.bk-dt-footer .btn {
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 6px;
}

/* ── Tablet / small laptop — keep the table (not stacked cards), tighten
   cell padding/font-size, keep the sticky Actions column pinned while the
   table itself scrolls horizontally inside .table-responsive ───────────── */
@media (min-width: 768px) and (max-width: 1024px) {
  .bk-table-card .table thead th {
    padding: 10px 12px;
    font-size: 10.5px;
  }
  .bk-table-card .table tbody td {
    padding: 10px 12px;
  }
  .bk-ref {
    font-size: 13.5px;
  }
  .bk-meta,
  .bk-time,
  .bk-pay-info {
    font-size: 11.5px;
  }
  .bk-reason {
    max-width: 180px;
  }
}

/* ── Mobile tabs — single row, horizontal scroll (Host's own .supporttabs
   pattern, dev-host/public/css/responsive.css:37,89,146, reused here for
   the dashboard tab group) ───────────────────────────────────────────── */
@media (max-width: 767px) {
  .gd-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .gd-tabs .nav-item {
    white-space: nowrap;
  }
}

/* ── Mobile stacked cards ───────────────────────────────────────────── */
@media (max-width: 767px) {
  .bk-table-card thead {
    display: none;
  }
  .bk-table-card tbody tr {
    display: block;
    padding: 14px;
    border-bottom: 1px solid var(--bk-line);
  }
  .bk-table-card tbody td {
    display: block;
    border: none;
    padding: 6px 0;
  }
  .bk-table-card td.sticky-action-col {
    position: static;
    box-shadow: none;
    background: transparent !important;
    padding-top: 12px;
  }
  .bk-table-card .btn-actions-bk {
    width: 100%;
    justify-content: center;
  }
  .bk-dt-footer {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}
