/* Chat Section Styles (Alistair.sh inspired) */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    margin-top: 20px;
    padding: 20px 20px 40px;
    box-sizing: border-box;
}

/* Chat Rows */
.chat-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
}

.chat-left {
    justify-content: flex-start;
}

.chat-right {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

/* Avatars */
.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 6px;
}

/* Avatar Link Container */
.chat-avatar-link,
.chat-avatar-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-avatar-link:hover,
.chat-avatar-wrapper:hover {
    transform: scale(1.1);
}

.chat-avatar-link {
    text-decoration: none;
}

/* Tooltip Styles */
.chat-avatar-link[data-tooltip],
.chat-avatar-wrapper[data-tooltip] {
    position: relative;
}

.chat-avatar-link[data-tooltip]::before,
.chat-avatar-wrapper[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-line;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    min-width: 120px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-avatar-link[data-tooltip]::after,
.chat-avatar-wrapper[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.chat-avatar-link:hover[data-tooltip]::before,
.chat-avatar-wrapper:hover[data-tooltip]::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

.chat-avatar-link:hover[data-tooltip]::after,
.chat-avatar-wrapper:hover[data-tooltip]::after {
    opacity: 1;
}

/* Bubbles */
.chat-bubble {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    max-width: 450px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

/* Left Bubble (Owner/PMThinking) */
.chat-left .chat-bubble {
    background-color: #f4f4f5;
    color: #18181b;
}

/* Wide Bubble for larger content like SVG images */
.chat-bubble.wide {
    max-width: 600px;
    padding: 8px;
}

/* Right Bubble (User/Reader) */
.chat-right .chat-bubble {
    background-color: #18181b;
    color: #ffffff;
}

/* Loading State */
.chat-loading {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 20px;
}

/* Responsive adjustment */
@media (max-width: 480px) {
    .chat-bubble {
        max-width: 85%;
    }

    .chat-wrapper {
        padding: 0 0 40px;
        margin-top: 10px;
    }
}

/* 
   Tailwind Compatibility Layer for Rich Text & SVGs 
   Scoped to .chat-bubble to avoid global pollution
*/

.chat-bubble .p-0 {
    padding: 0 !important;
}

.chat-bubble .px-4 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.chat-bubble .py-2\.5 {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
}

.chat-bubble .font-serif {
    font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
}

.chat-bubble .italic {
    font-style: italic;
}

.chat-bubble .underline {
    text-decoration: underline;
}

.chat-bubble .decoration-zinc-400 {
    text-decoration-color: #a1a1aa;
}

.chat-bubble .inline {
    display: inline;
}

.chat-bubble .mb-\[3px\] {
    margin-bottom: 3px;
}

.chat-bubble .ml-\[2px\] {
    margin-left: 2px;
}

.chat-bubble .mb-px {
    margin-bottom: 1px;
}

.chat-bubble .ml-px {
    margin-left: 1px;
}