@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Montserrat:wght@400;500;600;700&display=swap');

body { display: flex; }

.chat-layout {
    margin-left: 220px;
    display: flex;
    width: calc(100% - 220px);
    height: 100vh;
}

.conversations-list {
    width: 280px;
    background: var(--color-white);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.conv-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-border);
}

.conv-header h2 {
    font-size: 18px;
    font-family: "Bebas Neue", cursive;
    letter-spacing: 1px;
    color: var(--color-text-primary);
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(232, 232, 236, 0.5);
}

.conv-item.active { background: var(--color-tag-bg); }
.conv-item:hover { background: var(--color-bg); }

.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.conv-info { flex: 1; min-width: 0; }

.conv-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-preview {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.conv-time {
    font-size: 10px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
}

.chat-header {
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.chat-header img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
}

.chat-header-info h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.chat-header-info p {
    font-size: 11px;
    color: var(--color-active-dot);
    font-weight: 600;
}

.chat-header-actions { margin-left: auto; display: flex; gap: 8px; }

.btn-lre {
    background: var(--color-dark);
    color: var(--color-white);
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-lre:hover { background: var(--color-text-primary); }

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.date-separator {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    position: relative;
}

.date-separator::before,
.date-separator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--color-border);
}

.date-separator::before { left: 0; }
.date-separator::after { right: 0; }

.message-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    animation: fadeIn 0.3s ease both;
}

.message-row.out { flex-direction: row-reverse; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-row:nth-child(1) { animation-delay: 0.05s; }
.message-row:nth-child(2) { animation-delay: 0.15s; }
.message-row:nth-child(3) { animation-delay: 0.25s; }
.message-row:nth-child(4) { animation-delay: 0.35s; }
.message-row:nth-child(5) { animation-delay: 0.45s; }
.message-row:nth-child(6) { animation-delay: 0.55s; }
.message-row:nth-child(7) { animation-delay: 0.65s; }
.message-row:nth-child(8) { animation-delay: 0.75s; }

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.msg-bubble-wrap { display: flex; flex-direction: column; max-width: 60%; }
.message-row.out .msg-bubble-wrap { align-items: flex-end; }

.msg-sender {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    padding: 0 6px;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.message-row.in .msg-bubble {
    background: var(--color-white);
    color: var(--color-text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.message-row.out .msg-bubble {
    background: var(--color-dark);
    color: var(--color-white);
    border-bottom-right-radius: 4px;
}

.msg-bubble.special {
    background: linear-gradient(135deg, #0e1a30, var(--color-dark));
    color: var(--color-white);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px !important;
}

.msg-bubble.special .lre-card {
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 10px;
    margin-top: 8px;
    border: 1px solid rgba(255,255,255,0.2);
}

.msg-bubble.special .lre-card h4 { font-size: 13px; font-weight: 700; margin-bottom: 4px; }

.msg-bubble.special .lre-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.msg-bubble.special .lre-tag {
    background: rgba(255,255,255,0.2);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
}

.msg-bubble.special .lre-btn {
    display: inline-block;
    margin-top: 10px;
    background: var(--color-white);
    color: var(--color-tag-text);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.2s;
}

.msg-bubble.special .lre-btn:hover { opacity: 0.85; }

.msg-time { font-size: 10px; color: var(--color-text-muted); margin-top: 4px; padding: 0 6px; }

.chat-input-area {
    background: var(--color-white);
    border-top: 1px solid var(--color-border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input {
    flex: 1;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13px;
    color: var(--color-text-primary);
    outline: none;
}

.chat-input:focus { border-color: var(--color-tag-text); }

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-dark);
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-btn:hover { background: var(--color-text-primary); }

.txt-lre {
    font-size: 12px;
    line-height: 1.4;
    color: var(--color-white);
}

.conv-radio {
    display: none;
}

.chat-window {
    display: none;
}

#radio-psc:checked ~ #conv-psc,
#radio-bvv:checked ~ #conv-bvv,
#radio-vmk:checked ~ #conv-vmk {
    display: flex;
}

#radio-psc:checked ~ .conversations-list #tab-psc,
#radio-bvv:checked ~ .conversations-list #tab-bvv,
#radio-vmk:checked ~ .conversations-list #tab-vmk {
    background: var(--color-tag-bg);
}

@media (max-width: 768px) {
    .chat-layout { margin-left: 0; width: 100%; }
    .conversations-list { display: none; }
}