/**
 * @mention styles for Done Desk
 */

/* Mention dropdown */
.mention-dropdown {
    display: none;
    position: absolute;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    max-height: 180px;
    overflow-y: auto;
    min-width: 250px;
    z-index: 10000;
}

.mention-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-item:hover,
.mention-item.active {
    background-color: #f8f9fa;
}

.mention-avatar {
    margin-right: 8px;
    flex-shrink: 0;
}

.mention-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.mention-role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    color: white;
    text-transform: uppercase;
}

.mention-role-client .mention-role-badge {
    background-color: #2271b1; /* WordPress blue */
}

.mention-role-agent .mention-role-badge {
    background-color: #00a32a; /* WordPress green */
}

.mention-role-triage_manager .mention-role-badge {
    background-color: #d63638; /* WordPress red */
}

.mention-role-team_owner .mention-role-badge {
    background-color: #8c8f94; /* WordPress gray */
}

.mention-role-team_member .mention-role-badge {
    background-color: #72aee6; /* WordPress light blue */
}

.mention-details {
    flex-grow: 1;
    min-width: 0;
}

.mention-name {
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    line-height: 1.2;
}

.mention-role-label {
    font-size: 11px;
    color: #646970;
    text-transform: capitalize;
    line-height: 1.2;
}

/* Styled mentions in comments */
.done-desk-mention {
    color: var(--done-desk-primary-color, #2271b1);
    font-weight: bold;
    background-color: color-mix(in srgb, var(--done-desk-primary-color, #2271b1) 5%, transparent);
    padding: 2px 4px;
    border-radius: 3px;
    text-decoration: none;
}

.done-desk-mention:hover {
    background-color: color-mix(in srgb, var(--done-desk-primary-color, #2271b1) 10%, transparent);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mention-dropdown {
        background: #1d2327;
        border-color: #3c434a;
        color: #f0f0f1;
    }
    
    .mention-item {
        border-bottom-color: #3c434a;
    }
    
    .mention-item:hover,
    .mention-item.active {
        background-color: #2c3338;
    }
    
    .mention-name {
        color: #f0f0f1;
    }
    
    .mention-role-label {
        color: #a7aaad;
    }
    
    .done-desk-mention {
        background-color: color-mix(in srgb, var(--done-desk-primary-color, #2271b1) 15%, transparent);
        color: var(--done-desk-primary-color, #72aee6);
    }
    
    .done-desk-mention:hover {
        background-color: color-mix(in srgb, var(--done-desk-primary-color, #2271b1) 25%, transparent);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .mention-dropdown {
        min-width: 180px;
        max-width: calc(100vw - 40px);
    }
    
    .mention-item {
        padding: 5px 8px;
    }
    
    .mention-avatar-img {
        width: 24px;
        height: 24px;
    }
    
    .mention-role-badge {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .mention-avatar {
        margin-right: 6px;
    }
    
    .mention-name {
        font-size: 13px;
    }
    
    .mention-role-label {
        font-size: 10px;
    }
}

/* Animation for dropdown appearance */
.mention-dropdown {
    animation: mentionDropdownFadeIn 0.2s ease-out;
}

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

/* Scrollbar styling for dropdown */
.mention-dropdown::-webkit-scrollbar {
    width: 6px;
}

.mention-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mention-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mention-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus states for accessibility */
.mention-item:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

/* Loading state for participants */
.mention-loading {
    padding: 10px;
    text-align: center;
    color: #646970;
    font-style: italic;
    font-size: 12px;
}

.mention-no-results {
    padding: 10px;
    text-align: center;
    color: #646970;
    font-style: italic;
    font-size: 12px;
}

/* Integration with existing comment styles */
.done-desk-comment-textarea {
    position: relative;
}

/* Ensure mentions work well with existing comment display */
.done-desk-comment-content .done-desk-mention {
    display: inline;
    line-height: inherit;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mention-dropdown {
        border-width: 2px;
        border-color: #000;
    }
    
    .mention-item.active {
        background-color: #000;
        color: #fff;
    }
    
    .done-desk-mention {
        border: 1px solid currentColor;
        background-color: transparent;
    }
}
