/* Mention Menu Styling */
.mention-menu {
    position: absolute;
    bottom: auto; /* Remove conflicting bottom */
    min-width: 220px;
    min-height: 80px; /* Increased min-height */
    max-height: 400px;
    height: auto !important;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2147483647; /* Maximum possible z-index */
    overflow-y: auto !important;
    display: none;
    flex-direction: column;
    padding: 10px;
    min-height: 120px !important;
    scrollbar-width: thin;
    scrollbar-color: var(--color1) transparent;
}

.mention-menu.active {
    display: flex !important;
    animation: menuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mention-menu-header {
    position: sticky;
    top: -10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -10px -10px 6px;
    padding: 10px 10px 8px;
    background: rgba(18, 18, 18, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mention-menu-title {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.mention-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.mention-menu-close:hover,
.mention-menu-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
}

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

.mention-item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    min-height: 50px;
}

.mention-item:hover, .mention-item.selected {
    background: rgba(245, 75, 115, 0.15);
    border-color: rgba(245, 75, 115, 0.3);
}

.mention-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.mention-character-pfp {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 24px;
}

.mention-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.mention-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-code {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
}

/* Contenteditable Rich Input Styling */
.rich-message-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #333;
    background-color: #1f1f1fcc;
    color: #f0f0f0bc;
    border-radius: 10px;
    min-height: 45px;
    max-height: 120px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
    cursor: text;
}

.rich-message-input:focus {
    border-color: var(--color1);
    font-size: 13px;
    background-color: #1f1f1f;
    color: #fff;
}

.rich-message-input[placeholder]:empty:before {
    content: attr(placeholder);
    color: #666;
    pointer-events: none;
    display: block; /* For Firefox */
}

.lorebook-mention {
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.paired-text {
    color: var(--color1);
    font-weight: bold;
}
