/* base.css - Überarbeitet und konsolidiert */

:root {
    --font-scale: 1;
    /* 1 = 100% */
}

html {
    font-size: calc(15px * var(--font-scale));
    /* Base 15px */
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f7fa;
    color: #2d3748;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
}

.sidebar {
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
    box-shadow: 4px 0 16px rgba(13, 45, 87, 0.08);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@supports (height: 100dvh) {
    .sidebar {
        min-height: 100dvh;
    }
}

@supports (height: 100svh) {
    .sidebar {
        min-height: 100svh;
    }
}

@supports (-webkit-touch-callout: none) {
    .sidebar {
        padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }
}

/* Universeller Container für alle Seiteninhalte */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background-color: #f5f7fa;
    width: 100%;
    box-sizing: border-box;
    /* Verhindert horizontales Überlaufen, aber erlaubt vertikales für Icons */
    overflow-x: hidden;
    overflow-y: visible;
}

/* Umschließt Hauptinhalt inklusive Footer für Sticky Footer Layout */
.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Verhindert horizontales Überlaufen, aber erlaubt vertikales für Icons */
    overflow-x: hidden;
    overflow-y: visible;
}

.main-content.no-navbar {
    margin-left: 0;
}

/* Inhaltsbereich füllt den verfügbaren Platz */
.content-container {
    flex: 1;
    background-color: #f5f7fa;
    /* Verhindert horizontales Überlaufen, aber erlaubt vertikales für Icons */
    overflow-x: hidden;
    overflow-y: visible;
}

/* Footer: Bleibt am unteren Rand, kompaktes Styling */
.footer {
    flex-shrink: 0;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 1rem 0;
    text-align: center;
    font-size: 0.75rem;
    color: #718096;
    width: 100%;
}

.footer p {
    margin: 0;
}

/* Gemeinsamer Header für Seiten */
.page-header {
    max-width: 800px;
    margin: 0 auto 2rem auto;
    text-align: center;
}

.page-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 1.5rem;
}

/* Inhaltsbereich - wird verwendet, um den Hauptseiteninhalt zu umschließen */
.section {
    margin-bottom: 2rem;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    margin: 2rem auto;
    position: relative;
    /* Ensure section is the positioning context */
    /* Verhindert horizontales Überlaufen, aber erlaubt vertikales für Icons */
    overflow-x: hidden;
    overflow-y: visible;
}

/* Zentrierte Karte - spezifischer Stil für Formulare wie Login/Registrierung */
.centered-card {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    max-width: 500px;
    width: 100%;
}

/* Styling für Button-Gruppen zur Zentrierung */
.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* Allgemeine Link-Styles */
a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.text-muted {
    color: #718096;
}

/* Formularelemente */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: #2d3748;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    /* Inputs immer maximal so breit wie ihr Container */
    max-width: 100%;
    /* kein Überschreiten des Containers */
    box-sizing: border-box;
    /* Padding und Border in der Breite berücksichtigen */
    display: block;
    /* verhindert inline-bedingtes Überlaufen */
}

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

.form-check {
    margin-bottom: 0.5rem;
}

.form-check-input {
    border-color: #e2e8f0;
    transition: border-color 0.2s ease;
}

.form-check-input:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.form-check-label {
    font-size: 0.875rem;
    color: #4a5568;
}

.form-check-inline {
    margin-right: 1rem;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
    background-color: #3b82f6;
    border: none;
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2563eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: #6b7280;
    border: none;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #4b5563;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-success {
    background-color: #34d399;
    border: none;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #2bb380;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-danger {
    background-color: #ef4444;
    border: none;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-info {
    background-color: #0dcaf0;
    border: none;
    color: #000000;
}

.btn-info:hover {
    background-color: #3dd5f3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-warning {
    background-color: #ffc107;
    border: none;
    color: #000000;
}

.btn-warning:hover {
    background-color: #ffca2c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn.w-100 {
    padding: 0.75rem;
}

/* Einheitliches Tabellen-Styling */
.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    /* Use auto layout by default */
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
    /* Sicherstellen, dass die Tabelle nicht überläuft */
    max-width: 100%;
    box-sizing: border-box;
}

.table thead {
    background-color: #e0f2fe;
    color: #4a5568;
    font-weight: 500;
}

.table th,
.table td {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
    font-size: 0.875rem;
    color: #4a5568;
    overflow-wrap: break-word;
    /* Erzwingt den Umbruch von langen Wörtern */
    word-break: break-word;
    /* Zusätzlicher Fallback für lange Wörter */
    /* Verhindert horizontales Überlaufen */
    max-width: 0;
    /* Erlaubt Zellen, sich zu verkleinern */
}

.table th {
    font-weight: 600;
    /* Verhindert, dass Header-Spalten zu breit werden */
    white-space: nowrap;
}

/* Spezielle Behandlung für lange Inhalte in Tabellenzellen */
.table td {
    /* Erlaubt Text-Umbruch in Zellen */
    white-space: normal;
    /* Verhindert horizontales Überlaufen */
    max-width: 0;
}

/* login-attempts.css – spezifisch für die Seite */
#loginAttemptsTable {
    table-layout: fixed;
    width: 100%;
}

/* Spalten: User-Agent (4) und Grund (6) dürfen brutal umbrechen */
#loginAttemptsTable th:nth-child(4),
#loginAttemptsTable td:nth-child(4),
#loginAttemptsTable th:nth-child(6),
#loginAttemptsTable td:nth-child(6) {
    overflow-wrap: anywhere;
    /* bricht auch bei / . _ etc. */
    word-break: break-word;
    /* Fallback */
    white-space: normal;
}

/* Horizontales Scrollen nur bei Bedarf - nicht für alle Tabellen */
.section {
    /* overflow-x: auto; - ENTFERNT: verursachte horizontale Scrollbars */
}

/* DataTables Wrapper - horizontales Scrollen nur bei Bedarf */
.dataTables_wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* overflow-x: auto; - ENTFERNT: verursachte horizontale Scrollbars */
}

/* DataTables Tabelle selbst - keine horizontalen Scrollbars */
.dataTables_wrapper .dataTable {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* DataTables Filter und Controls */
.dataTables_filter {
    margin-bottom: 1rem;
    text-align: left;
}

.dataTables_filter label {
    font-size: 0.875rem;
    color: #4a5568;
}

.dataTables_filter input {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 100%;
    max-width: 300px;
}

.dataTables_info {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #4a5568;
}

.dataTables_paginate {
    margin-top: 1rem;
    text-align: center;
}

.dataTables_paginate .paginate_button {
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 4px;
    background-color: #f5f7fa;
    color: #3b82f6;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.dataTables_paginate .paginate_button:hover {
    background-color: #e2e8f0;
}

.dataTables_paginate .paginate_button.current {
    background-color: #3b82f6;
    color: #ffffff;
}

.dataTables_paginate .paginate_button.disabled {
    color: #a0aec0;
    pointer-events: none;
}

/* Nur bei sehr breiten Tabellen horizontales Scrollen erlauben */
.table-responsive {
    overflow-x: auto;
}

/* Spezifische Tabellen, die horizontales Scrollen benötigen */
.table-wide {
    overflow-x: auto;
}

.table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

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

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table a:not(.btn) {
    color: #3b82f6;
    text-decoration: none;
}

.table a:hover {
    text-decoration: underline;
}

/* DataTables Anpassungen - bereinigt */
.dataTables_wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* overflow-x: auto; - ENTFERNT: verursachte horizontale Scrollbars */
}

/* DataTables Tabelle selbst - keine horizontalen Scrollbars */
.dataTables_wrapper .dataTable {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* DataTables Filter und Controls */
.dataTables_filter {
    margin-bottom: 1rem;
    text-align: left;
}

.dataTables_filter label {
    font-size: 0.875rem;
    color: #4a5568;
}

.dataTables_filter input {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 100%;
    max-width: 300px;
}

.dataTables_info {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #4a5568;
}

.dataTables_paginate {
    margin-top: 1rem;
    text-align: center;
}

.dataTables_paginate .paginate_button {
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 4px;
    background-color: #f5f7fa;
    color: #3b82f6;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.dataTables_paginate .paginate_button:hover {
    background-color: #e2e8f0;
}

.dataTables_paginate .paginate_button.current {
    background-color: #3b82f6;
    color: #ffffff;
}

.dataTables_paginate .paginate_button.disabled {
    color: #a0aec0;
    pointer-events: none;
}

/* ===================================== */
/* Schwimmabzeichen - Profilseite Design */
/* ===================================== */
.badges-container {
    display: grid;
    /* Use grid for a clean layout */
    grid-template-columns: 1fr;
    /* One column by default */
    gap: 0.75rem;
    /* Space between badge items */
    margin-top: 1rem;
}

/* For wider screens, make it two columns */
@media (min-width: 768px) {
    .badges-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        /* Adjust minmax as needed */
    }
}

.badge-item-display {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background-color: #f0f4f8;
    /* Light background for badge items */
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease-in-out;
}

.badge-item-display.has-badge {
    background-color: #e6ffed;
    /* A slightly greener background for completed badges */
    border-color: #a7f3d0;
}

.badge-item-display.no-badge {
    opacity: 0.7;
    /* Slightly dim non-achieved badges */
    font-style: italic;
}

.badge-item-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.badge-icon {
    font-size: 1.5rem;
    /* Size of the icon */
    margin-right: 0.75rem;
    color: #38a169;
    /* Green color for icons */
}

.badge-item-display.no-badge .badge-icon {
    color: #a0aec0;
    /* Grey color for icons of non-achieved badges */
}

.badge-info {
    display: flex;
    /* Use flex to align strong and span */
    flex-direction: column;
    /* Stack strong and span vertically */
    flex-grow: 1;
    /* Allow badge-info to take available space */
    /* Add this to potentially fix background issues on text itself */
    background-color: transparent;
    padding: 0;
}

.badge-info strong {
    display: block;
    /* Puts the name on its own line */
    font-size: 0.95rem;
    color: #2d3748;
    background-color: transparent;
    /* Ensure no background on strong */
    padding: 0;
    margin: 0;
}

.badge-info span {
    font-size: 0.85rem;
    color: #4a5568;
    background-color: transparent;
    /* Ensure no background on span */
    padding: 0;
    margin: 0;
}

/* ===================================== */
/* Schwimmabzeichen - Formularseiten Design */
/* ===================================== */
.badge-input-container {
    display: grid;
    grid-template-columns: 1fr;
    /* Single column layout for smaller screens */
    gap: 1.5rem;
    /* Space between badge input groups */
    padding: 1rem;
    background-color: #f8fafc;
    /* Light background for the whole section */
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* For wider screens, make it two columns */
@media (min-width: 768px) {
    .badge-input-container {
        grid-template-columns: repeat(2, 1fr);
        /* Two columns for larger screens */
    }
}

.badge-input-group {
    background-color: #ffffff;
    /* White background for each individual badge input */
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Space between checkbox and date input */
    transition: all 0.2s ease-in-out;
}

.badge-input-group:focus-within {
    border-color: #3b82f6;
    /* Highlight border on focus */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.badge-input-group .form-check {
    margin-bottom: 0;
    /* Remove default margin from form-check */
    display: flex;
    /* Use flex to align checkbox and label */
    align-items: center;
    /* Vertically center them */
}

.badge-input-group .form-check-input {
    margin-top: 0;
    /* Remove default margin-top from Bootstrap */
    margin-right: 0.5rem;
    /* Space between checkbox and label */
}

.badge-input-group .form-check-label {
    font-weight: 600;
    /* Make badge names stand out */
    color: #2d3748;
}

.badge-input-group input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #4a5568;
}

.badge-input-group input[type="date"]:disabled {
    background-color: #edf2f7;
    cursor: not-allowed;
}

/* chat.html <style> oder externe CSS-Datei */
.modal {
    display: none;
    /* bleibt versteckt, bis .show dazukommt */
    position: fixed;
    z-index: 1055;
    /* > 1050, damit Modal über dem Backdrop liegt */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    /* Wird durch Flexbox-Zentrierung des Elternelements weniger wichtig */
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    /* Maximale Breite */
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

/* Styles für die Benutzerliste im Modal */
#userListContainer .form-check {
    padding-left: 1.5em;
    /* Platz für Checkbox */
    margin-bottom: 0.5rem;
}

#userListContainer .form-check-label {
    margin-left: 0.5em;
}

/* Karten-Layout für Mobil (verwendet von mobileView.js) */
.cards {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
}

.card .info {
    font-size: 0.75rem;
    color: #4a5568;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.card .info a {
    color: #3b82f6;
    text-decoration: none;
}

.card .info a:hover {
    text-decoration: underline;
}

.card .actions {
    flex-shrink: 0;
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Styles for announcement cards on dashboard */
.announcements-section .announcement-card {
    padding: 0.5rem 0.75rem;
    /* Adjusted padding */
    font-size: 0.9rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    overflow: hidden;
    display: block;
    /* Override potential flex from .card */
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .05);
    transition: transform .15s ease, box-shadow .15s ease;
    background: #fff;
    margin-bottom: 1rem;
    /* Added margin-bottom here to create space between cards */
}

.announcements-section .announcement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .07);
}

/* ---------------------------------------------
   Titel-Link
--------------------------------------------- */
.announcements-section .card-title a {
    font-family: inherit;
    /* bleibt Calibri             */
    font-size: 1.1rem;
    font-weight: 600;
    color: #0d6efd;
    /* Bootstrap-Primärblau        */
    text-decoration: none;
    text-align: left;
    /* linksbündig                 */
}

.announcements-section .card-title a:hover {
    text-decoration: underline;
}

/* ans Ende von base.css */
.announcements-section .announcement-card,
.announcements-section .card-title a {
    white-space: normal;
    /* darf umbrechen          */
    word-break: break-word;
    /* lange Wörter aufsplitten*/
}


/* ---------------------------------------------
   Snippet (max. 2 Zeilen, Multi-Line Ellipsis)
--------------------------------------------- */
.announcement-snippet span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* nur zwei Zeilen anzeigen    */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal !important;
    /* überschreibt altes nowrap   */
    font-size: .95rem;
    line-height: 1.45;
    text-align: left;
}

/* ---------------------------------------------
   „Mehr lesen“-Link (erscheint per JS)
--------------------------------------------- */
.read-more-link {
    display: inline-block;
    margin-top: .25rem;
    font-size: .9rem;
    font-weight: 500;
    color: #0d6efd;
    text-decoration: none;
    text-align: left;
}

.read-more-link:hover {
    text-decoration: underline;
}

/* ---------------------------------------------
   Meta-Zeile (Autor & Datum)
--------------------------------------------- */
.announcement-meta {
    margin-top: .4rem;
    font-size: .75rem;
    color: #6c757d;
    text-align: left;
}

.announcements-section .announcement-card,
.announcement-detail {
    /* Detailseite gleich mitnehmen */
    position: relative;
    /* Anker für die Icons           */
}

.announcement-actions {
    position: absolute;
    top: .4rem;
    right: .5rem;
    display: flex;
    gap: .25rem;
    opacity: 0;
    /* invisible by default */
    transition: opacity .15s ease;
    z-index: 10;
    /* Ensure icons are above content */
}

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

.announcement-detail .announcement-actions {
    opacity: 1;
    top: 1rem;
    right: 1rem;
}

.announcement-actions .btn {
    padding: .35rem .45rem;
    line-height: 1;
    border-radius: 50%;
    font-size: 1rem;
    /* Icon-Größe                    */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Trix Editor Styling (for announcementForm.html) */
trix-editor {
    min-height: 14rem;
    border: 1px solid #e2e8f0;
    /* Match Bootstrap form control border */
    border-radius: 8px;
    /* Match Bootstrap form control border radius */
    padding: 1rem;
    /* Sufficient padding inside the editor */
    font-size: 1rem;
    /* Match Bootstrap form control font size */
    color: #2d3748;
    /* Match body text color */
    background-color: #ffffff;
    /* White background */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Subtle inner shadow */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    /* Ensure it takes the full width of its container */
    display: block;
    width: 100%;
    box-sizing: border-box;
    /* Include padding and border in the element's total width and height */
}

trix-editor:focus-within {
    /* Style when the editor or its toolbar is focused */
    border-color: #3b82f6;
    /* Primary blue border on focus */
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
    /* Bootstrap-like focus ring */
    outline: none;
    /* Remove default outline */
}

.trix-toolbar {
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
    /* Light background for toolbar */
    padding: 0.5rem 1rem;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    /* Ensure toolbar is also full width and doesn't affect layout */
    display: flex;
    flex-wrap: wrap;
    /* Allow toolbar items to wrap if needed */
    gap: 0.5rem;
    /* Space between button groups */
    width: 100%;
    box-sizing: border-box;
}

.trix-button-row {
    display: flex;
    flex-wrap: wrap;
    /* Allow toolbar buttons to wrap */
    gap: 0.5rem;
    /* Space between button groups */
}

.trix-button-group {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent buttons within a group from wrapping */
}

.trix-button {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.875rem;
    color: #4a5568;
    transition: background-color 0.1s ease, border-color 0.1s ease, box-shadow 0.1s ease;
    cursor: pointer;
    /* Ensure buttons don't collapse and have proper spacing */
    flex-shrink: 0;
}

.trix-button:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e0;
}

.trix-button.active {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.trix-button.active:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Ensure content within Trix editor and rendered content is styled */
.trix-content {
    line-height: 1.6;
    /* Improve readability */
    word-wrap: break-word;
    /* Prevent overflow with long words */
    /* Ensure basic HTML elements within trix-content are styled */
}

.trix-content h1,
.trix-content h2,
.trix-content h3,
.trix-content h4,
.trix-content h5,
.trix-content h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.2;
    color: #1a202c;
    /* Darker color for headings */
}

.trix-content h1 {
    font-size: 2em;
}

.trix-content h2 {
    font-size: 1.75em;
}

.trix-content h3 {
    font-size: 1.5em;
}

.trix-content h4 {
    font-size: 1.25em;
}

.trix-content h5 {
    font-size: 1.1em;
}

.trix-content h6 {
    font-size: 1em;
}

.trix-content p {
    margin-bottom: 1em;
}

.trix-content ul,
.trix-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.trix-content li {
    margin-bottom: 0.5em;
}

.trix-content a {
    color: #3b82f6;
    text-decoration: underline;
}

.trix-content a:hover {
    color: #2563eb;
}


/* Registrierungen – E-Mail-Spalte mit Ellipsis (Existing styles) */
#registrationsTable {
    /* nur dieses eine Grid */
    table-layout: fixed;
    /* verhindert, dass Inhalte die Breite bestimmen */
}


/* Leere-Zustand-Zeile: eine Zelle über volle Breite, kompakt und lesbar */
#registrationsTable .table-empty-state td {
    max-width: none !important;
    padding: 0.75rem 1rem !important;
}

#registrationsTable th:nth-child(2),
#registrationsTable td:nth-child(2),
#registrationsTable .email-col {
    /* gleicher Effekt, falls Klasse verwendet wird */
    max-width: 250px;
    /* an Containerbreite anpassen */
    overflow: hidden !important;
    /* überfließenden Text abschneiden */
    text-overflow: ellipsis !important;
    /* “…” anhängen */
    white-space: nowrap !important;
    /* einzeilig halten */
}

/* Styles for announcement cards on dashboard */
.announcements-section .announcement-card {
    padding: 0.5rem 0.75rem;
    /* Adjusted padding */
    font-size: 0.9rem;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    overflow: hidden;
    display: block;
    /* Override potential flex from .card */
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .05);
    transition: transform .15s ease, box-shadow .15s ease;
    background: #fff;
    margin-bottom: 1rem;
    /* Added margin-bottom here to create space between cards */
}

.announcements-section .announcement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .07);
}

/* ---------------------------------------------
   Titel-Link
--------------------------------------------- */
.announcements-section .card-title a {
    font-family: inherit;
    /* bleibt Calibri             */
    font-size: 1.1rem;
    font-weight: 600;
    color: #0d6efd;
    /* Bootstrap-Primärblau        */
    text-decoration: none;
    text-align: left;
    /* linksbündig                 */
}

.announcements-section .card-title a:hover {
    text-decoration: underline;
}

/* ---------------------------------------------
   Snippet (max. 2 Zeilen, Multi-Line Ellipsis)
--------------------------------------------- */
.announcement-snippet span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* nur zwei Zeilen anzeigen    */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal !important;
    /* überschreibt altes nowrap   */
    font-size: .95rem;
    line-height: 1.45;
    text-align: left;
}

/* ---------------------------------------------
   „Mehr lesen“-Link (erscheint per JS)
--------------------------------------------- */
.read-more-link {
    display: inline-block;
    margin-top: .25rem;
    font-size: .9rem;
    font-weight: 500;
    color: #0d6efd;
    text-decoration: none;
    text-align: left;
}

.read-more-link:hover {
    text-decoration: underline;
}

/* ---------------------------------------------
   Meta-Zeile (Autor & Datum)
--------------------------------------------- */
.announcement-meta {
    margin-top: .4rem;
    font-size: .75rem;
    color: #6c757d;
    text-align: left;
}

.announcements-section .announcement-card,
.announcement-detail {
    /* Detailseite gleich mitnehmen */
    position: relative;
    /* Anker für die Icons           */
}

.announcement-actions {
    position: absolute;
    top: .4rem;
    right: .5rem;
    display: flex;
    gap: .25rem;
    opacity: 0;
    /* invisible by default */
    transition: opacity .15s ease;
    z-index: 10;
    /* Ensure icons are above content */
}

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

.announcement-detail .announcement-actions {
    opacity: 1;
    top: 1rem;
    right: 1rem;
}

.announcement-actions .btn {
    padding: .35rem .45rem;
    line-height: 1;
    border-radius: 50%;
    font-size: 1rem;
    /* Icon-Größe                    */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Add styles for the create announcement button container */
.create-announcement-btn-container {
    position: absolute;
    /* Position relative to the section */
    top: 1rem;
    /* Adjust as needed */
    right: 1.5rem;
    /* Adjust as needed to give space from the edge */
    z-index: 10;
    /* Ensure it's above other content */
}

.create-announcement-btn-container .btn.btn-primary {
    /* Reuse circular button styles or define similar ones */
    padding: .35rem .45rem;
    /* Match .announcement-actions .btn */
    line-height: 1;
    border-radius: 50%;
    /* Make it round */
    font-size: 1rem;
    /* Icon size */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Ensure the '+' text is centered within the round button */
    text-align: center;
}


/* Responsive Anpassungen */

/* Tablet und kleiner */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        /* Verhindert horizontales Überlaufen auf mobilen Geräten */
        overflow-x: hidden;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100vh;
        min-height: 100vh;
        min-height: 100svh;
        z-index: 1000;
        background-color: #ffffff;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        /* Verhindert horizontales Überlaufen auf mobilen Geräten */
        overflow-x: hidden;
    }

    .content-container {
        padding: 0;
        /* Verhindert horizontales Überlaufen auf mobilen Geräten */
        overflow-x: hidden;
    }

    .section {
        padding: 1rem;
        margin-bottom: 1.5rem;
        max-width: 100%;
        /* Verhindert horizontales Überlaufen auf mobilen Geräten */
        overflow-x: hidden;
    }

    .page-header {
        margin: 0 auto 1.5rem auto;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .centered-card {
        padding: 1.5rem;
        max-width: 100%;
        margin: 0 1rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1rem;
    }

    h5 {
        font-size: 0.875rem;
    }

    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    /* Ensure all button variants get proper mobile sizing */
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-warning,
    .btn-info {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    .card .actions form {
        display: inline-block;
    }

    .btn-success.btn-sm,
    .btn-danger.btn-sm {
        width: 2.2rem;
        /* quadratisch */
        height: 2.2rem;
        min-width: 2.2rem;
        /* zur Sicherheit */
        padding: 0;
        /* Textplatz entfernen */
        font-size: 0;
        /* Text verstecken */
        line-height: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ✓  = Genehmigen */
    .btn-success.btn-sm::before {
        content: "\2713";
        font-size: 1.35rem;
        color: inherit;
        /* übernimmt weiß von .btn-success */
    }

    /* ✕ = Ablehnen */
    .btn-danger.btn-sm::before {
        content: "\2715";
        font-size: 1.35rem;
        color: inherit;
    }
}

/* Mobile spezifische Anpassungen (verwendet von mobileView.js) */
@media (max-width: 600px) {
    .table {
        display: table !important;
        /* Ensure table is visible */
        font-size: 0.75rem;
        /* Smaller font for mobile */
        /* Verhindert horizontales Überlaufen auf mobilen Geräten */
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    .table th,
    .table td {
        padding: 0.3rem;
        /* Reduced padding for mobile */
        font-size: 0.75rem;
        /* Verhindert horizontales Überlaufen */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 0;
    }

    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dataTables_length {
        /* Added .dataTables_length */
        display: none !important;
        /* Hide standard DataTables elements on mobile */
    }


    /* Show custom mobile elements on mobile */
    .mobile-search,
    .mobile-info,
    .mobile-pagination {
        display: block;
    }

    .mobile-search input {
        max-width: 100%;
    }

    .card .actions .action-btn {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }

    .announcements-section .card {
        padding: 0.2rem;
        font-size: 0.65rem;
    }

    .announcements-section .card .info {
        font-size: 0.65rem;
    }

    .announcements-section .card .actions .action-btn {
        width: 1.2rem;
        height: 1.2rem;
        font-size: 0.65rem;
    }

    .announcements-section .card-body {
        padding: 0.4rem;
        font-size: 0.65rem;
    }

    .announcements-section .card-body h5 {
        font-size: 0.75rem;
    }

    .announcements-section .card-body .text-muted {
        font-size: 0.6rem;
    }

    .dataTables_paginate {
        text-align: center;
        margin-top: 0.5rem;
    }

    .dataTables_paginate .paginate_button {
        padding: 0.3rem 0.7rem;
        font-size: 0.75rem;
    }

    /* Hide Rolle column in Registrations Table on mobile */
    #registrationsTable .role-column-reg {
        display: none !important;
    }

    /* Styles for the info block in mobile cards */
    .card .info {
        display: flex;
        /* Use flexbox to arrange items */
        flex-direction: column;
        /* Stack items vertically */
        overflow: hidden;
        /* Hide overflow of the flex container */
        flex: 1;
        /* Allow info block to grow */
        font-size: 0.75rem;
        color: #4a5568;
        white-space: normal;
        /* Allow wrapping for the container */
        text-overflow: clip;
        /* Reset text-overflow for the container */
    }

    /* Truncate overflowing email in registrations mobile cards */
    #registrationsCards .card .info .email-display {
        display: block;
        /* Ensure it's on its own line within the flex column */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        /* Prevent wrapping of the email content */
        width: 100%;
        /* Take full width of the info flex item */
        box-sizing: border-box;
    }

    .mobile-view .btn-success.btn-sm,
    .mobile-view .btn-danger.btn-sm {
        width: 1.8rem;
        /* quadratischer Button */
        height: 1.8rem;
        padding: 0;
        /* kein Innenabstand */
        font-size: 0;
        /* Text unsichtbar machen */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* ✓-Symbol für »Genehmigen« */
    .mobile-view .btn-success.btn-sm::before {
        content: "\2713";
        /* Unicode-Haken */
        font-size: 1.1rem;
        line-height: 1;
    }

    /* ✕-Symbol für »Ablehnen« */
    .mobile-view .btn-danger.btn-sm::before {
        content: "\2715";
        /* Unicode-X */
        font-size: 1.1rem;
        line-height: 1;
    }




}

/* Stellt sicher, dass die Tabelle auf Bildschirmen breiter als 600px angezeigt wird */
@media (min-width: 601px) {
    .cards {
        display: none !important;
    }

    .table {
        display: table !important;
        table-layout: auto;
        /* Ensure auto layout on desktop */
        /* Verhindert horizontales Überlaufen auf Desktop */
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate,
    /* Keep showing standard pagination */
    .dataTables_wrapper .dataTables_length {
        /* Keep showing standard length changer */
        display: block !important;
    }

    /* Hide custom mobile elements on desktop */
    .mobile-search,
    .mobile-info,
    .mobile-pagination {
        display: none !important;
    }

    .btn-icon {
        padding: 0.5rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }

    .card .actions form {
        display: inline;
    }

    /* Styles for the Registrations Table on wider screens */
    #registrationsTable th,
    #registrationsTable td {
        /* Ensure cells don't overflow easily but allow content to wrap if needed */
        overflow: visible;
        /* Changed from hidden */
        text-overflow: clip;
        /* Changed from ellipsis */
        white-space: normal;
        /* Allow text to wrap */
        padding: 0.5rem 1rem;
        /* Adjusted padding for desktop table cells */
    }

    #registrationsTable td:nth-child(1) {
        /* Name column */
        width: 25%;
        /* Example width - adjust as needed */
        overflow: hidden;
        /* Added overflow for potential truncation */
        text-overflow: ellipsis;
        /* Added ellipsis for truncation */
        white-space: nowrap;
        /* Prevent wrapping */
    }

    #registrationsTable td:nth-child(2) {
        /* E-Mail column */
        width: 40%;
        /* Example width - adjust as needed */
        overflow: hidden !important;
        /* Enable truncation */
        text-overflow: ellipsis !important;
        /* Show ellipsis */
        white-space: nowrap !important;
        /* Prevent wrapping */
    }

    #registrationsTable td:nth-child(3) {
        /* Rolle column */
        width: 10%;
        /* Keep a relatively small width */
        overflow: hidden;
        /* Added overflow for potential truncation */
        text-overflow: ellipsis;
        /* Added ellipsis for truncation */
        white-space: nowrap;
        /* Prevent wrapping */
    }

    #registrationsTable td:nth-child(4) {
        /* Aktion column */
        width: 1%;
        /* Keep action column tight based on content */
        white-space: nowrap;
        /* Prevent wrapping in action cell */
        overflow: visible;
        /* Ensure buttons isible */
        text-overflow: clip;
        /* Prevent truncation on action buttons */
    }

    #registrationsTable td:nth-child(4) {
        padding: 0.5rem !important;
        text-align: center;
        vertical-align: middle;
    }

    #registrationsTable td:nth-child(4) .button-group {
        display: flex;
        flex-direction: row;
        gap: 0.25rem;
        align-items: center;
        justify-content: center;
    }

    #registrationsTable td:nth-child(4) .button-group .btn {
        padding: 0.2rem 0.5rem;
        /* Smaller button padding */
        font-size: 0.7rem;
        /* Smaller button font size */
    }

    #parentRegistrationsTable td:nth-child(4) {
        padding: 0.5rem !important;
        text-align: center;
        vertical-align: middle;
    }

    #parentRegistrationsTable td:nth-child(4) .button-group {
        display: flex;
        flex-direction: row;
        gap: 0.25rem;
        align-items: center;
        justify-content: center;
    }

    #parentRegistrationsTable td:nth-child(4) .button-group .btn {
        padding: 0.2rem 0.5rem;
        /* Smaller button padding */
        font-size: 0.7rem;
        /* Smaller button font size */
    }

    #registrationsCards .email-display {
        max-width: 100%;
    }


}

@media (max-width: 1366px) {
    .sidebar {
        width: 200px;
        /* etwas schmaler */
        padding: 1.5rem 0.5rem;
        /* weniger Padding */
    }

    .main-content {
        margin-left: 200px;
        /* Verhindert horizontales Überlaufen */
        overflow-x: hidden;
    }

    .container {
        max-width: calc(100% - 2rem);
        /* immer etwas Luft lassen */
        padding: 1rem;
        /* Verhindert horizontales Überlaufen */
        overflow-x: hidden;
    }
}

@media (max-width: 1200px) {
    .sidebar {
        width: 180px;
    }

    .main-content {
        margin-left: 180px;
        /* Verhindert horizontales Überlaufen */
        overflow-x: hidden;
    }

    /* Sektionen und Buttons anpassen */
    .section {
        padding: 1rem;
        /* Verhindert horizontales Überlaufen */
        overflow-x: hidden;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* ----------------------------- */
/* 3. "Phablets" und große Smartphones: bis 992px */
/* ----------------------------- */
@media (max-width: 992px) {

    /* Sidebar ganz einklappen und Mobile-Toggle zeigen */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
    }

    .mobile-nav-toggle {
        display: block;
        /* Button sichtbar machen */
    }

    .main-content {
        margin-left: 0;
        /* Verhindert horizontales Überlaufen */
        overflow-x: hidden;
    }

    /* Falls gewünscht: Container fluid */
    .container {
        max-width: 100%;
        padding: 0.5rem;
        /* Verhindert horizontales Überlaufen */
        overflow-x: hidden;
    }
}