/**
 * Orlando International Resorts — app layer on top of Bootstrap 5.
 * Keep custom rules small; prefer utilities and components in markup.
 */
:root {
  --app-sidebar-width: 260px;
  --app-navbar-height: 64px;
  --orlando-maroon: #78212d;
  --orlando-maroon-soft: #97535c;
  --orlando-ink: #433132;
  --orlando-dark: #202020;
  --orlando-beige: #f1eae1;
  --orlando-offwhite: #eae2e1;
  --orlando-stone: #ccc6c2;

  --bs-primary: var(--orlando-maroon);
  --bs-primary-rgb: 120, 33, 45;
  --bs-secondary: #6f6661;
  --bs-secondary-rgb: 111, 102, 97;
  --bs-body-bg: var(--orlando-offwhite);
  --bs-body-bg-rgb: 234, 226, 225;
  --bs-body-color: var(--orlando-ink);
  --bs-body-color-rgb: 67, 49, 50;
  --bs-tertiary-bg: #f5efe8;
  --bs-tertiary-bg-rgb: 245, 239, 232;
  --bs-border-color: #d9d1c9;
  --bs-border-color-translucent: rgba(120, 33, 45, 0.12);
  --bs-light-bg-subtle: var(--orlando-beige);
  --bs-warning-bg-subtle: #f5ead8;
  --bs-success-bg-subtle: #e8efe7;
  --bs-primary-bg-subtle: #f0dde0;
  --bs-link-color: var(--orlando-maroon);
  --bs-link-hover-color: #5d1721;
}

.app-shell {
  min-height: calc(100vh - var(--app-navbar-height));
}

.app-navbar {
  background: #fff !important;
  border-bottom-color: var(--bs-border-color) !important;
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: var(--app-navbar-height);
}

.app-navbar .navbar-brand {
  color: var(--orlando-ink) !important;
  margin-left: 0 !important;
}

.app-navbar .nav-text {
  color: var(--orlando-ink) !important;
}

.app-navbar .btn-outline-light {
  --bs-btn-color: var(--orlando-maroon);
  --bs-btn-border-color: var(--orlando-maroon-soft);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--orlando-maroon);
  --bs-btn-hover-border-color: var(--orlando-maroon);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #5d1721;
  --bs-btn-active-border-color: #5d1721;
}

.brand-logo {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  display: inline-block;
  flex: 0 0 48px;
  border-radius: 50%;
  object-fit: cover !important;
}

.brand-title {
  color: var(--orlando-ink);
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
  font-family: "Times New Roman", Georgia, serif;
  font-size: 2rem;
  letter-spacing: 0.01em;
}

.brand-title span {
  display: block;
}

.brand-title-mobile {
  display: none !important;
}

@media (max-width: 767.98px) {
  :root {
    --app-navbar-height: 58px;
  }
  .app-navbar .container-fluid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.6rem;
  }
  .app-navbar .btn[data-bs-target="#appSidebarNav"] {
    flex: 0 0 auto;
    margin-right: 0 !important;
  }
  .app-navbar .navbar-brand {
    flex: 1 1 auto;
    margin-right: 0 !important;
    gap: 0.45rem !important;
    min-width: 0;
    align-items: center !important;
  }
  .app-navbar .navbar-nav {
    flex: 0 0 auto;
    width: auto;
    justify-content: initial;
    margin-top: 0;
    margin-left: auto !important;
    position: relative;
    overflow: visible;
  }
  .app-navbar .navbar-nav .dropdown {
    display: inline-block;
    position: relative;
  }
  .app-navbar .navbar-nav .dropdown-menu {
    position: absolute !important;
    top: calc(100% + 0.35rem);
    right: 0;
    left: auto;
    margin-top: 0;
    min-width: 9rem;
  }
  .brand-logo {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    flex-basis: 32px;
  }
  .brand-title {
    font-size: 1rem;
    line-height: 1.05;
  }
  .brand-title-full {
    display: none !important;
  }
  .brand-title-mobile {
    display: block !important;
  }
}

.app-sidebar {
  width: var(--app-sidebar-width);
  flex: 0 0 var(--app-sidebar-width);
}

.app-sidebar.offcanvas-lg {
  --bs-offcanvas-width: min(88vw, 320px);
}

.app-sidebar .offcanvas-header {
  background: #fff;
}

.sidebar-section-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--orlando-ink);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.85rem 0.75rem 0.35rem;
}

.sidebar-section-toggle::after {
  content: "▾";
  float: right;
  font-size: 0.8rem;
  opacity: 0.7;
}

.sidebar-section-toggle.collapsed::after {
  content: "▸";
}

.app-sidebar .collapse .nav-link {
  margin: 0.1rem 0;
}

.app-sidebar .nav-link {
  color: var(--orlando-ink);
}

.app-sidebar .nav-pills .nav-link:hover {
  background: #f3e8e8;
  color: var(--orlando-maroon);
}

.app-sidebar .nav-pills .nav-link.active,
.app-sidebar .nav-pills .show > .nav-link {
  background: var(--orlando-maroon);
  border-color: var(--orlando-maroon);
  color: #fff;
}

.app-sidebar .text-primary {
  color: var(--orlando-maroon) !important;
}

@media (min-width: 992px) {
  .app-sidebar.offcanvas-lg {
    --bs-offcanvas-width: var(--app-sidebar-width);
  }
  .app-sidebar {
    position: sticky;
    top: var(--app-navbar-height);
    align-self: flex-start;
    height: calc(100vh - var(--app-navbar-height));
    overflow-y: auto;
  }
}

@media (max-width: 991.98px) {
  .app-shell {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    border-right: none !important;
    border-bottom: 1px solid var(--bs-border-color);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
  }
  .app-sidebar .nav {
    gap: 0.25rem !important;
  }
  .app-sidebar .nav-link {
    padding: 0.42rem 0.7rem !important;
    font-size: 0.95rem;
    line-height: 1.2;
  }
  .sidebar-section-toggle {
    padding-top: 0.65rem;
    padding-bottom: 0.2rem;
    font-size: 0.62rem;
  }
}

/* Filter panels — structure comes from .filters + Bootstrap form classes in PHP */
.filters {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--bs-border-radius-lg);
  background-color: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
}

.filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}

.filters__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 8rem;
  flex: 0 1 auto;
}

.filters__field--grow {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.filters__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.filters__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Report hub tiles */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.report-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}

.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  padding: 1.25rem;
  background: var(--bs-body-bg);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.tile:hover {
  border-color: var(--bs-primary);
  box-shadow: 0 0.25rem 1rem rgba(var(--bs-primary-rgb), 0.15);
}

.tile-title {
  font-weight: 700;
}

.tile-sub {
  font-size: 0.875rem;
  color: var(--bs-secondary-color);
  margin-top: 0.25rem;
}

.tile--compact {
  padding: 0.75rem 0.85rem;
  border-radius: var(--bs-border-radius);
}

.tile--compact .tile-title {
  font-size: 0.95rem;
  line-height: 1.2;
}

.tile--compact .tile-sub {
  font-size: 0.8rem;
  line-height: 1.25;
}

.live-trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.trend-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 0.65rem 0.75rem;
}

.sparkline-bars {
  height: 78px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
}

.sparkline-point {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.sparkline-bar {
  width: 100%;
  border-radius: 0.35rem 0.35rem 0.2rem 0.2rem;
  background: var(--bs-secondary);
  opacity: 0.95;
}

.trend-income {
  background: #198754;
}

.trend-occupancy {
  background: #0d6efd;
}

.trend-expenses {
  background: #dc3545;
}

.trend-stock {
  background: #fd7e14;
}

.sparkline-label {
  font-size: 0.66rem;
  color: var(--bs-secondary-color);
  line-height: 1;
}

/* Dashboard: room mix bars */
.room-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.room-bar {
  display: grid;
  grid-template-columns: 5.5rem 1fr 3rem;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.room-bar__label {
  color: var(--bs-secondary-color);
}

.room-bar__track {
  height: 0.5rem;
  background: var(--bs-tertiary-bg);
  border-radius: 999px;
  overflow: hidden;
}

.room-bar__fill {
  height: 100%;
  border-radius: 999px;
}

.room-bar__fill--avail {
  background: var(--bs-success);
}

.room-bar__fill--occ {
  background: var(--bs-primary);
}

.room-bar__fill--booked {
  background: var(--bs-info);
}

.room-bar__fill--clean {
  background: var(--bs-warning);
}

.room-bar__num {
  text-align: right;
  font-weight: 600;
}

/* Department snapshot */
.dept-snapshot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.dept-snap {
  padding: 0.75rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--bs-body-bg);
}

.dept-snap__name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color);
}

.dept-snap__qty {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

/* Sticky table header in wide lists */
.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bs-body-bg);
  box-shadow: inset 0 -1px 0 var(--bs-border-color);
}

.pre {
  overflow: auto;
  padding: 1rem;
  background: var(--bs-dark);
  color: var(--bs-light);
  border-radius: var(--bs-border-radius-lg);
}

.row-warn td {
  background-color: var(--bs-warning-bg-subtle);
}
