/* Links-Ausrichtung für Chat-Nachrichten */
.chat-text {
  text-align: left !important;
  display: inline-block;
  vertical-align: middle;
}
.own-message {
  text-align: left !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
}
/* Mobile und Responsive Styles für Chatarea */

/* Fix für mobile Geräte */
@media (max-width: 600px) {
    .chat-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

  /* Sidebar-Styles entfernt! Alle Sidebar-Styles sind jetzt in sidebar.css */

    .chat-area {
        width: 100vw;
        min-width: 0;
        height: auto;
    }

    .messages-container {
        margin: 5px 0;
        padding: 10px 2vw 10px 2vw;
        border-radius: 0;
        font-size: 1em;
    }

    .chat-messages {
        height: auto;
        min-height: 300px;
        padding-bottom: 0;
        overflow-y: auto;
        word-break: break-word;
        white-space: pre-line;
    }

    .message {
        word-break: break-word;
        white-space: pre-line;
    }

    .message-form {
        border-radius: 0;
        padding: 8px 2vw;
        background: #ebe6e6;
    }

    .message-input-container {
        width: 100%;
        min-width: 0;
        flex: 1 1 0%;
    }

    #message-input {
        width: 100%;
        min-width: 0;
        font-size: 1.1em;
        padding: 18px 12px;
        min-height: 48px;
        box-sizing: border-box;
    }

    .message-form-icons .btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .chat-container {
        flex-direction: column !important;
        height: 100vh !important;
        min-height: 100vh !important;
    }
    .chat-area {
        width: 100vw !important;
        min-width: 0 !important;
        height: 70vh !important;
        flex: 1 1 0 !important;
    }
    .chat-room-list {
        max-height: none !important;
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
    }
    .online-users {
        max-height: none !important;
        overflow-y: auto !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
    }
    .message-form {
        border-radius: 0;
        padding: 10px 3vw;
        background: #ebe6e6;
    }
    .message-input-container {
        width: 100%;
        min-width: 0;
        flex: 1 1 0%;
    }
    #message-input {
        width: 100%;
        min-width: 0;
        font-size: 1.1em;
        padding: 18px 12px;
        min-height: 48px;
        box-sizing: border-box;
    }
}

@media (max-width: 700px) {
    .chat-container {
        width: 100vw;
        padding: 0;
    }
    .chat-area {
        font-size: 1.05em;
        background-size: 180px auto;
    }
    .messages-container {
        padding: 8px 2vw 8px 2vw;
        font-size: 1em;
        min-height: 200px;
    }
    .message {
    padding: 8px 6px;
    font-size: 1em;
    border-radius: 6px;
    margin-bottom: 6px;
    text-align: left;
    justify-content: flex-start;
    align-items: flex-start;
    }
    .message-form {
        width: 100vw;
        left: 0;
        right: 0;
        border-radius: 0;
        padding: 8px 2vw;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        height: auto;
        min-height: unset;
    }
    .message-input-container {
        width: 100%;
        min-width: 0;
        flex: 1 1 0%;
        margin-bottom: 0;
    }
    #message-input {
        width: 100%;
        min-width: 0;
        font-size: 1.1em;
        padding: 16px 10px;
        min-height: 44px;
        box-sizing: border-box;
    }
    .message-form-icons {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
        margin: 0;
        padding-top: 2px;
        order: 2;
    }
}

/* --- Mobile-Optimierung für Volvo/kleine Displays: Chatbereich --- */
@media (max-width: 900px), (max-height: 600px) {
  .chat-container {
    height: 100vh !important;
    min-height: 0 !important;
    width: 100vw !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  .chat-area {
    height: 100vh !important;
    min-height: 0 !important;
    font-size: 1.05em !important;
    background-size: 120px auto !important;
  }
  .messages-container {
    font-size: 1em;
    padding: 8px 2vw 8px 2vw !important;
    width: 100vw !important;
    box-sizing: border-box;
    margin: 0 auto !important;
    background: #fff !important;
    overflow-y: auto !important;
  }
  .message-form {
    border-radius: 0 !important;
    padding: 8px 2vw !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    height: auto !important;
    min-height: unset !important;
    background: #ebe6e6 !important;
  }
  .message-input-container {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 0% !important;
    margin-bottom: 0 !important;
  }
  #message-input {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 1.1em !important;
    padding: 14px 10px !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
  }
  .message-form-icons .btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}


/* --- Fix: Sidebar immer rechts außen auf großen Displays (z.B. Volvo) --- */
@media (min-width: 900px) {
  .chat-container {
    flex-direction: row !important;
    align-items: stretch !important;
    height: 100vh !important;
    width: 100vw !important;
    min-height: 0 !important;
    max-width: 100vw !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  .chat-area {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: calc(100vw - 300px) !important;
    max-width: calc(100vw - 300px) !important;
    height: 100vh !important;
    background: linear-gradient(to bottom, #ecebea7a, #ecebea7a), url("../images/logo insel.png") center center no-repeat !important;
    background-size: 300px auto !important;
    position: relative !important;
    overflow: hidden !important;
    font-size: 0.9em !important;
    box-sizing: border-box !important;
  }
  .messages-container {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    overflow-x: hidden !important;
  }
}
