/* Bahn Mate hub — light-only, no theme switching. */

.bd-bahnmate {
  --bd-bm-text: #18314f;
  --bd-bm-text-soft: #5f7593;
  --bd-bm-title: #102944;
  --bd-bm-surface: rgba(255, 255, 255, 0.88);
  --bd-bm-stroke: rgba(137, 159, 191, 0.28);
  --bd-bm-shadow: 0 24px 60px rgba(22, 40, 72, 0.12);
  --bd-bm-class: #1f8f7a;
  --bd-bm-chat: #2a6df6;
  --bd-bm-reserve: #c45a1a;
  color: var(--bd-bm-text);
  margin: 1.5rem auto 2.25rem;
  max-width: min(1080px, calc(100% - 1.5rem));
}

.bd-bahnmate *,
.bd-bahnmate *::before,
.bd-bahnmate *::after {
  box-sizing: border-box;
}

.bd-bahnmate .bd-lang-switcher {
  margin-bottom: 1rem;
}

.bd-bahnmate__toolbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  min-height: 42px;
}

.bd-bahnmate__toolbar[hidden] {
  display: none !important;
}

.bd-bahnmate__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--bd-bm-stroke);
  background: #fff;
  color: var(--bd-bm-title);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.bd-bahnmate__back:hover,
.bd-bahnmate__back:focus-visible {
  border-color: rgba(42, 109, 246, 0.35);
}

.bd-bahnmate__toolbar strong {
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--bd-bm-title);
}

.bd-bahnmate__hub,
.bd-bahnmate__panel {
  padding: clamp(1.2rem, 2.4vw, 1.85rem);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  background: linear-gradient(180deg, #f4f7fb 0%, #eef3fa 48%, #e8eef8 100%);
  box-shadow: var(--bd-bm-shadow);
}

.bd-bahnmate__hub[hidden],
.bd-bahnmate__panel[hidden],
.bd-bahnmate__chat[hidden] {
  display: none !important;
}

.bd-bahnmate__hero {
  margin-bottom: 1.5rem;
}

.bd-bahnmate__brand {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  background: linear-gradient(135deg, #2a6df6, #1c57cb);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.bd-bahnmate__kicker {
  margin: 0 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--bd-bm-text-soft);
}

.bd-bahnmate__title {
  margin: 0 0 0.55rem;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  line-height: 1.2;
  color: var(--bd-bm-title);
}

.bd-bahnmate__subtitle,
.bd-bahnmate__guest,
.bd-bahnmate__note,
.bd-bahnmate__panel-head p {
  margin: 0;
  line-height: 1.7;
  color: var(--bd-bm-text-soft);
}

.bd-bahnmate__note {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--bd-bm-stroke);
  background: #fff;
}

.bd-bahnmate__panel-body {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

.bd-bahnmate__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bd-bahnmate__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  min-height: 220px;
  padding: 1.15rem 1.1rem 1rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: var(--bd-bm-surface);
  box-shadow: 0 12px 28px rgba(22, 40, 72, 0.08);
  text-align: inherit;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.bd-bahnmate__card:hover,
.bd-bahnmate__card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(22, 40, 72, 0.12);
}

.bd-bahnmate__card-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
}

.bd-bahnmate__card.is-class .bd-bahnmate__card-icon {
  background: var(--bd-bm-class);
}

.bd-bahnmate__card.is-chat .bd-bahnmate__card-icon {
  background: var(--bd-bm-chat);
}

.bd-bahnmate__card.is-reserve .bd-bahnmate__card-icon {
  background: var(--bd-bm-reserve);
}

.bd-bahnmate__card-copy {
  display: grid;
  gap: 0.35rem;
  flex: 1 1 auto;
}

.bd-bahnmate__card-copy strong {
  font-size: 1.08rem;
  color: var(--bd-bm-title);
}

.bd-bahnmate__card-copy span {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--bd-bm-text-soft);
}

.bd-bahnmate__card-action {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--bd-bm-chat);
}

.bd-bahnmate__card.is-class .bd-bahnmate__card-action {
  color: var(--bd-bm-class);
}

.bd-bahnmate__card.is-reserve .bd-bahnmate__card-action {
  color: var(--bd-bm-reserve);
}

.bd-bahnmate__guest {
  margin-top: 1.1rem;
}

.bd-bahnmate__guest a {
  margin-inline-start: 0.35rem;
  font-weight: 700;
  color: var(--bd-bm-chat);
  text-decoration: none;
}

.bd-bahnmate__panel-head {
  margin-bottom: 1rem;
}

.bd-bahnmate__panel-head h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
  color: var(--bd-bm-title);
}

.bd-bahnmate__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.bd-bahnmate__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.65rem 0.4rem;
  border-radius: 14px;
  border: 1px solid var(--bd-bm-stroke);
  background: #fff;
}

.bd-bahnmate__stat strong {
  font-size: 1.05rem;
  color: var(--bd-bm-title);
}

.bd-bahnmate__stat span {
  font-size: 0.72rem;
  color: var(--bd-bm-text-soft);
  text-align: center;
}

.bd-bahnmate__sessions {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.bd-bahnmate__session {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.8rem;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  border: 1px solid var(--bd-bm-stroke);
  background: #fff;
}

.bd-bahnmate__session.is-booked {
  border-color: rgba(31, 143, 122, 0.28);
  background: rgba(31, 143, 122, 0.06);
}

.bd-bahnmate__session-when {
  display: grid;
  gap: 0.12rem;
  min-width: 9rem;
}

.bd-bahnmate__session-when strong {
  font-size: 0.88rem;
  color: var(--bd-bm-title);
}

.bd-bahnmate__session-when span {
  font-size: 0.78rem;
  color: var(--bd-bm-text-soft);
  direction: ltr;
  unicode-bidi: plaintext;
}

.bd-bahnmate__badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: #e8eef8;
  color: #334155;
}

.bd-bahnmate__badge.is-booked {
  background: rgba(31, 143, 122, 0.16);
  color: #0f6b5a;
}

.bd-bahnmate__session-actions {
  margin-inline-start: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bd-bahnmate__btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--bd-bm-stroke);
  background: #fff;
  color: var(--bd-bm-title);
  cursor: pointer;
}

.bd-bahnmate__btn.is-primary {
  background: linear-gradient(135deg, #2a6df6, #1c57cb);
  border-color: transparent;
  color: #fff;
}

.bd-bahnmate__btn.is-class {
  background: var(--bd-bm-class);
  border-color: transparent;
  color: #fff;
}

.bd-bahnmate__btn.is-danger {
  border-color: rgba(218, 110, 118, 0.42);
  color: #a83a42;
}

.bd-bahnmate__btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.bd-bahnmate__slotday {
  margin-bottom: 0.85rem;
}

.bd-bahnmate__slotday-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--bd-bm-title);
  margin-bottom: 0.45rem;
}

.bd-bahnmate__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.bd-bahnmate__chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--bd-bm-stroke);
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.bd-bahnmate__chip strong {
  font-size: 0.82rem;
  color: var(--bd-bm-title);
  direction: ltr;
  unicode-bidi: plaintext;
}

.bd-bahnmate__chip small {
  font-size: 0.68rem;
  color: var(--bd-bm-text-soft);
}

.bd-bahnmate__chip:hover,
.bd-bahnmate__chip:focus-visible {
  border-color: rgba(196, 90, 26, 0.4);
}

.bd-bahnmate__note.is-error {
  color: #a83a42;
}

.bd-bahnmate__note.is-success {
  color: #0f6b5a;
}

.bd-bahnmate[data-view="class-live"] {
  max-width: min(1240px, calc(100% - 1rem));
}

.bd-bahnmate[data-view="class-live"] .bd-bahnmate__chat {
  display: block;
}

.bd-bahnmate[data-view="class-live"] .bd-chatroom {
  border-radius: 24px;
}

.bd-bahnmate[data-view="class-live"] .bd-chatroom-dashboard-strip,
.bd-bahnmate[data-view="class-live"] .bd-chatroom-guidance,
.bd-bahnmate[data-view="class-live"] .bd-chatroom-policy-note {
  display: none;
}

.bd-bahnmate[data-view="class-live"] .bd-chatroom-layout {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 34%);
}

.bd-bahnmate[data-view="class-live"] .bd-chatroom-sidebar {
  order: 2;
}

.bd-bahnmate[data-view="class-live"] .bd-chatroom-main {
  order: 1;
}

.bd-bahnmate[data-view="class-live"] .bd-chatroom-screen-panel:not([hidden]) {
  display: block;
  min-height: 240px;
}

/* Chat view: messaging only. Classroom chrome stays on class-live. */
.bd-bahnmate[data-view="reserve"],
.bd-bahnmate[data-view="class"] {
  max-width: min(760px, calc(100% - 1.5rem));
}

.bd-bahnmate[data-view="chat"] {
  max-width: min(1180px, calc(100% - 1rem));
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.bd-bahnmate[data-view="chat"] > .bd-lang-switcher {
  display: none !important;
}

.bd-bahnmate[data-view="chat"] .bd-bahnmate__toolbar {
  margin-bottom: 0.65rem;
}

.bd-bahnmate[data-view="chat"] .bd-bahnmate__chat {
  display: block;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom,
.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view {
  padding: 0;
  gap: 0;
  margin: 0;
  border-radius: 24px;
  background: transparent;
  grid-template-rows: minmax(0, 1fr);
  min-height: calc(100vh - 5.25rem);
  min-height: calc(100dvh - 5.25rem);
  height: calc(100vh - 5.25rem);
  height: calc(100dvh - 5.25rem);
  max-height: calc(100vh - 5.25rem);
  max-height: calc(100dvh - 5.25rem);
  overflow: hidden;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom-header,
.bd-bahnmate[data-view="chat"] .bd-chatroom-dashboard-strip,
.bd-bahnmate[data-view="chat"] .bd-chatroom-guidance,
.bd-bahnmate[data-view="chat"] .bd-chatroom-policy-note,
.bd-bahnmate[data-view="chat"] .bd-chatroom-score-strip,
.bd-bahnmate[data-view="chat"] .bd-chatroom-thread-scores,
.bd-bahnmate[data-view="chat"] .bd-chatroom-thread-guide,
.bd-bahnmate[data-view="chat"] .bd-chatroom-search-inline,
.bd-bahnmate[data-view="chat"] .bd-chatroom-action-group-primary,
.bd-bahnmate[data-view="chat"] .bd-chatroom-files,
.bd-bahnmate[data-view="chat"] .bd-chatroom-screen-panel,
.bd-bahnmate[data-view="chat"] .bd-chatroom-sidebar-head span,
.bd-bahnmate[data-view="chat"] [data-chatroom-call-toggle],
.bd-bahnmate[data-view="chat"] [data-chatroom-screen-toggle],
.bd-bahnmate[data-view="chat"] [data-chatroom-load-files],
.bd-bahnmate[data-view="chat"] [data-chatroom-screen-indicator] {
  display: none !important;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom-topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
  align-items: center;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom.is-user-view .bd-chatroom-topbar-actions {
  display: none !important;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom.is-user-view .bd-chatroom-topbar {
  grid-template-columns: minmax(0, 1fr);
}

.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view .bd-chatroom-layout,
.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view .bd-chatroom-main,
.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view .bd-chatroom-sidebar {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view .bd-chatroom-thread-list,
.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view .bd-chatroom-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view .bd-chatroom-composer {
  position: relative;
  bottom: auto;
  z-index: auto;
}

/* Chat markup stays in the DOM for instant view switches, but must not
   paint unread badges, 100vh shells, or composer chrome onto hub/reserve. */
.bd-bahnmate:not([data-view="chat"]):not([data-view="class-live"]) .bd-bahnmate__chat {
  display: none !important;
}

body.admin-bar .bd-bahnmate[data-view="chat"] .bd-chatroom,
body.admin-bar .bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view {
  min-height: calc(100vh - var(--wp-admin--admin-bar--height, 32px) - 4.75rem);
  min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px) - 4.75rem);
  height: calc(100vh - var(--wp-admin--admin-bar--height, 32px) - 4.75rem);
  height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px) - 4.75rem);
  max-height: calc(100vh - var(--wp-admin--admin-bar--height, 32px) - 4.75rem);
  max-height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px) - 4.75rem);
}

@media (max-width: 900px) {
  .bd-bahnmate__cards {
    grid-template-columns: 1fr;
  }

  .bd-bahnmate__card {
    min-height: 0;
  }

  .bd-bahnmate[data-view="class-live"] .bd-chatroom-layout {
    grid-template-columns: 1fr;
  }

  .bd-bahnmate[data-view="class-live"] .bd-chatroom-sidebar {
    order: 0;
  }

  .bd-bahnmate[data-view="chat"] .bd-chatroom,
  .bd-bahnmate[data-view="chat"] .bd-chatroom.is-admin-view {
    min-height: calc(100vh - 4.75rem);
    min-height: calc(100dvh - 4.75rem);
    height: calc(100vh - 4.75rem);
    height: calc(100dvh - 4.75rem);
    max-height: calc(100vh - 4.75rem);
    max-height: calc(100dvh - 4.75rem);
  }
}
