/* Better Messages Chat Viewer - Frontend Styles */

.bm-chat-viewer {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Detaillierte Fehleranzeige */
.bm-error-details {
    background: #fff2f2;
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.1);
}

.bm-error-details h4 {
    color: #c53030;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.bm-error-details p {
    margin: 8px 0;
    color: #2d3748;
    line-height: 1.5;
}

.bm-error-details strong {
    color: #c53030;
    font-weight: 600;
}

.bm-error-details pre {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
    font-size: 12px;
    color: #4a5568;
    margin: 8px 0;
}

.bm-error-details details {
    margin-top: 15px;
}

.bm-error-details summary {
    cursor: pointer;
    font-weight: 600;
    color: #c53030;
    padding: 5px 0;
}

.bm-error-details summary:hover {
    text-decoration: underline;
}

.bm-error {
    background: #ffeaea;
    border-left: 4px solid #ff6b6b;
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 4px;
    color: #c53030;
    font-weight: 500;
}

.bm-chat-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.bm-chat-viewer-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.bm-chat-viewer-controls {
    display: flex;
    gap: 10px;
}

.bm-chat-viewer-btn {
    padding: 8px 16px;
    background: #c19be9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.bm-chat-viewer-btn:hover {
    background: #005a87;
    color: white;
}

.bm-chat-viewer-btn.secondary {
    background: #6c757d;
}

.bm-chat-viewer-btn.secondary:hover {
    background: #5a6268;
}

.bm-chat-messages {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    max-height: 600px;
    overflow-y: auto;
}

.bm-message-item {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f1f3f4;
    position: relative;
}

.bm-message-item:last-child {
    border-bottom: none;
}

.bm-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.bm-message-content {
    flex: 1;
    min-width: 0;
}

.bm-message-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    gap: 10px;
}

.bm-message-sender {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.bm-message-date {
    font-size: 12px;
    color: #6c757d;
}

.bm-message-text {
    color: #495057;
    line-height: 1.5;
    word-wrap: break-word;
    margin-bottom: 10px;
}

.bm-message-attachments {
    margin-top: 10px;
}

.bm-attachment-item {
    display: inline-block;
    margin: 5px 5px 5px 0;
    position: relative;
}

.bm-attachment-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.3s ease;
    border: 1px solid #e1e5e9;
}

.bm-attachment-image:hover {
    transform: scale(1.05);
}

.bm-attachment-file {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    text-decoration: none;
    color: #495057;
    transition: background-color 0.3s ease;
}

.bm-attachment-file:hover {
    background: #e9ecef;
    color: #495057;
}

.bm-attachment-icon {
    margin-right: 8px;
    font-size: 16px;
}

.bm-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.bm-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #c19be9;
    border-radius: 50%;
    animation: bm-spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes bm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bm-error {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 10px 0;
}

.bm-no-messages {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

/* Image Gallery */
.bm-image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.bm-gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e1e5e9;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.bm-gallery-item:hover {
    transform: scale(1.02);
}

.bm-gallery-image {
    width: 100%;
    height: 200px !important;
    object-fit: cover;
}

.bm-gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 8px;
    font-size: 12px;
}

/* Modal für Bildvorschau */
.bm-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.bm-modal-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    top: 50%;
    transform: translateY(-50%);
}

.bm-modal-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.bm-modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.bm-modal-close:hover {
    color: #ccc;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bm-chat-viewer-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .bm-chat-viewer-controls {
        justify-content: center;
    }
    
    .bm-message-item {
        padding: 12px;
    }
    
    .bm-message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .bm-attachment-image {
        max-width: 150px;
        max-height: 150px;
    }
    
    .bm-image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .bm-gallery-image {
        height: 120px;
    }
}

/* Filter Controls */
.bm-filter-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.bm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bm-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
}

.bm-filter-input {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.bm-filter-input:focus {
    outline: none;
    border-color: #c19be9;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.bm-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.bm-stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    flex: 1;
}

.bm-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #c19be9;
    display: block;
}

.bm-stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    margin-top: 5px;
}

/* Pagination Styles */
.bm-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    border-top: 1px solid #e1e5e9;
}

.bm-pagination-btn {
    background: #c19be9;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.bm-pagination-btn:disabled,
.bm-pagination-btn.disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.bm-pagination-info {
    font-size: 14px;
    color: #495057;
    text-align: center;
}

.bm-pagination-info span {
    font-weight: 600;
}
