/* Kassabuch - Modernes, luftiges Design */

/* Farbpalette - Hell und Modern */
:root {
    --white: #ffffff;
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --gray-50: #fafbfc;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --text-primary: #212529;
    --text-secondary: #495057;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.6;
}

/* Navbar - Weiß mit gutem Kontrast */
.navbar {
    padding: 0.5rem 1rem;
    background: var(--white) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-bottom: 1px solid var(--gray-200);
}

.navbar-brand {
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 1.1rem;
}

.navbar-brand:hover {
    color: var(--text-secondary) !important;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background-color: var(--gray-100);
}

.nav-link.active {
    color: var(--text-primary) !important;
    background-color: var(--gray-200);
    font-weight: 600;
}

/* Dropdown */
.dropdown-menu {
    background: var(--white);
    border: 1px solid var(--gray-300);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 0.5rem;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    transition: all 0.2s;
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: var(--gray-100);
}

/* Buttons */
.btn-primary {
    background: var(--gray-700);
    border: none;
    color: var(--white);
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--gray-600);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-outline-primary {
    border: 2px solid var(--gray-400);
    color: var(--text-primary);
    background: transparent;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background: var(--gray-700);
    border-color: var(--gray-700);
    color: var(--white);
}

.btn-light {
    background: var(--white);
    border: 2px solid var(--gray-300);
    color: var(--text-primary);
    font-weight: 600;
}

.btn-light:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-outline-light {
    border: 2px solid var(--gray-300);
    color: var(--text-primary);
    background: transparent;
    font-weight: 600;
}

.btn-outline-light:hover {
    background: var(--gray-100);
}

/* Cards - Wie rettungssport.at */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--gray-300);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header.bg-primary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    color: #212529 !important;
}

/* Überschreibe text-white wenn Hintergrund hellgrau ist */
.card-header.bg-primary.text-white,
.card-header.bg-primary .text-white,
.card-header.bg-primary span,
.card-header.bg-primary i {
    color: #212529 !important;
}

.card-header h5 {
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: 1rem;
    color: var(--text-primary);
}

.card-footer {
    background-color: var(--white);
    border-top: 1px solid var(--gray-300);
    padding: 1rem;
}

.card-title {
    color: var(--text-primary);
    font-weight: 600;
}

.card-text {
    color: var(--text-secondary);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-100) 100%);
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    color: var(--text-primary);
    padding: 3rem;
    margin-bottom: 2rem;
}

.hero-section h1 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.hero-section .lead {
    font-weight: 400;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    padding-top: 100px;
    padding-bottom: 2rem;
    min-height: calc(100vh - 200px);
}

/* Footer */
.footer {
    background: var(--gray-100);
    color: var(--text-secondary);
    padding: 2rem 0;
    border-top: 2px solid var(--gray-200);
    font-weight: 500;
}

/* Forms */
.form-control,
.form-select {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 0.625rem 1rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-weight: 500;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gray-600);
    box-shadow: 0 0 0 3px rgba(134,142,150,0.1);
    background: var(--white);
}

.form-control::placeholder {
    color: var(--gray-500);
}

.form-label {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* List Groups */
.list-group-item {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    border-radius: 8px !important;
    color: var(--text-primary);
    font-weight: 500;
}

.list-group-item:hover {
    border-left-color: var(--gray-700);
    background: var(--gray-50);
    transform: translateX(3px);
}

.list-group-item.active {
    background: var(--gray-700);
    border-color: var(--gray-700);
    color: var(--white);
    font-weight: 600;
}

/* Alerts */
.alert {
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    background: var(--white);
    color: var(--text-primary);
    font-weight: 500;
}

.alert-primary {
    background: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--text-primary);
}

/* Tables */
.table {
    border-radius: 8px;
    /* overflow: hidden entfernt - blockiert Touch-Scroll */
    color: var(--text-primary);
}

.table thead th {
    background: var(--gray-100);
    border: none;
    font-weight: 700;
    color: var(--text-primary);
    padding: 1rem;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: all 0.2s;
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody td {
    color: var(--text-primary);
    font-weight: 500;
    padding: 1rem;
}

/* Badges */
.badge {
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    border-radius: 6px;
}

.badge.bg-primary {
    background: var(--gray-700) !important;
    color: var(--white);
}

.badge.bg-warning {
    background: #ffc107 !important;
    color: var(--gray-900);
}

/* News Items */
.news-item {
    border-left: 3px solid var(--gray-500);
    background: var(--white);
    transition: all 0.2s ease;
    border-radius: 8px;
    border: 1px solid var(--gray-300);
    padding: 1rem;
    margin-bottom: 1rem;
}

.news-item:hover {
    background: var(--gray-50);
    border-left-color: var(--gray-700);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.news-item h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.news-item p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Module Cards Icons */
.card-body .fa-3x {
    color: var(--gray-600);
    margin-bottom: 1rem;
}

/* Small Text */
small,
.small,
.text-muted {
    color: var(--text-secondary) !important;
}

/* User Avatar */
.user-avatar {
    width: 80px;
    height: 80px;
    background: var(--gray-700);
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 3px solid var(--gray-300);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--gray-300);
}

.nav-tabs .nav-link {
    color: var(--text-secondary);
    border: none;
    background: transparent;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
}

.nav-tabs .nav-link:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.nav-tabs .nav-link.active {
    background: var(--gray-700);
    color: var(--white);
    border-radius: 8px 8px 0 0;
}

/* Error Pages */
.error-number {
    font-size: 120px;
    font-weight: 800;
    color: var(--gray-700);
}

.link-item {
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-left: 3px solid var(--gray-600);
    color: var(--text-primary);
    font-weight: 600;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.link-item:hover {
    background: var(--gray-50);
    border-left-color: var(--gray-700);
}

/* Override Bootstrap */
.bg-primary {
    background-color: var(--gray-700) !important;
    color: var(--white) !important;
}

.text-primary {
    color: var(--text-primary) !important;
}

.border-primary {
    border-color: var(--gray-600) !important;
}

/* Shadows */
.shadow-sm {
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
}

.shadow {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.shadow-lg {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-200);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-500);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-600);
}


/* Tabellen - Erweitert wie rettungssport.at */
.table {
    margin-bottom: 0;
    width: 100%;
}

.table thead th {
    background-color: var(--gray-100);
    color: var(--text-primary);
    font-weight: 600;
    border-top: none;
    padding: 0.5rem 1rem;
    border-bottom: 2px solid var(--gray-300);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.table td {
    padding: 0.5rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

.table tfoot td {
    font-weight: 700;
    border-top: 2px solid var(--gray-400);
    background-color: var(--gray-100);
}

/* Sortierbare Tabellen */
th.sortable {
    cursor: pointer;
    position: relative;
    padding-right: 1.5rem !important;
    user-select: none;
    transition: all 0.2s;
}

th.sortable:hover {
    background-color: var(--gray-200);
}

th.sortable::after {
    content: "\f0dc";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 0.5rem;
    color: var(--gray-500);
    opacity: 0.5;
}

th.sortable.sort-asc::after {
    content: "\f0de";
    color: var(--gray-700);
    opacity: 1;
}

th.sortable.sort-desc::after {
    content: "\f0dd";
    color: var(--gray-700);
    opacity: 1;
}

/* Tabellen-Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background-color: var(--white);
    border-top: 1px solid var(--gray-300);
    font-size: 0.875rem;
    border-radius: 0 0 8px 8px;
}

.table-pagination-info {
    color: var(--text-secondary);
    font-weight: 500;
}

.table-pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.table-pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    color: var(--gray-700);
    background-color: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.table-pagination-button:hover:not(.disabled) {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
    text-decoration: none;
    color: var(--gray-700);
}

.table-pagination-button.active {
    background-color: var(--gray-700);
    color: var(--white);
    border-color: var(--gray-700);
}

.table-pagination-button.disabled {
    color: var(--gray-400);
    background-color: var(--gray-100);
    cursor: not-allowed;
    opacity: 0.6;
}

.table-pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    color: var(--gray-500);
}

/* Table Responsive Wrapper */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 991px) {
    .hero-section {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding-top: 80px;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
}

/* ============================================
   MOBILE TOUCH-SCROLL FIX
   ============================================ */

/* Ermöglicht horizontales Scrollen in Tabellen auf Touch-Geräten */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: pan-x pan-y;
}

/* Verhindert dass der Body scrollt während Tabelle gescrollt wird */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Tabellen-Container für besseres Touch-Verhalten */
.card .table-responsive {
    margin: 0;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Minimale Breite für Tabellenspalten auf Mobile */
@media (max-width: 768px) {
    .table-responsive table {
        min-width: 600px;
    }
    
    .table-responsive th,
    .table-responsive td {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
    }
    
    /* Erste Spalte fixiert (optional) */
    .table-sticky-first th:first-child,
    .table-sticky-first td:first-child {
        position: sticky;
        left: 0;
        background: var(--white);
        z-index: 1;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }
}

/* Besserer Touch-Target für interaktive Elemente */
@media (max-width: 768px) {
    .btn-sm {
        min-height: 38px;
        min-width: 38px;
        padding: 0.5rem 0.75rem;
    }
    
    .table .btn-sm {
        padding: 0.4rem 0.6rem;
    }
    
    /* Größere Klickflächen in Tabellen */
    .table tbody tr {
        cursor: pointer;
    }
    
    .table tbody td {
        vertical-align: middle;
    }
}

/* Verhindert ungewolltes Zoomen bei Doppeltipp */
* {
    touch-action: manipulation;
}

/* Scroll-Indikator für Tabellen */
.table-scroll-hint {
    position: relative;
}

.table-scroll-hint::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.05));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}

.table-scroll-hint.scrolled-right::after {
    opacity: 0;
}


/* ============================================
   ZUSÄTZLICHE MOBILE FIXES
   ============================================ */

/* Card-Body darf nicht overflow blockieren */
.card-body {
    overflow: visible;
}

/* Tabellen-Container explizit scrollbar */
.card > .table-responsive,
.card-body > .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Auf Mobile: Kein overflow:hidden auf Cards */
@media (max-width: 768px) {
    .card {
        overflow: visible;
    }
    
    /* Scroll-Bereich deutlich machen */
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
        width: calc(100% + 2rem);
    }
    
    /* Tabelle etwas kompakter */
    .table th, .table td {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    /* Aktions-Buttons kleiner */
    .table .btn-group .btn {
        padding: 0.25rem 0.5rem;
    }
}

/* iOS Safari Fix */
@supports (-webkit-touch-callout: none) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========== KONTRAST-REGELN ========== */
/* Bei hellem Hintergrund immer dunkle Schrift */
.bg-light, 
.bg-light *,
.bg-secondary.text-light,
.bg-secondary.text-white,
[class*="bg-light"] {
    color: #212529 !important;
}

/* bg-primary ist in diesem Projekt hellgrau, daher text-white überschreiben */
.bg-primary.text-white,
.bg-primary .text-white,
.bg-primary.text-white *,
.bg-primary span,
.bg-primary i.fas,
.bg-primary i.far {
    color: #212529 !important;
}

/* Buttons in hellgrauem Header sollen eigene Farben behalten */
.bg-primary .btn,
.bg-primary .btn * {
    color: inherit !important;
}
.bg-primary .btn-light,
.bg-primary .btn-light * {
    color: #212529 !important;
}
.bg-primary .btn-success,
.bg-primary .btn-success * {
    color: #fff !important;
}
.bg-primary .btn-danger,
.bg-primary .btn-danger * {
    color: #fff !important;
}
.bg-primary .btn-warning,
.bg-primary .btn-warning * {
    color: #212529 !important;
}

/* Badge-Kontrast verbessern */
.badge.bg-light,
.badge.bg-secondary {
    color: #212529 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
    color: #fff !important;
}

/* Card-Header mit hellem Hintergrund */
.card-header.bg-light,
.card-header.bg-light * {
    color: #212529 !important;
}

/* Sicherstellen dass text-muted sichtbar bleibt */
.text-muted {
    color: #6c757d !important;
}

/* Alert-Kontraste */
.alert-light {
    color: #212529 !important;
    background-color: #f8f9fa !important;
}

/* List-Group Items */
.list-group-item.bg-light,
.list-group-item-light {
    color: #212529 !important;
}

/* =====================================================
   FIX: Pagination in Cards sichtbar machen
   ===================================================== */

/* Card mit Pagination: overflow visible um Pagination nicht abzuschneiden */
.card:has(.table-pagination) {
    overflow: visible;
}
/* Fallback für Browser ohne :has() Support */
.card-with-pagination {
    overflow: visible !important;
}


/* Pagination innerhalb card-body explizit sichtbar */
.card-body .table-pagination {
    position: relative;
    z-index: 10;
    margin-top: 0;
    border-radius: 0;
}

/* Wenn card-body padding:0 hat, braucht Pagination eigenes Padding */
.card-body.p-0 .table-pagination {
    padding: 0.75rem 1rem;
    margin: 0;
}

/* Pagination Buttons besser sichtbar machen */
.table-pagination-button {
    min-width: 2.25rem;
    height: 2.25rem;
    font-size: 0.9rem;
}

.table-pagination-button.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.table-pagination-button:not(.disabled):not(.active):hover {
    background-color: #e9ecef;
    border-color: #0d6efd;
    color: #0d6efd;
}
