/* === WADUG Mitgliederverwaltung - Stylesheet === */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --bg: #f1f5f9;
    --bg-white: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --border-focus: #93c5fd;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* === Login-Seite === */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #3b82f6 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.login-header p {
    opacity: 0.85;
    margin-top: 0.3rem;
    font-size: 0.9rem;
}

.login-card form {
    padding: 1.5rem;
}

.login-card .form-group {
    margin-bottom: 1rem;
}

.login-card input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.login-error {
    background: #fef2f2;
    color: var(--danger);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    border: 1px solid #fecaca;
}

/* === Header === */

header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 0.15rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-user {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-right: 0.5rem;
}

.btn-header {
    padding: 0.4rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-header:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* === Main === */

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

/* === Toolbar === */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 600px;
}

.search-box input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* === Stats === */

.stats-bar {
    margin-bottom: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* === Buttons === */

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-light);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* === Tabelle === */

.table-container {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

.member-name {
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.member-name:hover {
    text-decoration: underline;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

.action-buttons {
    display: flex;
    gap: 0.4rem;
}

/* === Empty State === */

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}

.empty-state p:first-child {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* === Modal === */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 750px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease-out;
}

.modal-small {
    max-width: 450px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-white);
    border-radius: 12px 12px 0 0;
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.warning {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* === Form === */

form {
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 0.3rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    padding: 0.55rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 0;
    padding-top: 1.2rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
}

/* === Feld-Validierungsfehler === */

.input-error {
    border-color: var(--danger) !important;
    background: #fef2f2;
}

.input-error:focus {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: 0.78rem;
    margin-top: 0.25rem;
    line-height: 1.3;
}

/* === SEPA Button und Modal === */

.toolbar-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-sepa {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
}

.btn-sepa:hover {
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
}

.btn-problem {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    color: white;
}

.btn-problem:hover {
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
}

.modal-sepa {
    max-width: 850px;
}

.sepa-summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.sepa-table-wrap {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.sepa-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sepa-preview-table th {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

.sepa-preview-table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sepa-preview-table code {
    font-size: 0.8rem;
    color: var(--text-light);
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-problem {
    background: #fef3c7;
    color: #92400e;
    margin-left: 0.4rem;
}

.sepa-skipped-title {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

#sepaSkippedList {
    font-size: 0.85rem;
    color: var(--warning);
    padding-left: 1.5rem;
    margin: 0;
}

#sepaSkippedList li {
    margin-bottom: 0.2rem;
}

/* === CSV Import Ergebnis === */

.csv-result-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: #166534;
    margin-bottom: 0.5rem;
}

.csv-result-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--danger);
    max-height: 150px;
    overflow-y: auto;
}

.csv-result-errors ul {
    margin: 0.25rem 0 0 1.25rem;
    padding: 0;
}

.csv-result-errors li {
    margin-bottom: 0.15rem;
}

/* === Toast === */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: toastIn 0.3s ease-out;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

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

/* === Responsive === */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    header {
        padding: 1rem;
    }

    main {
        padding: 1rem;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal {
        padding-top: 1rem;
    }
}
