/* =========================================================
   MENTION SYSTEM - CSS Styles
   Professional Mention System like Telegram
   Date: Feb 11, 2026
   ========================================================= */

/* Mention Autocomplete Container */
.mention-autocomplete {
    position: fixed;
    background: var(--ios-card-bg, #ffffff);
    border: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.12));
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    max-height: 280px;
    overflow-y: auto;
    z-index: 10000;
    display: none;
    min-width: 280px;
    max-width: 360px;
    animation: mentionSlideUp 0.2s ease-out;
}

@keyframes mentionSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mention Item */
.mention-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--ios-separator, rgba(60, 60, 67, 0.08));
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-item:hover,
.mention-item.selected {
    background: var(--ios-blue-dim, rgba(0, 122, 255, 0.08));
}

.mention-item:active {
    background: var(--ios-blue-dim, rgba(0, 122, 255, 0.15));
}

/* Mention Avatar */
.mention-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--ios-gray-light, #e5e5ea);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mention-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mention-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--ios-blue, #007AFF);
    background: var(--ios-blue-dim, rgba(0, 122, 255, 0.1));
}

/* Mention Info */
.mention-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mention-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--ios-text-primary, #000000);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-username {
    font-size: 12px;
    color: var(--ios-text-secondary, #8e8e93);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mention in Message Text */
.mention {
    color: var(--ios-blue, #007AFF);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s ease;
    padding: 0 2px;
    border-radius: 3px;
}

.mention:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.mention:active {
    opacity: 0.5;
}

/* Mention in Sent Messages */
.message-bubble.sent .mention {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.1);
}

.message-bubble.sent .mention:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mention Badge (@ Icon) */
.mention-badge {
    position: absolute;
    top: -50px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--ios-blue, #007AFF);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    transition: all 0.2s ease;
    z-index: 100;
    user-select: none;
    animation: mentionBadgeBounce 0.5s ease-out;
}

@keyframes mentionBadgeBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.mention-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.5);
}

.mention-badge:active {
    transform: scale(0.95);
}

/* Mention Highlight Animation */
.mention-highlight {
    animation: mentionPulse 1s ease-in-out;
}

@keyframes mentionPulse {
    0%, 100% { 
        background: transparent; 
    }
    50% { 
        background: rgba(0, 122, 255, 0.15);
        transform: scale(1.02);
    }
}

/* Scrollbar for Autocomplete */
.mention-autocomplete::-webkit-scrollbar {
    width: 6px;
}

.mention-autocomplete::-webkit-scrollbar-track {
    background: transparent;
}

.mention-autocomplete::-webkit-scrollbar-thumb {
    background: var(--ios-gray-light, #c7c7cc);
    border-radius: 3px;
}

.mention-autocomplete::-webkit-scrollbar-thumb:hover {
    background: var(--ios-gray, #8e8e93);
}

/* Dark Mode Styles */
body.dark-mode .mention-autocomplete {
    background: #17212B;
    border-color: #101921;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
}

body.dark-mode .mention-item {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .mention-item:hover,
body.dark-mode .mention-item.selected {
    background: rgba(10, 132, 255, 0.15);
}

body.dark-mode .mention-item:active {
    background: rgba(10, 132, 255, 0.25);
}

body.dark-mode .mention-avatar {
    background: #1c1c1e;
}

body.dark-mode .mention-avatar .avatar-placeholder {
    color: #0a84ff;
    background: rgba(10, 132, 255, 0.15);
}

body.dark-mode .mention-name {
    color: #ffffff;
}

body.dark-mode .mention-username {
    color: #708499;
}

body.dark-mode .mention {
    color: #0a84ff;
}

body.dark-mode .message-bubble.sent .mention {
    color: rgba(255, 255, 255, 0.95);
}

body.dark-mode .mention-badge {
    background: #0a84ff;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.4);
}

body.dark-mode .mention-badge:hover {
    box-shadow: 0 6px 16px rgba(10, 132, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .mention-autocomplete {
        max-width: calc(100vw - 40px);
        min-width: 260px;
    }
    
    .mention-badge {
        width: 40px;
        height: 40px;
        font-size: 22px;
        top: -45px;
        right: 15px;
    }
}

/* RTL Support */
[dir="rtl"] .mention-autocomplete {
    right: auto;
    left: auto;
}

[dir="rtl"] .mention-badge {
    right: auto;
    left: 20px;
}

@media (max-width: 768px) {
    [dir="rtl"] .mention-badge {
        left: 15px;
    }
}

/* =========================================================
   End of Mention System CSS
   ========================================================= */
