/* assets/css/backend.css */
/* Globale Backend-Styles für das Mika CMS */

/* ==================================================
   1. FARB-VARIABLEN (Light & Dark Mode)
================================================== */
:root, [data-bs-theme="light"] { 
    --bs-primary: #607d8b; 
    --bs-primary-rgb: 96, 125, 139; 
    --bs-body-bg: #f5f7f9; 
    --bs-tertiary-bg: #ffffff; 
    --bs-border-color: #e2e8ee; 
    --bs-link-color: #607d8b;
    --bs-link-hover-color: #4f6874;
}

[data-bs-theme="dark"] { 
    --bs-primary: #7899b8; 
    --bs-primary-rgb: 120, 153, 184; 
    --bs-body-bg: #1a1d21; 
    --bs-tertiary-bg: #22262b; 
    --bs-border-color: #30363d; 
    --bs-body-color: #c9d1d9; 
    --bs-link-color: #7899b8;
    --bs-link-hover-color: #9cb5ce;
}

/* ==================================================
   2. BOOTSTRAP OVERRIDES (Zwingt alles auf Graublau)
================================================== */
/* Utility Klassen */
.text-primary { color: var(--bs-primary) !important; }
.bg-primary { background-color: var(--bs-primary) !important; }
.border-primary { border-color: var(--bs-primary) !important; }

/* Links global */
a { color: var(--bs-primary); text-decoration: none; }
a:hover { color: var(--bs-link-hover-color); }

/* Buttons */
.btn-primary { 
    --bs-btn-bg: var(--bs-primary); 
    --bs-btn-border-color: var(--bs-primary); 
    --bs-btn-hover-bg: #4f6874; 
    --bs-btn-hover-border-color: #4f6874; 
    --bs-btn-active-bg: #4f6874;
    --bs-btn-active-border-color: #4f6874;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active {
    background-color: #4f6874 !important;
    border-color: #4f6874 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 0.25rem rgba(96, 125, 139, 0.5) !important;
}
.btn-outline-primary {
    color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--bs-primary) !important;
    color: #fff !important;
}

/* ==================================================
   3. GRUND-LAYOUT & SIDEBAR
================================================== */
body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.wrapper { display: flex; flex-grow: 1; overflow: hidden; background-color: var(--bs-body-bg); }
#sidebar { min-width: 290px; max-width: 290px; transition: margin-left 0.3s; background-color: var(--bs-tertiary-bg); border-right: 1px solid var(--bs-border-color); display: flex; flex-direction: column; overflow-y: auto; z-index: 1040; }
#sidebar.collapsed { margin-left: -290px; }
#content { width: 100%; padding: 25px; overflow-y: auto; background-color: var(--bs-body-bg); }

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; } 
::-webkit-scrollbar-thumb { background: rgba(150, 150, 150, 0.3); border-radius: 4px; }

/* ==================================================
   4. NAVIGATION: MENÜS & TABS
================================================== */
/* Sidebar Menüpunkte */
#sidebar .nav-pills .nav-link.active,
#sidebar .nav-link.active {
    background-color: var(--bs-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 6px;
    border: none !important;
}
#sidebar .nav-link { 
    color: var(--bs-body-color) !important; 
    padding: 0.4rem 1rem !important; 
    font-size: 0.95rem; 
    border-radius: 6px;
    margin-bottom: 2px;
    transition: all 0.2s; 
}
#sidebar .nav-link:hover:not(.active) { 
    color: var(--bs-primary) !important; 
    background-color: rgba(96, 125, 139, 0.08) !important; 
}

/* Content Tabs (z.B. Benutzer, Navigation, Einstellungen) */
.nav-tabs .nav-link { 
    border: none !important; 
    border-bottom: 2px solid transparent !important; 
    border-radius: 0 !important; 
    color: var(--bs-body-color) !important;
    padding: 0.5rem 1rem !important;
}
.nav-tabs .nav-link:hover { 
    border-color: transparent !important; 
    color: var(--bs-primary) !important; 
    background-color: rgba(96, 125, 139, 0.05) !important;
}
.nav-tabs .nav-link.active { 
    color: var(--bs-primary) !important; 
    border-bottom-color: var(--bs-primary) !important; 
    font-weight: 600; 
    background-color: transparent !important; 
}

/* Nav-Pills (z.B. Plugin-Verwaltung) */
.nav-pills .nav-link {
    color: var(--bs-body-color) !important;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}
.nav-pills .nav-link:hover {
    color: var(--bs-primary) !important;
    background-color: rgba(96, 125, 139, 0.08) !important;
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    background-color: var(--bs-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075) !important;
}

/* ==================================================
   5. EXPLORER TREE (Menüverwaltung)
================================================== */
.explorer-tree, .explorer-tree ul { list-style-type: none; padding-left: 0; margin: 0; }
.explorer-tree ul { padding-left: 1.2rem; border-left: 1px dashed var(--bs-border-color); margin-left: 0.4rem; }
.tree-item { padding: 0.25rem 0; font-size: 0.85rem; display: flex; align-items: center; white-space: nowrap; }
.tree-toggle { cursor: pointer; width: 16px; margin-right: 0.4rem; color: #6c757d; } 
.tree-toggle:hover { color: var(--bs-primary); }
.tree-toggle.collapsed .icon-minus { display: none; } 
.tree-toggle:not(.collapsed) .icon-plus { display: none; }
.tree-label { cursor: pointer; color: var(--bs-body-color); transition: color 0.15s; } 
.tree-label:hover { color: var(--bs-primary); }

/* ==================================================
   6. SPEZIELLE UI ELEMENTE
================================================== */
/* Frontend/Backend Switch im Header */
.custom-area-switch { position: relative; display: inline-flex; width: 170px; height: 32px; background-color: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: 8px; cursor: pointer; padding: 2px; }
.custom-area-switch input { display: none; }
.switch-bg { position: absolute; top: 2px; left: 2px; width: calc(50% - 2px); height: calc(100% - 4px); background-color: var(--bs-primary); border-radius: 6px; transition: transform 0.3s; }
.custom-area-switch input:checked ~ .switch-bg { transform: translateX(100%); }
.switch-texts { position: relative; display: flex; width: 100%; height: 100%; z-index: 2; }
.switch-texts span { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; color: var(--bs-body-color); transition: color 0.3s; }
.custom-area-switch input:not(:checked) ~ .switch-texts .text-front { color: #fff; } 
.custom-area-switch input:checked ~ .switch-texts .text-back { color: #fff; }

/* Custom "Graublau" Hilfsklassen (Abwärtskompatibilität) */
.btn-grayblue, .btn-gray-blue { background-color: var(--bs-primary) !important; color: #ffffff !important; border: 1px solid var(--bs-primary) !important; transition: all 0.2s; }
.btn-grayblue:hover, .btn-grayblue.active, .btn-gray-blue:hover { background-color: #4f6874 !important; border-color: #4f6874 !important; color: #ffffff !important; }
.bg-grayblue { background-color: var(--bs-primary) !important; color: white !important; }
.border-grayblue { border-color: var(--bs-primary) !important; }
.text-gray-blue { color: var(--bs-primary) !important; }
.badge-grayblue { background-color: var(--bs-primary); color: #ffffff; }
.badge-grayblue a { color: #ffffff; text-decoration: none; }
.badge-grayblue a:hover { color: #e2e8ee; }

/* Formulare, Listen & Pagination */
.custom-switch-grayblue .form-check-input:checked, .toggle-gray-blue:checked { background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; }
.hover-row:hover { background-color: rgba(92, 119, 146, 0.03); }
[data-bs-toggle="collapse"][aria-expanded="false"] .toggle-icon { transform: rotate(-90deg); }
[data-bs-toggle="collapse"][aria-expanded="true"] .toggle-icon { transform: rotate(0deg); }
.custom-tooltip-shadow .tooltip-inner { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3); max-width: 250px; }
.list-group-item-action:hover, .list-group-item-action:focus { background-color: rgba(96, 125, 139, 0.05) !important; color: var(--bs-primary) !important; }
.pagination-grayblue .page-item.active .page-link { background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; color: white !important; }
.pagination-grayblue .page-link { color: var(--bs-primary); }
.pagination-grayblue .page-link:hover { background-color: #e2e8ee; color: #4f6874; }

/* Plugin Sidebar Accordion */
.list-group-cat-header { background-color: var(--bs-primary) !important; color: #ffffff !important; cursor: pointer; user-select: none; border: none !important; border-bottom: 1px solid rgba(255,255,255,0.15) !important; }
.list-group-cat-header:last-child { border-bottom: none !important; }
.list-group-cat-header .bi-chevron-down { transition: transform 0.3s ease; }
.list-group-cat-header[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.plugin-list-item { position: relative; z-index: 1; }
.plugin-list-item:hover, .plugin-list-item:focus-within { z-index: 10; }
/* ==================================================
   7. FIX FÜR SUCHFELDER (Lupe) IM DARKMODE
================================================== */
.input-group-text.bg-body,
.input-group-text.bg-white {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
    border-color: var(--bs-border-color) !important;
}
/* ==================================================
   8. GLOBALE TOGGLES & CHECKBOXEN (Graublau)
================================================== */
.form-check-input:checked {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

/* Optional: Den leichten blauen Schatten beim Klicken (Focus) entfernen/anpassen */
.form-check-input:focus {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.25rem rgba(96, 125, 139, 0.25) !important;
}
/* Gruppen-Icon-Auswahl */
.role-icon-preview { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.55rem; border: 1px solid rgba(92, 119, 146, 0.3); border-radius: 0.5rem; background: var(--bs-tertiary-bg); }
.role-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 0.35rem; max-height: 240px; overflow-y: auto; }
.role-icon-option { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 0.4rem; background: transparent; color: var(--bs-body-color); font-size: 1.1rem; }
.role-icon-option:hover, .role-icon-option:focus-visible { background: rgba(92, 119, 146, 0.12); border-color: rgba(92, 119, 146, 0.45); outline: 0; }
.role-icon-option.active { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
/* Spalten für die Gruppenliste */
.role-list-min-width { min-width: 760px; }
.role-list-grid { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(240px, 2fr) minmax(90px, 0.55fr) minmax(150px, 0.75fr); column-gap: 1rem; }
.role-list-header { background: var(--bs-tertiary-bg); letter-spacing: 0.03em; font-size: 0.72rem; }
.role-list-grid > * { min-width: 0; }