/* =========================================================
   LIVBEN - CHAT CSS
   Dosya: /public/assets/css/chat.css
   Amaç: Genel sohbet alanı, mesaj listesi, chat item yapısı,
         benim mesajım, boş durum, composer çevresi
========================================================= */

.room-chat {
    display: flex;
    flex-direction: column;
    min-height: 42rem;
    background: var(--room-surface);
}

.room-chat__head {
    flex-shrink: 0;
}

.room-chat__messages {
    flex: 1 1 auto;
    min-height: 24rem;
    max-height: 42rem;
    padding: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.55) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.room-chat__messages > * + * {
    margin-top: 0.875rem;
}

.room-chat__composer {
    flex-shrink: 0;
    padding: 1rem;
    border-top: 1px solid var(--room-border);
    background: var(--room-surface);
}

/* ---------------------------------------------------------
   Boş durum
--------------------------------------------------------- */
.chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12rem;
    padding: 1.25rem;
    text-align: center;
    color: var(--room-muted);
    font-size: var(--fs-14);
    line-height: 1.6;
    border: 1px dashed var(--room-border);
    border-radius: var(--room-radius-sm);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

/* ---------------------------------------------------------
   Mesaj satırı
--------------------------------------------------------- */
.chat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: min(44rem, 88%);
}

.chat-item.is-mine {
    margin-left: auto;
    align-items: flex-end;
}

.chat-item__head {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0 0.125rem;
}

.chat-item__head strong {
    color: var(--room-text);
    font-size: var(--fs-14);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.chat-item__head small {
    color: var(--room-muted);
    font-size: var(--fs-12);
    line-height: 1.2;
    white-space: nowrap;
}

.chat-item__body {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--room-border);
    border-radius: 1rem 1rem 1rem 0.35rem;
    background: #ffffff;
    color: var(--room-text);
    font-size: var(--fs-15);
    line-height: 1.65;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.chat-item.is-mine .chat-item__body {
    border-color: rgba(14, 165, 233, 0.18);
    border-radius: 1rem 1rem 0.35rem 1rem;
    background: rgba(14, 165, 233, 0.08);
    box-shadow: 0 8px 22px rgba(14, 165, 233, 0.10);
}

.chat-item__body a {
    color: var(--room-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-item__body a:hover {
    color: var(--room-primary-dark);
}

.chat-item__body strong {
    color: var(--room-text);
    font-weight: 700;
}

.chat-item__body em {
    font-style: italic;
}

/* ---------------------------------------------------------
   Sistem / bilgi mesajı varyantları
--------------------------------------------------------- */
.chat-item.is-system {
    max-width: 100%;
    align-items: center;
}

.chat-item.is-system .chat-item__head {
    display: none;
}

.chat-item.is-system .chat-item__body {
    width: auto;
    padding: 0.625rem 0.875rem;
    border-style: dashed;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--room-muted);
    font-size: var(--fs-13);
    text-align: center;
    box-shadow: none;
}

/* ---------------------------------------------------------
   Composer / alt yazma alanı çevresi
--------------------------------------------------------- */
.room-chat__composer .room-chat__tools {
    margin-bottom: 0.875rem;
}

.room-chat__composer .form-group {
    margin-bottom: 0;
}

.room-chat__composer .form-actions {
    margin-top: 0.875rem;
}

.room-chat__composer textarea {
    max-height: 12rem;
}

/* ---------------------------------------------------------
   Yazıyor bilgisi / alt yardımcı alan
--------------------------------------------------------- */
.chat-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
    color: var(--room-muted);
    font-size: var(--fs-12);
    line-height: 1.4;
}

.chat-meta__status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.chat-meta__status::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: var(--room-success);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.10);
}

.chat-meta__count {
    font-weight: 600;
    color: var(--room-text);
}

/* ---------------------------------------------------------
   Mesaj listesi içi tarih ayırıcı
--------------------------------------------------------- */
.chat-separator {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    text-align: center;
}

.chat-separator::before {
    content: "";
    position: absolute;
    inset: 50% 0 auto;
    border-top: 1px solid var(--room-border);
    transform: translateY(-50%);
}

.chat-separator span {
    position: relative;
    z-index: 1;
    padding: 0.2rem 0.75rem;
    border: 1px solid var(--room-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--room-muted);
    font-size: var(--fs-12);
    font-weight: 600;
}

/* ---------------------------------------------------------
   Scroll görünümü
--------------------------------------------------------- */
.room-chat__messages::-webkit-scrollbar {
    width: 10px;
}

.room-chat__messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

.room-chat__messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* ---------------------------------------------------------
   Sağ panel / küçük sohbet kutuları için opsiyonel sınıflar
--------------------------------------------------------- */
.chat-compact .room-chat__messages {
    min-height: 18rem;
    max-height: 26rem;
}

.chat-compact .chat-item {
    max-width: 94%;
}

.chat-compact .chat-item__body {
    padding: 0.75rem 0.875rem;
    font-size: var(--fs-14);
}

/* ---------------------------------------------------------
   Responsive
--------------------------------------------------------- */
@media (max-width: 1100px) {
    .room-chat {
        min-height: 38rem;
    }

    .room-chat__messages {
        max-height: 36rem;
    }
}

@media (max-width: 768px) {
    .room-chat {
        min-height: auto;
    }

    .room-chat__messages {
        min-height: 20rem;
        max-height: 28rem;
        padding: 0.875rem;
    }

    .room-chat__composer {
        padding: 0.875rem;
    }

    .chat-item {
        max-width: 96%;
    }

    .chat-item__body {
        padding: 0.8rem 0.875rem;
        font-size: var(--fs-14);
        line-height: 1.6;
    }

    .chat-item__head {
        gap: 0.375rem 0.625rem;
    }
}
