/* ── Layout ────────────────────────────────────────────────────────────────── */

html {
  height: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#layout {
  flex: 1;
  min-height: 0; /* nötig damit flex-child mit overflow funktioniert */
}

#mainContent {
  overflow-y: auto;
}

/* ── Verlauf-Sidebar ─────────────────────────────────────────────────────── */

#historySidebar {
  width: 110px;
  min-width: 110px;
  overflow: hidden;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
}

#historyList {
  flex: 1;
  overflow-y: auto;
}

.info-toggle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  padding: 8px 4px;
  border: none;
  border-bottom: 1px solid #dee2e6;
  background: #198754;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}

.info-toggle-label {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.9;
}

.info-toggle-btn:hover {
  background: #157347;
}

.info-toggle-btn.active {
  background: #6c757d;
}

.info-toggle-btn.active:hover {
  background: #5c636a;
}

/* Grid-Bezeichnung ausblenden wenn Info aus */
#layout.hide-info .sign-label {
  display: none;
}

.sidebar-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e9ecef;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6c757d;
  text-align: center;
  padding: 6px 4px;
  border-bottom: 1px solid #dee2e6;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#historyList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px;
}

.history-thumb {
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  text-align: center;
  transition: background 0.12s;
}

.history-thumb:hover {
  background: #dee2e6;
}

.history-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.history-num {
  font-size: 0.6rem;
  color: #6c757d;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90px;
}

/* ── Display-Bereich ─────────────────────────────────────────────────────── */

.display-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}

#primarySignWrap {
  min-width: 180px;
}

#primarySignImg {
  cursor: zoom-in;
}

.primary-sign-img {
  width: var(--sign-size, 320px);
  max-width: var(--sign-size, 320px);
  max-height: var(--sign-size, 320px);
  object-fit: contain;
  transition: width 0.15s, max-width 0.15s, max-height 0.15s;
}

.zusatz-stack-img {
  width: calc(var(--sign-size, 320px) * 0.75);
  max-height: calc(var(--sign-size, 320px) * 0.45);
  object-fit: contain;
  display: block;
}

/* ── Zusatzzeichen im Display (Stapel unter Hauptzeichen) ───────────────── */

.zusatz-stack-item {
  display: block;
}


.zusatz-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(108, 117, 125, 0.8);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.zusatz-stack-item:hover .zusatz-remove-btn {
  opacity: 1;
}

/* Auf Touch-Geräten (kein Hover) immer sichtbar */
@media (hover: none) {
  .zusatz-remove-btn {
    opacity: 1;
  }
}

/* ── Sign-Grid ───────────────────────────────────────────────────────────── */

.sign-card {
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  background: #fff;
}

.sign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: #adb5bd;
}

.sign-card.active {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.sign-thumb {
  width: 100%;
  height: 80px;
  object-fit: contain;
}

.sign-num {
  font-size: 0.6rem;
  color: #6c757d;
  line-height: 1.2;
}

.sign-label {
  font-size: 0.7rem;
  color: #343a40;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  line-height: 1.3;
}

/* ── Zusatzzeichen-Picker Modal ──────────────────────────────────────────── */

.zusatz-picker-card {
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.1s, box-shadow 0.1s;
  background: #fff;
}

.zusatz-picker-card:hover {
  border-color: #0d6efd;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.zusatz-picker-thumb {
  width: 60px;
  height: 60px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.zusatz-picker-label {
  font-size: 0.62rem;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  margin-top: 2px;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */

.navbar .nav-link {
  font-size: 0.87rem;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  white-space: nowrap;
}

.navbar .nav-link.active {
  color: #fff !important;
  font-weight: 600;
  border-bottom: 2px solid #0d6efd;
}

/* ── Erläuterungs-Formatierung ───────────────────────────────────────────── */

.erl-head {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #495057;
  margin-top: 0.8rem;
  margin-bottom: 0.2rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid #dee2e6;
}

.erl-head:first-child {
  margin-top: 0;
}

.erl-item {
  display: grid;
  grid-template-columns: 1.6em 1fr;
  gap: 0.15em;
  margin: 0.2em 0;
  font-size: 0.82rem;
}

.erl-subitem {
  display: grid;
  grid-template-columns: 1.4em 1fr;
  gap: 0.15em;
  margin: 0.15em 0;
  padding-left: 1.6em;
  font-size: 0.82rem;
}

.erl-num {
  font-weight: 600;
  color: #495057;
}

.erl-para {
  font-size: 0.82rem;
  margin: 0.2em 0;
  padding-left: 0.1em;
}

/* ── Vollbild-Overlay ────────────────────────────────────────────────────── */

#fullscreenOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem;
  cursor: default;
}

.fullscreen-back-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 14px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: #f8f9fa;
  color: #343a40;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  z-index: 1;
}

.fullscreen-back-btn:hover {
  background: #e9ecef;
}

#fullscreenSignStack img {
  cursor: pointer;
}

#fullscreenSignStack .fs-main-img {
  width: var(--fs-size, 300px);
  max-width: var(--fs-size, 300px);
  max-height: var(--fs-size, 300px);
  object-fit: contain;
  display: block;
}

#fullscreenSignStack .fs-zusatz-img {
  width: calc(var(--fs-size, 300px) * 0.75);
  max-height: calc(var(--fs-size, 300px) * 0.45);
  object-fit: contain;
  display: block;
}

.fullscreen-info {
  text-align: center;
  max-width: 640px;
  max-height: 30vh;
  overflow-y: auto;
}

/* ── Responsive: Sidebar bei kleinen Screens ausblenden ─────────────────── */

@media (max-width: 576px) {
  #historySidebar {
    width: 70px;
    min-width: 70px;
  }

  .history-img {
    width: 52px;
    height: 52px;
  }

  .primary-sign-img {
    max-width: 150px;
    max-height: 150px;
  }

  .sign-thumb {
    height: 60px;
  }
}
