:root {
    --primary:       #0031a0;   /* TV Treffelhausen Blau */
    --primary-dark:  #002585;   /* Hover / aktive Elemente */
    --primary-light: #e8eeff;   /* Helle Akzentflächen */
    --accent:        #0031a0;
    --bottom-nav-h:  62px;

    /* Bootstrap-Variablen überschreiben */
    --bs-primary:        #0031a0;
    --bs-primary-rgb:    0, 49, 160;
    --bs-link-color:     #0031a0;
    --bs-link-hover-color: #002585;
}

body {
    background-color: #f0f2f5;
    font-size: 0.95rem;
    /* iOS safe area bottom (home indicator) */
    padding-bottom: env(safe-area-inset-bottom);
}

/* Navbar */
.bg-primary { background-color: var(--primary) !important; }
.navbar-brand { font-size: 1rem; letter-spacing: 0.02em; }
.bg-accent { background-color: var(--accent) !important; }

.navbar-logo {
    height: 40px;
    width: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 0 2px rgba(255,255,255,0.3));
}
.navbar-title {
    font-size: 0.88rem;
    line-height: 1.25;
}
.login-logo-img {
    height: 120px;
    width: auto;
}

/* Hide top nav links + hamburger on mobile (replaced by bottom nav) */
@media (max-width: 991.98px) {
    .navbar-collapse { display: none !important; }
    .navbar-toggler  { display: none !important; }
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-weight: 600;
    padding: 0.85rem 1rem;
}

/* Stat cards */
.stat-card {
    border-left: 4px solid var(--primary);
    transition: transform 0.15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.25;
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success { border-left-color: #198754; }
.stat-card.success .stat-value { color: #198754; }
.stat-card.danger { border-left-color: #dc3545; }
.stat-card.danger .stat-value { color: #dc3545; }

/* Tables */
.table { font-size: 0.875rem; }
.table thead th {
    background-color: var(--primary);
    color: #fff;
    border: none;
    white-space: nowrap;
    font-weight: 500;
}
.table-hover tbody tr:hover { background-color: rgba(0,49,160,0.05); }

/* Badges */
.badge-role-admin      { background-color: #6f42c1; color:#fff; }
.badge-role-kassenwart { background-color: var(--accent); color: #fff; }
.badge-role-kapitaen   { background-color: #0d9488; color: #fff; }
.badge-role-spieler    { background-color: #0d6efd; color:#fff; }

/* Login page */
.login-wrapper {
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport on iOS Safari */
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #1a52c0 100%);
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 1rem;
}
.login-logo {
    font-size: 3rem;
    color: var(--primary);
}

/* Buttons */
.btn-primary { background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent { background-color: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* Mobile table scroll */
.table-responsive { -webkit-overflow-scrolling: touch; }

/* Paid badge */
.paid-badge { font-size: 0.75rem; }

/* Amount display */
.amount { font-family: monospace; font-weight: 600; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

/* Filter card */
.filter-card { border-left: 4px solid var(--accent); }

/* Form labels */
.form-label { font-weight: 500; font-size: 0.875rem; }

/* ═══════════════════════════════════════════════
   BOTTOM NAVIGATION BAR (mobile only)
═══════════════════════════════════════════════ */
.bottom-nav {
    display: none;
}

@media (max-width: 991.98px) {
    /* Padding so content doesn't hide behind bottom nav */
    main.container-fluid {
        padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 0.5rem);
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: #fff;
        border-top: 1px solid #dde1e7;
        box-shadow: 0 -3px 16px rgba(0,0,0,0.09);
        z-index: 1040;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: #9aa0ab;
        font-size: 0.6rem;
        font-weight: 500;
        letter-spacing: 0.01em;
        min-height: 44px;
        padding: 6px 2px;
        border: none;
        background: transparent;
        transition: color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item i {
        font-size: 1.35rem;
        line-height: 1;
    }

    /* Notification badge on nav icons */
    .nav-icon-wrap {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .nav-badge {
        position: absolute;
        top: -6px;
        right: -8px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        background: #dc3545;
        color: #fff;
        font-size: .6rem;
        font-weight: 700;
        line-height: 16px;
        border-radius: 99px;
        text-align: center;
        pointer-events: none;
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    /* FAB-style "+" button in the middle */
    .bottom-nav-fab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav-fab-inner {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: var(--accent);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 3px 12px rgba(0,49,160,0.45);
        margin-top: -18px;
        transition: transform 0.15s, box-shadow 0.15s;
    }
    .bottom-nav-fab-inner i {
        font-size: 1.5rem;
        color: #fff;
    }
    .bottom-nav-fab:active .bottom-nav-fab-inner {
        transform: scale(0.93);
        box-shadow: 0 2px 6px rgba(0,49,160,0.35);
    }
}

/* ═══════════════════════════════════════════════
   MOBILE CARD LIST (replaces tables on phones)
═══════════════════════════════════════════════ */
.m-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    padding: 0.875rem 1rem;
    margin-bottom: 0.625rem;
    border-left: 4px solid var(--primary);
}
.m-card.inactive {
    border-left-color: #adb5bd;
    opacity: 0.7;
}
.m-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
    line-height: 1.3;
}
.m-card-sub {
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 2px;
}
.m-card-meta {
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.m-card-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
}
.m-card-actions .btn {
    flex: 1;
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    min-height: 38px;
}
.m-card-amount {
    font-family: monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}
.m-card-amount.text-danger { color: #dc3545 !important; }

/* ═══════════════════════════════════════════════
   iOS-SPECIFIC FIXES
═══════════════════════════════════════════════ */
@media (max-width: 991.98px) {
    /* Prevent auto-zoom on input focus (iOS requires min 16px) */
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Bigger touch targets */
    .btn {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 38px;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .form-control, .form-select {
        min-height: 44px;
    }

    /* Better modal on iPhone */
    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-content {
        border-radius: 1rem;
    }

    /* Stat card values */
    .stat-card .stat-value { font-size: 1.3rem; }
    .page-header h1 { font-size: 1.15rem; }

    /* Summary mini-cards on strafen.php */
    .sum-mini .fw-bold { font-size: 0.95rem; }
}

/* Smooth scrolling for iOS */
* { -webkit-overflow-scrolling: touch; }
