
/*************** 1.Variables ***************/


/* ------------------ Color Pallet ------------------ */


/*************** 2.Mixins ***************/


/************************************************
    ************************************************
										Search Box
	************************************************
************************************************/

.chat-search-box {
    -webkit-border-radius: 3px 0 0 0;
    -moz-border-radius: 3px 0 0 0;
    border-radius: 3px 0 0 0;
    padding: .75rem 1rem;
}

.chat-search-box .input-group .form-control {
    -webkit-border-radius: 2px 0 0 2px;
    -moz-border-radius: 2px 0 0 2px;
    border-radius: 2px 0 0 2px;
    border-right: 0;
    height: 35px;
}

.chat-search-box .input-group .form-control:focus {
    border-right: 0;
}

.chat-search-box .input-group .input-group-btn .btn {
    -webkit-border-radius: 0 2px 2px 0;
    -moz-border-radius: 0 2px 2px 0;
    border-radius: 0 2px 2px 0;
    margin: 0;
}

.chat-search-box .input-group .input-group-btn .btn i {
    font-size: 1.2rem;
    line-height: 100%;
    vertical-align: middle;
}

/* Desktop/Mobile responsive classes */
.desktop-only {
    display: inline-block;
}

.mobile-only {
    display: none;
}

/* Desktop Chat Input Styling */
.chat-input-container {
    margin-left: 15px;
}

.chat-input-wrapper {
    display: block;
}

#chat_msg {
    margin-bottom: 10px;
}

.chat-send-btn {
    margin-left: 0;
}

#chat_char_count {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

#chat_char_count.warn {
    color: #dc3545;
    font-weight: bold;
}

@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: inline-flex !important;
    }
    
    .chat-search-box {
        display: none;
    }
    
    /* Mobile: Reset Desktop margins */
    .chat-input-container {
        margin-left: 0 !important;
    }
    
    /* Weißer Container Abstand zur fixierten Partner-Liste */
    .col-xl-12.col-lg-12.col-md-12.col-sm-12.col-12.bg-white.rounded {
        margin-top: 20px !important; /* 70px Partner-Liste + 20px Abstand */
        min-height: 65vh !important; /* Mindestens volle Viewport-Höhe */
    }

    #footer-legal {
        display: none !important;
    }
}


/************************************************
	************************************************
									Users Container
	************************************************
************************************************/

.users-container {
    position: relative;
    padding: 1rem 0;
    border-right: 1px solid #e6ecf3;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
}


/************************************************
	************************************************
											Users
	************************************************
************************************************/

.users {
    padding: 0;
}

.users .person {
    position: relative;
    width: 100%;
    padding: 10px 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f4f8;
}

.users .person:hover {
    background-color: #ffffff;
    /* Fallback Color */
    background-image: -webkit-gradient(linear, left top, left bottom, from(#e9eff5), to(#ffffff));
    /* Saf4+, Chrome */
    background-image: -webkit-linear-gradient(right, #e9eff5, #ffffff);
    /* Chrome 10+, Saf5.1+, iOS 5+ */
    background-image: -moz-linear-gradient(right, #e9eff5, #ffffff);
    /* FF3.6 */
    background-image: -ms-linear-gradient(right, #e9eff5, #ffffff);
    /* IE10 */
    background-image: -o-linear-gradient(right, #e9eff5, #ffffff);
    /* Opera 11.10+ */
    background-image: linear-gradient(right, #e9eff5, #ffffff);
}

.users .person.active-user {
    background-color: #ffffff;
    /* Fallback Color */
    background-image: -webkit-gradient(linear, left top, left bottom, from(#f7f9fb), to(#ffffff));
    /* Saf4+, Chrome */
    background-image: -webkit-linear-gradient(right, #f7f9fb, #ffffff);
    /* Chrome 10+, Saf5.1+, iOS 5+ */
    background-image: -moz-linear-gradient(right, #f7f9fb, #ffffff);
    /* FF3.6 */
    background-image: -ms-linear-gradient(right, #f7f9fb, #ffffff);
    /* IE10 */
    background-image: -o-linear-gradient(right, #f7f9fb, #ffffff);
    /* Opera 11.10+ */
    background-image: linear-gradient(right, #f7f9fb, #ffffff);
}

.users .person:last-child {
    border-bottom: 0;
}

.users .person .user {
    display: inline-block;
    position: relative;
    margin-right: 10px;
}

.users .person .user img {
    width: 48px;
    height: 48px;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
}

.users .person .user .status {
    width: 10px;
    height: 10px;
    -webkit-border-radius: 100px;
    -moz-border-radius: 100px;
    border-radius: 100px;
    background: #e6ecf3;
    position: absolute;
    top: 0;
    right: 0;
}

.users .person .user .status.online {
    background: #9ec94a;
}

.users .person .user .status.offline {
    background: #c4d2e2;
}

.users .person .user .status.away {
    background: #f9be52;
}

.users .person .user .status.busy {
    background: #fd7274;
}

.users .person p.name-time {
    font-weight: 600;
    display: inline-block;
}

.users .person p.name-time .time {
    font-weight: 400;
    font-size: .75rem;
    text-align: right;
    color: #8796af;
}

@media (max-width: 767px) {
    .users .person .user img {
        width: 40px;
        height: 40px;
    }
    
    /* Mobile: Horizontale scrollbare Liste */
    .users-container {
        padding: 8px 0;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap; /* Verhindert Zeilenumbruch */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling auf iOS */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE */
        position: fixed !important; /* Fixed - bleibt dauerhaft oben */
        top: 0 !important; /* Ersetzt das Top-Menü komplett */
        left: 0 !important; /* Keine Lücke links */
        right: 0 !important; /* Volle Breite */
        width: 100% !important; /* Explizit volle Breite */
        z-index: 2000 !important; /* Höher als Top-Menü (z-index: 100) */
        background: white !important;
        border-bottom: 1px solid #ddd !important;
        height: 70px !important; /* Feste Höhe für Partner-Liste */
    }
    
    /* Top-Menü verstecken wenn Chat aktiv ist */
    .navbar.nav-mobile-top {
        display: none !important;
    }
    
    .users-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }
    
    .users {
        display: inline-flex; /* inline-flex für horizontale Ausrichtung */
        flex-direction: row;
        gap: 8px;
        padding: 0 8px;
        white-space: nowrap;
    }
    
    /* Mobile: Logos mit Namen anzeigen */
    .users .person {
        padding: 0;
        display: inline-block; /* inline-block für horizontale Ausrichtung */
        width: 52px; /* Etwas breiter für Text */
        height: 62px; /* Höher für Logo + Text */
        border-radius: 8px;
        flex-shrink: 0;
        margin-right: 6px; /* Weniger Abstand da breiter */
        margin-bottom: 0;
        vertical-align: top;
    }
    
    /* Zeit verstecken, Namen anzeigen aber kürzen */
    .users .person span.time,
    .users .person .time {
        display: none !important;
    }
    
    .users .person .name-time,
    .users .person p.name-time {
        display: block !important;
        visibility: visible !important;
        width: auto !important;
        height: auto !important;
        margin-top: 2px !important;
        text-align: center !important;
        font-size: 10px !important;
        line-height: 1 !important;
    }
    
    .users .person span.name,
    .users .person .name {
        display: block !important;
        visibility: visible !important;
        width: 48px !important;
        height: auto !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 10px !important;
        text-align: center !important;
    }
    
    .users .person .user {
        margin-right: 0;
        margin-bottom: 0;
        display: block;
        width: 48px;
        height: 48px;
        padding: 4px;
    }
    
    /* Badges in mobiler Ansicht anpassen */
    .users .person .user .badge {
        top: -3px !important;
        right: -3px !important;
        font-size: 9px !important;
        width: 16px !important;
        height: 16px !important;
        line-height: 16px !important;
    }
    
    /* "Mehr" Button für mobile ausblenden */
    .users-container button[data-toggle="collapse"] {
        display: none !important;
    }
    
    /* Collapse-Container in mobile: alle Logos in einer Zeile */
    #collapse_users {
        display: block !important; /* Immer sichtbar in mobile */
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        background: none !important;
    }
    
    #collapse_users.users {
        display: inline-flex !important;
        flex-direction: row;
        gap: 8px;
        padding: 0;
        white-space: nowrap;
        margin-left: 0;
    }
    
    #collapse_users .person {
        display: inline-block;
        margin-right: 8px;
        margin-bottom: 0;
    }
    
    /* In mobile: Haupt-UL und Collapse-UL zu einer einzigen Zeile verbinden */
    .users-container {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
    }
    
    .users {
        flex: 0 0 auto;
    }
    
    #collapse_users {
        flex: 0 0 auto;
        margin-left: 0;
    }
    
    /* Mobile Chat Container anpassen */
    .chat-container {
        padding-bottom: 80px !important; /* Platz für fixiertes Eingabefeld */
        margin-bottom: 0 !important;
    }
    
    /* Chat Input Container: WhatsApp-style Layout */
    .chat-input-container#anchor_new {
        position: fixed !important;
        bottom: 60px !important; /* Höhe der Bottom-Nav */
        transition: bottom 0.25s ease !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        padding: 12px 15px !important;
        margin: 0 !important;
        border-top: 1px solid #ddd !important;
        z-index: 1000 !important;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1) !important;
    }
    
    /* Flex-Container für Input und Button */
    .chat-input-wrapper {
        display: flex !important;
        align-items: flex-end !important;
        gap: 8px !important;
    }
    
    /* WhatsApp-style Input Field */
    #chat_msg {
        flex: 1 !important;
        min-height: 40px !important;
        max-height: 150px !important;
        border-radius: 20px !important;
        border: 1px solid #ddd !important;
        padding: 8px 15px !important;
        resize: none !important;
        font-size: 16px !important;
        line-height: 1.4 !important;
        overflow-y: auto !important;
        display: block !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Theme-styled Send Button */
    .chat-send-btn-mobile {
        background: #61883c !important; /* Theme Success Color */
        border: none !important;
        border-radius: 50% !important;
        width: 40px !important;
        height: 40px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: white !important;
        cursor: pointer !important;
        transition: background-color 0.2s ease !important;
        flex-shrink: 0 !important;
    }
    
    .chat-send-btn-mobile:hover {
        background: #4f6e30 !important; /* Darker success on hover */
    }
    
    .chat-send-btn-mobile:active {
        background: #3d5525 !important; /* Even darker when pressed */
        transform: scale(0.95) !important;
    }
    
    /* SVG arrow icon styling */
    .chat-send-btn-mobile svg {
        width: 18px !important;
        height: 18px !important;
        transform: rotate(0deg) !important; /* Point right */
    }
    
    /* Keyboard-aktive Klasse für dynamische Positionierung */
    body.keyboard-active .chat-input-container#anchor_new {
        bottom: 60px !important;
        z-index: 10000 !important;
    }
    
    
    /* Chat-Nachrichten Bereich anpassen */
    .chat-box {
        margin-bottom: 0 !important;
        padding-bottom: 120px !important; /* Platz für fixierten Input (~65px) + Bottom-Nav (60px) + Luft */
    }
    
    /* Mobile: Nur die Nachrichten-Liste umkehren, nicht den ganzen Container */
    .chat-container {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Nachrichten-Box normal anzeigen (nicht umkehren) */
    .chat-container ul.chat-box {
        display: flex !important;
        flex-direction: column !important; /* Normal, nicht reverse */
        flex: 1;
        order: 1;
    }
    
    /* Nur den alten Desktop-Button ausblenden */
    button[onclick*="chat("].desktop-only {
        display: none !important;
    }
    
    /* Button-Container ohne Inhalt ausblenden */
    div.ml-3:empty,
    .ml-3:empty {
        display: none !important;
    }
    
    /* Ältere Nachrichten Button oben in der Nachrichten-Liste */
    .chat-container .text-center {
        order: -1;
    }
    
    /* Container höher machen für bessere Scroll-Performance */
    .chat-container {
        padding-bottom: 0 !important; /* Kein padding unten */
        padding-top: 10px !important; /* Normales Padding wieder */
        position: relative !important; /* Relative statt fixed - scrollt natürlich mit */
        margin-top: 0 !important; 
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important; /* Smooth scrolling auf iOS */
        background: white !important;
        z-index: 1 !important;
    }
    
    
    /* Trennlinie in mobiler Ansicht ausblenden */
    .border-top.py-3.my-3 {
        display: none !important;
    }
    
    /* Natürliches Scrolling auf mobilen Geräten */
    
    /* "Hoch" Button und Trennstrich in mobiler Ansicht ausblenden - nur außerhalb chat-container */
    .col-12.text-center {
        display: none !important;
    }
    
    /* Mobile: "Ältere Nachrichten laden" Button oben positionieren */
    .chat-container div.text-center {
        display: block !important; /* Explizit anzeigen */
        visibility: visible !important; /* Sichtbarkeit erzwingen */
        order: -2 !important; /* Ganz oben in der Flex-Reihenfolge */
        margin: 10px 0 !important;
        padding: 10px !important;
        background: rgba(248, 249, 250, 0.9) !important;
        border-radius: 8px !important;
        opacity: 1 !important; /* Falls opacity Problem */
        height: auto !important; /* Falls height Problem */
    }
    
    .chat-container .text-center .btn,
    .chat-container .text-center button {
        display: inline-block !important; /* Button explizit anzeigen */
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 14px !important;
        padding: 8px 16px !important;
        border-radius: 20px !important;
        background: #6c757d !important; /* Neutrales Grau */
        color: white !important;
        border: 1px solid #6c757d !important;
    }
    
    .chat-container .text-center small {
        display: none !important; /* "oder scrollen Sie nach unten" Text ausblenden */
    }
    
    /* "Scrollen Sie nach unten" Text ausblenden */
    small.text-muted,
    .text-muted {
        display: none !important;
    }
    
    /* Alternative: Spezifischere Selektion falls nötig */
    .col-12.text-center .btn-primary[href="#anchor_start"],
    .col-12.text-center hr {
        display: none !important;
    }
}


/************************************************
	************************************************
									Chat right side
	************************************************
************************************************/

.selected-user {
    width: 100%;
    padding: 0 15px;
    min-height: 64px;
    line-height: 64px;
    border-bottom: 1px solid #e6ecf3;
    -webkit-border-radius: 0 3px 0 0;
    -moz-border-radius: 0 3px 0 0;
    border-radius: 0 3px 0 0;
}

.selected-user span {
    line-height: 100%;
}

.selected-user span.name {
    font-weight: 700;
}

.chat-container {
    position: relative;
    padding: 1rem;
}

.chat-container li.chat-left,
.chat-container li.chat-right {
    display: flex;
    flex: 1;
    flex-direction: row;
    margin-bottom: 40px;
}

.chat-container li img {
    width: 48px;
    height: 48px;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    border-radius: 30px;
}

@media (max-width: 767px) {
  .chat-avatar {
    display: none !important;
  }
}


.chat-container li .chat-avatar {
    margin-right: 20px;
}

.chat-container li.chat-right {
    justify-content: flex-end;
}

.chat-container li.chat-right > .chat-avatar {
    margin-left: 20px;
    margin-right: 0;
}

.chat-container li .chat-name {
    font-size: .75rem;
    color: #999999;
    text-align: center;
}

.chat-container li .chat-text {
    padding: .4rem 1rem;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    background: #f2f2f2;
    font-weight: 300;
    line-height: 150%;
    position: relative;
    overflow-wrap: break-word;
    word-break: break-word;
}

.chat-container li .chat-text:before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    top: 10px;
    left: -20px;
    border: 10px solid;
    border-color: transparent #f2f2f2 transparent transparent;
}

.chat-container li.chat-right > .chat-text {
    text-align: left;
    background: #e4f4e2;
}

.chat-container li.chat-right > .chat-text:before {
    right: -20px;
    border-color: transparent transparent transparent #e4f4e2;
    left: inherit;
}

.chat-container li .chat-hour {
    padding: 0;
    margin-bottom: 10px;
    font-size: .75rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: 0 0 0 15px;
}

.chat-container li .chat-hour > span {
    font-size: 16px;
    color: #9ec94a;
}

.chat-ticks {
    display: inline-flex;
    align-items: center;
    font-size: 16px;
}
.chat-ticks-sent .icon {
    color: #9ec94a;
}
.chat-ticks-read .icon {
    color: #9ec94a;
}
.chat-ticks-read .icon + .icon {
    margin-left: -6px;
}

.chat-container li.chat-right > .chat-hour {
    margin: 0 15px 0 0;
}

@media (max-width: 767px) {
    .chat-container li.chat-left,
    .chat-container li.chat-right {
        flex-direction: column;
        margin-bottom: 30px;
    }
    .chat-container li img {
        width: 32px;
        height: 32px;
    }
    .chat-container li.chat-left .chat-avatar {
        margin: 0 0 5px 0;
        display: flex;
        align-items: center;
    }
    .chat-container li.chat-left .chat-hour {
        justify-content: flex-end;
    }
    .chat-container li.chat-left .chat-name {
        margin-left: 5px;
    }
    .chat-container li.chat-right .chat-avatar {
        order: -1;
        margin: 0 0 5px 0;
        align-items: center;
        display: flex;
        justify-content: right;
        flex-direction: row-reverse;
    }
    .chat-container li.chat-right .chat-hour {
        justify-content: flex-start;
        order: 2;
    }
    .chat-container li.chat-right .chat-name {
        margin-right: 5px;
    }
    .chat-container li .chat-text {
        font-size: .8rem;
    }
}

.chat-form {
    padding: 15px;
    width: 100%;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffffff;
    border-top: 1px solid white;
}

ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}
.card {
    border: 0;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    border-radius: 2px;
    margin-bottom: 2rem;
    box-shadow: none;
}

.chat_umbruch {
   white-space: pre-wrap;
}

/* Chat Search */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-result-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.search-result-text {
    flex: 1;
}

.search-result-name {
    font-weight: bold;
    font-size: 13px;
    color: #333;
    line-height: 1.2;
}

.search-result-team {
    font-size: 11px;
    color: #666;
    line-height: 1.1;
    margin-top: 1px;
}

.chat-search-container {
    position: relative;
}

