/* ===========================================
   0. Vollflächiges Flex-Layout
   =========================================== */
   html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  
  main, #mainContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  
  
  /* ===========================================
     1. CSS-Variablen
     =========================================== */
  :root {
    --blue: #0000ff;
    --blue-hover: #0000cc;
    --red: #dc3545;
    --red-dark: #a00020;
    --light-bg: #f1f1f1;
    --white: #ffffff;
    --text-dark: #333;
    --gray: #ccc;
    --shadow: rgba(0, 0, 0, 0.1);
  }
  
  /* ===========================================
     2. Allgemeine Styles
     =========================================== */
  body {
    background-color: var(--light-bg);
    font-family: Arial, sans-serif;
    color: var(--text-dark);
  }
  a {
    color: var(--blue);
  }
  a:hover {
    color: var(--blue-hover);
  }
  
  /* ===========================================
     3. Header
     =========================================== */
  header {
    background-color: var(--blue);
    color: var(--white);
    padding: 15px 0;
  }
  header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .logo {
    width: 125px;
    height: 70px;
    object-fit: contain;
  }
  
  /* ===========================================
     4. Haupt-Layout (Sidebars + Content)
     =========================================== */
  .main-content-wrapper {
    display: flex;
    gap: 15px;
    margin: 20px;
    flex: 1;
    overflow: auto;
  }
  .sidebar-left {
    flex: 0 0 20%;
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow);
  }
  .sidebar-right {
    flex: 0 0 25%;
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow);
    overflow-y: auto;
  }
  .profile-card {
    text-align: center;
    margin-bottom: 20px;
  }
  .profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
  }
  .menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .menu-item {
    padding: 10px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
  }
  .menu-item:hover {
    background: var(--blue);
    color: var(--white);
  }
  .announcement-card h5 {
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
  }
  .announcement-item {
    margin-bottom: 15px;
  }
  .announcement-item p {
    margin: 0;
    font-size: 0.9rem;
  }
  
  /* ===========================================
     5. Chat-Bereich
     =========================================== */
  .chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
  .chat-container {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;      /* für flex-Kinder mit Scroll */
    overflow: hidden;
  }
  .chat-header {
    padding: 10px;
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
  }
  .chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    min-height: 0;
  }
  .chat-message {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border-radius: 6px;
  }
  .chat-message:hover {
    background-color: #f9f9f9;
  }
  .chat-user {
    font-weight: bold;
  }
  .chat-timestamp {
    font-size: 0.75rem;
    color: #777;
  }
  
  /* Thumbnails für Chat-Medien */
  .chat-media {
    display: block;
    max-width: 300px;
    max-height: 200px;
    width: auto;
    height: auto;
    margin: 0.5rem 0;
    border-radius: 6px;
  }
  
  /* ===========================================
     6. Like-Button & Herz-Animation
     =========================================== */
  .like-button {
    position: relative;
    overflow: visible;
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    padding: 4px 8px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, transform 0.2s;
    align-self: flex-start;
  }
  .like-button:hover {
    background: var(--red);
    color: var(--white);
    transform: scale(1.05);
  }
  .like-emoji {
    margin-left: 5px;
  }
  .like-count {
    margin-left: 3px;
  }
  /* Keyframes: Herz steigt nach oben und verblasst */
  @keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
   100% { opacity: 0; transform: translateY(-40px) scale(1.5); }
  }
  .heart-float {
    position: absolute;
    color: var(--red);
    font-size: 16px;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
  }
  
  /* optionales +1-Feedback */
  .like-feedback {
    position: absolute;
    top: -10px;
    right: 8px;
    display: none;
    font-weight: bold;
    color: var(--red);
    pointer-events: none;
    z-index: 10;
  }
  
  /* ===========================================
     7. Edit + Delete Buttons
     =========================================== */
  .message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
  }
  .message-actions .btn {
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 5px;
    line-height: 1.2;
  }
  
  /* ===========================================
     8. Post-Popup & Vorschau
     =========================================== */
  .popup-post {
    position: absolute;
    top: 100px;
    left: 100px;
    z-index: 9999;
    background-color: var(--white);
    border: 1px solid var(--gray);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    padding: 15px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .popup-post.show {
    display: block;
    opacity: 1;
    transform: scale(1.02);
  }
  .popup-header {
    position: relative;
    background: var(--blue);
    color: var(--white);
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    cursor: move;
  }
  .popup-header .btn-close {
    font-size: 1.4rem;
    color: red;
    background: none;
    border: none;
    opacity: 0.8;
    cursor: pointer;
  }
  .popup-header .btn-close:hover {
    opacity: 1;
    transform: scale(1.2);
    color: darkred;
  }
  #previewImage,
  #postPopup video {
    display: block;
    max-width: 100%;    /* nie breiter als das Formular */
    max-height: 200px;  /* anpassen */
    width: auto;
    height: auto;
    margin: 10px 0;
    border-radius: 6px;
  }
  
  /* ===========================================
     9. Neuer Beitrag (falls Verwendung)
     =========================================== */
  .post-section {
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow);
  }
  .post-header {
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  .post-body textarea {
    width: 100%;
    resize: none;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
  }
  .post-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }
  
  /* ===========================================
     10. Footer
     =========================================== */
  footer {
    background-color: var(--blue);
    color: var(--white);
    text-align: center;
    padding: 10px 0;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
  }
  
  /* ===========================================
     11. Responsiv
     =========================================== */
  @media (max-width: 992px) {
    .main-content-wrapper {
      flex-direction: column;
    }
    .sidebar-left,
    .sidebar-right {
      flex: 1 0 auto;
      width: 100%;
      margin-bottom: 15px;
    }
    .chat-section {
      width: 100%;
    }
  }

  /* ==== 12. Chat-Section & Post-Button immer sichtbar ==== */
.chat-section {
  flex: 1;                 /* füllt den verfügbaren Raum zwischen Header/Footer */
  display: flex;
  flex-direction: column;  
  min-height: 0;           /* wichtig für korrektes Flex-Scrollen */
}

/* .chat-container selbst streckt sich, overflow bleibt versteckt */
.chat-container {
  display: flex;
  flex-direction: column;
  flex: 1;                 
  min-height: 0;           
  overflow: hidden;        
}

/* Nur hier scrollen */
.chat-messages {
  flex: 1;                 
  overflow-y: auto;        
  padding: 10px;           
}

/* Button immer am unteren Rand der Chat-Section */
#openPostPopup {
  flex-shrink: 0;          /* verhindert, dass er mit im Scroll-Bereich verschwindet */
  margin-top: 10px;        
  width: 100%;             /* optional: volle Breite */
}

/* Platz für den Footer freihalten */
main,
#mainContent {
  padding-bottom: 70px;  /* hier die Footer-Höhe + etwas Luft */
}

/* Damit die Chat-Box in einem Viewport-abhängigen Rahmen scrollt */
.chat-container {
  /* Statt fixer px-Höhe hier lieber viewport-basiert */
  height: calc(100vh - 160px);
  /*    ↑ 100vh minus Header (ca. 60px) und Footer (ca. 60px) und Paddings */
  max-height: calc(100vh - 160px);
  overflow: hidden;  /* sorgt dafür, dass nur .chat-messages scrollt */
}

/* Der Nachrichten-Container bekommt den Scrollbalken */
.chat-messages {
  height: 100%;
  overflow-y: auto;
  padding-right: 8px;  /* Platz für den Scrollbalken */
}

/* Optional: Scrollbalken optisch anpassen (Webkit) */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 4px;
}

  