/* Komunikator - Style CSS - Messenger Style */

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f0f2f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.container {
    flex: 1;
}

/* ============================================================================
   MESSENGER CONTAINER
   ============================================================================ */

.messenger-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    margin: 20px;
}

.messenger-wrapper {
    display: flex;
    height: 100%;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Panel rozmów (dla admina) */
.conversations-panel {
    width: 300px;
    border-right: 1px solid #e4e6eb;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}

.conversations-header {
    padding: 20px;
    border-bottom: 1px solid #e4e6eb;
    background: white;
}

.conversations-header h5 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.conversation-item {
    padding: 12px;
    margin-bottom: 5px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.conversation-item:hover {
    background: #e4e6eb;
}

/* Panel czatu */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

/* Nagłówek czatu */
.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e4e6eb;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
}

/* Kontener wiadomości */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Separator daty */
.date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.date-separator::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: #e4e6eb;
}

.date-separator span {
    background: #f0f2f5;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    color: #65676b;
    position: relative;
    z-index: 1;
}

/* Wrapper wiadomości */
.message-wrapper {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease-in;
}

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

.message-wrapper.message-sent {
    justify-content: flex-end;
}

.message-wrapper.message-received {
    justify-content: flex-start;
}

/* Bąbelek wiadomości */
.message-bubble {
    display: flex;
    gap: 8px;
    max-width: 70%;
    align-items: flex-end;
}

.message-wrapper.message-sent .message-bubble {
    flex-direction: row-reverse;
}

/* Avatar wiadomości */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

/* Zawartość wiadomości */
.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: #65676b;
    padding: 0 8px;
}

/* Tekst wiadomości */
.message-text {
    background: white;
    padding: 10px 12px;
    border-radius: 18px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-wrapper.message-sent .message-text {
    background: #0084ff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-wrapper.message-received .message-text {
    background: #e4e6eb;
    color: #050505;
    border-bottom-left-radius: 4px;
}

.message-text span {
    display: block;
    line-height: 1.4;
}

/* Obrazy w wiadomościach */
.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    display: block;
}

.message-text-image {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.message-text-image .message-image {
    margin: 0;
}

/* Wideo w wiadomościach */
.message-video {
    max-width: 400px;
    max-height: 300px;
    border-radius: 12px;
    display: block;
}

.message-text-video {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.message-text-video .message-video {
    margin: 0;
}

/* Dokumenty w wiadomościach */
.message-document-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    text-decoration: none;
    color: #050505;
    transition: background-color 0.2s;
    border: 1px solid #e4e6eb;
}

.message-wrapper.message-sent .message-document-link {
    background: #00a884;
    color: white;
    border-color: #00a884;
}

.message-wrapper.message-received .message-document-link {
    background: #e4e6eb;
    color: #050505;
    border-color: #d0d2d6;
}

.message-document-link:hover {
    background: #f0f2f5;
    text-decoration: none;
}

.message-wrapper.message-sent .message-document-link:hover {
    background: #008a6b;
}

.message-wrapper.message-received .message-document-link:hover {
    background: #d0d2d6;
}

.message-document-icon {
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

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

.message-document-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-document-size {
    font-size: 12px;
    color: #65676b;
    opacity: 0.8;
}

.message-wrapper.message-sent .message-document-size {
    color: rgba(255, 255, 255, 0.8);
}

.message-text-document {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.message-text-document .message-document-link {
    margin: 0;
}

/* Audio w wiadomościach */
.message-audio {
    width: 250px;
}

.message-text-audio {
    padding: 10px 12px;
}

.message-text-audio .message-audio {
    margin: 0;
}

/* Czas wiadomości */
.message-time {
    font-size: 11px;
    color: #65676b;
    padding: 0 8px;
    margin-top: 2px;
}

.message-wrapper.message-sent .message-time {
    text-align: right;
}

/* Formularz wprowadzania wiadomości */
.chat-input-container {
    padding: 15px 20px;
    border-top: 1px solid #e4e6eb;
    background: white;
}

.chat-input-form {
    margin: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-recipient-select {
    max-width: 150px;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border-radius: 20px;
    border: 1px solid #e4e6eb;
    padding: 10px 15px;
    font-size: 15px;
}

.chat-input:focus {
    border-color: #0084ff;
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.1);
    outline: none;
}

.chat-file-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e4e6eb;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #65676b;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-file-btn:hover {
    background: #d0d2d6;
    color: #050505;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0084ff;
    border: none;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #0066cc;
}

.chat-send-btn svg {
    fill: white;
}

/* Responsywność */
@media (max-width: 768px) {
    .messenger-container {
        margin: 10px;
        height: calc(100vh - 100px);
    }
    
    .conversations-panel {
        display: none;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-recipient-select {
        max-width: 120px;
        font-size: 12px;
    }
    
    .message-image {
        max-width: 250px;
        max-height: 250px;
    }
    
    .message-video {
        max-width: 300px;
        max-height: 250px;
    }
}

/* Kolory dla różnych użytkowników (opcjonalne) */
.user-5d41402abc4b2a76b9719d911017c592 .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-098f6bcd4621d373cade4e832627b4f6 .message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.user-5e884898da28047151d0e56f8ee62999 .message-avatar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.user-7c6a180b36798ca2a61c6c02f7b8e988 .message-avatar {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.user-9f86d081884c7d659a2feaa0c55ad015 .message-avatar {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}
