/*
 Modern responsive layer for Booked Scheduler.
 Loaded after booked.css and the page specific stylesheets, before any theme
 uploaded through Look and Feel, so a custom theme can still override it.
*/

:root {
  --bk-primary: #1e4bb4;
  --bk-primary-hover: #183d93;
  --bk-primary-soft: #e8eefb;
  --bk-text: #1f2937;
  --bk-muted: #6b7280;
  --bk-bg: #f3f5f9;
  --bk-surface: #ffffff;
  --bk-border: #e2e6ee;
  --bk-radius: 10px;
  --bk-radius-sm: 6px;
  --bk-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --bk-shadow-lg: 0 10px 30px rgba(16, 24, 40, .16);
  --bk-nav-height: 60px;
}

/* ---------- Base ---------- */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--bk-text);
  background-color: var(--bk-bg);
  padding-top: calc(var(--bk-nav-height) + 16px);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: auto;
}

html, body {
  height: auto;
}

#main {
  flex: 1 0 auto;
  min-height: 0;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 15px 32px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: inherit;
  font-weight: 600;
  color: var(--bk-text);
}

a, a:visited {
  color: var(--bk-primary);
}

a:hover, a:focus {
  color: var(--bk-primary-hover);
}

:focus-visible {
  outline: 2px solid var(--bk-primary);
  outline-offset: 2px;
}

/* ---------- Navigation ---------- */

.navbar-default {
  background: var(--bk-surface);
  border: 0;
  border-bottom: 1px solid var(--bk-border);
  box-shadow: 0 1px 8px rgba(16, 24, 40, .06);
  min-height: var(--bk-nav-height);
}

.navbar-fixed-top {
  z-index: 1030;
}

.adjust-nav-bar-static {
  margin-top: calc(-1 * (var(--bk-nav-height) + 16px));
  margin-bottom: 16px;
}

.navbar-brand {
  height: var(--bk-nav-height);
  padding: 6px 12px 6px 0;
  display: flex;
  align-items: center;
}

.navbar-brand img.logo,
.navbar-brand img {
  max-height: calc(var(--bk-nav-height) - 12px);
  width: auto;
}

.navbar-default .navbar-nav > li > a {
  color: #374151;
  font-weight: 500;
  border-radius: var(--bk-radius-sm);
  margin: 0 2px;
}

@media (min-width: 1001px) {
  .navbar-default .navbar-nav > li > a {
    padding-top: 9px;
    padding-bottom: 9px;
    margin-top: 11px;
    margin-bottom: 11px;
  }
}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus,
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
  background-color: var(--bk-primary-soft);
  color: var(--bk-primary);
}

.navbar-default .navbar-toggle {
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius-sm);
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 10px 11px;
}

.navbar-default .navbar-toggle .icon-bar {
  background-color: #374151;
}

.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
  background-color: var(--bk-primary-soft);
}

.dropdown-menu {
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius);
  box-shadow: var(--bk-shadow-lg);
  padding: 6px;
  min-width: 220px;
}

.dropdown-menu > li > a {
  border-radius: var(--bk-radius-sm);
  padding: 7px 12px;
  color: var(--bk-text);
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
  background-color: var(--bk-primary-soft);
  color: var(--bk-primary);
}

.dropdown-menu .divider {
  margin: 6px 0;
  background-color: var(--bk-border);
}

/* Collapsed menu (booked.css collapses the navbar below 1000px) */
@media (max-width: 1000px) {
  .navbar-collapse {
    max-height: calc(100vh - var(--bk-nav-height));
    overflow-y: auto;
    border-top: 1px solid var(--bk-border);
    box-shadow: none;
  }

  .navbar-default .navbar-nav {
    margin: 8px 0;
  }

  .navbar-default .navbar-nav > li > a {
    padding: 12px 14px;
    margin: 2px 0;
  }

  .navbar-nav .open .dropdown-menu {
    position: static;
    float: none;
    width: auto;
    margin: 0 0 6px 12px;
    background: transparent;
    border: 0;
    border-left: 2px solid var(--bk-border);
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 0 6px;
  }

  .navbar-nav .open .dropdown-menu > li > a {
    padding: 10px 12px;
  }
}

/* ---------- Footer ---------- */

.footer,
footer.footer.navbar {
  flex-shrink: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 14px 16px;
  background: var(--bk-surface);
  border: 0;
  border-top: 1px solid var(--bk-border);
  border-radius: 0;
  color: var(--bk-muted);
  font-size: 12px;
  line-height: 1.6;
  filter: none;
}

.footer a,
.footer a:visited {
  color: var(--bk-muted);
}

/* ---------- Cards: panels, boxes, dashboard ---------- */

.panel,
.default-box,
.default-box-shadow,
.dashboard {
  background: var(--bk-surface);
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius);
  box-shadow: var(--bk-shadow);
}

.default-box,
.default-box-shadow {
  padding: 24px;
}

.default-box-header {
  background: #f8fafc;
  color: var(--bk-text);
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius) var(--bk-radius) 0 0;
  font-size: 16px;
  font-weight: 600;
}

.default-box-header a,
.default-box-header a:visited {
  color: var(--bk-primary);
}

.default-box h1 {
  color: var(--bk-text);
  font-weight: 600;
  border-bottom-color: var(--bk-border);
}

.panel-heading,
#page-dashboard .panel-heading {
  border-top-left-radius: var(--bk-radius);
  border-top-right-radius: var(--bk-radius);
}

.panel-default > .panel-heading,
#page-dashboard .panel-heading {
  background: #f8fafc;
  color: var(--bk-text);
  border-color: var(--bk-border);
}

#page-dashboard .panel {
  border-color: var(--bk-border);
}

.dashboard {
  margin-top: 0;
  margin-bottom: 20px;
  overflow: hidden;
}

.dashboardHeader {
  background: transparent;
  color: var(--bk-text);
  font-weight: 600;
  letter-spacing: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bk-border);
}

.dashboardHeader a,
.dashboardHeader a:visited {
  color: var(--bk-muted);
}

.dashboardHeader .badge {
  background-color: var(--bk-primary-soft);
  color: var(--bk-primary);
  font-weight: 600;
}

.dashboardContents {
  padding: 12px 18px 16px;
}

.upcomingReservationsDashboard .timespan {
  background: transparent;
  color: var(--bk-muted);
  font-style: normal;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 0;
  padding: 14px 0 6px;
}

.upcomingReservationsDashboard .reservation {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid #eef1f5;
  border-radius: var(--bk-radius-sm);
}

.upcomingReservationsDashboard .reservation.hover {
  background-color: var(--bk-primary-soft);
}

.availabilityDashboard .resourceName {
  background-color: var(--bk-primary-soft);
  color: var(--bk-primary);
  padding: 2px 8px;
  border-radius: 999px;
}

.availabilityDashboard .resourceName a {
  color: var(--bk-primary);
}

@media (max-width: 767px) {
  .upcomingReservationsDashboard .reservation {
    padding: 10px 0;
  }

  .upcomingReservationsDashboard .reservation > div:first-child {
    font-weight: 600;
  }

  .upcomingReservationsDashboard .reservation > div:not(:first-child) {
    color: var(--bk-muted);
    font-size: 13px;
  }

  .dashboardContents {
    padding: 8px 14px 12px;
  }

  .availabilityDashboard .availabilityItem > div {
    margin-bottom: 6px;
  }
}

/* ---------- Buttons ---------- */

.btn {
  border-radius: var(--bk-radius-sm);
  font-weight: 500;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}

.btn:not(.btn-xs):not(.btn-sm):not(.btn-link) {
  min-height: 36px;
}

.btn-primary,
.btn-primary:visited {
  background-color: var(--bk-primary);
  border-color: var(--bk-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
  background-color: var(--bk-primary-hover);
  border-color: var(--bk-primary-hover);
  color: #fff;
}

.btn-default {
  border-color: #d0d6e0;
  color: var(--bk-text);
}

.btn-default:hover,
.btn-default:focus {
  background-color: #f3f5f9;
  border-color: #c0c7d3;
}

.btn.btn-success {
  background-color: #16a34a;
  border-color: #16a34a;
}

.btn.btn-success:hover,
.btn.btn-success:focus {
  background-color: #15803d;
  border-color: #15803d;
}

.btn-link,
.btn-link:visited {
  color: var(--bk-primary);
}

/* ---------- Forms ---------- */

.form-control {
  border-color: #d0d6e0;
  border-radius: var(--bk-radius-sm);
  box-shadow: none;
}

.form-control:not(.input-sm):not(textarea):not([multiple]) {
  height: 38px;
}

.form-control:focus {
  border-color: var(--bk-primary);
  box-shadow: 0 0 0 3px rgba(30, 75, 180, .15);
}

.input-group-addon {
  background-color: #f8fafc;
  border-color: #d0d6e0;
  color: var(--bk-muted);
}

.input-group .form-control:first-child,
.input-group-addon:first-child {
  border-top-left-radius: var(--bk-radius-sm);
  border-bottom-left-radius: var(--bk-radius-sm);
}

.input-group .form-control:last-child,
.input-group-addon:last-child {
  border-top-right-radius: var(--bk-radius-sm);
  border-bottom-right-radius: var(--bk-radius-sm);
}

label {
  font-weight: 600;
  color: #374151;
}

/* Prevent iOS zoom on input focus */
@media (max-width: 767px) {
  input.form-control,
  select.form-control,
  textarea.form-control {
    font-size: 16px;
  }
}

/* ---------- Tables ---------- */

.table > thead > tr > th {
  border-bottom: 1px solid var(--bk-border);
  color: var(--bk-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: #f8fafc;
}

.table > tbody > tr > td,
.table > tbody > tr > th {
  border-top-color: #eef1f5;
  vertical-align: middle;
}

.table-hover > tbody > tr:hover,
.table-striped > tbody > tr:nth-of-type(odd):hover {
  background-color: var(--bk-primary-soft);
}

/* Wide admin and report tables scroll sideways instead of stretching the page.
   The wrapper is added in globalfooter.tpl. */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll > .table {
  margin-bottom: 0;
}

.table-scroll {
  margin-bottom: 20px;
}

.admin-panel a,
.admin-panel a:visited {
  color: var(--bk-primary);
}

/* ---------- Modals and popups ---------- */

.modal-content {
  border: 0;
  border-radius: 12px;
  box-shadow: var(--bk-shadow-lg);
}

.modal-header {
  border-bottom-color: var(--bk-border);
}

.modal-footer {
  border-top-color: var(--bk-border);
}

.modal-title {
  font-weight: 600;
}

@media (max-width: 767px) {
  .modal-dialog {
    margin: 8px;
  }
}

/* booked.css removes the width limit; keep popups inside small screens */
.qtip {
  max-width: min(480px, calc(100vw - 16px));
}

.qtip-content {
  overflow-wrap: anywhere;
}

/* On phones the popup is a centred card; its arrow would point at the wrong place */
@media (max-width: 767px) {
  .qtip {
    left: 8px !important;
    width: calc(100vw - 16px) !important;
    max-width: none;
  }

  .qtip-tip {
    display: none !important;
  }
}

.qtip-default,
.qtip-bootstrap {
  border-radius: var(--bk-radius);
  box-shadow: var(--bk-shadow-lg);
}

.alert {
  border-radius: var(--bk-radius-sm);
}

/* ---------- Login ---------- */

#page-login .default-box {
  background: var(--bk-surface);
  border-color: var(--bk-border);
  padding: 28px 20px;
}

#page-login .login-icon img {
  max-height: 160px;
  width: auto;
}

/* ---------- Schedule ---------- */

#page-schedule #schedule-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
}

#page-schedule .schedule-dates {
  font-size: 1.3em;
}

@media (min-width: 1200px) {
  #page-schedule .schedule-dates {
    white-space: nowrap;
  }
}

#page-schedule .schedule-dates img {
  vertical-align: -3px;
}

#page-schedule .schedule-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 8px 0 12px;
  float: none;
}

div.legend {
  width: auto;
  min-width: 90px;
  padding: 0 12px;
  margin: 0;
  border-radius: 999px;
  border-color: rgba(0, 0, 0, .15);
  font-size: 12px;
  line-height: 24px;
}

#reservations-left {
  background: var(--bk-surface);
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius);
  box-shadow: var(--bk-shadow);
  margin-bottom: 16px;
}

.reservations-left-header {
  color: var(--bk-text);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom-color: var(--bk-border);
}

/* The grid keeps a readable minimum width and scrolls sideways on narrow screens */
#reservations > div[style*="relative"] {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--bk-radius-sm);
  margin-bottom: 14px;
  background: var(--bk-surface);
  box-shadow: var(--bk-shadow);
}

table.reservations {
  border-color: #c9d3e6;
}

table.reservations:not(.mobile) {
  min-width: 860px;
}

table.reservations td {
  border-color: #d5dcea;
}

td.resdate,
td.reslabel {
  font-weight: 600;
}

td.resourcename {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 120px;
  background-color: #f8fafc;
}

table.reservations thead td.resdate {
  position: sticky;
  left: 0;
  z-index: 3;
}

@media (max-width: 767px) {
  #page-schedule .schedule-dates {
    font-size: 16px;
  }

  td.resourcename {
    min-width: 84px;
    max-width: 100px;
    font-size: 12px;
    white-space: normal;
    word-break: break-word;
  }
}

/* Mobile schedule view (schedule-mobile.tpl) */
table.reservations.mobile {
  min-width: 0;
}

#reservations .mobile td {
  border-color: #e2e6ee;
}

/* ---------- Week timeline layout (schedule-week-timeline.tpl) ---------- */

.wt-resource-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.wt-resource-tab,
.wt-resource-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--bk-border);
  background: var(--bk-surface);
  color: var(--bk-muted);
  border-radius: 999px;
  padding: 5px 13px 5px 9px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}

.wt-resource-all {
  padding-left: 13px;
  color: var(--bk-primary);
}

.wt-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--wt-color);
  background: transparent;
  flex-shrink: 0;
}

.wt-resource-tab:hover,
.wt-resource-all:hover {
  border-color: var(--wt-color, var(--bk-primary));
}

.wt-resource-tab.active {
  background: var(--wt-color);
  border-color: var(--wt-color);
  color: var(--wt-text);
}

.wt-resource-tab.active .wt-dot {
  background: var(--wt-text);
  border-color: var(--wt-text);
}

.wt-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bk-surface);
  border: 1px solid var(--bk-border);
  border-radius: var(--bk-radius);
  box-shadow: var(--bk-shadow);
}

.wt-grid {
  --wt-axis: 56px;
  --wt-hour-height: 52px;
  --wt-day-min: 130px;
  min-width: calc(var(--wt-axis) + var(--wt-days) * var(--wt-day-min));
}

.wt-head,
.wt-body {
  display: grid;
  grid-template-columns: var(--wt-axis) repeat(var(--wt-days), minmax(var(--wt-day-min), 1fr));
}

.wt-head {
  border-bottom: 1px solid var(--bk-border);
  background: #f8fafc;
}

.wt-corner,
.wt-axis {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f8fafc;
  border-right: 1px solid var(--bk-border);
}

.wt-day-head {
  padding: 8px 6px;
  text-align: center;
  border-left: 1px solid var(--bk-border);
  line-height: 1.25;
}

.wt-day-head:nth-child(2) {
  border-left: 0;
}

.wt-day-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
}

.wt-day-date {
  display: block;
  font-size: 12px;
  color: var(--bk-muted);
}

.wt-day-head.today {
  background: var(--bk-primary-soft);
}

.wt-day-head.today .wt-day-name,
.wt-day-head.today .wt-day-date {
  color: var(--bk-primary);
}

.wt-body {
  height: calc(var(--wt-hours) * var(--wt-hour-height));
}

.wt-hour {
  height: var(--wt-hour-height);
  padding: 2px 8px 0 0;
  text-align: right;
  font-size: 11px;
  color: var(--bk-muted);
  font-variant-numeric: tabular-nums;
  border-top: 1px solid #eef1f5;
}

.wt-hour:first-child {
  border-top: 0;
}

.wt-day {
  position: relative;
  border-left: 1px solid var(--bk-border);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--wt-hour-height) - 1px),
    #eef1f5 calc(var(--wt-hour-height) - 1px),
    #eef1f5 var(--wt-hour-height)
  );
}

.wt-axis + .wt-day {
  border-left: 0;
}

.wt-day.today {
  background-color: #f7f9fe;
}

.wt-slot {
  position: absolute;
  left: 0;
  right: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
}

#reservations .wt-slot.reserved {
  z-index: 2;
  padding: 3px 6px;
  border: 0;
  border-radius: 5px;
  background-color: var(--wt-color) !important;
  color: var(--wt-text) !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9);
  cursor: pointer;
}

#reservations .wt-slot.reserved:hover {
  z-index: 4;
  overflow: visible;
  min-height: fit-content;
  box-shadow: 0 0 0 1px #fff, var(--bk-shadow-lg);
}

#reservations .wt-slot.reserved.pending {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .28) 0, rgba(255, 255, 255, .28) 5px, transparent 5px, transparent 10px) !important;
  outline: 2px dashed rgba(0, 0, 0, .35);
  outline-offset: -2px;
}

.wt-swatches {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}

.wt-swatches:empty {
  display: none;
}

.wt-swatches span {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .85);
}

.wt-time {
  display: block;
  font-weight: 600;
  font-size: 11px;
  opacity: .9;
  font-variant-numeric: tabular-nums;
}

.wt-label {
  display: block;
  word-break: break-word;
}

.wt-resources {
  display: block;
  font-size: 11px;
  opacity: .85;
  word-break: break-word;
}

.wt-resources:empty {
  display: none;
}

/* Blocks squeezed next to many others: name written vertically, details in the tooltip */
#reservations .wt-slot.reserved.wt-narrow {
  padding: 4px 2px;
}

.wt-narrow .wt-time,
.wt-narrow .wt-resources {
  display: none;
}

.wt-narrow .wt-swatches {
  flex-direction: column;
  align-items: center;
}

.wt-narrow .wt-label {
  writing-mode: vertical-rl;
  white-space: nowrap;
  margin: 0 auto;
  font-weight: 600;
}

.wt-slot.reservable {
  z-index: 1;
  cursor: pointer;
  background: transparent !important;
  color: var(--bk-primary) !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wt-slot.reservable .fa {
  opacity: 0;
  transition: opacity .1s;
}

.wt-slot.reservable:hover {
  background: var(--bk-primary-soft) !important;
}

.wt-slot.reservable:hover .fa {
  opacity: 1;
}

.wt-slot.unreservable,
.wt-slot.restricted {
  padding: 3px 6px;
  color: var(--bk-muted);
  background: repeating-linear-gradient(135deg, #f1f3f7 0, #f1f3f7 6px, #e8ebf1 6px, #e8ebf1 12px) !important;
}

.wt-slot.pasttime {
  background: rgba(148, 163, 184, .12) !important;
}

@media (max-width: 767px) {
  .wt-resource-picker {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-left: -15px;
    margin-right: -15px;
    padding: 0 15px 4px;
    -webkit-overflow-scrolling: touch;
  }

  .wt-grid {
    --wt-axis: 44px;
    --wt-hour-height: 48px;
    --wt-day-min: 110px;
  }

  .wt-slot {
    font-size: 11px;
  }
}

/* ---------- Calendar (FullCalendar) ---------- */

.fc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fc-toolbar > * {
  float: none !important;
}

.fc-toolbar:before,
.fc-toolbar:after {
  display: none;
}

.fc-toolbar h2 {
  font-size: 20px;
  font-weight: 600;
}

@media (max-width: 767px) {
  .fc-toolbar {
    justify-content: center;
  }

  .fc-toolbar h2 {
    font-size: 17px;
  }

  .fc-view-container {
    overflow-x: auto;
  }
}

/* ---------- Small screens: general ---------- */

@media (max-width: 767px) {
  body {
    font-size: 15px;
    padding-top: calc(var(--bk-nav-height) + 8px);
  }

  #main {
    padding: 0 15px 24px;
  }

  .default-box,
  .default-box-shadow {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  .pull-right.btn,
  .btn-group-justified-xs .btn {
    float: none !important;
  }

  img {
    max-width: 100%;
    height: auto;
  }
}
