/* =====================================================
   NACHRICHTEN-SYSTEM ERWEITERUNG
   Erstellen, Löschen, Sortieren, Filtern
   ===================================================== */

/* Section Header mit Button */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h1 {
    margin: 0;
}

/* Nachrichten Toolbar */
.messages-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.messages-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.messages-filters select {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
}

.messages-filters select:hover {
    border-color: #3b82f6;
}

.messages-filters select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Nachrichten Stats */
.messages-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
}

.messages-stats span {
    color: #64748b;
    font-weight: 500;
}

/* Nachrichtenkarte mit Lösch-Button */
.message-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    transition: all 0.2s;
}

.message-content {
    min-width: 0;
    cursor: pointer;
}

.message-actions {
    display: flex;
    align-items: flex-start;
    padding-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-card:hover .message-actions {
    opacity: 1;
}

/* Icon Buttons */
.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
}

.btn-icon:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.btn-icon.btn-delete:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #ef4444;
}

/* Neue Nachricht Modal */
#newMessageModal .modal-content {
    max-width: 600px;
    width: 90%;
}

.modal-medium {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header i {
    color: #3b82f6;
}

.modal-header .close {
    font-size: 2rem;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-header .close:hover {
    color: #ef4444;
}

.modal-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group label i {
    color: #64748b;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* Modal Background */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .messages-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .messages-filters {
        flex-direction: column;
    }
    
    .messages-filters select {
        width: 100%;
    }
    
    .messages-stats {
        justify-content: space-between;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .message-actions {
        opacity: 1; /* Immer sichtbar auf Mobile */
    }
    
    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .section-header .btn-primary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-form {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
}
