/* Emoji picker (chatEmoji.js). Loaded by both the admin console and the customer widget, so the
   rules here stay surface-neutral - anything specific to one of the two lives in chat.css or
   chatWidget.css. Colours follow the same variables the quick-creds and tag popups use. */

.chat-emoji-panel {
    position: absolute;
    bottom: 100%;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--ct-card-bg, #fff);
    border: 1px solid var(--ct-border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 12;
    margin-bottom: 8px;
    overflow: hidden;
    animation: chatEmojiFade 0.15s ease;
}

/* Same rise-and-fade the other input popups use. Declared here rather than reused, because this file
   also loads on pages that never pull in chat.css and a missing keyframe drops the animation. */
@keyframes chatEmojiFade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-emoji-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--ct-border-color, #e2e8f0);
    color: var(--ct-text-muted, #8a94a6);
}

.chat-emoji-search i {
    font-size: 14px;
    flex: 0 0 auto;
}

.chat-emoji-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-size: 13px;
    color: var(--ct-body-color, #1f2937);
}

.chat-emoji-search-input::placeholder {
    color: var(--ct-text-muted, #8a94a6);
}

.chat-emoji-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 6px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-emoji-tabs::-webkit-scrollbar {
    display: none;
}

.chat-emoji-tab {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 4px 7px;
    font-size: 15px;
    line-height: 1.2;
    color: var(--ct-text-muted, #8a94a6);
    border-bottom: 2px solid transparent;
}

.chat-emoji-tab:hover {
    background: rgba(99, 102, 241, 0.08);
}

.chat-emoji-tab.active {
    background: rgba(99, 102, 241, 0.12);
    border-bottom-color: #6366f1;
}

.chat-emoji-grid {
    height: 226px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 6px 8px;
}

.chat-emoji-section-label {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 6px 4px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--ct-text-muted, #8a94a6);
    background: var(--ct-card-bg, #fff);
}

.chat-emoji-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 2px;
}

.chat-emoji-item {
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 2px 0;
    height: 34px;
    font-size: 20px;
    line-height: 1;
    /* Colour emoji come from the OS font; naming them keeps Windows/macOS/Android consistent and
       stops the picker inheriting an icon font that has no glyph for them. */
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

.chat-emoji-item:hover {
    background: rgba(99, 102, 241, 0.12);
    transform: scale(1.12);
}

/* Flashed when the message is already at its character limit, so a click that does nothing still
   says why. */
.chat-emoji-item-full {
    background: rgba(239, 68, 68, 0.18);
}

.chat-emoji-empty {
    padding: 28px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--ct-text-muted, #8a94a6);
}

/* The open state of the trigger button is left to each surface: the widget already styles
   .chat-widget-input-btn.active, and the admin console styles .chat-attach-btn.chat-emoji-btn.active
   in chat.css. Defining it here would override the widget's own look purely by load order. */

[data-bs-theme="dark"] .chat-emoji-panel {
    background: #1e1f2e;
    border-color: #2d2e3f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="dark"] .chat-emoji-search {
    border-bottom-color: #2d2e3f;
}

[data-bs-theme="dark"] .chat-emoji-search-input {
    color: #e5e7eb;
}

[data-bs-theme="dark"] .chat-emoji-section-label {
    background: #1e1f2e;
}

@media (max-width: 575.98px) {
    .chat-emoji-panel {
        width: 300px;
    }

    .chat-emoji-grid {
        height: 190px;
    }
}
