:root {
    --ehbs-red: #E30613;
    --ehbs-red-dark: #b50510;
    --ehbs-black: #1a1a1a;
    --ehbs-proxy: #6f42c1;
    --ehbs-proxy-dark: #59339d;
}

/* Proxy-Aktionen (Manager handelt im Namen eines anderen Nutzers) */
/* Bootstrap 5 erfordert CSS-Variablen-Overrides fuer Button-Varianten */
.btn-proxy {
    --bs-btn-color: #fff;
    --bs-btn-bg: #6f42c1;
    --bs-btn-border-color: #6f42c1;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #59339d;
    --bs-btn-hover-border-color: #59339d;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #59339d;
    --bs-btn-active-border-color: #59339d;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #6f42c1;
    --bs-btn-disabled-border-color: #6f42c1;
}
.btn-outline-proxy {
    --bs-btn-color: #6f42c1;
    --bs-btn-border-color: #6f42c1;
    --bs-btn-bg: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #6f42c1;
    --bs-btn-hover-border-color: #6f42c1;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #59339d;
    --bs-btn-active-border-color: #59339d;
}

/* Topbar (Desktop: nur Logo + Hilfe + User) */
.navbar-ehbs {
    background-color: var(--ehbs-black);
    border-bottom: 3px solid var(--ehbs-red);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.navbar-ehbs .navbar-brand img {
    height: 38px;
    width: auto;
}

.navbar-ehbs .navbar-brand span {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
}

.navbar-ehbs .nav-link {
    color: rgba(255,255,255,0.85) !important;
}

.navbar-ehbs .nav-link:hover,
.navbar-ehbs .nav-link.active {
    color: #fff !important;
}

/* App-Layout: Sidebar + Inhalt nebeneinander */
.app-layout {
    display: flex;
    min-height: calc(100vh - 59px); /* 59px = navbar (56px) + border (3px) */
}

/* Sidebar */
.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #dee2e6;
    position: sticky;
    top: 59px;
    height: calc(100vh - 59px);
    overflow-y: auto;
}

.sidebar-nav {
    padding: 0.5rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1.25rem;
    color: #444;
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
    transition: background 0.12s, color 0.12s;
}

.sidebar-link:hover {
    background: #f3f4f6;
    color: var(--ehbs-black);
}

.sidebar-link.active {
    background: #fef0f1;
    color: var(--ehbs-red);
    border-left-color: var(--ehbs-red);
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-divider {
    height: 1px;
    background: #dee2e6;
    margin: 0.5rem 1rem;
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #aaa;
    padding: 0.75rem 1.25rem 0.25rem;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    font-size: 0.72rem;
    color: #aaa;
    border-top: 1px solid #dee2e6;
}

/* Inhaltsbereich neben Sidebar */
.app-content {
    flex: 1;
    min-width: 0;
}

/* Buttons */
.btn-ehbs {
    background-color: var(--ehbs-red);
    border-color: var(--ehbs-red);
    color: #fff;
    font-weight: 500;
}

.btn-ehbs:hover,
.btn-ehbs:focus {
    background-color: var(--ehbs-red-dark);
    border-color: var(--ehbs-red-dark);
    color: #fff;
}

/* Login-Seite */
.login-wrapper {
    min-height: 100vh;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10);
}

.login-card .card-header {
    background-color: var(--ehbs-black);
    border-radius: 0.75rem 0.75rem 0 0 !important;
    padding: 1.5rem;
    text-align: center;
    border-bottom: 3px solid var(--ehbs-red);
}

.login-card .card-header img {
    height: 72px;
    width: auto;
    margin-bottom: 0.75rem;
}

.login-card .card-header h4 {
    color: #fff;
    margin: 0;
    font-weight: 700;
}

/* Badge Rollen */
.badge-admin        { background-color: var(--ehbs-red); color: #fff; }
.badge-vorstand     { background-color: #6f42c1; color: #fff; }
.badge-standortleiter { background-color: #0d6efd; color: #fff; }
.badge-trainer      { background-color: #198754; color: #fff; }
.badge-gast         { background-color: #6c757d; color: #fff; }

/* Equipment-Status: Dauerausleihe (lila) */
.bg-purple,
.badge.bg-purple {
    background-color: #6f42c1 !important;
    color: #fff !important;
}

/* Allgemein */
body {
    background-color: #f8f9fa;
}

.page-header {
    border-bottom: 2px solid var(--ehbs-red);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.page-header h1,
.page-header h2 {
    font-weight: 700;
}

/* Icon-only Button: immer quadratisch */
.btn-icon {
    aspect-ratio: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

/* Touch-freundliche Buttons auf Mobilgeraeten */
@media (max-width: 767.98px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    .btn-sm {
        min-height: 36px;
    }
    .btn-icon {
        width: 44px;
        height: 44px;
        min-width: unset;
        min-height: unset;
    }
    .page-header h1 {
        font-size: 1.4rem;
    }
    main {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* Mobile Bottom Navigation */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--ehbs-black);
    border-top: 3px solid var(--ehbs-red);
    display: flex;
    flex-direction: column;
    z-index: 1030;
}

.mobile-nav-row {
    display: flex;
    align-items: stretch;
    height: 56px;
}

.mobile-nav-row--secondary {
    height: 48px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.55rem;
    gap: 2px;
    transition: color 0.15s;
}

.mobile-nav a i {
    font-size: 1.2rem;
    line-height: 1;
}

.mobile-nav-row--secondary a i {
    font-size: 1rem;
}

.mobile-nav a.active,
.mobile-nav a:hover {
    color: #fff;
}

.mobile-nav a.active i {
    color: var(--ehbs-red);
}

/* iOS Safe Area für die mobile Nav */
.mobile-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Spacer damit Inhalt nicht hinter der mobilen Nav verschwindet */
/* Höhe = Zeile1 (56) + Trennlinie (1) + Zeile2 (48) + Border (3) + Puffer */
.mobile-nav-spacer {
    height: calc(120px + env(safe-area-inset-bottom, 0px));
}

/* Druckansicht */
@media print {
    nav, footer, .btn, .alert, #deleteModal { display: none !important; }
    body { background: #fff; }
    .container { max-width: 100%; padding: 0; }
    .shadow-sm { box-shadow: none !important; }
}
