﻿/* wwwroot/css/internal-chat.css */
/* Chat Interna - Pannello laterale stile WhatsApp/Slack */

/* ============================================
   VARIABILI
   ============================================ */
:root {
    --ic-primary: #667eea;
    --ic-primary-dark: #5a6fd6;
    --ic-primary-light: #eef0ff;
    --ic-success: #28a745;
    --ic-danger: #dc3545;
    --ic-warning: #ffc107;
    --ic-bg: #ffffff;
    --ic-bg-secondary: #f8f9fa;
    --ic-bg-hover: #f1f3f5;
    --ic-text: #212529;
    --ic-text-muted: #6c757d;
    --ic-border: #e9ecef;
    --ic-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    --ic-bubble-mine: #667eea;
    --ic-bubble-mine-text: #ffffff;
    --ic-bubble-other: #f1f3f5;
    --ic-bubble-other-text: #212529;
    --ic-panel-width: 380px;
    --ic-radius: 12px;
    --ic-radius-sm: 8px;
}

/* ============================================
   BOTTONE TOGGLE (nel menu/navbar)
   ============================================ */
#internalChatToggle {
    position: relative;
    cursor: pointer;
}

.ic-unread-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--ic-danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    border: 2px solid white;
    z-index: 1;
}

/* ============================================
   PANNELLO PRINCIPALE
   ============================================ */
.ic-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: var(--ic-panel-width);
    height: 100vh;
    background: var(--ic-bg);
    box-shadow: var(--ic-shadow);
    z-index: 1060;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

    .ic-panel.ic-open {
        right: 0;
    }

.ic-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.ic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--ic-primary) 0%, #764ba2 100%);
    color: white;
    flex-shrink: 0;
}

.ic-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ic-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ic-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: white;
}

.ic-connection-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

    .ic-connection-badge.ic-connected {
        background: #4ade80;
        box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
    }

    .ic-connection-badge.ic-disconnected {
        background: #f87171;
    }

.ic-icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

    .ic-icon-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }

.ic-icon-btn-sm {
    background: none;
    border: none;
    color: var(--ic-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 12px;
}

/* ============================================
   RICERCA
   ============================================ */
.ic-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--ic-bg-secondary);
    border-bottom: 1px solid var(--ic-border);
}

    .ic-search-box i {
        color: var(--ic-text-muted);
        font-size: 13px;
    }

    .ic-search-box input {
        flex: 1;
        border: none;
        background: transparent;
        font-size: 14px;
        outline: none;
        color: var(--ic-text);
    }

        .ic-search-box input::placeholder {
            color: #adb5bd;
        }

/* ============================================
   LISTA CONVERSAZIONI
   ============================================ */
.ic-view {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ic-conversation-list {
    flex: 1;
    overflow-y: auto;
}

.ic-conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f3f5;
}

    .ic-conversation-item:hover {
        background: var(--ic-bg-hover);
    }

    .ic-conversation-item.ic-active {
        background: var(--ic-primary-light);
    }

    .ic-conversation-item.ic-unread {
        background: #fefce8;
    }

        .ic-conversation-item.ic-unread .ic-conv-name {
            font-weight: 700;
        }

        .ic-conversation-item.ic-unread .ic-conv-preview {
            font-weight: 600;
            color: var(--ic-text);
        }

/* Avatar */
.ic-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ic-primary), #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    position: relative;
}

    .ic-avatar.ic-online::after {
        content: '';
        position: absolute;
        bottom: 1px;
        right: 1px;
        width: 10px;
        height: 10px;
        background: var(--ic-success);
        border-radius: 50%;
        border: 2px solid white;
    }

.ic-avatar-group {
    background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
    font-size: 16px;
}

/* Info conversazione */
.ic-conv-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ic-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ic-conv-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ic-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ic-conv-time {
    font-size: 11px;
    color: var(--ic-text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.ic-conv-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ic-conv-preview {
    font-size: 13px;
    color: var(--ic-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.ic-badge {
    background: var(--ic-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
}

.ic-muted-icon {
    color: #adb5bd;
    font-size: 12px;
}

/* ============================================
   VISTA MESSAGGI
   ============================================ */
.ic-messages-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.ic-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--ic-border);
    flex-shrink: 0;
}

.ic-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ic-primary), #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.ic-chat-info {
    flex: 1;
    min-width: 0;
}

.ic-chat-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ic-text);
}

.ic-chat-status {
    display: block;
    font-size: 12px;
}

.ic-status-online {
    color: var(--ic-success);
}

.ic-status-offline {
    color: var(--ic-text-muted);
}

/* Area messaggi */
.ic-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fafbfc;
}

/* Messaggio singolo */
.ic-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: ic-fadeIn 0.2s ease-out;
}

@keyframes ic-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ic-message.ic-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ic-message.ic-other {
    align-self: flex-start;
}

.ic-message.ic-system-message {
    align-self: center;
    max-width: 100%;
    text-align: center;
}

.ic-system-message span {
    background: #e9ecef;
    color: var(--ic-text-muted);
    font-size: 12px;
    padding: 4px 14px;
    border-radius: 20px;
    display: inline-block;
}

/* ============================================
   SEPARATORE DI DATA TRA I MESSAGGI
   ============================================ */
.ic-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    width: 100%;
    margin: 14px 0 4px;
    position: relative;
    pointer-events: none;
}

    .ic-date-separator::before,
    .ic-date-separator::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--ic-border);
        opacity: 0.6;
    }

    .ic-date-separator span {
        background: var(--ic-bg-secondary, #f1f3f5);
        color: var(--ic-text-muted);
        font-size: 11px;
        font-weight: 600;
        padding: 3px 12px;
        margin: 0 10px;
        border-radius: 12px;
        text-transform: capitalize;
        letter-spacing: 0.2px;
        white-space: nowrap;
    }

/* Primo separatore: niente margine sopra */
.ic-messages > .ic-date-separator:first-child {
    margin-top: 0;
}

/* Avatar nel messaggio */
.ic-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ic-primary), #764ba2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Bolla */
.ic-msg-bubble {
    padding: 8px 12px;
    border-radius: var(--ic-radius);
    position: relative;
    word-break: break-word;
}

.ic-mine .ic-msg-bubble {
    background: var(--ic-bubble-mine);
    color: var(--ic-bubble-mine-text);
    border-bottom-right-radius: 4px;
}

.ic-other .ic-msg-bubble {
    background: var(--ic-bubble-other);
    color: var(--ic-bubble-other-text);
    border-bottom-left-radius: 4px;
}

.ic-msg-sender {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ic-primary);
    margin-bottom: 2px;
}

.ic-msg-text {
    font-size: 14px;
    line-height: 1.4;
}

    .ic-msg-text a {
        color: inherit;
        text-decoration: underline;
    }

.ic-mine .ic-msg-text a {
    color: rgba(255, 255, 255, 0.9);
}

.ic-msg-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.ic-msg-time {
    font-size: 10px;
    opacity: 0.6;
}

.ic-edited {
    font-size: 10px;
    font-style: italic;
    opacity: 0.5;
}

/* Azioni messaggio (hover) */
.ic-msg-actions {
    display: none;
    position: absolute;
    top: 2px;
    gap: 2px;
    background: white;
    border: 1px solid var(--ic-border);
    border-radius: 12px;
    padding: 2px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 5;
}

.ic-mine .ic-msg-actions {
    left: 4px;
}

.ic-other .ic-msg-actions {
    right: 4px;
}

.ic-message:hover .ic-msg-actions,
.ic-msg-actions:hover {
    display: flex;
}

.ic-msg-actions button {
    background: white;
    border: 1px solid var(--ic-border);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--ic-text-muted);
    transition: all 0.15s;
}

    .ic-msg-actions button:hover {
        background: var(--ic-bg-hover);
        color: var(--ic-text);
    }

/* Reply quote */
.ic-reply-quote {
    background: rgba(0, 0, 0, 0.08);
    border-left: 3px solid var(--ic-primary);
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 12px;
}

.ic-mine .ic-reply-quote {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.ic-reply-sender {
    display: block;
    font-weight: 600;
    font-size: 11px;
}

.ic-reply-content {
    display: block;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Typing indicator */
.ic-typing-indicator {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--ic-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ic-typing-dots {
    display: flex;
    gap: 3px;
}

    .ic-typing-dots span {
        width: 6px;
        height: 6px;
        background: var(--ic-text-muted);
        border-radius: 50%;
        animation: ic-typingBounce 1.4s infinite ease-in-out;
    }

        .ic-typing-dots span:nth-child(2) {
            animation-delay: 0.2s;
        }

        .ic-typing-dots span:nth-child(3) {
            animation-delay: 0.4s;
        }

@keyframes ic-typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Reply bar */
.ic-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--ic-primary-light);
    border-top: 2px solid var(--ic-primary);
    font-size: 13px;
    flex-shrink: 0;
}

.ic-reply-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ic-primary);
    overflow: hidden;
}

    .ic-reply-info span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Area input */
.ic-input-area {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--ic-border);
    background: white;
    flex-shrink: 0;
}

#icMessageInput {
    flex: 1;
    border: 1px solid var(--ic-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
    transition: border-color 0.2s;
}

    #icMessageInput:focus {
        border-color: var(--ic-primary);
    }

.ic-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ic-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}

    .ic-send-btn:hover {
        background: var(--ic-primary-dark);
        transform: scale(1.05);
    }

/* Emoji button */
.ic-emoji-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: var(--ic-text-muted);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

    .ic-emoji-btn:hover {
        color: var(--ic-primary);
        background: var(--ic-bg-hover);
    }

/* ============================================
   ATTACH BUTTON
   ============================================ */
.ic-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    color: var(--ic-text-muted);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
    position: relative;
}

    .ic-attach-btn:hover {
        color: var(--ic-primary);
        background: var(--ic-bg-hover);
    }

.ic-attach-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--ic-primary);
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* ============================================
   FILE PREVIEW (above input area)
   ============================================ */
.ic-file-preview {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: var(--ic-bg-secondary);
    border-top: 1px solid var(--ic-border);
    overflow-x: auto;
    flex-shrink: 0;
    animation: ic-slideUp 0.2s ease-out;
}

@keyframes ic-slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ic-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid var(--ic-border);
    border-radius: 8px;
    padding: 6px 8px;
    min-width: 0;
    flex-shrink: 0;
    max-width: 180px;
    position: relative;
    animation: ic-fadeIn 0.2s ease-out;
}

.ic-file-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.ic-file-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.ic-file-name {
    font-size: 11px;
    color: var(--ic-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.ic-file-remove {
    background: none;
    border: none;
    color: #adb5bd;
    cursor: pointer;
    padding: 0;
    font-size: 10px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
    flex-shrink: 0;
}

    .ic-file-remove:hover {
        background: var(--ic-danger);
        color: white;
    }

/* ============================================
   UPLOAD PROGRESS BAR
   ============================================ */
.ic-upload-progress {
    padding: 6px 16px;
    background: var(--ic-bg-secondary);
    border-top: 1px solid var(--ic-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ic-upload-progress-bar {
    flex: 1;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.ic-upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ic-primary), #764ba2);
    border-radius: 2px;
    transition: width 0.1s ease;
    width: 0%;
}

.ic-upload-progress-text {
    font-size: 11px;
    color: var(--ic-text-muted);
    white-space: nowrap;
}

/* ============================================
   DRAG & DROP OVERLAY
   ============================================ */
.ic-messages-view.ic-drag-over::after {
    content: '📎 Rilascia i file qui';
    position: absolute;
    inset: 0;
    background: rgba(102, 126, 234, 0.12);
    border: 3px dashed var(--ic-primary);
    border-radius: var(--ic-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--ic-primary);
    z-index: 50;
    pointer-events: none;
    animation: ic-fadeIn 0.15s ease-out;
}

/* ============================================
   MESSAGE ATTACHMENTS (inline in messages)
   ============================================ */
.ic-msg-attachment {
    margin-top: 6px;
}

/* Immagine inline */
.ic-msg-attachment-image img.ic-msg-img {
    max-width: 260px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    object-fit: cover;
    transition: opacity 0.2s;
    border: 1px solid rgba(0,0,0,0.06);
}

    .ic-msg-attachment-image img.ic-msg-img:hover {
        opacity: 0.9;
    }

.ic-msg-attachment-image a {
    display: inline-block;
    text-decoration: none;
}

.ic-msg-attachment-name {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 3px;
}

/* File card (non-immagine) */
.ic-msg-file-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none !important;
    color: inherit !important;
    transition: background 0.15s;
    min-width: 160px;
    max-width: 240px;
}

.ic-mine .ic-msg-file-card {
    background: rgba(255, 255, 255, 0.15);
}

.ic-other .ic-msg-file-card {
    background: rgba(0, 0, 0, 0.04);
}

.ic-mine .ic-msg-file-card:hover {
    background: rgba(255, 255, 255, 0.25);
}

.ic-other .ic-msg-file-card:hover {
    background: rgba(0, 0, 0, 0.08);
}

.ic-msg-file-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.ic-msg-file-info {
    flex: 1;
    min-width: 0;
}

.ic-msg-file-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ic-msg-file-download {
    font-size: 12px;
    opacity: 0.5;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.ic-msg-file-card:hover .ic-msg-file-download {
    opacity: 1;
}

/* Emoji Picker Popup */
.ic-emoji-picker {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    margin-bottom: 6px;
    background: white;
    border: 1px solid var(--ic-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 100;
    max-height: 280px;
    overflow: hidden;
}

    .ic-emoji-picker.ic-show {
        display: block;
    }

.ic-emoji-tabs {
    display: flex;
    border-bottom: 1px solid var(--ic-border);
    padding: 0 4px;
    overflow-x: auto;
}

.ic-emoji-tab {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    flex-shrink: 0;
}

    .ic-emoji-tab:hover,
    .ic-emoji-tab.active {
        opacity: 1;
        border-bottom-color: var(--ic-primary);
    }

.ic-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.ic-emoji-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    border: none;
    background: none;
    transition: background 0.1s, transform 0.1s;
}

    .ic-emoji-item:hover {
        background: var(--ic-bg-hover);
        transform: scale(1.2);
    }

/* ============================================
   LISTA UTENTI (nuova chat / gruppo)
   ============================================ */
.ic-user-list {
    flex: 1;
    overflow-y: auto;
}

.ic-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f3f5;
}

    .ic-user-item:hover {
        background: var(--ic-bg-hover);
    }

    .ic-user-item.ic-selected {
        background: var(--ic-primary-light);
    }

.ic-user-info {
    flex: 1;
    min-width: 0;
}

.ic-user-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ic-text);
}

.ic-user-email {
    display: block;
    font-size: 12px;
    color: var(--ic-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ic-user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ic-dot-online {
    background: var(--ic-success);
}

.ic-dot-offline {
    background: #dee2e6;
}

.ic-check {
    color: var(--ic-primary);
    font-size: 14px;
}

/* Chip selezionati */
.ic-selected-users {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    min-height: 10px;
}

.ic-selected-chip {
    background: var(--ic-primary-light);
    color: var(--ic-primary);
    border: 1px solid var(--ic-primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .ic-selected-chip i {
        cursor: pointer;
        font-size: 10px;
        opacity: 0.6;
    }

        .ic-selected-chip i:hover {
            opacity: 1;
        }

/* Form gruppo */
.ic-group-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ic-input {
    border: 1px solid var(--ic-border);
    border-radius: var(--ic-radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    margin: 12px 16px 0;
    transition: border-color 0.2s;
}

    .ic-input:focus {
        border-color: var(--ic-primary);
    }

.ic-btn-primary {
    background: var(--ic-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--ic-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

    .ic-btn-primary:hover {
        background: var(--ic-primary-dark);
    }

/* ============================================
   STATI
   ============================================ */
.ic-hidden {
    display: none !important;
}

.ic-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--ic-text-muted);
    gap: 10px;
}

.ic-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--ic-text-muted);
    text-align: center;
}

    .ic-empty i {
        font-size: 40px;
        opacity: 0.3;
        margin-bottom: 12px;
    }

    .ic-empty p {
        margin: 0;
        font-size: 14px;
    }

    .ic-empty small {
        font-size: 12px;
        opacity: 0.7;
        margin-top: 4px;
    }

.ic-empty-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #adb5bd;
    text-align: center;
    padding: 40px;
}

    .ic-empty-messages i {
        font-size: 48px;
        opacity: 0.3;
        margin-bottom: 12px;
    }

/* ============================================
   SCROLLBAR
   ============================================ */
.ic-panel ::-webkit-scrollbar {
    width: 5px;
}

.ic-panel ::-webkit-scrollbar-track {
    background: transparent;
}

.ic-panel ::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 10px;
}

    .ic-panel ::-webkit-scrollbar-thumb:hover {
        background: #adb5bd;
    }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 576px) {
    .ic-panel {
        width: 100vw;
        right: -100vw;
    }

        .ic-panel.ic-open {
            right: 0;
        }
}

/* ============================================
   DARK MODE SUPPORT (opzionale)
   ============================================ */
[data-theme="dark"] .ic-panel,
.dark-mode .ic-panel {
    --ic-bg: #1e1e2e;
    --ic-bg-secondary: #181825;
    --ic-bg-hover: #313244;
    --ic-text: #cdd6f4;
    --ic-text-muted: #a6adc8;
    --ic-border: #313244;
    --ic-bubble-other: #313244;
    --ic-bubble-other-text: #cdd6f4;
}

[data-theme="dark"] .ic-emoji-picker,
.dark-mode .ic-emoji-picker {
    background: #1e1e2e;
    border-color: #313244;
}

[data-theme="dark"] .ic-emoji-tabs,
.dark-mode .ic-emoji-tabs {
    border-color: #313244;
}

[data-theme="dark"] .ic-emoji-item:hover,
.dark-mode .ic-emoji-item:hover {
    background: #313244;
}

[data-theme="dark"] .ic-msg-actions,
.dark-mode .ic-msg-actions {
    background: #1e1e2e;
    border-color: #313244;
}

    [data-theme="dark"] .ic-msg-actions button,
    .dark-mode .ic-msg-actions button {
        background: #1e1e2e;
        border-color: #313244;
        color: #a6adc8;
    }

        [data-theme="dark"] .ic-msg-actions button:hover,
        .dark-mode .ic-msg-actions button:hover {
            background: #313244;
            color: #cdd6f4;
        }

[data-theme="dark"] .ic-file-item,
.dark-mode .ic-file-item {
    background: #313244;
    border-color: #45475a;
}

[data-theme="dark"] .ic-file-preview,
.dark-mode .ic-file-preview {
    background: #181825;
    border-color: #313244;
}

[data-theme="dark"] .ic-msg-file-card,
.dark-mode .ic-msg-file-card {
    background: rgba(255,255,255,0.05);
}

/* Date separator - dark mode */
[data-theme="dark"] .ic-date-separator span,
.dark-mode .ic-date-separator span {
    background: #313244;
    color: #a6adc8;
}

[data-theme="dark"] .ic-date-separator::before,
[data-theme="dark"] .ic-date-separator::after,
.dark-mode .ic-date-separator::before,
.dark-mode .ic-date-separator::after {
    background: #45475a;
}

/* ============================================
   BANNER SUPPORTO TECNICO
   ============================================ */
.ic-support-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--ic-primary) 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

    .ic-support-banner:hover {
        filter: brightness(1.1);
        padding-left: 20px;
    }

    .ic-support-banner:active {
        filter: brightness(0.95);
        transform: scale(0.995);
    }

.ic-support-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .ic-support-icon i {
        font-size: 18px;
        color: #fff;
    }

.ic-support-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ic-support-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.2px;
}

.ic-support-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    gap: 5px;
}

    .ic-support-status .ic-dot-online {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #4ade80;
        box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
        display: inline-block;
    }

    .ic-support-status .ic-dot-offline {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
        display: inline-block;
    }

.ic-support-action {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ic-support-banner:hover .ic-support-action {
    background: rgba(255, 255, 255, 0.35);
}

.ic-support-action i {
    font-size: 14px;
    color: #fff;
}

/* Dark mode */
[data-theme="dark"] .ic-support-banner,
.dark-mode .ic-support-banner {
    background: linear-gradient(135deg, #4a5399 0%, #5a3d7a 100%);
}
