/**
 * Communication Tab CSS
 *
 * Styles für den Kommunikation-Tab in allen Dashboards.
 * Ersetzt die Task-Sidebar mit integriertem Channel-basiertem Layout.
 *
 * Layout: 1/3 Channels | 2/3 Messages
 *
 * @version 1.1.0
 * - Individuelle Scrollbars für Kanäle und Nachrichten (nicht das ganze Dashboard)
 */

/* ===== Tab Content Container Override ===== */
/* Verhindert, dass das ganze Dashboard scrollt - nur die Bereiche darin */
/* WICHTIG: .active Klasse erforderlich, damit inaktive Tabs nicht display:flex bekommen */
#tab-kommunikation.active,
[id$="-kommunikation"].dashboard-tab-content.active,
.s1-tab-content#tab-kommunikation.active,
.s2-tab-content#tab-kommunikation.active,
.s3-tab-content#tab-kommunikation.active,
.s4-tab-content#tab-kommunikation.active,
.s5-tab-content#tab-kommunikation.active,
.s6-tab-content#tab-kommunikation.active,
.el-tab-content#tab-kommunikation.active,
.kats-tab-content#tab-kommunikation.active,
.iuk-tab-content#tab-kommunikation.active,
.abschnitt-tab-content#tab-kommunikation.active,
.sichter-tab-content#tab-kommunikation.active,
.audit-tab-content#tab-kommunikation.active,
.etb-tab-content#tab-kommunikation.active {
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

/* ===== Tab Badge (für ungelesene Nachrichten) ===== */
.comm-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger-color, #ef4444);
    color: white;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 6px;
}

/* ===== Main Container ===== */
.communication-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    /* Feste Höhe für den Container - ermöglicht individuelles Scrollen */
    height: calc(100vh - 220px);
    min-height: 350px;
    gap: 0;
    background: var(--bg-primary, #0f172a);
    overflow: hidden;
}

/* ===== Channel List (Left Panel - 1/3) ===== */
.comm-channel-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary, #1e293b);
    border-right: 1px solid var(--border-color, #475569);
    overflow: hidden;
    height: 100%;
}

.comm-channel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color, #475569);
    background: var(--bg-tertiary, #334155);
}

.comm-channel-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary, #f8fafc);
    display: flex;
    align-items: center;
    gap: 8px;
}

.comm-channel-header h3 i {
    color: var(--primary-color, #3b82f6);
}

.comm-channel-list {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
    min-height: 0;
    /* Explizite Höhe für Scrolling */
    height: 0;
}

/* Channel Groups */
.comm-channel-group {
    margin-bottom: 16px;
}

.comm-channel-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comm-channel-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, #475569);
}

/* Channel Items */
.comm-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 2px 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.comm-channel-item:hover {
    background: var(--bg-tertiary, #334155);
}

.comm-channel-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--primary-color, #3b82f6);
}

.comm-channel-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #334155);
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.comm-channel-item.active .comm-channel-icon {
    background: var(--primary-color, #3b82f6);
    color: white;
}

/* Broadcast channel special styling */
.comm-channel-item.broadcast .comm-channel-icon {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.comm-channel-item.broadcast.active .comm-channel-icon {
    background: #fb923c;
    color: white;
}

/* Abschnitt channel special styling */
.comm-channel-item.abschnitt .comm-channel-icon {
    background: rgba(22, 163, 74, 0.2);
    color: #16a34a;
}

.comm-channel-item.abschnitt.active .comm-channel-icon {
    background: #16a34a;
    color: white;
}

.comm-channel-item.abschnitt .comm-channel-name {
    color: #16a34a;
}

.comm-channel-item.abschnitt.active .comm-channel-name {
    color: #16a34a;
    font-weight: 600;
}

/* "Mein Dashboard" Channel - Hervorgehoben */
.comm-my-dashboard-section {
    padding: 0 0 4px 0;
}

.comm-channel-item.my-dashboard {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(147, 51, 234, 0.1) 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    position: relative;
}

.comm-channel-item.my-dashboard:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(147, 51, 234, 0.15) 100%);
    border-color: rgba(59, 130, 246, 0.5);
}

.comm-channel-item.my-dashboard.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(147, 51, 234, 0.2) 100%);
    border-color: var(--primary-color, #3b82f6);
    border-left: 3px solid var(--primary-color, #3b82f6);
}

.comm-channel-item.my-dashboard .my-dashboard-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
}

.comm-channel-item.my-dashboard .comm-channel-name {
    font-weight: 600;
    color: var(--primary-color, #3b82f6);
}

.comm-channel-item.my-dashboard.active .comm-channel-name {
    color: var(--primary-color, #3b82f6);
}

.comm-channel-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--border-color, #475569) 20%, var(--border-color, #475569) 80%, transparent 100%);
    margin: 8px 12px;
}

.comm-channel-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.comm-channel-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comm-channel-item.active .comm-channel-name {
    color: var(--primary-color, #3b82f6);
}

.comm-channel-preview {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.comm-unread-hint {
    color: var(--primary-color, #3b82f6);
    font-weight: 500;
}

.comm-channel-badge {
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    background: var(--primary-color, #3b82f6);
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.comm-channel-badge.urgent {
    background: var(--danger-color, #ef4444);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===== Message Panel (Right Panel - 2/3) ===== */
.comm-message-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.comm-message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color, #475569);
    background: var(--bg-secondary, #1e293b);
}

.comm-message-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.comm-message-header-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #334155);
    border-radius: 8px;
    color: var(--primary-color, #3b82f6);
    font-size: 1rem;
}

.comm-message-header-info h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary, #f8fafc);
}

.comm-message-header-info span {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}

.comm-message-header-actions {
    display: flex;
    gap: 8px;
}

/* Filter Tabs */
.comm-filter-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 20px;
    background: var(--bg-tertiary, #334155);
    border-bottom: 1px solid var(--border-color, #475569);
}

.comm-filter-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-color, #475569);
    border-radius: 6px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.comm-filter-tab:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
    border-color: var(--primary-color, #3b82f6);
}

.comm-filter-tab.active {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: white;
}

.comm-filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.comm-filter-tab.active .comm-filter-count {
    background: rgba(255, 255, 255, 0.3);
}

/* Message List */
.comm-message-list {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    min-height: 0;
    /* Explizite Höhe für Scrolling */
    height: 0;
}

/* Task/Message Cards */
.comm-task-card {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #475569);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comm-task-card:hover {
    border-color: var(--primary-color, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.comm-task-card.unread {
    border-left: 4px solid var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.08);
}

.comm-task-card.priority-urgent {
    border-left-color: var(--danger-color, #ef4444);
}

.comm-task-card.priority-high {
    border-left-color: var(--warning-color, #fb923c);
}

.comm-task-card.unread.priority-urgent,
.comm-task-card.unread.priority-high {
    background: rgba(239, 68, 68, 0.08);
}

.comm-task-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.comm-task-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    line-height: 1.4;
    flex: 1;
}

.comm-task-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Priority & Status Badges */
.comm-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.comm-badge.priority-low {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.comm-badge.priority-normal {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.comm-badge.priority-high {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.comm-badge.priority-urgent {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.comm-badge.status-pending {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.comm-badge.status-in_progress {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.comm-badge.status-completed {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.comm-badge.status-cancelled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Gelesen/Ungelesen Badges */
.comm-badge.read-status-unread {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
    animation: pulse-unread 2s ease-in-out infinite;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comm-badge.read-status-unread i {
    font-size: 0.65rem;
}

.comm-badge.read-status-read {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comm-badge.read-status-read i {
    font-size: 0.65rem;
}

@keyframes pulse-unread {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.comm-task-description {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.comm-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}

.comm-task-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.comm-task-meta-item i {
    color: var(--primary-color, #3b82f6);
    font-size: 0.75rem;
}

/* Checklist Progress in Card */
.comm-task-checklist-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color, #475569);
}

.comm-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color, #475569);
    border-radius: 3px;
    overflow: hidden;
}

.comm-progress-fill {
    height: 100%;
    background: var(--success-color, #22c55e);
    transition: width 0.3s ease;
}

.comm-progress-text {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    min-width: 40px;
    text-align: right;
}

/* Empty State */
.comm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted, #64748b);
    text-align: center;
}

.comm-empty-state i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.comm-empty-state h4 {
    color: var(--text-secondary, #94a3b8);
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.comm-empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

/* Create Task Button */
.comm-create-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    background: var(--bg-tertiary, #334155);
    border: 2px dashed var(--border-color, #475569);
    border-radius: 8px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comm-create-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color, #3b82f6);
    color: var(--primary-color, #3b82f6);
}

.comm-create-btn i {
    font-size: 1rem;
}

/* ===== Task Detail Modal Extensions ===== */
.comm-detail-section {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.comm-detail-section h4 {
    color: var(--text-primary, #f8fafc);
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comm-detail-section h4 i {
    color: var(--primary-color, #3b82f6);
}

/* Target Dashboards Display */
.comm-target-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.comm-target-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color, #3b82f6);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.comm-target-tag i {
    font-size: 0.75rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .communication-container {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .communication-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .comm-channel-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color, #475569);
        max-height: 200px;
    }

    .comm-channel-list {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 8px;
        gap: 8px;
    }

    .comm-channel-group {
        display: flex;
        gap: 4px;
        margin-bottom: 0;
    }

    .comm-channel-group-title {
        display: none;
    }

    .comm-channel-item {
        flex-shrink: 0;
        padding: 8px 12px;
        min-width: auto;
    }

    .comm-channel-info {
        display: none;
    }

    .comm-channel-icon {
        margin: 0;
    }

    .comm-channel-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        font-size: 0.65rem;
    }

    .comm-channel-item {
        position: relative;
    }

    .comm-filter-tabs {
        overflow-x: auto;
        padding: 8px 16px;
    }

    .comm-filter-tab {
        flex-shrink: 0;
    }
}

/* ===== Scrollbar Styling ===== */
.comm-channel-list::-webkit-scrollbar,
.comm-message-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.comm-channel-list::-webkit-scrollbar-track,
.comm-message-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary, #1e293b);
    border-radius: 4px;
}

.comm-channel-list::-webkit-scrollbar-thumb,
.comm-message-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #475569);
    border-radius: 4px;
    border: 2px solid var(--bg-tertiary, #1e293b);
}

.comm-channel-list::-webkit-scrollbar-thumb:hover,
.comm-message-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color, #3b82f6);
}

/* Firefox scrollbar styling */
.comm-channel-list,
.comm-message-list {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color, #475569) var(--bg-tertiary, #1e293b);
}

/* ===== Loading State ===== */
.comm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted, #64748b);
}

.comm-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== View Mode Tabs (Aufgaben / Nachrichten) ===== */
.comm-view-mode-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-secondary, #1e293b);
    border-bottom: 1px solid var(--border-color, #475569);
}

.comm-view-mode-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-tertiary, #334155);
    border: 1px solid var(--border-color, #475569);
    border-radius: 8px;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comm-view-mode-tab:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
    border-color: var(--primary-color, #3b82f6);
}

.comm-view-mode-tab.active {
    background: var(--primary-color, #3b82f6);
    border-color: var(--primary-color, #3b82f6);
    color: white;
}

.comm-view-mode-tab i {
    font-size: 1rem;
}

.comm-mode-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger-color, #ef4444);
    color: white;
    border-radius: 9px;
    font-size: 0.7rem;
    font-weight: 600;
}

.comm-view-mode-tab.active .comm-mode-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== Message Cards ===== */
.comm-message-card {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #475569);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comm-message-card:hover {
    border-color: var(--primary-color, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.comm-message-card.unread {
    border-left: 4px solid var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.08);
}

.comm-message-card.priority-urgent {
    border-left-color: var(--danger-color, #ef4444);
}

.comm-message-card.priority-high {
    border-left-color: var(--warning-color, #fb923c);
}

.comm-message-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.comm-message-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.comm-message-card-title i {
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
}

/* Absender-Rolle in Klammern */
.sender-role {
    color: var(--text-muted, #64748b);
    font-weight: 400;
    font-size: 0.85em;
}

.comm-message-card-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.comm-message-card-preview {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.comm-message-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}

.comm-message-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.comm-message-meta-item i {
    color: var(--primary-color, #3b82f6);
    font-size: 0.75rem;
}

/* ===== Message Create Modal - Attachments ===== */
.msg-attachments-area {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 12px;
}

.msg-attachment-list {
    margin-bottom: 12px;
    max-height: 150px;
    overflow-y: auto;
}

.msg-no-attachments {
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    text-align: center;
    padding: 8px 0;
}

.msg-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-secondary, #1e293b);
    border-radius: 6px;
    margin-bottom: 6px;
}

.msg-attachment-item i {
    color: var(--primary-color, #3b82f6);
    font-size: 1rem;
}

.msg-attachment-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-attachment-size {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    flex-shrink: 0;
}

.btn-remove-attachment {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-remove-attachment:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color, #ef4444);
}

.msg-attachment-add {
    display: flex;
    align-items: center;
    gap: 12px;
}

.msg-attachment-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
}

/* ===== Message Detail Modal ===== */
.message-detail-modal {
    max-width: 700px;
}

.msg-detail-header-info {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.msg-detail-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.msg-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 8px;
}

.msg-detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.msg-detail-meta i {
    color: var(--primary-color, #3b82f6);
}

.msg-detail-meta strong {
    color: var(--text-primary, #f8fafc);
}

.msg-detail-time {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 6px;
}

.msg-detail-time i {
    color: var(--text-muted, #64748b);
}

.msg-detail-content {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.msg-detail-content h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-primary, #f8fafc);
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-detail-content h4 i {
    color: var(--primary-color, #3b82f6);
}

.msg-detail-text {
    font-size: 0.95rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.7;
    white-space: pre-wrap;
}

/* Reply Info Box */
.msg-reply-info {
    background: var(--bg-tertiary, #0f172a);
    border-left: 3px solid var(--primary-color, #3b82f6);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.msg-reply-info i {
    color: var(--primary-color, #3b82f6);
}

.msg-reply-info span {
    color: var(--text-secondary, #94a3b8);
}

.msg-reply-info strong {
    color: var(--text-primary, #f8fafc);
}

.msg-reply-sender {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted, #64748b) !important;
}

/* Status Info Badge (for replies) */
.comm-badge.status-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color, #3b82f6);
}

/* Message Detail Attachments */
.msg-detail-attachments {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 16px;
}

.msg-detail-attachments h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-primary, #f8fafc);
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-detail-attachments h4 i {
    color: var(--primary-color, #3b82f6);
}

.msg-attachment-download-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-attachment-download-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #475569);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.msg-attachment-download-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color, #3b82f6);
}

.msg-attachment-download-item i:first-child {
    font-size: 1.2rem;
    color: var(--primary-color, #3b82f6);
}

.msg-attachment-download-item .msg-attachment-name {
    flex: 1;
    font-weight: 500;
}

.msg-attachment-download-item .msg-attachment-size {
    font-size: 0.8rem;
}

.msg-attachment-download-item i:last-child {
    color: var(--text-muted, #64748b);
    font-size: 0.9rem;
}

.msg-attachment-download-item:hover i:last-child {
    color: var(--primary-color, #3b82f6);
}

/* ===== Task Target Grid (für Aufgaben und Nachrichten) ===== */
.task-target-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.task-target-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 10px;
    background: var(--bg-tertiary, #0f172a);
    border: 2px solid var(--border-color, #334155);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 80px;
}

.task-target-tile:hover {
    border-color: var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

.task-target-tile.selected {
    border-color: var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.task-target-tile.selected .task-target-icon {
    color: var(--primary-color, #3b82f6);
}

.task-target-tile.selected .task-target-label {
    color: var(--primary-color, #3b82f6);
}

.task-target-tile.selected .task-target-check {
    opacity: 1;
    transform: scale(1);
}

.task-target-tile.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.task-target-icon {
    font-size: 1.5rem;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 8px;
    transition: color 0.2s;
}

.task-target-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary, #94a3b8);
    text-align: center;
    transition: color 0.2s;
}

.task-target-check {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--primary-color, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.task-target-check i {
    color: white;
    font-size: 0.65rem;
}

/* Abschnitt Tiles - green accent */
.task-target-tile.abschnitt-tile {
    border-color: rgba(22, 163, 74, 0.4);
    background: rgba(22, 163, 74, 0.1);
}

.task-target-tile.abschnitt-tile:hover {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.15);
}

.task-target-tile.abschnitt-tile.selected {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.2);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.3);
}

.task-target-tile.abschnitt-tile .task-target-icon {
    color: #16a34a;
}

.task-target-tile.abschnitt-tile .task-target-label {
    color: #16a34a;
}

.task-target-tile.abschnitt-tile .task-target-check {
    background: #16a34a;
}

/* ===== Message Create Modal ===== */
.message-create-modal {
    max-width: 650px;
}

/* Message Recipient Grid (gleich wie Task Target Grid) */
.msg-recipient-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.msg-recipient-tile {
    cursor: pointer;
}

.msg-recipient-tile.broadcast {
    grid-column: span 4;
    background: rgba(251, 146, 60, 0.1);
    border-color: rgba(251, 146, 60, 0.3);
}

.msg-recipient-tile.broadcast .task-target-icon {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.msg-recipient-tile.broadcast.selected {
    background: rgba(251, 146, 60, 0.2);
    border-color: #fb923c;
}

.msg-recipient-tile.broadcast.selected .task-target-icon {
    background: #fb923c;
    color: white;
}

.msg-recipient-tile.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.msg-recipient-tile.disabled:hover {
    transform: none;
    border-color: var(--border-color, #475569);
}

@media (max-width: 600px) {
    .msg-recipient-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .msg-recipient-tile.broadcast {
        grid-column: span 3;
    }
}

/* ===== Dashboard Container Override für Kommunikations-Tab ===== */
/* Verhindert, dass das Dashboard scrollt, wenn der Kommunikations-Tab aktiv ist */

/* Klasse wird per JS hinzugefügt wenn der Tab aktiviert wird */
.comm-tab-active {
    overflow: hidden !important;
}

/* ===== Request Create Modal (Anforderungen) ===== */
.request-create-modal {
    max-width: 650px;
}

/* Request Target Grid (für Abschnitte) */
.request-target-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.request-target-tile {
    cursor: pointer;
}

.request-target-tile[data-target="stab"] {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
}

.request-target-tile[data-target="stab"] .task-target-icon {
    color: #fbbf24;
}

.request-target-tile[data-target="stab"].selected {
    background: rgba(251, 191, 36, 0.2);
    border-color: #fbbf24;
}

.request-target-tile[data-target="stab"].selected .task-target-icon {
    background: #fbbf24;
    color: white;
}

.request-target-tile[data-target="stab"].selected .task-target-check {
    background: #fbbf24;
}

.request-target-tile.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.request-target-tile.disabled:hover {
    transform: none;
    border-color: var(--border-color, #475569);
}

/* Warning Button Style (für Anforderung senden) */
.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
}

.btn-warning:hover {
    background: #d97706;
}

/* Request Sections Loading/Empty State */
.request-sections-loading {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.request-sections-loading i {
    margin-right: 8px;
    color: var(--primary-color, #3b82f6);
}

.request-sections-empty {
    padding: 8px 12px;
    text-align: center;
    grid-column: span 4;
}

@media (max-width: 600px) {
    .request-target-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .request-sections-empty {
        grid-column: span 3;
    }
}

/* ===== Replies Section (Message Detail Modal) ===== */
.msg-detail-replies {
    background: var(--bg-tertiary, #0f172a);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.msg-detail-replies h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-primary, #f8fafc);
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-detail-replies h4 i {
    color: var(--primary-color, #3b82f6);
}

.msg-replies-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-reply-item {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #475569);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
}

.msg-reply-item:hover {
    border-color: var(--primary-color, #3b82f6);
}

.msg-reply-item.unread {
    border-left: 3px solid var(--primary-color, #3b82f6);
    background: rgba(59, 130, 246, 0.05);
}

.msg-reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.msg-reply-sender-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-primary, #f8fafc);
}

.msg-reply-sender-info i {
    color: var(--primary-color, #3b82f6);
    font-size: 0.8rem;
}

.msg-reply-role {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 400;
    margin-left: 4px;
}

.msg-reply-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
}

.msg-reply-time i {
    font-size: 0.7rem;
}

.msg-reply-content {
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.6;
}

/* ===== Inline Reply Section (Message Detail Modal) ===== */
.msg-inline-reply-section {
    background: var(--bg-tertiary, #0f172a);
    border: 1px solid var(--border-color, #475569);
    padding: 16px;
    margin: 0 24px 16px 24px;
    border-radius: 8px;
    box-sizing: border-box;
}

.msg-inline-reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #f8fafc);
}

.msg-inline-reply-header i {
    color: var(--primary-color, #3b82f6);
}

.msg-inline-reply-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-inline-reply-form .form-textarea {
    width: 100%;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #475569);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.msg-inline-reply-form .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.msg-inline-reply-form .form-textarea::placeholder {
    color: var(--text-muted, #64748b);
}

.msg-inline-reply-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.msg-inline-reply-actions .form-select-sm {
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #475569);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.85rem;
    min-width: 100px;
}

.msg-inline-reply-actions .form-select-sm:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
}

.msg-inline-reply-actions .btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Responsive Anpassungen */
@media (max-width: 600px) {
    .msg-inline-reply-section {
        padding: 12px;
    }

    .msg-inline-reply-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    .msg-inline-reply-actions .form-select-sm {
        flex: 1;
        min-width: 0;
    }

    .msg-inline-reply-actions .btn-sm {
        flex: 1;
        justify-content: center;
    }
}

/* ===== Search Box in Message Header ===== */
.comm-message-header-search {
    flex: 1;
    max-width: 320px;
    margin: 0 16px;
}

.comm-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary, #334155);
    border: 1px solid var(--border-color, #475569);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.2s ease;
}

.comm-search-box:focus-within {
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.comm-search-box i.fa-search {
    color: var(--text-muted, #64748b);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.comm-search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}

.comm-search-box input::placeholder {
    color: var(--text-muted, #64748b);
}

.comm-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--bg-hover, rgba(255, 255, 255, 0.1));
    border: none;
    border-radius: 50%;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.comm-search-clear:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color, #ef4444);
}

.comm-search-clear i {
    font-size: 0.7rem;
}

/* Responsive Anpassungen für Search Box */
@media (max-width: 1024px) {
    .comm-message-header-search {
        max-width: 240px;
        margin: 0 12px;
    }
}

@media (max-width: 768px) {
    .comm-message-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .comm-message-header-search {
        order: 3;
        flex: 1 0 100%;
        max-width: none;
        margin: 8px 0 0 0;
    }

    .comm-search-box {
        padding: 10px 14px;
    }
}

/* ===== Reply Message Card Styling ===== */
.comm-message-card.is-reply {
    border-left: 3px solid var(--info-color, #06b6d4);
    background: rgba(6, 182, 212, 0.05);
}

.comm-message-card.is-reply:hover {
    border-left-color: var(--info-color, #06b6d4);
}

.comm-message-card.is-reply .comm-message-card-title i.fa-reply {
    color: var(--info-color, #06b6d4);
    margin-right: 4px;
}
