/* ---------------------------------
   Lernbüro Board – Elementor-safe (CLEAN)
   ✅ Basis: Typografie/Größen aus "halb-alt"
   ✅ Weekplan entfernt
   ✅ Inputs-Table (Stundenplan-Ansicht) + Resize Handles + Week-Navigation
   ✅ Fix: Table-Inputs sprengen niemals Spalten (Wrap/Clamp/Min-Width)
   --------------------------------- */

/* =========================
   Grundlayout
   ========================= */
.lb-widget{
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit; /* Elementor-safe */
}

.lb-widget__header{
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .35rem;
  cursor: pointer;
}
.lb-widget__header:hover{
  outline: 2px solid rgba(0,0,0,.12);
  outline-offset: 6px;
  border-radius: 8px;
}

.lb-icon{
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.lb-icon-emoji{
  font-size: clamp(18px, 2vw, 26px) !important;
  line-height: 1 !important;
}

.lb-widget__title{
  margin: 0;
  padding: 0;
}

.lb-list{
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.lb-empty{
  opacity: .65;
  font-style: italic;
}

/* Hover-Markierung */
.lb-item{
  position: relative;
}
.lb-item:hover{
  outline: 2px solid rgba(0,0,0,.12);
  outline-offset: 1px;
  border-radius: 6px;
  cursor: pointer;
}

/* Utility */
.lb-nowrap{ white-space: nowrap; }
.lb-dot{ padding: 0 .35em; opacity: .8; }

/* =========================
   Inputs (Liste) – bestehendes Widget
   ========================= */
.lb-input{
  display: grid;
  grid-template-rows: auto auto;
  border-radius: 8px;
  padding: 0;
}

.lb-input__top{
  padding: .14rem .25rem;
}

.lb-input__topic{
  font-weight: 700 !important;
  font-size: clamp(27px, 2.4vw, 31px) !important;
  text-align: left;
  margin: 0;
  line-height: 1.15 !important;
  color: inherit;
}

.lb-input__bottom{
  display: grid;
  grid-template-columns: clamp(70px, 5.9vw, 110px) 1fr;
  align-items: start;
}

.lb-input__time{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: clamp(27px, 2.4vw, 31px) !important;
  line-height: 1.05 !important;
  font-weight: 700 !important;
  border-right: 6px solid rgba(0,0,0,.25);
  padding: .44rem .30rem;
}

.lb-marker--time{
  display: inline-block;
  padding: 0.10em 0.16em;
  border-radius: .14em;
  line-height: 1.05;
  white-space: nowrap;
}

.lb-input__meta{
  padding: .18rem .25rem;
  font-size: clamp(24px, 1.5vw, 28px) !important;
  line-height: 1.2 !important;
  font-style: italic !important;
  opacity: .85;
  align-self: start;
  color: inherit;
}

/* Fach-Tag in Meta-Zeile */
.lb-subject-tag{
  padding: 0 .22em;
  border-radius: .2em;
  font-weight: 800;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  background: linear-gradient(transparent 55%, rgba(0,0,0,.10) 55%);
}

/* Fachfarben (Tag) */
.lb-subject-tag--deutsch{
  color: #b00020;
  background: linear-gradient(transparent 55%, #ffd6d6 55%);
}
.lb-subject-tag--englisch{
  color: #8a6a00;
  background: linear-gradient(transparent 55%, #fff1b8 55%);
}
.lb-subject-tag--mathe{
  color: #0b4ea2;
  background: linear-gradient(transparent 55%, #d9ecff 55%);
}

/* Marker-Optik für Thema */
.lb-marker{
  padding: 0.08em;
  border-radius: .1em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  background: linear-gradient(transparent 45%, rgba(0,0,0,.09) 45%);
}
.lb-marker--deutsch{ background: linear-gradient(transparent 45%, #ffd6d6 45%); }
.lb-marker--englisch{ background: linear-gradient(transparent 45%, #fff1b8 45%); }
.lb-marker--mathe{ background: linear-gradient(transparent 45%, #d9ecff 45%); }

/* Input-Status Rahmen (Liste + Tabelle kompatibel) */
.lb-input.is-soon{
  outline: 3px solid rgba(0,0,0,.22);
  outline-offset: 4px;
  animation: lbPulse 1.1s ease-in-out infinite;
}
.lb-input.is-live{
  outline: 3px solid rgba(0,0,0,.35);
  outline-offset: 4px;
  animation: none;
}
@keyframes lbPulse{
  0%{ outline-color: rgba(0,0,0,.12); }
  50%{ outline-color: rgba(0,0,0,.45); }
  100%{ outline-color: rgba(0,0,0,.12); }
}

/* =========================
   Inputs (Tabelle) – Widget inputs_table
   ========================= */
.lb-widget.lb-inputs-table{
  /* Grid-Template wird per JS gesetzt: Zeit + 5 Tage */
  --lb-cols: 120px 1fr 1fr 1fr 1fr 1fr; /* fallback */
  --lb-grid-border: rgba(0,0,0,.10);

  /* Skalierung (JS setzt das optional) */
  --lb-scale: 1;
}

.lb-inputs-table__header{
  margin-bottom: .6rem;
}

/* Wochenanzeige + Navigation */
.lb-inputs-table__week{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}

.lb-week-nav{
  border: 2px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 12px;
  width: 52px;
  height: 52px;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  user-select: none;
}
.lb-week-nav:hover{
  outline: 2px solid rgba(0,0,0,.12);
  outline-offset: 3px;
}

.lb-week-title{
  flex: 1;
  text-align: center;
}
.lb-week-range{
  font-weight: 900;
  font-size: clamp(26px, 2.2vw, 36px);
  line-height: 1.1;
}
.lb-week-hint{
  margin-top: 2px;
  opacity: .7;
  font-weight: 700;
  font-size: clamp(16px, 1.2vw, 20px);
}

/* Grid Container */
.lb-inputs-grid{
  display: block;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

/* gleiche Box-Berechnung überall (verhindert Pixel-Drift) */
.lb-inputs-grid,
.lb-inputs-grid *{
  box-sizing: border-box;
}

/* Row layout: Zeit + 5 Tage */
.lb-inputs-grid__row{
  display: grid;
  grid-template-columns: var(--lb-cols);
}

/* Header row sticky */
.lb-inputs-grid__row--head{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255,255,255,.96);
}

/* Cells */
.lb-inputs-grid__timehead,
.lb-inputs-grid__dayhead,
.lb-inputs-grid__time,
.lb-inputs-grid__cell{
  border-bottom: 1px solid var(--lb-grid-border);
  border-right: 1px solid var(--lb-grid-border);
}

/* letzte Spalte jeder Zeile ohne rechten Border */
.lb-inputs-grid__row > :last-child{
  border-right: 0 !important;
}

/* WICHTIG: Grid-Items dürfen schrumpfen (sonst drückt Content Spalten) */
.lb-inputs-grid__timehead,
.lb-inputs-grid__dayhead,
.lb-inputs-grid__time,
.lb-inputs-grid__cell{
  min-width: 0;
}

/* Zeitspalte */
.lb-inputs-grid__timehead,
.lb-inputs-grid__time{
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: rgba(250,250,250,.92);
  white-space: nowrap;
  font-size: clamp(22px, 1.2vw, 26px);
}

/* Tageskopf */
.lb-inputs-grid__dayhead{
  position: relative;
  padding: 12px 10px;
  text-align: center;
  background: #f7f7f7;
}

/* aktueller Tag */
.lb-inputs-grid__dayhead.is-today{
  background: rgba(0,0,0,.06);
  outline: 2px solid rgba(0,0,0,.18);
  outline-offset: -2px;
}

.lb-day-name{
  font-weight: 900;
  font-size: calc(clamp(24px, 1.2vw, 28px) * var(--lb-scale));
  line-height: 1.1;
}
.lb-day-date{
  opacity: .75;
  font-weight: 800;
  margin-top: 2px;
  font-size: calc(clamp(22px, 1vw, 24px) * var(--lb-scale));
  line-height: 1.1;
}

/* Resize handle */
.lb-col-handle{
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 22px;
  transform: translateX(50%);
  cursor: col-resize;
  touch-action: none;
  z-index: 20;
  pointer-events: auto;
  background: transparent;
}
.lb-col-handle::before{
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 10px;
  width: 3px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.20);
  border-radius: 4px;
  opacity: .55;
}
.lb-col-handle:hover::before{ opacity: .85; }

/* Slot cell */
.lb-inputs-grid__cell{
  min-height: 110px; /* Mindesthöhe */
  padding: 8px;
  background: #fff;
  position: relative;
}
.lb-inputs-grid__cell:hover{
  background: rgba(0,0,0,.03);
}

/* Zeitspalte Zeilenhöhe */
.lb-inputs-grid__time{
  min-height: 110px;
}

/* Slot overlay (für Klick auf leere Slots) */
.lb-slot{ position: relative; }
.lb-slot-empty{
  position: absolute;
  inset: 0;
}

/* =========================
   Input card in table (nur Tabelle!)
   ========================= */
.lb-inputs-grid__cell .lb-input{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;

  width: 100%;
  max-width: 100%;

  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  border: 3px solid rgba(0,0,0,.16);
  background: rgba(120,120,120,.10);

  cursor: pointer;
  user-select: none;

  overflow: hidden; /* ✅ Content darf nie rausdrücken */
  transition: transform .10s ease, box-shadow .12s ease, border-color .12s ease;
}
.lb-inputs-grid__cell .lb-input:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
}

/* Linker Contentbereich muss schrumpfen dürfen */
.lb-inputs-grid__cell .lb-input__main{
  min-width: 0;
  overflow: hidden;
}

/* Titel: bevorzugt Umbruch, aber begrenzt (2 Zeilen) */
.lb-inputs-grid__cell .lb-input__title{
  font-weight: 900;
  font-size: calc(clamp(24px, 1.5vw, 28px) * var(--lb-scale));
  line-height: 1.12;
  margin: 0 0 6px 0;

  white-space: normal;       /* ✅ Umbruch erlaubt */
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;     /* ✅ max 2 Zeilen, dann ... */
}

/* Meta: kompakt, darf umbrechen, aber nie Spalten sprengen */
.lb-inputs-grid__cell .lb-input__meta{
  padding: 0;
  font-size: calc(clamp(20px, 1.2vw, 24px) * var(--lb-scale)) !important;
  line-height: 1.2 !important;
  font-style: italic !important;
  opacity: .9;

  min-width: 0;
  overflow: hidden;

  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Raum/Lehrkraft: 1 Zeile mit ... (damit es sauber bleibt) */
.lb-inputs-grid__cell .lb-input__room,
.lb-inputs-grid__cell .lb-input__teacher{
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge-Kreis rechts */
.lb-inputs-grid__cell .lb-input__badge{
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-weight: 950;
  font-size: calc(clamp(22px, 1.2vw, 26px) * var(--lb-scale));
  background: rgba(255,255,255,.55);
  border: 3px solid rgba(0,0,0,.16);
}

/* Subject colors (Table cards) */
.lb-inputs-grid__cell .lb-input.lb-subject-deutsch{
  background: rgba(255, 60, 60, .16);
  border-color: rgba(255, 60, 60, .45);
}
.lb-inputs-grid__cell .lb-input.lb-subject-englisch{
  background: rgba(255, 215, 0, .22);
  border-color: rgba(255, 215, 0, .55);
}
.lb-inputs-grid__cell .lb-input.lb-subject-mathe{
  background: rgba(0, 120, 255, .16);
  border-color: rgba(0, 120, 255, .45);
}
.lb-inputs-grid__cell .lb-input.lb-subject-none{
  background: rgba(120,120,120,.10);
  border-color: rgba(120,120,120,.28);
}

/* Status in Table: Soon/Live */
.lb-inputs-grid__cell .lb-input.is-soon{
  animation: lbPulse 1.1s ease-in-out infinite;
}
.lb-inputs-grid__cell .lb-input.is-live{
  border-width: 6px;
  animation: none;
}

/* =========================
   Fristen/Termine
   ========================= */
.lb-frist, .lb-termin{
  font-weight: 500;
  padding: .2vh .05vh;
  border-radius: 4px;
}

.lb-frist__grid{
  display: grid;
  grid-template-rows: auto auto;
  gap: .2rem;
}

.lb-frist__top{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.lb-frist__pill{ justify-self: start; }
.lb-frist__pill--empty{
  display: inline-block;
  width: 0;
  padding: 0;
  margin: 0;
}

.lb-frist__date{
  justify-self: center;
  font-size: clamp(25px, 2vw, 34px);
  font-weight: 450 !important;
  text-decoration: underline;
}

.lb-frist__spacer{ justify-self: end; }

.lb-frist__title{
  text-align: center;
  font-size: clamp(25px, 2vw, 34px);
  font-weight: 600;
}

.lb-frist__hint{
  margin-top: .1rem;
  font-weight: 300;
  font-style: italic;
  opacity: .9;
  text-align: center;
}

.lb-marker--frist{ color: #000 !important; }

.lb-frist__title .lb-marker--frist,
.lb-frist__hint  .lb-marker--frist{
  display: inline;
  padding: 0.08em 0.12em;
  border-radius: .1em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.lb-marker--frist a{ color: #000 !important; }

/* Termine: Row */
.lb-termin__row{
  display: grid;
  grid-template-columns: clamp(70px, 7vw, 120px) 1fr auto;
  gap: 1rem;
  align-items: baseline;
}
.lb-termin__date{
  font-weight: 450 !important;
  text-decoration: underline;
}
.lb-termin__hint{
  margin-top: .1rem;
  font-weight: 300;
  font-style: italic;
  opacity: .9;
}

/* Pills */
.lb-pill{
  display: inline-block;
  padding: .05rem .35rem;
  border-radius: 999px;
  font-size: clamp(12px, 1.4vw, 16px) !important;
  line-height: 1.1 !important;
  color: #fff !important;
  white-space: nowrap;
}

/* Bullets */
.lb-bullets{ margin: 0; padding-left: 0rem; }
.lb-bullet{ margin: .35rem 0; font-weight: 600; }
.lb-bullet__hint{
  font-style: italic;
  font-weight: 400;
  margin-top: .2rem;
  opacity: .9;
}

/* =========================
   Gruppenräume
   ========================= */
.lb-gr-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.lb-gr-cell{
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  padding: .6rem .2rem;
  border-radius: 12px;
}

.lb-gr-lamp{
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,.18);
  background: #b00020;
  cursor: pointer;
}
.lb-gr-lamp.is-open{ background: #1faa00; }
.lb-gr-lamp.is-closed{ background: #b00020; }

.lb-gr-label{
  font-family: "Patrick Hand SC", Arial;
  font-size: clamp(30px, 1.4vw, 34px);
  text-align: center;
  line-height: 1.1;
  font-weight: 800 !important;
}
.lb-gr-teacher{
  font-size: clamp(28px, 1.4vw, 32px) !important;
  line-height: 1.2 !important;
  opacity: .95;
  text-align: center;
}

/* =========================
   Modal
   ========================= */
.lb-modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.lb-modal{
  width: min(720px, 92vw);
  border-radius: 14px;
  padding: 14px;
  background: #1f4db8;
  color: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
}

.lb-modal h4{
  margin: 0 0 .6rem 0;
  font-size: 1.2rem !important;
  line-height: 1.2 !important;
}

.lb-form{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}

.lb-modal.lb-subject-none{ background: #2d2f33; }
.lb-modal.lb-subject-deutsch{ background: #3a1e1f; }
.lb-modal.lb-subject-englisch{ background: #3a3416; }
.lb-modal.lb-subject-mathe{ background: #18263a; }

.lb-form .full{ grid-column: 1 / -1; }

.lb-form label{
  font-size: .9rem !important;
  line-height: 1.2 !important;
  opacity: .95;
  display: block;
  margin-bottom: .2rem;
}

.lb-form input,
.lb-form select,
.lb-form textarea{
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: .55rem .6rem;
  font-size: 1rem !important;
  line-height: 1.2 !important;
}

.lb-form textarea{ min-height: 110px; }

.lb-modal-actions{
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  margin-top: .8rem;
}

.lb-btn{
  border: none;
  padding: .55rem .9rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800 !important;
  font-size: 1rem !important;
}
.lb-btn.save{ background:#1faa00; color:#fff; }
.lb-btn.cancel{ background:#ffd000; color:#1b1b1b; }
.lb-btn.delete{ background:#b00020; color:#fff; }

/* Vollbild Button */
.lb-fullscreen-btn{
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 99998;
  border: none;
  border-radius: 999px;
  padding: .65rem .9rem;
  font-weight: 800 !important;
  font-size: 1rem !important;
  cursor: pointer;
  background: rgba(0,0,0,.75);
  color: #fff;
}
