/* ================================================================
   chat-panel.css — Per-conversation panel styles
   Used by: _panel.html.twig (served as AJAX fragment + included in layout)
   ================================================================ */

/* ── Chat image previews ────────────────────────────────────── */
.chat-img-wrap {
    width: 240px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    background: #e5e5ea;
    display: block;
    cursor: pointer;
    flex-shrink: 0;
}
.chat-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Message bubbles ────────────────────────────────────────── */
.message-bubble {
    animation: chatFadeIn 0.25s ease-in;
    word-wrap: break-word;
    font-size: 0.95rem;
}
@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Delete button — show on hover, hide if read */
.message .message-delete                { display: none !important; }
.message:hover .message-delete          { display: flex !important; }
.message.msg-read .message-delete,
.message.msg-read:hover .message-delete { display: none !important; }

/* ── Reactions ──────────────────────────────────────────────── */
.reaction-trigger {
    position: absolute;
    bottom: -12px;
    right: 6px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    padding: 0;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.message:hover .reaction-trigger { opacity: 1; }

.reaction-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.message[style*="row-reverse"] .reaction-bar { justify-content: flex-end; }

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 2px 7px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    user-select: none;
}
.reaction-pill.reaction-mine { background: #dbeafe; border-color: #1E73BE; }
.reaction-pill:hover { transform: scale(1.1); }

/* ── Typing indicator ───────────────────────────────────────── */
.typing-indicator-bar {
    display: flex !important;
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #e5e5ea;
    padding: 12px 16px !important;
    font-style: normal;
    color: #34495e;
    font-size: 0.9rem;
    gap: 8px;
    animation: slideUp 0.3s ease-out;
}
.typing-indicator-bar[style*="display: none"] { display: none !important; }

.typing-dots { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34495e;
    animation: typingBounce 1.8s infinite ease-in-out;
    opacity: 0.6;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.3s; }
.typing-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes typingBounce {
    0%   { transform: translateY(0);   opacity: 0.4; }
    50%  { transform: translateY(-8px); opacity: 1; }
    100% { transform: translateY(0);   opacity: 0.4; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Emoji-only messages (1–2 emojis → large display) ──────── */
.message-content.emoji-only {
    font-size: 2.8rem !important;
    line-height: 1.2 !important;
}
.message-bubble:has(.emoji-only) {
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px 8px !important;
    display: flex !important;
    flex-direction: column-reverse !important;
}
.message-bubble:has(.emoji-only) .message-header {
    border-radius: 10px;
    padding: 2px 8px !important;
    margin-bottom: 0 !important;
    margin-top: 4px !important;
}
.message-bubble.bg-primary:has(.emoji-only) .message-header { background: rgba(30, 115, 190, 0.85); }
.message-bubble.bg-light:has(.emoji-only)   .message-header { background: rgba(255, 255, 255, 0.85); }
.message-bubble.bg-primary:has(.emoji-only) .message-header small {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}
.message-bubble.bg-light:has(.emoji-only) .message-header small {
    color: #000000 !important;
    -webkit-text-fill-color: #000000 !important;
}
.message-bubble:has(.emoji-only) .message-header .message-ticks,
.message-bubble:has(.emoji-only) .message-header .message-ticks i {
    -webkit-text-fill-color: currentColor !important;
}

/* ── Emoji picker popup ─────────────────────────────────────── */
#emoji-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 1000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
#emoji-popup em-emoji-picker {
    --border-radius: 12px;
    --shadow: none;
    --color-border: #e5e5ea;
    --rgb-accent: 30, 115, 190;
    height: 380px;
}
#emoji-trigger {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s ease, transform 0.15s;
}
#emoji-trigger:hover { color: #1E73BE; transform: scale(1.1); }

/* ── Attach popup ───────────────────────────────────────────── */
#attach-trigger {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.2s ease, transform 0.15s;
}
#attach-trigger:hover { color: #1E73BE; transform: scale(1.1); }

#attach-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    z-index: 1001;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px 0;
    min-width: 160px;
    display: none;
    flex-direction: column;
}
#attach-popup.open { display: flex; }

.attach-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #1c1c1e;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}
.attach-option:hover { background: #f5f5f5; }
.attach-option .attach-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ── Scroll-to-bottom button ────────────────────────────────── */
[data-chat-target="scrollButton"] { transition: all 0.3s ease; }
[data-chat-target="scrollButton"]:hover { transform: scale(1.1); }

/* ── Message area scrollbar ─────────────────────────────────── */
[data-chat-target="messages"]::-webkit-scrollbar       { width: 6px; }
[data-chat-target="messages"]::-webkit-scrollbar-track  { background: transparent; }
[data-chat-target="messages"]::-webkit-scrollbar-thumb  { background: #ccc; border-radius: 3px; }
[data-chat-target="messages"]::-webkit-scrollbar-thumb:hover { background: #999; }

/* ── Misc animations ────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.2); }
}
.pulse-red {
    color: #ff0000 !important;
    -webkit-text-fill-color: #ff0000 !important;
    animation: pulse 1.5s ease-in-out infinite;
}
