﻿/* ==========================================================================
   chat-bubbles.css - 대화창 메시지 컨테이너, 말풍선, 썸네일 사진, 발화 글로우, 리셋 제안
   ========================================================================== */

/* 3. 대화창 메시지 컨테이너 & 카톡 스타일 프로필 레이아웃 */
#chatContainer {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    max-width: 90%;
    animation: fadeIn 0.2s ease-out;
}

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

/* 오빠 메시지: 우측 정렬 */
.message-row.user {
    align-self: flex-end;
    justify-content: flex-end;
}

/* 지은이/상대방 메시지: 카톡 스타일 좌측 아바타 + 우측 바디 */
.message-row:not(.user) {
    align-self: flex-start;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
}

.msg-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    margin-top: 1px;
    border: 2px solid rgba(255, 255, 255, 0.08);
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.msg-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sender-name {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 4px;
    padding: 0 2px;
    font-weight: 500;
}

.bubble-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.bubble {
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
}

.message-row.user .bubble {
    background: #3b222d;
    border: 1px solid #632d43;
    color: #ffe4e6;
    border-bottom-right-radius: 4px;
}

.message-row:not(.user) .bubble {
    background: #1e2128;
    border: 1px solid #2d3340;
    color: #f3f4f6;
    border-bottom-left-radius: 4px;
}

/* 발화 중 핑크 펄스 글로우 */
@keyframes speakingPulse {
    0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.speaking-glow {
    animation: speakingPulse 1.5s infinite;
    border: 2px solid #f43f5e !important;
}

.bubble-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    gap: 8px;
    font-size: 0.72rem;
    color: #71717a;
    padding: 0 2px;
}

.replay-btn {
    background: transparent;
    border: none;
    color: #f43f5e;
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.replay-btn:active {
    background: rgba(244, 63, 94, 0.2);
}

/* 4. 더보기 / 접기 클리핑 시스템 */
.bubble-content.collapsed {
    max-height: 105px;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 60%, transparent 100%);
}

.more-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    background: #14171d;
    border: 1px solid #2d3340;
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 0;
    border-radius: 6px;
    margin-top: 6px;
    cursor: pointer;
}

.more-toggle-btn:active {
    background: #202634;
}

/* 말풍선 내부 이미지 렌더링 (카톡식 고정 썸네일 규격) */
.bubble-img-frame {
    width: 180px;
    height: 135px;
    max-width: 180px;
    max-height: 135px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    background: #121418;
    flex-shrink: 0;
}

.bubble-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.15s ease;
}

.bubble-img:active {
    transform: scale(0.96);
}

/* 7. 생각 중 로딩 애니메이션 & 세션 리셋 제안 */
.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background-color: #f43f5e;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.3); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

.loading-text {
    font-size: 0.8rem;
    color: #fda4af;
    font-weight: 500;
}

.reset-suggest-box {
    background: #2a1520;
    border: 1px dashed #f43f5e;
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 6px;
    font-size: 0.82rem;
    color: #fda4af;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeIn 0.3s ease-out;
}

.reset-btn-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.reset-action-btn {
    background: #f43f5e;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
}

.reset-action-btn:active {
    background: #e11d48;
    transform: scale(0.95);
}
