* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    background: white;
    padding: 30px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 2em;
}

.header-stats {
    display: flex;
    gap: 20px;
}

.header-stats span {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    color: #666;
}

/* Toolbar */
.toolbar {
    background: white;
    padding: 20px 30px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
}

.search-box {
    flex: 1;
    display: flex;
    gap: 10px;
    min-width: 300px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.filter-box select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

button:active {
    transform: translateY(0);
}

/* Content */
.content {
    background: white;
    padding: 30px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 400px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #c62828;
}

/* Adressliste */
.adressen-liste {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.adresse-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
    cursor: pointer;
}

.adresse-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.adresse-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.adresse-name {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.adresse-firma {
    color: #667eea;
    font-size: 0.9em;
    font-weight: 600;
}

.adresse-kategorie {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
}

.adresse-details {
    color: #666;
    font-size: 0.9em;
    line-height: 1.8;
}

.adresse-details div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.adresse-details a {
    color: #667eea;
    text-decoration: none;
}

.adresse-details a:hover {
    text-decoration: underline;
}

.adresse-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.adresse-actions button {
    flex: 1;
    padding: 8px;
    font-size: 0.85em;
}

.btn-edit {
    background: #28a745;
    color: white;
}

.btn-edit:hover {
    background: #218838;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
    position: relative;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #333;
    font-size: 1.5em;
}

.close {
    color: #aaa;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

form {
    padding: 30px;
}

.form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group label {
    margin-bottom: 2px;
    color: #555;
    font-weight: 600;
    font-size: 0.9em;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 5px 6px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .adressen-liste {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1.1em;
}


/* Neue Styles für erweiterte Features */

/* Modal Large */
.modal-large {
    max-width: 900px;
}

/* Section Titles */
.section-title {
    color: #667eea;
    font-size: 1.1em;
    margin: 13px 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #667eea;
}

/* Checkbox Row */
.checkbox-row {
    display: flex;
    gap: 15px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-group-checkbox label {
    margin: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Checkbox Group für Gruppen */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
}

.checkbox-item label {
    flex: 1;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-item label:hover {
    transform: translateX(3px);
}

/* Badges */
.badge-vereinsmitglied {
    background: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    margin-left: 8px;
}

.badge-inaktiv {
    background: #dc3545;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
}

.badge-unterschrieben {
    background: #17a2b8;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
}

.adresse-badges {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.adresse-inaktiv {
    opacity: 0.6;
    border-left-color: #dc3545 !important;
}

/* Datei-Upload */
input[type="file"] {
    padding: 8px;
    border: 2px dashed #ddd;
    border-radius: 6px;
    width: 100%;
    margin-bottom: 10px;
}

.dateien-liste {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.datei-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 8px;
}

.datei-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.datei-icon {
    font-size: 1.2em;
}

.datei-groesse {
    color: #999;
    font-size: 0.85em;
}

.btn-delete-small {
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-delete-small:hover {
    background: #c82333;
}

/* Gruppen Modal */
.gruppen-toolbar {
    margin-bottom: 20px;
}

.add-gruppe-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.add-gruppe-form h3 {
    margin-bottom: 15px;
    color: #333;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.gruppen-liste-modal {
    max-height: 400px;
    overflow-y: auto;
}

.gruppe-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
}

.gruppe-info {
    flex: 1;
}

.gruppe-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.gruppe-beschreibung {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.gruppe-stats {
    color: #999;
    font-size: 0.85em;
}

.gruppe-actions {
    display: flex;
    gap: 8px;
}

.btn-edit-small {
    padding: 5px 10px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-edit-small:hover {
    background: #218838;
}

/* Print Button */
.btn-print {
    background: #17a2b8;
    color: white;
}

.btn-print:hover {
    background: #138496;
}

/* Color Input */
input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .modal-large {
        width: 95%;
    }
    
    .checkbox-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .gruppe-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .gruppe-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Scroll-to-top Button innerhalb von Modals */
.modal-scroll-top-wrap {
    position: sticky;
    bottom: 0;
    height: 0;
    text-align: right;
    z-index: 10;
    pointer-events: none;
}

.modal-scroll-top {
    position: relative;
    bottom: 55px;
    right: 5px;
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    font-size: 1.3em;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.2s, background 0.2s;
    pointer-events: none;
}

.modal-scroll-top.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-scroll-top:hover {
    background: #5a6fd6;
    transform: translateY(-3px);
}
