/* Square-Dance Figuren – Bootstrap-5-Ergänzungen & Fach-Styles */

:root {
  --app-primary: #0ea5e9;
  --app-primary-hover: #0284c7;
  --app-primary-rgb: 14, 165, 233;
  --app-surface: #f5f8fb;
  --bs-primary: #0ea5e9;
  --bs-primary-rgb: 14, 165, 233;
  --bs-link-color: #0284c7;
  --bs-link-hover-color: #0369a1;
  --bs-focus-ring-color: rgba(14, 165, 233, 0.35);
}

body {
  min-height: 100vh;
  background-color: var(--app-surface);
}

.app-shell {
  max-width: 960px;
}

.app-header {
  border-radius: 0.75rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.app-header .h3,
.app-header h1 {
  color: #0f172a;
  letter-spacing: -0.02em;
}

/* Burger + search toolbar */
.app-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.app-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.15);
  background: #fff;
}
.app-icon-btn:hover,
.app-icon-btn:focus,
.app-icon-btn[aria-expanded="true"] {
  color: var(--app-primary-hover);
  border-color: var(--app-primary);
  background: rgba(var(--app-primary-rgb), 0.08);
}
.app-nav-offcanvas {
  --bs-offcanvas-width: min(20rem, 86vw);
}
.app-nav-list .list-group-item {
  padding: 0.9rem 1.15rem;
  font-weight: 500;
  border-color: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}
.app-nav-list .list-group-item:hover {
  background: rgba(var(--app-primary-rgb), 0.08);
  color: var(--app-primary-hover);
}
.app-nav-list .list-group-item.active {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #fff;
}
.figure-search-panel .figure-search {
  border-color: rgba(var(--app-primary-rgb), 0.25);
}

/* Bootstrap primary overrides (buttons, pills, focus) */
.btn-primary {
  --bs-btn-bg: var(--app-primary);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary-hover);
  --bs-btn-hover-border-color: var(--app-primary-hover);
  --bs-btn-active-bg: #0369a1;
  --bs-btn-active-border-color: #0369a1;
  --bs-btn-disabled-bg: var(--app-primary);
  --bs-btn-disabled-border-color: var(--app-primary);
  --bs-btn-focus-shadow-rgb: var(--app-primary-rgb);
}
.btn-outline-primary {
  --bs-btn-color: var(--app-primary-hover);
  --bs-btn-border-color: var(--app-primary);
  --bs-btn-hover-bg: var(--app-primary);
  --bs-btn-hover-border-color: var(--app-primary);
  --bs-btn-active-bg: var(--app-primary-hover);
  --bs-btn-active-border-color: var(--app-primary-hover);
  --bs-btn-focus-shadow-rgb: var(--app-primary-rgb);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background-color: var(--app-primary) !important;
}
.nav-pills .nav-link {
  color: #334155;
}
.nav-pills .nav-link:hover {
  color: var(--app-primary-hover);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--app-primary-rgb), 0.2);
}
.form-check-input:checked {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
}

/* Figuren-Tabelle */
.figures-table .figure-name { font-weight: 500; }
.figures-table .col-teach {
  width: 3.25rem;
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.figures-table .col-select {
  width: 2rem;
  text-align: center;
  padding-left: 0.4rem !important;
  padding-right: 0.25rem !important;
}
.teacher-actions { white-space: nowrap; }
.figure-link { font-size: 0.85em; margin-left: 0.25rem; text-decoration: none; }
.figure-link:hover { text-decoration: underline; }

.figure-actions-mobile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  font-weight: 500;
}

/*
 * Lernfarben – Bootstrap 5 färbt Zellen oft per inset box-shadow;
 * daher Hintergrund + box-shadow explizit setzen (hohe Spezifität).
 */
table.figures-table.table tbody tr.figure-row--white > td,
table.figures-table.table tbody tr.figure-row--white > th {
  --bs-table-bg: #ffffff;
  --bs-table-bg-state: transparent;
  --bs-table-accent-bg: transparent;
  background-color: #ffffff !important;
  box-shadow: none !important;
}
table.figures-table.table tbody tr.figure-row--yellow > td,
table.figures-table.table tbody tr.figure-row--yellow > th {
  --bs-table-bg: #fff3cd;
  --bs-table-bg-state: transparent;
  --bs-table-accent-bg: transparent;
  background-color: #fff3cd !important;
  box-shadow: none !important;
}
table.figures-table.table tbody tr.figure-row--green > td,
table.figures-table.table tbody tr.figure-row--green > th {
  --bs-table-bg: #c8e6c9;
  --bs-table-bg-state: transparent;
  --bs-table-accent-bg: transparent;
  background-color: #c8e6c9 !important;
  box-shadow: none !important;
}
.figure-row--group td { font-style: italic; }
.figures-table .figure-row--in-group .figure-name {
  padding-left: 1.25rem;
  border-left: 3px solid rgba(0, 0, 0, 0.12);
}

/* Filter */
.filter-nav { gap: 0.5rem; }
.filter-nav-evenings {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}
.filter-nav-evenings__icon {
  flex-shrink: 0;
  margin-top: -1px;
}
.filter-link {
  padding: 0.4rem 0.75rem;
  background: #e9ecef;
  border-radius: 0.375rem;
  text-decoration: none;
  color: #212529;
  font-size: 0.95rem;
}
.filter-link:hover { background: #dee2e6; color: #212529; }
.filter-link--active {
  background: var(--app-primary);
  color: #fff;
  font-weight: 600;
}
.filter-link--active:hover { background: var(--app-primary-hover); color: #fff; }

.figure-search-hint { font-size: 0.9rem; color: #6c757d; }

/* Übungsabende */
.evening-figure-list { margin-bottom: 0; }
.evening-lesson-badge { color: #6c757d; font-size: 0.9em; }

/* Kurse verwalten */
.class-share-links input[type="text"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
.role-form .user-name { font-weight: 600; min-width: 8rem; }

/* Login-Karte */
.page-login .login-card { max-width: 420px; }

/* Caller board – dense taught-figure wall */
body.page-caller-board {
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #6c757d;
  min-height: 100dvh;
}
.caller-board-back {
  position: fixed;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 20;
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  color: #212529;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.35rem;
  opacity: 0.55;
}
.caller-board-back:hover,
.caller-board-back:focus {
  opacity: 1;
  color: #212529;
}
.caller-board-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem;
  font-size: 1.25rem;
  color: #fff;
}
.caller-board-wrap {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0.35rem;
  padding-top: 2.1rem; /* room for back link */
  width: 100%;
  max-width: 100vw;
}
.caller-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  width: 100%;
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
  align-content: start;
  grid-auto-rows: auto;
}
@media (min-width: 600px) {
  .caller-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.caller-board__item {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  line-height: 1.15;
  min-height: 2.1em;
  padding: 0.35em 0.4em;
  border-radius: 0.3rem;
  overflow: visible;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  color: #212529 !important;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.caller-board__item--yellow {
  background-color: #fff3cd !important;
}
.caller-board__item--green {
  background-color: #c8e6c9 !important;
}

/* Mobile: kompakt, ohne Horizontal-Scroll */
@media (max-width: 767.98px) {
  .app-shell {
    max-width: 100%;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  .figures-table-wrap {
    /* Kein erzwungenes Quer-Scrollen der ganzen Seite */
    overflow-x: visible;
  }

  .figures-table {
    font-size: 0.82rem;
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
  }

  .figure-row--group td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .figures-table th,
  .figures-table td {
    padding: 0.35rem 0.3rem !important;
    vertical-align: top;
  }

  .figures-table .figure-name {
    width: auto;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .figures-table .figure-row--in-group .figure-name {
    padding-left: 0.75rem;
  }

  .figures-table .col-teach {
    width: 2.6rem;
    font-size: 0.78rem;
  }

  .figures-table .col-select {
    width: 1.6rem;
  }

  .figures-table .form-check-input {
    width: 1rem;
    height: 1rem;
    margin: 0;
  }

  .figure-search .card-body,
  .figure-search.card .card-body {
    padding: 0.75rem !important;
  }

  .figure-search-hint {
    font-size: 0.8rem;
  }
}
