/* Datei: styles.css */

:root {
  --header-h: 70px;
  --footer-h: 40px; /* großzügiger Standardwert */
}

body { font-family: Verdana, sans-serif;
       padding-bottom: var(--footer-h, 48px);}

/* Schüleransicht (dein Beige) */
body.student-view { background: #EfDcB9; }

/* Lehreransicht (hell pink) */
body.admin-view   { background: #d2dcf1; }

.ansicht-gruppe {
  display: inline-block;    /* hält beide zusammen wie ein Block */
  white-space: nowrap;      /* kein Umbruch innerhalb */
  margin-left: 20px;
  margin-top: 10px;
  margin-bottom: 5px;
}

/* -------------- Layout-Container -------------- */
.messages-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;                 /* Abstand zwischen Bubbles */
  align-items: flex-start;  /* unterschiedliche Höhen nice */
}



.button-link {
    display: inline-block;
    padding: 8px 8px 8px 8px; 
    background-color: #EEEEEE;  
    color: #111111;
    text-align: center;
    text-decoration: none; 
    border-radius: 5px;    
    border: solid;
    border-width: thin; 
    cursor: pointer;
}

.button-link.active {
  background-color: #ccc;   /* z.B. grauer Hintergrund */
  font-weight: bold;        /* Text etwas betonen */
  color: #000;
}

.button-link:hover {
    background-color: #AAAAAA;
}

.button2 {
    display: inline-block;
    padding: 2px 2px 2px 2px; 
    background-color: #F9F9F9; 
    color: #111111;
    text-align: center;
    text-decoration: none; 
    border-radius: 2px;
    font-weight: normal;
    border: solid;
    border-width: thin; 
    cursor: pointer;
}
.button3 {
    display: inline-block;
    padding: 8px 8px 8px 8px; 
    color: #0b3309;
    background-color: #EEEEEE;
    text-align: center;
    text-decoration: none; 
    border-radius: 5px;    
    border: solid;
    border-width: thin; 
    cursor: pointer;
}
.button4 {
    display: inline-block;    
    color:#FFF;
    background-color: #0f520d;
    padding: 8px 8px 8px 8px; 
    text-align: center;
    text-decoration: none; 
    border-radius: 5px;
    font-weight: bold;
    border: solid;
    border-width: thin; 
    cursor: pointer;
    
}

.button5 {
    display: inline-block;    
  color:#740a0a;
  background-color: #EEEEEE;
    padding: 8px 8px 8px 8px; 
    text-align: center;
    text-decoration: none; 
    border-radius: 5px;
    font-weight: normal;
    border: solid;
    border-width: thin; 
    cursor: pointer;
    margin-left: 10px;   
}

.button5.active {
  background-color: #EEEEEE;   /* z.B. grauer Hintergrund */
  font-weight: bold;        /* Text etwas betonen */
  color:#740a0a;
;
}

.button5:hover {
    background-color: #AAAAAA;
}


    
    

.button {
    font-size: 18px;
    padding: 3px 3px 3px 3px;   
    margin-bottom: 4px; /* Fügt einen unteren Abstand von 4px hinzu */ 
    margin-top: 4px;  
    margin-left: 4px;  
    -webkit-appearance: none;
    appearance: none; 
    }
    
/* iOS-Override: Buttons im Footer nicht blau */
.main-footer button {
  -webkit-appearance: none;
  appearance: none;
  background-color: #f0f0f0; /* oder deine Standard-Farbe */
  color: #333;
  border: 1px solid #111;
  border-radius: 4px;
  padding: 6px 16px;
  font-size: 14px;
}

.main-footer button:hover {
  background-color: #e0e0e0;
}

/* Spezielle Button-Farben beibehalten */
.main-footer button[name="sendV"] {
  color: #AAAAAA !important;
}

.main-footer button[name="sendW"] {
  color: darkred !important;
}

.btn-ki-auswertung {
  background-color: #6e32bd !important;
  color: white !important;
}

.btn-tafelbild {
  background-color: #2c5f8d !important;
  color: white !important;
}

/* Datum immer volle Breite, nicht neben Bubbles */
.datum {
  display: block;
  width: 100%;
  flex: 0 0 100%;
  margin: 16px 0 6px;
  font-weight: bold;
}


/* dezente Linie vor dem Datum (optional, sieht auf dem Beamer gut aus) */
.datum::before {
  content: "";
  display: block;
  border-top: 1px solid #ddd;
  margin-bottom: 8px;     /* Abstand zwischen Linie und Datum */
}

.textfeld-container {
    width: 100%;
    display: flex;
    gap: 5px; /* Abstand zwischen den Textfeldern */
}


.button-icon {
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 5px; /* Anpassbar nach Bedarf */
}
    
.echo {
    font-family: Verdana, sans-serif;
    font-weight: normal;
    font-size: 16px; 
}


.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;            /* = width:100% ohne Scroll-Leiste zu stören */
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #ddd;
  padding: 8px 10px;
}

/* Inhalt unter Header und über Footer schieben */
.content {
  padding-top: var(--header-h, 70px);
  padding-bottom: calc(var(--footer-h, 56px) + 24px); /* +24px Sicherheitsabstand */
}

.footer-links {
  text-align: center; /* zentriert am unteren Rand */
  font-size: 14px;
}




/* -------------- Bubbles -------------- */
.chat-bubble {
  display: inline-block;    /* Größe richtet sich nach Inhalt */
  max-width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  padding: 8px 12px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  overflow-wrap: anywhere;
  margin: 0;                /* Abstand macht jetzt .messages-flow via gap */
}

/* kurze, flexible Bubbles (stehen wie Buttons nebeneinander) */
.chat-bubble.fluid {
  min-width: 14ch;
  max-width: var(--maxch, 46ch); /* default 46ch, pro Bubble übersteuerbar */
  overflow-wrap: anywhere;       /* falls mal ein langes Wort kommt */
}

/* volle Breite erzwingen (Lehrer, Tabellen, „lange“ Texte) */
.chat-bubble.full {
  flex-basis: 100%;
  max-width: 100%;
}

/* Farben wie gehabt */
.chat-bubble.me    { background: #d9fdd3; max-width: 90% !important; align-self: flex-end; margin-left: auto; }
.chat-bubble.other { background: #fbfbfb; }
.chat-bubble.admin { background: #deeff3; }

.chat-bubble.gpt   { background: #e8eaf6; }
.chat-bubble.admin2contact   { background: #deeff3; }

.chat-bubble.important { border: 1px solid #c62828; background: #f8e0e0; }
.chat-bubble.masked    { opacity: 0.95; }

.chat-bubble .meta {
  display: flex;             /* wichtig, damit .time nach rechts kann */
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: #444;
  margin-bottom: 4px;
}
.chat-bubble .meta .author { font-weight: 600; }
.chat-bubble .meta .time   { margin-left:auto; opacity:.8; padding-left:8px; }
.chat-bubble .text { white-space: normal; }
.chat-bubble .meta .edit-date {
  color: #444;
  font-size: 0.85em;
  margin-left: 8px;
  font-style: italic;
}
/* Erstelldatum im Meta-Bereich */
.chat-bubble .meta .created-date {
  color:#444;
  font-size:1em;
  font-weight: 600;
  margin-left:20px;
  letter-spacing:.5px;
}

.chat-bubble .meta .deleted-marker {  
  color: #c44;        /* nicht nötig, da gelöschte Messages gar nicht angezeigt werden */
  font-size: 0.85em;
  margin-left: 8px;
  font-style: italic;
}

.chat-bubble a.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.chat-bubble a.file-link:hover {
  text-decoration: underline;
}
.chat-bubble audio {
  max-width: 100%;
  margin-top: 4px;
}
.chat-bubble img.chat-image {
  max-width: 100%;
  border-radius: 6px;
}



/* kleine Tabellen in Bubbles */
.chat-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;  /* Spalten gleich breit */
  margin-top: 5px;
}

.chat-table td {
  border: 1px solid #ccc;
  padding: 6px;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}
        
/* Edit-Button */
.edit-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  background-color:#fff;
}
.edit-btn:hover { opacity: .8; }

/* eingebettete Bilder (falls vorhanden) */
.chat-bubble img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

/* ========================================
   TAFELBILDER
   ======================================== */

.tafelbild-embed {
    background: #fffef7;
    border: 2px solid #2c5f8d;
    border-radius: 8px;
    margin: 15px auto 8px; /* ← Unterer Margin reduziert (vorher: 15px) */
    overflow: hidden;
    max-width: 1350px;
}

.tafelbild-embed-header {
    background: #2c5f8d;
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
}

.tafelbild-open-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.tafelbild-open-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.tafelbild-content {
    padding: 20px 20px 12px; /* ← Unteres Padding reduziert (vorher: 20px) */
    font-size: 16px;
    line-height: 1.6;
}

/* Abstände optimieren */
.tafelbild-content > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.tafelbild-content p {
    margin: 0 0 10px 0;  /* nur 10px unten statt default */
}

.tafelbild-content p:first-child {
    margin-top: 0;
}

/* NEU: Abstand zwischen Text und Tabelle reduzieren */
.tafelbild-content p + table {
    margin-top: 10px !important;  /* statt 15px */
}

.tafelbild-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 15px 0;
}



.tafelbild-content table td,
.tafelbild-content table th {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.tafelbild-content table th {
    background-color: #f0f0f0;
    font-weight: bold;
}

.tafelbild-content h1 {
    font-size: 22px;
    margin: 20px 0 10px 0;
    color: #2c5f8d;
}

.tafelbild-content h2 {
    font-size: 18px;
    margin: 18px 0 8px 0;
    color: #2c5f8d;
}

.tafelbild-content h3 {
    font-size: 16px;
    margin: 15px 0 6px 0;
    color: #2c5f8d;
}

.tafelbild-content ul,
.tafelbild-content ol {
    margin: 10px 0 10px 30px;
}

.tafelbild-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
}

/* Unsichtbare Nachrichten (nur in Admin-Ansicht) */
.hidden-message {
    opacity: 0.9;
    background: #f6f6f6 !important;
}

.hidden-message .text,
.hidden-message .author,
.hidden-message td {
    color: #888 !important;
}

.hidden-message::before {
    content: '';
    opacity: 0.6;
}

/* Button für neues Tafelbild */
.btn-tafelbild {
    background: #1b801b;
    color: white;
    padding: 6px 6px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    margin-left: 10px;
    margin-top: 6px;
}

.btn-tafelbild:hover {
    background: #1e4466;
}

/* Button für neues Tafelbild */
.btn-ki-auswertung {
    background: #6242e3;
    color: white;
    padding: 6px 6px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    margin-left: 10px;
    margin-top: 6px;
}

.btn-ki-auswertung:hover {
    background: #1e4466;
}

.input-row { display:flex; gap:.5rem; align-items:flex-start; }
.input-row .chatInput { flex:1 1 auto; }
.icon-btn { cursor:pointer; border:0; background:#eee; padding:.4rem .5rem; border-radius:.4rem; }
.icon-btn:hover { filter:brightness(0.95); }


/* Standard-Vorschaugröße im Chat */
img.thumb{
  max-width: 220px;     /* Breite begrenzen */
  max-height: 140px;    /* Höhe begrenzen */
  width: auto;
  height: auto;
  object-fit: contain;  /* Bild vollständig sichtbar lassen */
  display: block;
  border-radius: .4rem;
}

/* Optional: leicht anderes Limit in Tabellenzellen */
.chat-table img.thumb{
  max-width: 180px;
  max-height: 120px;
}

/* Optional: per Variable global steuerbar */
:root{
  --thumb-w: 220px;
  --thumb-h: 140px;
}
img.thumb{
  max-width: var(--thumb-w);
  max-height: var(--thumb-h);
}

/* Liste */
.user-list { width: 100% ; }

/* Eine Zeile: links Name/Checkbox, rechts der Button */
.user-row{
  display: flex;
  align-items: center;
  justify-content: space-between;  /* Button ganz nach rechts */
  gap: .5rem;
  width: 100%;
  margin: .25rem 0;
  min-height: 1.2rem;
}

.user-label{
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex: 1 1 auto;          /* nimmt Platz, darf umbrechen */
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Der rote X-Button – sicher gegen Überschreibungen */
.userManage-button{
  -webkit-appearance: none;
  appearance: none;
 
  font-weight: 1500;
  border: none !important;
  width: 5rem;
  height: 1.2rem;
  line-height: 1.2rem;
  text-align: center;
  border-radius: .35rem;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;          /* bleibt schmal, bricht nicht in neue Zeile */
  display: inline-block;
}
.user-delete-btn:hover{ filter: brightness(0.95); }

/* Damit die beiden Fabric-Canvas-Schichten nicht „unter“ etwas liegen */
#editor-surface { position: relative; width: 900px; }
#editor-surface canvas { display: block; }



.tafelbild-panel[hidden] { display: none; }

.tafelbild-panel {
  margin: 14px 0 8px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  margin: 14px 0 calc(var(--footer-h) + 60px); /* Footer-Höhe + Links-Footer + Padding */
  position: relative;
  z-index: 999; /* unter den Footern (1000) */
}

.tafelbild-panel .tb-head {
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 10px; background:#f7f7fb; border-bottom:1px solid #eee;
  border-top-left-radius:10px; border-top-right-radius:10px;
}

.tafelbild-panel .btn-close {
  appearance:none; border:0; background:transparent; font-size:20px; line-height:1;
  cursor:pointer; padding:4px 8px; border-radius:6px;
}
.tafelbild-panel .btn-close:hover { background:#eee; }

.tafelbild-panel iframe {
  width: 100%;
  height: 70vh;    /* angenehm groß zum Arbeiten */
  border: 0;
  border-bottom-left-radius:10px; border-bottom-right-radius:10px;
}



/* ========== RESPONSIVE INPUT AREA ========== */

/* Desktop (>= 769px): Fixed Footer */
@media (min-width: 769px) {
  .main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-top: 2px solid #ddd;
    padding: 12px;
    background: #f9f9f9;
  }
  
  .content {
    padding-bottom: 240px; /* Platz für fixen Footer */
  }
  
  .input-wrapper {
    /* bleibt in fixed Footer */
  }
}

/* Mobile/Tablet (<= 768px): Scrollable Input */
@media (max-width: 768px) {
  .main-footer {
    position: relative; /* ← überschreibt fixed */
    border-top: 2px solid #ddd;
    padding: 12px;
    background: #f9f9f9;
  }
  

  
  /* Input-Bereich auf Mobile: optimiert */
  .input-wrapper textarea {
    font-size: 16px !important; /* verhindert iOS Auto-Zoom */
  }
  
  /* Auto-Scroll bei Fokus */
  .input-wrapper textarea:focus {
    scroll-margin-bottom: 100px; /* Tastatur-Platz */
  }
}

/* Firefox Mobile: Text Inflation deaktivieren */
.chat-bubble,
.chat-bubble * {
  -moz-text-size-adjust: none; /* Firefox */
  text-size-adjust: none;      /* Standard (zukünftig) */
}

/* Zusätzlich: Webkit/Blink auch absichern */
.chat-bubble,
.chat-bubble * {
  -webkit-text-size-adjust: 100%; /* verhindert Auto-Zoom */
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}