/* ==========================================================================
   Trust-Halle KDB — zentrale Design-Schicht
   Dezente Variante: Markenrot nur als Akzent, klare Kanten, kein Verlauf,
   keine Animationen ausser kurzen Farbwechseln.

   Wird von navigation.php und den Modul-Headern geladen und ueberschreibt die
   Bootstrap-Standards global. Bestehende Bootstrap-Klassen in den Seiten
   (nav, btn, card, table, form, alert, badge) bekommen dadurch einheitliche
   Optik, ohne jede PHP-Datei anzufassen.
   ========================================================================== */

:root {
    /* Marke */
    --th-primary: #E4002B;
    --th-primary-dark: #9E001E;
    --th-primary-rgb: 228, 0, 43;

    /* Flaechen */
    --th-bg: #FFFFFF;
    --th-surface: #F7F7F7;
    --th-border: #e5e7eb;
    --th-border-strong: #d1d5db;

    /* Text */
    --th-fg: #1D1D1D;
    --th-muted: #6b7280;

    /* Semantik */
    --th-success: #2e7d32;
    --th-danger: #d9534f;
    --th-warning: #b45309;

    /* Form */
    --th-radius-sm: 6px;
    --th-radius-lg: 12px;
    --th-shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --th-shadow-md: 0 4px 12px rgba(0, 0, 0, .08);

    /* Bootstrap-Bruecke (greift in 5.1/5.2/5.3) */
    --bs-primary: var(--th-primary);
    --bs-primary-rgb: var(--th-primary-rgb);
    --bs-body-bg: var(--th-bg);
    --bs-body-color: var(--th-fg);
    --bs-body-font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
    --bs-body-font-size: 15px;
    --bs-border-color: var(--th-border);
    --bs-link-color: var(--th-primary);
    --bs-link-color-rgb: var(--th-primary-rgb);
    --bs-link-hover-color: var(--th-primary-dark);
    --bs-link-hover-color-rgb: 158, 0, 30;
    --bs-border-radius: var(--th-radius-sm);
    --bs-border-radius-lg: var(--th-radius-lg);
}

/* --------------------------------------------------------------------------
   Grundflaechen und Typografie
   -------------------------------------------------------------------------- */

body {
    background-color: var(--th-bg);
    color: var(--th-fg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.navbar-brand {
    font-family: Outfit, "Segoe UI", system-ui, sans-serif;
    font-weight: 600;
}

.text-primary { color: var(--th-primary) !important; }
.bg-primary { background-color: var(--th-primary) !important; }
.border-primary { border-color: var(--th-primary) !important; }
.text-muted { color: var(--th-muted) !important; }

/* --------------------------------------------------------------------------
   Hauptnavigation (dunkel, einfaerbig, rote Unterkante)
   -------------------------------------------------------------------------- */

.navbar {
    background-color: var(--th-fg) !important;
    background-image: none !important;
    border-bottom: 3px solid var(--th-primary);
    padding: .6rem 0;
}

.navbar .navbar-brand {
    color: #fff !important;
    font-size: 1.15rem;
    background: none !important;
    padding: .25rem .5rem;
    transform: none !important;
}

.navbar .navbar-brand:hover { color: #fff !important; }

.navbar .nav-link {
    color: rgba(255, 255, 255, .82) !important;
    font-weight: 500;
    padding: .5rem .85rem !important;
    margin: 0 .1rem;
    border-radius: var(--th-radius-sm);
    transition: color 160ms ease, background-color 160ms ease;
}

.navbar .nav-link:hover {
    color: #fff !important;
    background-color: rgba(255, 255, 255, .08);
    transform: none !important;
}

.navbar .nav-link.active {
    color: #fff !important;
    background-color: transparent;
    box-shadow: inset 0 -2px 0 var(--th-primary);
}

.navbar .nav-link.active::after { content: none !important; }

.navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, .3);
}

.navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 2px var(--th-primary);
}

/* --------------------------------------------------------------------------
   Dropdowns
   -------------------------------------------------------------------------- */

.dropdown-menu {
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-sm);
    box-shadow: var(--th-shadow-md);
    padding: .35rem 0;
    animation: none !important;
}

.dropdown-item {
    padding: .5rem 1.1rem;
    font-weight: 500;
    color: var(--th-fg);
    transition: background-color 140ms ease, color 140ms ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--th-surface);
    color: var(--th-primary-dark);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--th-primary);
    color: #fff;
}

.dropdown-divider { border-top-color: var(--th-border); }
.dropdown-header { color: var(--th-muted); font-weight: 600; }

/* --------------------------------------------------------------------------
   Modul-Unterleiste (z. B. Netzwerkdokumentation)
   -------------------------------------------------------------------------- */

.nw-navbar {
    background-color: var(--th-surface) !important;
    background-image: none !important;
    border-bottom: 1px solid var(--th-border);
    padding: .35rem 0;
}

.nw-navbar .navbar-brand {
    color: var(--th-fg) !important;
    font-size: 1rem;
    box-shadow: none;
}

.nw-navbar .nav-link {
    color: var(--th-fg) !important;
    padding: .45rem .8rem !important;
    border-radius: var(--th-radius-sm);
    font-weight: 500;
    transition: background-color 160ms ease, color 160ms ease;
}

.nw-navbar .nav-link:hover {
    background-color: rgba(var(--th-primary-rgb), .07);
    color: var(--th-primary-dark) !important;
    transform: none !important;
}

.nw-navbar .nav-link.active {
    background-color: var(--th-primary);
    color: #fff !important;
    box-shadow: none;
}

.nw-navbar .nav-link.active::after { content: none !important; }

.nw-navbar .navbar-toggler {
    border-color: var(--th-border);
}

/* --------------------------------------------------------------------------
   Breadcrumbs
   -------------------------------------------------------------------------- */

.nw-breadcrumb-bar {
    background-color: var(--th-bg);
    border-bottom: 1px solid var(--th-border);
    padding: .5rem 0;
}

.breadcrumb {
    margin-bottom: 0;
    font-size: .875rem;
}

.breadcrumb-item a {
    color: var(--th-muted);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--th-primary);
    text-decoration: underline;
}

.breadcrumb-item.active { color: var(--th-fg); font-weight: 500; }

.breadcrumb-item + .breadcrumb-item::before {
    content: "\f105";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #c7ccd4;
}

/* --------------------------------------------------------------------------
   Karten
   -------------------------------------------------------------------------- */

.card {
    background-color: #fff;
    border: 1px solid var(--th-border);
    border-radius: var(--th-radius-lg);
    box-shadow: var(--th-shadow-sm);
}

.card-header {
    background-color: var(--th-surface);
    border-bottom: 1px solid var(--th-border);
    font-weight: 600;
}

.card-footer {
    background-color: var(--th-surface);
    border-top: 1px solid var(--th-border);
}

.shadow,
.shadow-sm,
.shadow-lg {
    box-shadow: var(--th-shadow-sm) !important;
}

/* Farbige Randbalken (in den Seiten genutzt, bisher teils undefiniert) */
.border-left-primary   { border-left: 3px solid var(--th-primary) !important; }
.border-left-secondary { border-left: 3px solid #6c757d !important; }
.border-left-success   { border-left: 3px solid var(--th-success) !important; }
.border-left-info      { border-left: 3px solid #0dcaf0 !important; }
.border-left-warning   { border-left: 3px solid var(--th-warning) !important; }
.border-left-danger    { border-left: 3px solid var(--th-danger) !important; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    border-radius: var(--th-radius-sm);
    font-weight: 500;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
    --bs-btn-focus-box-shadow: none;
}

.btn:focus-visible {
    outline: 2px solid var(--th-primary);
    outline-offset: 2px;
    box-shadow: none;
}

.btn-primary {
    --bs-btn-bg: var(--th-primary);
    --bs-btn-border-color: var(--th-primary);
    --bs-btn-hover-bg: var(--th-primary-dark);
    --bs-btn-hover-border-color: var(--th-primary-dark);
    --bs-btn-active-bg: var(--th-primary-dark);
    --bs-btn-active-border-color: var(--th-primary-dark);
    --bs-btn-disabled-bg: var(--th-primary);
    --bs-btn-disabled-border-color: var(--th-primary);
    background-color: var(--th-primary);
    border-color: var(--th-primary);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--th-primary-dark);
    border-color: var(--th-primary-dark);
    color: #fff;
}

.btn-outline-primary {
    --bs-btn-color: var(--th-primary);
    --bs-btn-border-color: var(--th-primary);
    --bs-btn-hover-bg: var(--th-primary);
    --bs-btn-hover-border-color: var(--th-primary);
    --bs-btn-active-bg: var(--th-primary-dark);
    --bs-btn-active-border-color: var(--th-primary-dark);
    color: var(--th-primary);
    border-color: var(--th-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: var(--th-primary);
    border-color: var(--th-primary);
    color: #fff;
}

.btn-secondary,
.btn-outline-secondary {
    --bs-btn-color: var(--th-fg);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--th-border-strong);
    --bs-btn-hover-bg: var(--th-surface);
    --bs-btn-hover-border-color: #c7ccd4;
    --bs-btn-hover-color: var(--th-fg);
    --bs-btn-active-bg: var(--th-surface);
    --bs-btn-active-color: var(--th-fg);
    background-color: #fff;
    border-color: var(--th-border-strong);
    color: var(--th-fg);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: var(--th-surface);
    border-color: #c7ccd4;
    color: var(--th-fg);
}

.btn-danger {
    --bs-btn-bg: var(--th-danger);
    --bs-btn-border-color: var(--th-danger);
    --bs-btn-hover-bg: #c9302c;
    --bs-btn-hover-border-color: #c9302c;
    background-color: var(--th-danger);
    border-color: var(--th-danger);
}

.btn-outline-danger {
    --bs-btn-color: var(--th-danger);
    --bs-btn-border-color: var(--th-danger);
    --bs-btn-hover-bg: var(--th-danger);
    --bs-btn-hover-border-color: var(--th-danger);
    color: var(--th-danger);
    border-color: var(--th-danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
    background-color: var(--th-danger);
    border-color: var(--th-danger);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Formulare
   -------------------------------------------------------------------------- */

.form-control,
.form-select,
.input {
    border: 1px solid var(--th-border-strong);
    border-radius: var(--th-radius-sm);
    color: var(--th-fg);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(var(--th-primary-rgb), .14);
}

.form-label {
    font-weight: 500;
    color: var(--th-fg);
}

.form-check-input:checked {
    background-color: var(--th-primary);
    border-color: var(--th-primary);
}

.form-check-input:focus {
    border-color: var(--th-primary);
    box-shadow: 0 0 0 3px rgba(var(--th-primary-rgb), .14);
}

.input-group-text {
    background-color: var(--th-surface);
    border-color: var(--th-border-strong);
}

/* --------------------------------------------------------------------------
   Tabellen
   -------------------------------------------------------------------------- */

.table {
    color: var(--th-fg);
    border-color: var(--th-border);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--th-border);
}

.table thead th {
    background-color: var(--th-surface);
    color: #4b5563;
    font-weight: 600;
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    border-bottom-color: var(--th-border);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(247, 247, 247, .6);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(var(--th-primary-rgb), .035);
}

/* --------------------------------------------------------------------------
   Hinweise, Badges, Navigationselemente
   -------------------------------------------------------------------------- */

.alert {
    border: 1px solid transparent;
    border-radius: var(--th-radius-sm);
}

.alert-success { background-color: #eaf5ea; border-color: #cfe6d0; color: #1b5e20; }
.alert-danger  { background-color: #fdecea; border-color: #f5c6c2; color: #8a2320; }
.alert-warning { background-color: #fdf3e3; border-color: #f0dcb4; color: #7a4a06; }
.alert-info    { background-color: #e8f2fb; border-color: #c9e0f2; color: #14567d; }

.badge { font-weight: 500; }

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

.pagination .page-link {
    color: var(--th-primary);
    border-color: var(--th-border);
}

.pagination .page-item.active .page-link {
    background-color: var(--th-primary);
    border-color: var(--th-primary);
}

.pagination .page-link:focus {
    box-shadow: 0 0 0 3px rgba(var(--th-primary-rgb), .14);
}

.list-group-item.active {
    background-color: var(--th-primary);
    border-color: var(--th-primary);
}

.progress-bar { background-color: var(--th-primary); }

.nav-tabs .nav-link { color: var(--th-fg); }
.nav-tabs .nav-link.active { color: var(--th-primary); font-weight: 600; }
.nav-pills .nav-link { color: var(--th-fg); border-radius: var(--th-radius-sm); }
.nav-pills .nav-link.active { background-color: var(--th-primary); color: #fff; }

/* --------------------------------------------------------------------------
   Barrierefreiheit
   -------------------------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--th-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
