/* ============================================================
   Dark-Mode für Cheems
   - Aktiviert wenn body.theme-dark gesetzt ist
   - Header-Bar bleibt unverändert (ist sowieso schon dunkelblau)
   ============================================================ */

/* --- Toggle in der Kopfzeile (immer sichtbar, oben rechts) --- */
.theme-toggle {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 1000010; /* über Header (1000000) und Navigation */
    line-height: 1;
}
.theme-toggle .theme-toggle-btn {
    color: #ffffff;
    text-decoration: none;
    padding: 2px 6px;
    opacity: 0.6;
    font-size: 20px;
    display: inline-block;
}
.theme-toggle .theme-toggle-btn:hover { opacity: 0.9; text-decoration: none; }
.theme-toggle .theme-toggle-btn.active { color: #f6c700; opacity: 1; }
.theme-toggle .theme-toggle-sep { color: #fff; opacity: 0.6; padding: 0 2px; font-size: 18px; }

/* "Willkommen, ..."-Zeile weiter unten, damit der Toggle oben rechts daneben Platz hat.
   WICHTIG: Box-Höhe darf 50px nicht überschreiten (= Container .header_logout Höhe).
   Original .loggedInAs war height:35px + padding-top:15px = 50px. Wenn padding auf 36px
   wächst und height bei 35px bleibt, wird die Box 71px hoch und überlappt VISUELL und
   KLICKEND die darunter liegende Hauptnavigation (Reiter werden unanklickbar).
   pointer-events:none lässt evtl. überstehenden Text Klicks durchlassen — der Logout-
   Link bleibt klickbar dank Override unten. */
.header .loggedInAs {
    padding-top: 36px !important;
    height: 14px !important;
    box-sizing: content-box !important;
    pointer-events: none;
}
.header .loggedInAs a,
.header .loggedInAs a:link,
.header .loggedInAs a:visited {
    pointer-events: auto;
}

/* Aktiven Reiter in der Hauptnavigation hervorheben.
   !important nötig, weil Bootstrap-Regeln auf .navbar-nav li sehr breit greifen. */
.header .navbar-nav > li.active-nav,
ul.nav > li.active-nav {
    background: rgba(255, 255, 255, 0.18) !important;
    box-shadow: inset 0 -3px 0 #f6c700 !important;   /* gelber Unterstrich */
    border-radius: 0 !important;
}
.header .navbar-nav > li.active-nav > a.navbar-brand,
ul.nav > li.active-nav > a.navbar-brand {
    color: #ffffff !important;
    font-weight: bold !important;
}
body.theme-dark .header .navbar-nav > li.active-nav,
body.theme-dark ul.nav > li.active-nav {
    background: rgba(255, 255, 255, 0.10) !important;
}


/* ============================================================
   Dark-Mode-Regeln (greifen nur unter body.theme-dark)
   ============================================================ */
body.theme-dark {
    background: #1f2329 !important;
    color: #e2e2e2;
}

/* Allgemeiner Fließtext */
body.theme-dark p,
body.theme-dark span,
body.theme-dark div,
body.theme-dark label,
body.theme-dark dt,
body.theme-dark dd,
body.theme-dark li,
body.theme-dark td,
body.theme-dark th { color: inherit; }

/* Überschriften */
body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark h5 { color: #e2e2e2; }

/* Hauptcontainer / Karten */
body.theme-dark #container,
body.theme-dark .container,
body.theme-dark .container-fluid,
body.theme-dark .panel,
body.theme-dark .well {
    background-color: #2a2f37 !important;
    color: #e2e2e2;
}

/* Tabellen */
body.theme-dark .table,
body.theme-dark table {
    background-color: #2a2f37 !important;
    color: #e2e2e2 !important;
}
body.theme-dark .table thead th,
body.theme-dark table thead th,
body.theme-dark table.table-striped thead tr th {
    background-color: #3a4150 !important;
    color: #ffffff !important;
    border-color: #444b56 !important;
}

/* Alle Zellen (gerade UND ungerade) in dunkler Variante; striping kommt darunter */
body.theme-dark .table tbody > tr > td,
body.theme-dark .table tbody > tr > th,
body.theme-dark table tbody > tr > td,
body.theme-dark table tbody > tr > th {
    background-color: #2a2f37 !important;
    color: #e2e2e2 !important;
    border-color: #3a4150 !important;
}

/* Striping über nth-child (Bootstrap) UND tr.odd (jquery.tablesorter / naturalsort) */
body.theme-dark .table-striped tbody > tr:nth-child(odd) > td,
body.theme-dark .table-striped tbody > tr:nth-child(odd) > th,
body.theme-dark table.table-striped tbody tr.odd td,
body.theme-dark table tbody tr.odd td {
    background-color: #313740 !important;
}

/* Hover */
body.theme-dark .table tbody > tr:hover > td,
body.theme-dark .table tbody > tr:hover > th {
    background-color: #3d434d !important;
}

/* Bootstrap-Status-Zeilen */
body.theme-dark .table tr.info td,
body.theme-dark .table-striped tr.info td       { background-color: #2c3441 !important; }
body.theme-dark .table tr.warning td,
body.theme-dark .table tr.current td             { background-color: #4a4530 !important; }
body.theme-dark .table tr.success td             { background-color: #2c4030 !important; }
body.theme-dark .table tr.error td,
body.theme-dark .table tr.danger td              { background-color: #4a2c2c !important; }

/* Forms */
body.theme-dark input[type="text"],
body.theme-dark input[type="password"],
body.theme-dark input[type="email"],
body.theme-dark input[type="number"],
body.theme-dark input[type="search"],
body.theme-dark input[type="tel"],
body.theme-dark input[type="url"],
body.theme-dark input[type="date"],
body.theme-dark input[type="datetime-local"],
body.theme-dark textarea,
body.theme-dark select,
body.theme-dark .form-control {
    background-color: #2a2f37 !important;
    color: #e2e2e2 !important;
    border: 1px solid #444b56 !important;
}
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder { color: #8a929c !important; }
body.theme-dark input[disabled],
body.theme-dark textarea[disabled],
body.theme-dark select[disabled] { background-color: #20242a !important; color: #888 !important; }

/* Buttons — Bootstrap default (.btn) ohne Farb-Modifier ist hellgrau auf weiß → in Dark unleserlich */
body.theme-dark .btn {
    box-shadow: none;
    text-shadow: none !important;
}
body.theme-dark .btn:not(.btn-primary):not(.btn-info):not(.btn-success):not(.btn-warning):not(.btn-danger):not(.btn-inverse):not(.btn-link) {
    background-color: #4a525e !important;
    background-image: none !important;
    color: #f0f0f0 !important;
    border-color: #5a6270 !important;
}
body.theme-dark .btn:not(.btn-primary):not(.btn-info):not(.btn-success):not(.btn-warning):not(.btn-danger):not(.btn-inverse):not(.btn-link):hover {
    background-color: #5a6270 !important;
    color: #ffffff !important;
}

/* Farbige Buttons: weiße Schrift erzwingen, kein text-shadow (sonst muddy) */
body.theme-dark .btn-primary,
body.theme-dark .btn-info,
body.theme-dark .btn-success,
body.theme-dark .btn-warning,
body.theme-dark .btn-danger,
body.theme-dark .btn-inverse,
body.theme-dark .btn-primary:hover, body.theme-dark .btn-primary:focus,
body.theme-dark .btn-info:hover,    body.theme-dark .btn-info:focus,
body.theme-dark .btn-success:hover, body.theme-dark .btn-success:focus,
body.theme-dark .btn-warning:hover, body.theme-dark .btn-warning:focus,
body.theme-dark .btn-danger:hover,  body.theme-dark .btn-danger:focus,
body.theme-dark .btn-inverse:hover, body.theme-dark .btn-inverse:focus {
    color: #ffffff !important;
    text-shadow: none !important;
}

/* btn-link bleibt textartig, aber sichtbar */
body.theme-dark .btn-link { color: #62b5ff !important; }

/* Disabled */
body.theme-dark .btn[disabled],
body.theme-dark .btn.disabled {
    opacity: 0.45;
}

/* Bootstrap "well" / Karten / div.letter (PDF-Layout-Vorschau) */
body.theme-dark div.letter {
    background: #2a2f37 !important;
    border-color: #3a4150 !important;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
    color: #e2e2e2;
}

/* infoWin (Filter-/Info-Box) — selbe Farbe wie Tab-Pane, damit es nicht erdrückt */
body.theme-dark .infoWin {
    background-color: #3a4150 !important;
    color: #e2e2e2 !important;
    border-color: #4a525e !important;
    text-shadow: none !important;
}
body.theme-dark .infoWinHeadline { color: #ffffff !important; }

/* Tabelle innerhalb infoWin transparent — Striping/dunkler BG entfällt, sieht aus wie eine Karte */
body.theme-dark .infoWin table,
body.theme-dark .infoWin .table {
    background-color: transparent !important;
}
body.theme-dark .infoWin table tbody > tr > td,
body.theme-dark .infoWin table tbody > tr > th,
body.theme-dark .infoWin .table tbody > tr > td,
body.theme-dark .infoWin .table tbody > tr > th,
body.theme-dark .infoWin table.table-striped tbody > tr:nth-child(odd) > td,
body.theme-dark .infoWin table tbody tr.odd td {
    background-color: transparent !important;
    color: #e2e2e2 !important;
    border-color: transparent !important;
}

/* Tablefilter-Inputs: original mit weißem Hintergrund */
body.theme-dark .flt {
    background: #2a2f37 !important;
    color: #e2e2e2 !important;
    border-color: #444b56 !important;
}

/* trigger_object — Klick-Trigger (z.B. ausklappbare Sektionen). Original: #eee BG */
body.theme-dark .trigger_object {
    background: #3a4150 !important;
    color: #e2e2e2 !important;
    border-color: #4a525e !important;
}
body.theme-dark .trigger_object .title_small,
body.theme-dark .trigger_object .title_small h2,
body.theme-dark .trigger_object .button_small {
    color: #e2e2e2 !important;
}

/* Glyphicons (Bootstrap-Sprite) — schwarze Variante ist auf dunklem BG unsichtbar.
   Alle Icons im Dark Mode auf das weiße Sprite umstellen. */
body.theme-dark [class^="icon-"],
body.theme-dark [class*=" icon-"] {
    background-image: url("../bootstrap/img/glyphicons-halflings-white.png") !important;
}

/* input-append / input-prepend Add-on (Original: #eee BG mit weißem text-shadow) */
body.theme-dark .input-append .add-on,
body.theme-dark .input-prepend .add-on {
    background-color: #4a525e !important;
    color: #e2e2e2 !important;
    border-color: #5a6270 !important;
    text-shadow: none !important;
}

/* Modals */
body.theme-dark .modal {
    background-color: #2a2f37 !important;
    color: #e2e2e2;
    border-color: #3a4150;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
}
body.theme-dark .modal-header,
body.theme-dark .modal-body,
body.theme-dark .modal-footer {
    background-color: #2a2f37 !important;
    color: #e2e2e2;
    border-color: #3a4150 !important;
}
body.theme-dark .modal-backdrop { background-color: #000; }

/* Tabs */
body.theme-dark .nav-tabs { border-color: #3a4150; }
body.theme-dark .nav-tabs > li > a,
body.theme-dark .nav-tabs > li > a span {
    color: #e2e2e2 !important;
    background-color: #232830;
    border-color: #3a4150;
}
body.theme-dark .nav-tabs > li.active > a,
body.theme-dark .nav-tabs > li.active > a:hover,
body.theme-dark .nav-tabs > li.active > a span,
body.theme-dark .nav-tabs > li.active > a:hover span {
    /* Aktiver Tab in derselben Farbe wie der Pane darunter, damit beides als eine Karte wirkt */
    background-color: #3a4150 !important;
    color: #ffffff !important;
    border-color: #4a525e #4a525e #3a4150 !important;
}
body.theme-dark .nav-tabs > li > a:hover,
body.theme-dark .nav-tabs > li > a:hover span { background-color: #313740 !important; color: #ffffff !important; }

/* Tab-Pane (Inhaltsbereich unter den Tabs) — Original ist #eee/#333 */
body.theme-dark .content_right .tab-content .tab-pane,
body.theme-dark .content_left .tab-content .tab-pane,
body.theme-dark .main .tab-content .tab-pane,
body.theme-dark .tab-content .tab-pane {
    background: #3a4150 !important;
    color: #e2e2e2 !important;
    border-color: #4a525e !important;
}

/* tr.fltrow (Tablefilter-Zeile, Original blau #2670b0) */
body.theme-dark tr.fltrow td {
    background: #2c3a4d !important;
    border-color: #3a4150 !important;
}
body.theme-dark tr.fltrow td select,
body.theme-dark tr.fltrow td input {
    color: #ffffff !important;
    background: transparent !important;
}

/* Pagination */
body.theme-dark .pagination ul > li > a,
body.theme-dark .pagination ul > li > span {
    background-color: #2a2f37 !important;
    color: #e2e2e2 !important;
    border-color: #444b56 !important;
}
body.theme-dark .pagination ul > li > a:hover,
body.theme-dark .pagination ul > li > a:focus {
    background-color: #3a4150 !important;
    color: #ffffff !important;
}
body.theme-dark .pagination ul > .active > a,
body.theme-dark .pagination ul > .active > span {
    background-color: #4a525e !important;
    color: #ffffff !important;
}
body.theme-dark .pagination ul > .disabled > span,
body.theme-dark .pagination ul > .disabled > a,
body.theme-dark .pagination ul > .disabled > a:hover,
body.theme-dark .pagination ul > .disabled > a:focus {
    background-color: #232830 !important;
    color: #6d7480 !important;
}

/* Links */
body.theme-dark a              { color: #62b5ff; }
body.theme-dark a:hover        { color: #8ec9ff; }
body.theme-dark a:visited      { color: #b890ff; }

/* Header-Bereich von obigen Link-Farben ausnehmen — Logo, Navigation, Login-Zeile bleiben weiß */
body.theme-dark .header a,
body.theme-dark .header a:link,
body.theme-dark .header a:visited,
body.theme-dark .header a:hover,
body.theme-dark .header .logo,
body.theme-dark .header .logo:visited,
body.theme-dark .header .logo:hover,
body.theme-dark .header .navbar-brand,
body.theme-dark .header .navbar-brand:visited,
body.theme-dark .header .loggedInAs a,
body.theme-dark .header .loggedInAs a:visited {
    color: #ffffff !important;
}

/* Wells, alerts */
body.theme-dark .alert {
    background-color: #2c3441;
    color: #e2e2e2;
    border-color: #3a4150;
}

/* Dropdowns */
body.theme-dark .dropdown-menu {
    background-color: #2a2f37;
    color: #e2e2e2;
    border-color: #3a4150;
}
body.theme-dark .dropdown-menu > li > a { color: #e2e2e2; }
body.theme-dark .dropdown-menu > li > a:hover {
    background-color: #3a4150;
    color: #ffffff;
}

/* Tooltip / Popover Inhalt lassen Bootstrap-Defaults */

/* Badges / Labels */
body.theme-dark .label { color: #fff; }

/* Datepicker (jQuery UI) */
body.theme-dark .ui-datepicker {
    background-color: #2a2f37;
    color: #e2e2e2;
    border-color: #3a4150;
}
body.theme-dark .ui-datepicker .ui-datepicker-header { background: #3a4150; color: #fff; }
body.theme-dark .ui-datepicker td a { color: #e2e2e2; background: #2a2f37; }
body.theme-dark .ui-datepicker td a.ui-state-hover { background: #3a4150; }
body.theme-dark .ui-datepicker td a.ui-state-active { background: #f6c700; color: #1f2329; }

/* Code / Pre */
body.theme-dark pre, body.theme-dark code {
    background-color: #1a1d22;
    color: #e2e2e2;
    border-color: #3a4150;
}

/* CKEditor — Inhaltsbereich nicht eindunkeln (Texte würden weiß auf weiß) */
body.theme-dark .cke_inner { background: #2a2f37; }
body.theme-dark .cke_top, body.theme-dark .cke_bottom { background: #3a4150; border-color: #444b56; }
