/**
 * Messaging System Styles
 * 
 * Nutzt Theme-Design-System für Konsistenz
 * 
 * @package IT_Expert_Messages
 * @version 1.0.0
 */

/* ===== Messages Container Layout ===== */
.dash-messages-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto 1fr;
    gap: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-height: 600px;
    max-height: 800px;
}

/* ===== Messages Sidebar ===== */
.dash-messages-sidebar {
    border-right: 2px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.dash-messages-header {
    padding: 20px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.dash-messages-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.dash-messages-actions {
    display: flex;
    gap: 8px;
}

.dash-messages-search {
    padding: 16px;
    background: white;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.dash-messages-search svg {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.dash-messages-search input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.dash-messages-search input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dash-messages-tabs {
    display: flex;
    padding: 12px;
    gap: 8px;
    background: white;
    border-bottom: 2px solid #e2e8f0;
}

.dash-messages-tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-messages-tab:hover {
    background: #f1f5f9;
    color: #475569;
}

.dash-messages-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dash-messages-list {
    flex: 1;
    overflow-y: auto;
}

.dash-messages-list::-webkit-scrollbar {
    width: 6px;
}

.dash-messages-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dash-message-item {
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: white;
}

.dash-message-item:hover {
    background: #f8fafc;
}

.dash-message-item.active {
    background: #ede9fe;
    border-left: 3px solid #667eea;
}

.dash-message-item.dash-message-unread {
    background: #f0f9ff;
}

.dash-message-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.dash-message-preview {
    flex: 1;
    min-width: 0;
}

.dash-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.dash-message-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.dash-message-time {
    font-size: 0.75rem;
    color: #94a3b8;
    flex-shrink: 0;
}

.dash-message-text {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-message-item.dash-message-unread .dash-message-text {
    color: #1e293b;
    font-weight: 600;
}

.dash-message-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* ===== Empty State ===== */
.dash-message-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
}

.dash-message-empty-state svg {
    color: #cbd5e1;
    margin-bottom: 16px;
}

.dash-message-empty-state h4 {
    font-size: 1.1rem;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.dash-message-empty-state p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

/* ===== Messages Content ===== */
.dash-messages-content {
    display: flex;
    flex-direction: column;
    background: white;
}

.dash-messages-conversation-header {
    padding: 20px 24px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.dash-conversation-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.dash-conversation-details h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.dash-conversation-status {
    font-size: 0.85rem;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dash-conversation-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #16a34a;
    border-radius: 50%;
}

.dash-conversation-actions {
    display: flex;
    gap: 8px;
}

.dash-conversation-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-conversation-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.dash-conversation-btn.active {
    background: #fef3c7;
    border-color: #fbbf24;
    color: #d97706;
}

/* ===== Messages Thread ===== */
.dash-messages-thread {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8fafc;
}

.dash-messages-thread::-webkit-scrollbar {
    width: 8px;
}

.dash-messages-thread::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dash-message-bubble {
    display: flex;
    gap: 12px;
    max-width: 70%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-message-bubble.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.dash-bubble-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.dash-bubble-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dash-bubble-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

.dash-message-bubble.own .dash-bubble-sender {
    text-align: right;
}

.dash-bubble-text {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    color: #1e293b;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.dash-message-bubble.own .dash-bubble-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dash-bubble-time {
    font-size: 0.75rem;
    color: #94a3b8;
}

.dash-message-bubble.own .dash-bubble-time {
    text-align: right;
}

.dash-message-date-divider {
    text-align: center;
    padding: 16px 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

/* ===== Message Input ===== */
.dash-messages-input-wrapper {
    padding: 20px 24px;
    border-top: 2px solid #e2e8f0;
    background: white;
}

.dash-messages-input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.dash-messages-input-field {
    flex: 1;
    position: relative;
}

.dash-messages-textarea {
    width: 100%;
    min-height: 50px;
    max-height: 120px;
    padding: 12px 48px 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    transition: all 0.2s;
}

.dash-messages-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dash-messages-attach-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-messages-attach-btn:hover {
    background: #e2e8f0;
}

.dash-messages-send-btn {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dash-messages-send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.dash-messages-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Placeholder ===== */
.dash-messages-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.dash-messages-placeholder svg {
    color: #cbd5e1;
    margin-bottom: 24px;
}

.dash-messages-placeholder h3 {
    font-size: 1.5rem;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.dash-messages-placeholder p {
    color: #64748b;
    font-size: 1rem;
    margin: 0 0 24px 0;
}

.dash-messages-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    grid-column: 2;
    grid-row: 1;
    padding: 14px 24px;
    border-bottom: 2px solid #e2e8f0;
    background: white;
    margin-bottom: 0;
}

.dash-messages-topbar .dash-btn {
    gap: 10px;
}

.dash-messages-sidebar {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.dash-messages-content {
    grid-column: 2;
    grid-row: 2;
}

/* ===== New Message Modal ===== */
.dash-messages-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.dash-messages-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dash-messages-modal-header {
    padding: 24px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-messages-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.dash-messages-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-messages-modal-close:hover {
    background: #e2e8f0;
}

.dash-messages-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.dash-user-search {
    position: relative;
    margin-bottom: 20px;
}

.dash-user-search input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.dash-user-search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.dash-user-results {
    max-height: 300px;
    overflow-y: auto;
}

.dash-user-result-item {
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-user-result-item:hover {
    background: #f8fafc;
}

.dash-user-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.dash-user-result-info h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 2px 0;
}

.dash-user-result-info p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .dash-messages-container {
        grid-template-columns: 300px 1fr;
    }
}

@media (max-width: 768px) {
    .dash-messages-container {
        grid-template-columns: 1fr;
        max-height: none;
    }
    
    .dash-messages-sidebar {
        display: none;
    }
    
    .dash-messages-sidebar.mobile-visible {
        display: flex;
    }
    
    .dash-message-bubble {
        max-width: 85%;
    }
}
