/* ── Alma Mater colour palette (derived from ІФНТУНГ logo #304090) ── */
:root {
  /* Primary – royal blue from the logo */
  --am-900: #1a2350;
  --am-800: #1e2a60;
  --am-700: #253472;
  --am-600: #2b3d84;
  --am-500: #304090;   /* ← logo colour, brand primary */
  --am-400: #4a5aaa;
  --am-300: #6472bc;
  --am-200: #9ea8d8;
  --am-100: #d0d5ef;
  --am-50:  #eceef8;

  /* Accent – gold, classic university pairing with royal blue */
  --am-accent:       #c9a227;
  --am-accent-light: #f0d070;

  /* Override Bootstrap 5 primary to match the logo */
  --bs-primary:         #304090;
  --bs-primary-rgb:     48, 64, 144;
  --bs-link-color:      #304090;
  --bs-link-hover-color:#1e2a60;
  --bs-link-color-rgb:  48, 64, 144;
}

/* ── Bootstrap component overrides ───────────────────────────── */
.btn-primary         { --bs-btn-bg: #304090; --bs-btn-border-color: #304090;
                       --bs-btn-hover-bg: #253472; --bs-btn-hover-border-color: #253472;
                       --bs-btn-active-bg: #1e2a60; }
.btn-outline-primary { --bs-btn-color: #304090; --bs-btn-border-color: #304090;
                       --bs-btn-hover-bg: #304090; --bs-btn-hover-border-color: #304090; }

/* ── Typography ──────────────────────────────────────────────── */
body { font-family: 'Segoe UI', system-ui, sans-serif; }

/* ── Sidebar nav ──────────────────────────────────────────────── */
.app-nav        { color: #495057; transition: background .15s, color .15s; }
.app-nav:hover  { background: var(--am-50);  color: var(--am-500); }
.app-nav.active { background: var(--am-100); color: var(--am-500); font-weight: 500; }

/* ── Page header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }

/* ── Sticky table header ──────────────────────────────────────── */
.table-sticky thead th {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
  box-shadow: 0 1px 0 #dee2e6;
}

/* ── Org department picker (searchable combobox) ────────────────── */
.dept-picker { position: relative; }
.dept-picker-menu {
  position: absolute; z-index: 1060; top: 100%; left: 0; right: 0;
  max-height: 280px; overflow-y: auto; margin-top: 2px;
  background: #fff; border: 1px solid #dee2e6; border-radius: .5rem;
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.12); display: none;
}
.dept-picker-menu.show { display: block; }
.dept-picker-item {
  padding: .4rem .75rem; font-size: .875rem; cursor: pointer;
}
.dept-picker-item:hover, .dept-picker-item.active { background: var(--am-50); }
.dept-picker-item .parent { display: block; font-size: .72rem; color: #6c757d; }
.dept-picker-empty { padding: .5rem .75rem; font-size: .8rem; color: #6c757d; }

/* ── History timeline (room card) ────────────────────────────────── */
.history-item {
  border-left: 2px solid var(--am-100);
  padding: 0 0 1rem 1rem;
  position: relative;
}
.history-item::before {
  content: '';
  position: absolute; left: -6px; top: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--am-200);
}
.history-item.is-current::before { background: var(--am-500); }
.history-item:last-child { padding-bottom: 0; }

/* ── Photo gallery (buildings/rooms) ─────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .5rem;
}
.photo-tile {
  aspect-ratio: 1 / 1;
  border-radius: .35rem;
  overflow: hidden;
  background: var(--am-50);
}
.photo-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.photo-tile-remove {
  position: absolute; top: .25rem; right: .25rem;
  padding: .15rem .4rem; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.photo-tile:hover .photo-tile-remove { opacity: 1; }

/* ── Equipment booking calendar ──────────────────────────────────── */
.booking-calendar {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}
.booking-calendar th {
  text-align: center;
  font-weight: 600;
  padding: .25rem;
  background: var(--am-50);
  white-space: nowrap;
}
.booking-calendar .slot-time {
  font-weight: 400;
  color: #6c757d;
  text-align: right;
  padding-right: .5rem;
  background: #fff;
}
.booking-calendar td.slot {
  width: 18%;
  height: 1.4rem;
  border: 1px solid #f1f1f1;
  cursor: pointer;
}
.slot-free    { background: #fff; }
.slot-free:hover { background: var(--am-50); }
.slot-busy    { background: #ced4da; }
.slot-pending, .slot-mine-pending     { background: #ffe69c; }
.slot-confirmed, .slot-mine-confirmed { background: #f1aeb5; }
.booking-calendar td.slot:hover { outline: 2px solid var(--am-500); outline-offset: -2px; }

.legend-item { display: inline-flex; align-items: center; }
.legend-swatch {
  display: inline-block; width: .7rem; height: .7rem; border-radius: .15rem;
  margin-right: .3rem; border: 1px solid rgba(0,0,0,.1);
}
.legend-swatch.slot-free    { background: #fff; }
.legend-swatch.slot-busy    { background: #ced4da; }
.legend-swatch.slot-pending, .legend-swatch.slot-mine-pending     { background: #ffe69c; }
.legend-swatch.slot-confirmed, .legend-swatch.slot-mine-confirmed { background: #f1aeb5; }

/* ── Loading placeholder ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: .35rem;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Misc ─────────────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }

/* ── Responsive sidebar (offcanvas drawer below lg, static column at lg+) ── */
#app-sidebar { width: 220px; }
@media (max-width: 991.98px) {
  #app-sidebar { width: 270px; }
}

/* ── Print: app chrome (navbar/sidebar) never shows in printed output,
   whether from a dedicated print page or a plain Ctrl+P on any screen ── */
@media print {
  .navbar, #app-sidebar, #sidebar-toggle { display: none !important; }
  #shell { height: auto !important; display: block !important; }
  .app-body { display: block !important; overflow: visible !important; }
  main#page { overflow: visible !important; padding: 0 !important; }
}
