﻿/* =========================
   Ortak WhatsApp tarzı Sohbet Stilleri
   (Hem Modal (#portalSohbetModal) hem sayfa (.mesajlar/#mesajlar) için)
   ========================= */

:root {
    --wa-bg: #efeae2;
    --wa-top: #f0f2f5;
    --wa-border: #e9edef;
    --wa-me: #d9fdd3;
    --wa-other: #ffffff;
    --wa-hover: #f5f6f6;
}

/* =========================
   SAYFA (Card içinde) yardımcıları
   ========================= */

.sohbet-kapsayici {
    min-height: 0;
}

.sohbet-kutu {
    min-height: 0;
}

/* Kişi listesi (sayfa) */
.kisi-listesi {
    max-height: calc(100vh - 220px);
    overflow: auto;
    min-height: 220px;
}

#kisiler .list-group-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
}

    #kisiler .list-group-item:hover {
        background: var(--wa-hover);
    }

    #kisiler .list-group-item.active {
        background: #e9edef;
    }

#kisiler .kisi-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #dfe5e7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex: 0 0 auto;
    user-select: none;
}

#kisiler .kisi-info {
    min-width: 0;
    width: 100%;
}

#kisiler .kisi-ad {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#kisiler .kisi-alt {
    font-size: 12px;
    opacity: .70;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   MESAJ ALANI (ORTAK)
   ========================= */

/* Mesaj container:
   - sayfa: .mesajlar / #mesajlar
   - modal: #portalSohbetModal .portal-sohbet-mesajlar
*/
.mesajlar,
#mesajlar,
#portalSohbetModal .portal-sohbet-mesajlar {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 14px 10px 14px;
    background-color: var(--wa-bg);
    background-image: radial-gradient(rgba(0,0,0,.04) 1px, transparent 1px), radial-gradient(rgba(0,0,0,.03) 1px, transparent 1px);
    background-size: 26px 26px, 26px 26px;
    background-position: 0 0, 13px 13px;
}

/* Satır:
   - sayfa: .msg-row + .right/.left
   - modal (eski): .sohbet-satir + .benim/.diger
*/
.msg-row,
#portalSohbetModal .sohbet-satir {
    display: flex;
    margin: 2px 0;
}

    .msg-row.right {
        justify-content: flex-end;
    }

    .msg-row.left {
        justify-content: flex-start;
    }

    #portalSohbetModal .sohbet-satir.benim {
        justify-content: flex-end;
    }

    #portalSohbetModal .sohbet-satir.diger {
        justify-content: flex-start;
    }

/* Balon:
   - sayfa: .baloncuk + .benim/.diger
   - modal (eski): .sohbet-baloncuk + .sohbet-benim/.sohbet-diger
*/
.baloncuk,
#portalSohbetModal .sohbet-baloncuk {
    max-width: 72%;
    height: %;
    display: inline-block;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 0.35;
    box-shadow: 0 1px 1px rgba(0,0,0,.08);
    position: relative;
    word-break: break-word;
    white-space: pre-wrap;
}

    /* Benim / Diğer */
    .baloncuk.benim,
    #portalSohbetModal .sohbet-benim {
        background: var(--wa-me);
        border-top-right-radius: 4px;
    }

    .baloncuk.diger,
    #portalSohbetModal .sohbet-diger {
        background: var(--wa-other);
        border: 1px solid rgba(0,0,0,.08);
        border-top-left-radius: 4px;
    }

/* Balon içi düzen (metin + saat) */
.balon-icerik,
#portalSohbetModal .sohbet-icerik {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: end;
}

.balon-metin,
#portalSohbetModal .sohbet-metin {
    white-space: pre-wrap;
    word-break: break-word;
}

.balon-saat,
#portalSohbetModal .sohbet-saat {
    font-size: 11px;
    opacity: .55;
    white-space: nowrap;
    padding-left: 6px;
}

/* Kuyruklar (sayfa) */
.baloncuk.benim::after {
    content: "";
    position: absolute;
    top: 0;
    right: -6px;
    border-left: 6px solid var(--wa-me);
    border-top: 6px solid transparent;
}

.baloncuk.diger::before {
    content: "";
    position: absolute;
    top: 0;
    left: -6px;
    border-right: 6px solid var(--wa-other);
    border-top: 6px solid transparent;
}

/* =========================
   MODAL (Portal) Layout (opsiyonel)
   ========================= */

#portalSohbetModal .portal-sohbet-modal {
    overflow: hidden;
    border-radius: 14px;
}

#portalSohbetModal .modal-body {
    height: min(82vh, 720px);
}

#portalSohbetModal .portal-sohbet-grid {
    height: 100%;
}

#portalSohbetModal .portal-sohbet-sol {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
}

#portalSohbetModal #sohbetKisiAra {
    border-radius: 999px;
    background: #f0f2f5;
    border: 1px solid var(--wa-border);
    padding: 10px 12px;
}

#portalSohbetModal .portal-sohbet-kisi-listesi {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

#portalSohbetModal .kisi-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #f0f2f5;
    background: #fff;
}

    #portalSohbetModal .kisi-item:hover {
        background: var(--wa-hover);
    }

    #portalSohbetModal .kisi-item.active {
        background: #e9edef;
    }

#portalSohbetModal .portal-sohbet-sag {
    height: 100%;
    min-height: 0;
    background: var(--wa-bg);
    display: flex;
    flex-direction: column;
}

#portalSohbetModal .portal-sohbet-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--wa-top);
    border-bottom: 1px solid var(--wa-border);
}

#portalSohbetModal .sohbet-baslik {
    font-weight: 700;
    line-height: 1.1;
}

#portalSohbetModal .sohbet-alt {
    font-size: 12px;
    opacity: .70;
    line-height: 1.1;
}

#portalSohbetModal .portal-sohbet-inputbar {
    background: var(--wa-top);
    border-top: 1px solid var(--wa-border);
    padding: 10px 12px;
}

#portalSohbetModal #sohbetMesajInput {
    border-radius: 999px;
    padding: 10px 14px;
}

#portalSohbetModal #sohbetGonderForm .btn {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal mobile liste <-> chat */
@media (max-width: 767.98px) {
    #portalSohbetModal .modal-dialog {
        margin: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
    }

    #portalSohbetModal .modal-content {
        height: 100%;
        border-radius: 0;
    }

    #portalSohbetModal .modal-body {
        height: calc(100vh - 56px);
    }

    #portalSohbetModal .modal-content:not(.chat-open) .portal-sohbet-sag {
        display: none !important;
    }

    #portalSohbetModal .modal-content.chat-open .portal-sohbet-sol {
        display: none !important;
    }

    #portalSohbetModal .modal-content.chat-open .portal-sohbet-sag {
        display: flex !important;
    }

    .baloncuk,
    #portalSohbetModal .sohbet-baloncuk {
        max-width: 86%;
        line-height: 0.35;
    }
}
