/**
 * Style modułu wiadomości
 * Używa zmiennych CSS z głównego stylu
 */

/* === Kontener główny === */
.messages-container {
    display: flex;
    height: calc(100vh - var(--header-height, 72px) - 100px);
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
}

/* === Sidebar z konwersacjami === */
.messages-sidebar {
    width: 340px;
    min-width: 280px;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    background: var(--white);
}

.messages-sidebar-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-200);
    gap: 10px;
    min-height: 56px;
}

.messages-sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 15px;
    color: var(--black);
    white-space: nowrap;
}

.messages-sidebar-header h3 svg {
    width: 20px;
    height: 20px;
}

.messages-search {
    flex: 1;
}

.messages-search .form-control {
    width: 100%;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
}

/* === Lista konwersacji === */
.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.conversation-item:hover {
    background: var(--gray-50);
}

.conversation-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.conversation-item.unread {
    background: rgba(0, 0, 255, 0.03);
}

.conversation-item.unread .conv-name {
    font-weight: 600;
}

.conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-weight: 600;
    font-size: 15px;
    color: white;
    text-transform: uppercase;
}

.conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.conv-avatar svg,
.conv-avatar .material-icons {
    width: 22px;
    height: 22px;
    font-size: 22px;
    color: var(--gray-500);
}

.conv-info {
    flex: 1;
    min-width: 0;
}

.conv-name {
    font-weight: 500;
    color: var(--black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-preview {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.encrypted-preview {
    font-style: italic;
    opacity: 0.7;
}

.conv-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.conv-time {
    font-size: 12px;
    color: var(--gray-500);
}

.unread-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Empty state === */
.messages-container .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-500);
}

.messages-container .empty-state svg,
.messages-container .empty-state .material-icons {
    width: 48px;
    height: 48px;
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
    color: var(--gray-400);
}

.messages-container .empty-state p {
    margin: 0 0 16px;
}

/* === Panel główny wiadomości === */
.messages-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
    min-width: 0;
}

.messages-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    text-align: center;
    padding: 40px;
}

.messages-empty-state svg,
.messages-empty-state .material-icons {
    width: 64px;
    height: 64px;
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
    color: var(--gray-400);
}

.messages-empty-state h3 {
    margin: 0 0 8px;
    color: var(--black);
}

.messages-empty-state p {
    margin: 0;
}

/* === Chat panel === */
.messages-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    gap: 12px;
    min-height: 56px;
}

.mobile-back-btn {
    display: none;
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 600;
    font-size: 13px;
    color: white;
    text-transform: uppercase;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar svg,
.chat-avatar .material-icons {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: var(--gray-500);
}

.chat-user-name {
    display: block;
    font-weight: 500;
    color: var(--black);
}

.chat-group-members {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-status {
    font-size: 12px;
    color: var(--success);
}

.chat-actions {
    display: flex;
    gap: 8px;
}

/* === Wiadomości === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.message {
    max-width: 65%;
    display: flex;
}

.message-other {
    align-self: flex-start;
}

.message-own {
    align-self: flex-end;
}

.message-content {
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
}

.message-other .message-content {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}

.message-own .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-sender {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--primary);
}

.message-own .message-sender {
    color: rgba(255,255,255,0.8);
}

.message-text {
    margin: 0;
    word-wrap: break-word;
    line-height: 1.4;
}

/* Linki w wiadomościach */
.msg-link {
    color: inherit;
    text-decoration: underline;
    word-break: break-all;
}

.message-other .msg-link {
    color: var(--primary);
}

.message-own .msg-link {
    color: white;
    opacity: 0.9;
}

.msg-link:hover {
    opacity: 0.8;
}

/* @Mentions */
.msg-mention {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.message-own .msg-mention {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* Cytaty w wiadomościach */
.msg-quote {
    background: rgba(0, 0, 0, 0.08);
    border-left: 3px solid var(--primary);
    padding: 8px 12px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 8px;
    font-size: 13px;
}

.message-own .msg-quote {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.msg-quote-author {
    display: block;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 4px;
    font-size: 12px;
}

.message-own .msg-quote-author {
    color: rgba(255, 255, 255, 0.9);
}

.msg-quote-text {
    display: block;
    color: var(--gray-600);
    line-height: 1.4;
}

.message-own .msg-quote-text {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .msg-quote {
    background: rgba(255, 255, 255, 0.08);
}

/* Message footer z czasem i przyciskiem cytowania */
.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.btn-quote {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
}

.message:hover .btn-quote {
    opacity: 1;
}

.btn-quote:hover {
    color: var(--primary);
}

.message-own .btn-quote {
    color: rgba(255, 255, 255, 0.5);
}

.message-own .btn-quote:hover {
    color: white;
}

.btn-quote .material-icons {
    font-size: 16px;
}

/* Quote preview przy pisaniu */
.quote-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    margin: 0 12px 8px 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

[data-theme="dark"] .quote-preview {
    background: var(--gray-800);
}

.quote-preview-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.quote-preview-icon {
    color: var(--primary);
    display: flex;
}

.quote-preview-icon .material-icons {
    font-size: 20px;
}

.quote-preview-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.quote-preview-sender {
    font-weight: 600;
    font-size: 12px;
    color: var(--primary);
}

.quote-preview-msg {
    font-size: 13px;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .quote-preview-msg {
    color: var(--gray-400);
}

.btn-remove-quote {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    min-width: 24px;
    padding: 0;
    border-radius: 50%;
    background: var(--gray-200) !important;
    color: var(--gray-600) !important;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove-quote:hover {
    background: var(--gray-300) !important;
}

[data-theme="dark"] .btn-remove-quote {
    background: var(--gray-700) !important;
    color: var(--gray-300) !important;
}

[data-theme="dark"] .btn-remove-quote:hover {
    background: var(--gray-600) !important;
}

.btn-remove-quote .material-icons {
    font-size: 16px;
}

/* Zdjęcia w wiadomościach */
.msg-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    margin: 4px 0;
    display: block;
}

.msg-image:hover {
    opacity: 0.9;
}

/* Image Preview */
.image-preview {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin: 0 12px 8px 12px;
}

[data-theme="dark"] .image-preview {
    background: var(--gray-800);
}

.image-preview img {
    max-height: 80px;
    max-width: 120px;
    border-radius: 8px;
    object-fit: cover;
}

.btn-remove-image {
    top: -6px;
    right: -6px;
    background: var(--danger) !important;
    color: white !important;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
}

.btn-remove-image .material-icons {
    font-size: 14px;
}

[data-theme="dark"] .btn-remove-image {
    border-color: var(--gray-900);
}

/* Przycisk załącznika */
.btn-attach {
    color: var(--gray-500);
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-attach:hover {
    color: var(--primary);
    background: var(--gray-100);
}

[data-theme="dark"] .btn-attach:hover {
    background: var(--gray-700);
}

/* Modal podglądu zdjęcia */
.image-view-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.image-view-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.image-view-content img {
    max-width: 95vw;
    max-height: calc(95vh - 60px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.image-view-actions {
    display: flex;
    gap: 12px;
}

.image-view-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.btn-download {
    background: var(--primary);
    color: white !important;
    border: none;
}

.btn-download:hover {
    background: var(--primary-dark, #4338ca);
}

.btn-close-modal {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Animacja ładowania */
@keyframes rotating {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotating {
    animation: rotating 1s linear infinite;
}

.message-time {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* === Input === */
.chat-input-area {
    padding: 16px 20px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-100);
    border-radius: 24px;
    padding: 6px 8px 6px 12px;
}

.chat-input-wrapper .btn-icon {
    flex-shrink: 0;
    align-self: center;
}

.chat-input-wrapper .btn-attach {
    width: 36px;
    height: 36px;
    min-width: 36px;
}

.chat-input-wrapper textarea,
.chat-input-wrapper .message-input-container textarea {
    flex: 1;
    border: none !important;
    background: transparent !important;
    resize: none;
    padding: 8px 4px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    color: var(--black);
    box-shadow: none !important;
    border-radius: 0 !important;
}

.chat-input-wrapper textarea:focus,
.chat-input-wrapper .message-input-container textarea:focus {
    outline: none;
    box-shadow: none !important;
}

.chat-input-wrapper textarea::placeholder {
    color: var(--gray-500);
}

/* Informacja o zarchiwizowanej konwersacji */
.archived-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--gray-100);
    color: var(--gray-600);
    border-radius: 8px;
    font-size: 14px;
}

.archived-notice .material-icons {
    font-size: 20px;
    color: var(--gray-500);
}

[data-theme="dark"] .archived-notice {
    background: var(--gray-800);
    color: var(--gray-400);
}

[data-theme="dark"] .archived-notice .material-icons {
    color: var(--gray-500);
}

.btn-send {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.btn-send:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-send .material-icons {
    font-size: 20px;
    margin-left: 2px;
}

/* Przycisk nowej wiadomości */
.btn-new-message {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(var(--primary-rgb), 0.25);
}

.btn-new-message:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.btn-new-message .material-icons {
    font-size: 20px;
}

.encryption-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--gray-500);
}

.encryption-notice svg,
.encryption-notice .material-icons {
    width: 12px;
    height: 12px;
    font-size: 12px;
}

/* === Header widget === */
/* Style przycisków i badge są w głównym style.css - tutaj tylko dodatki */

/* === Dropdown wiadomości === */
/* Style dropdown są w głównym style.css - tutaj tylko dodatki */

/* === Modal === */
/* Style modala są w głównym style.css */

/* Przycisk zamykania w modal */
.modal-header .btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--gray-500);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.modal-header .btn-icon:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-header .btn-icon .material-icons {
    font-size: 20px;
}

[data-theme="dark"] .modal-header .btn-icon {
    color: var(--gray-400);
}

[data-theme="dark"] .modal-header .btn-icon:hover {
    background: var(--gray-700);
    color: var(--white);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}

/* === Wybór wielu odbiorców === */
.selected-recipients {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 10px;
}

.recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light, rgba(99, 102, 241, 0.1));
    color: var(--primary);
    padding: 4px 8px 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.recipient-chip button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}

.recipient-chip button:hover {
    opacity: 1;
}

/* === Responsive === */
@media (max-width: 992px) {
    .messages-container {
        height: calc(100vh - var(--header-height, 72px) - 80px);
    }
    
    .messages-sidebar {
        width: 280px;
        min-width: 240px;
    }
}

@media (max-width: 768px) {
    .messages-container {
        flex-direction: column;
        height: calc(100vh - 140px);
    }
    
    .messages-sidebar {
        width: 100%;
        height: 100%;
        max-height: none;
        border-right: none;
        border-bottom: none;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
        background: var(--white);
    }
    
    .messages-sidebar.hidden {
        display: none;
    }
    
    .messages-main {
        flex: 1;
        min-height: 0;
        height: 100%;
    }
    
    .messages-chat {
        height: 100%;
    }
    
    .mobile-back-btn {
        display: flex;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-input-area {
        padding: 12px;
    }
    
    .messages-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    
    .messages-sidebar-header {
        flex-wrap: wrap;
    }
    
    .messages-sidebar-header h3 {
        order: 1;
    }
    
    .messages-sidebar-header .messages-search {
        order: 3;
        flex-basis: 100%;
        margin-top: 8px;
    }
    
    .messages-sidebar-header button {
        order: 2;
    }
}

/* === Dark mode adjustments === */
[data-theme="dark"] .messages-container {
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .message-other .message-content {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--black);
}

[data-theme="dark"] .chat-input-wrapper {
    background: var(--gray-200);
}

[data-theme="dark"] .messages-sidebar {
    background: var(--white);
    border-color: var(--gray-200);
}

[data-theme="dark"] .chat-header {
    background: var(--white);
    border-color: var(--gray-200);
}

[data-theme="dark"] .chat-input-area {
    background: var(--white);
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-search .form-control {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--black);
}

[data-theme="dark"] .conversation-item {
    border-color: var(--gray-200);
}

[data-theme="dark"] .conversation-item:hover {
    background: var(--gray-100);
}

[data-theme="dark"] .modal-content {
    background: var(--white);
    border-color: var(--gray-200);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown {
    background: var(--white);
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown-header {
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown-item {
    border-color: var(--gray-200);
}

[data-theme="dark"] .messages-dropdown-item:hover {
    background: var(--gray-100);
}

[data-theme="dark"] .messages-dropdown-footer {
    border-color: var(--gray-200);
}

/* === Chat action buttons === */
.chat-actions .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.chat-actions .btn-icon:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    border-color: var(--gray-300);
}

.chat-actions .btn-icon .material-icons {
    font-size: 18px;
}

[data-theme="dark"] .chat-actions .btn-icon {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-500);
}

[data-theme="dark"] .chat-actions .btn-icon:hover {
    background: var(--gray-200);
    color: var(--black);
}

/* === Typing indicator === */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--gray-500);
    font-size: 13px;
    font-style: italic;
}

.typing-indicator .typing-dots {
    display: flex;
    gap: 3px;
}

.typing-indicator .typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--gray-400);
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-indicator .typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator .typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* === Chat status in header === */
.chat-user-info {
    display: flex;
    flex-direction: column;
}

.chat-user-status {
    font-size: 12px;
    color: var(--gray-500);
}

.chat-user-status.typing {
    color: var(--success);
}

/* === Toast Notifications === */
.message-toast {
    position: fixed;
    top: 20px;
    transform: translateX(-50%) translateY(-100px);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-width: 400px;
}

.message-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.message-toast .material-icons {
    font-size: 24px;
    color: var(--primary);
}

.message-toast .toast-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.message-toast .toast-content strong {
    font-size: 14px;
    color: var(--black);
}

.message-toast .toast-content span {
    font-size: 13px;
    color: var(--gray-600);
}

.message-toast .toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-toast .toast-close:hover {
    color: var(--gray-700);
}

.message-toast .toast-close .material-icons {
    font-size: 18px;
    color: inherit;
}

/* Dark mode toast */
[data-theme="dark"] .message-toast {
    background: var(--gray-800);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .message-toast .toast-content strong {
    color: var(--white);
}

[data-theme="dark"] .message-toast .toast-content span {
    color: var(--gray-300);
}
/* === @Mention dropdown === */
.message-input-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.mention-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid var(--gray-200);
}

[data-theme="dark"] .mention-dropdown {
    background: var(--gray-800);
    border-color: var(--gray-600);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.mention-item:hover,
.mention-item.selected {
    background: var(--gray-100);
}

[data-theme="dark"] .mention-item:hover,
[data-theme="dark"] .mention-item.selected {
    background: var(--gray-700);
}

.mention-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.mention-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mention-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--black);
}

[data-theme="dark"] .mention-name {
    color: var(--gray-100);
}

.mention-role {
    font-size: 12px;
    color: var(--gray-500);
    text-transform: capitalize;
}
/* === Date separator (jak WhatsApp) === */
.date-separator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px 0;
    position: relative;
}

.date-separator span {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

[data-theme="dark"] .date-separator span {
    background: var(--gray-700);
    color: var(--gray-300);
}

/* === Sticky date (pływająca data u góry) === */
/* Styl identyczny z .date-separator span */
.sticky-date {
    position: sticky;
    top: 8px;
    align-self: center;
    display: none; /* Domyślnie ukryta, JS pokazuje gdy potrzeba */
    justify-content: center;
    margin: 0 auto 8px;
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

[data-theme="dark"] .sticky-date {
    background: var(--gray-700);
    color: var(--gray-300);
}

/* Chat area position relative for sticky date */
.chat-area {
    position: relative;
}

