/* ─── Calendar Book button ─── */
#book-btn {
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(44, 78, 138, .25);
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

#book-btn[hidden] {
  display: none !important;
}

#book-btn:hover {
  background: rgba(44, 78, 138, .45);
}

#book-btn.book-btn-pulse {
  animation: book-btn-pulse 1.8s ease-out 1;
}

@keyframes book-btn-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 107, 38, 0);
    border-color: var(--border);
  }
  20% {
    transform: scale(1.04);
    box-shadow: 0 0 0 5px rgba(255, 107, 38, 0.18), 0 0 18px rgba(255, 107, 38, 0.42);
    border-color: rgba(255, 128, 64, 0.95);
  }
  65% {
    transform: scale(1.01);
    box-shadow: 0 0 0 10px rgba(255, 107, 38, 0.06), 0 0 10px rgba(255, 107, 38, 0.2);
    border-color: rgba(255, 128, 64, 0.75);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(255, 107, 38, 0);
    border-color: var(--border);
  }
}

#book-count {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 18px;
  text-align: center;
  margin-left: 2px;
}

/* ─── Calendar Book overlay / panel ─── */
#book-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 35, 0.35);
  z-index: 2050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

#book-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Companion mode: docked left of the Coffee Chats panel, no backdrop */
#book-overlay.companion {
  background: none;
  inset: auto;
  right: 420px; /* clears dorphin panel (320px) + wheel (96px) + 4px gap */
  top: 60px;
  bottom: 52px;
  width: min(400px, 40vw);
  align-items: flex-start;
  justify-content: flex-end;
  z-index: 2099;
}

#book-overlay.companion #book-panel {
  width: 100%;
  max-height: 100%;
  border-radius: 12px;
}

#book-panel {
  background: rgba(19, 41, 75, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(44, 78, 138, 0.4);
  border-radius: 16px;
  width: min(84vw, 660px);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  overflow: hidden;
}

#book-panel-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

#book-panel-hdr h2 {
  font-size: .95rem;
  font-weight: 700;
  flex: 0 0 auto;
  white-space: nowrap;
}

#book-panel-meta {
  flex: 1;
  min-width: 0;
  font-size: .7rem;
  color: var(--text-dim);
}

#book-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s;
}

#book-panel-close:hover {
  color: var(--text);
}

#book-download-btn {
  padding: 6px 12px;
  background: rgba(255, 95, 5, .15);
  border: 1px solid rgba(255, 95, 5, .4);
  color: var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  transition: all .15s;
}

#book-download-btn:hover {
  background: rgba(255, 95, 5, .25);
  border-color: rgba(255, 95, 5, .6);
}

#book-day-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

#book-day-tabs::-webkit-scrollbar {
  display: none;
}

#book-day-tabs .ride-day-tab {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

#book-schedule {
  overflow-y: auto;
  flex: 1;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#book-schedule::-webkit-scrollbar {
  width: 4px;
}

#book-schedule::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.book-clear-btn {
  padding: 5px 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 95, 5, .4);
  background: rgba(255, 95, 5, .08);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.book-clear-btn:hover {
  background: rgba(255, 95, 5, .18);
}

/* Shift sidebar & zoom controls up when sim bar is visible */
body.sim-active #sidebar {
  transform: translateY(calc(-50% - 44px));
  transition: transform .35s ease;
}

body.sim-active #zoom-controls {
  bottom: 78px;
  transition: bottom .35s ease;
}

#sidebar {
  transition: transform .35s ease;
}

#zoom-controls {
  transition: bottom .35s ease;
}
