
:root {
    --sidebar-expanded: 200px;
    --sidebar-collapsed: 76px;

    /* MudBlazor-Schriftart auf Bootstrap-Systemstack zurücksetzen,
       damit das UI-Layout nicht durch den globalen MudBlazor-Font überschrieben wird. */
    --mud-typography-default-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-body1-family:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-body2-family:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-h1-family:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-h2-family:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-h3-family:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-h4-family:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-h5-family:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-h6-family:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-subtitle1-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-subtitle2-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-caption-family:   -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mud-typography-button-family:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Primärfarbe – wird per <style>-Injection in MainLayout überschrieben */
    --clr-primary:          #0d6efd;
    --clr-primary-hover-bg: color-mix(in srgb, var(--clr-primary) 8%, white);
    --clr-primary-active-bg-from: color-mix(in srgb, var(--clr-primary) 14%, white);
    --clr-primary-active-bg-to:   color-mix(in srgb, var(--clr-primary) 20%, white);
    --clr-primary-shadow:   color-mix(in srgb, var(--clr-primary) 12%, transparent);
    --clr-primary-focus:    color-mix(in srgb, var(--clr-primary) 40%, transparent);
    --clr-primary-input-border: color-mix(in srgb, var(--clr-primary) 55%, white);
}


html, body {
    height: 100%;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5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7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.nav-bottom {
    margin-top: auto !important;
    padding-bottom: 10px !important;
}

.sidebar {
    width: var(--sidebar-expanded);
    flex: 0 0 var(--sidebar-expanded);
    min-width: var(--sidebar-expanded);
    height: 95vh;
    position: sticky;
    top: 0;
    background: #ffffff;
    border-right: 1px solid #eef0f3;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: width 220ms ease, flex-basis 220ms ease, min-width 220ms ease;
    z-index: 100;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    flex: 0 0 var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
    padding: 16px 10px;
}

.sidebar-toggle:hover {
    background: #f5f8ff;
    border-color: #dbe6ff;
    transform: translateY(-1px);
}

.sidebar-toggle i {
    font-size: 1.2rem;
    color: #2f3a4a;
}

.sidebar-toggle {
    width: 44px;
    height: 44px;
    border: 1px solid #eef0f3;
    background: #fff;
    border-radius: 14px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.sidebar .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 14px;
    color: #253041;
    text-decoration: none;
    font-size: 1.02rem;
    font-weight: 500;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.sidebar .nav-icon {
    font-size: 1.25rem;
    width: 28px;
    min-width: 28px;
    display: grid;
    place-items: center;
    color: #3b4b63;
}

.sidebar .nav-item:hover .nav-icon {
    color: var(--clr-primary);
}


.sidebar .nav-item:hover {
    background: var(--clr-primary-hover-bg);
    color: var(--clr-primary);
    transform: translateX(2px);
}

.sidebar .nav-item.active,
.sidebar .active {
    background: linear-gradient(180deg, var(--clr-primary-active-bg-from) 0%, var(--clr-primary-active-bg-to) 100%);
    color: var(--clr-primary);
    font-weight: 650;
    box-shadow: 0 6px 18px var(--clr-primary-shadow);
}

.sidebar .nav-item.active .nav-icon,
.sidebar .active .nav-icon {
    color: var(--clr-primary);
}


.sidebar .nav-text {
    white-space: nowrap;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 160ms ease, transform 160ms ease;
}

/* Submenü-Einträge (z.B. Datenbank/E-Mail/LLM unter "Schnittstellen", Lizenz unter
   "Unternehmen") sind eine Ebene tiefer und sollen dezenter/kompakter wirken als die
   Hauptpunkte - insbesondere das Hover/Active-Highlighting war bisher genauso groß wie bei den
   Top-Level-Einträgen und wirkte dadurch neben der schmaleren Sidebar zu wuchtig. */
.sidebar .nav-item.sub-item {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 450;
    gap: 10px;
}

.sidebar .nav-item.sub-item .nav-icon {
    font-size: 1rem;
    width: 20px;
    min-width: 20px;
}

.sidebar .nav-item.sub-item.active,
.sidebar .active.sub-item {
    box-shadow: 0 3px 10px var(--clr-primary-shadow);
    font-weight: 600;
}

.sidebar .nav-item.sub-item:hover {
    transform: translateX(1px);
}

.body-container {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item::after {
    content: attr(title);
    position: absolute;
    left: calc(var(--sidebar-collapsed) + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #111827;
    color: #ffffff;
    font-size: 0.9rem;
    padding: 8px 10px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
}

.sidebar.collapsed .nav-item::before {
    content: "";
    position: absolute;
    left: calc(var(--sidebar-collapsed));
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-right-color: #111827;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease;
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(4px);
    position: absolute;
    z-index: 9999;
}

.sidebar.collapsed .nav-item:hover::before {
    opacity: 1;
    position: absolute;
    z-index: 9999;
}


.content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fbfcfe;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    transform: translateX(-6px);
    width: 0;
    overflow: hidden;
}


.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 10px;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.settings-container {
    display: flex;
    min-height: 85vh;
    background: #f5f7fa;
}

.settings-sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid #e5e5e5;
    padding: 24px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.settings-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.settings-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
}

.settings-link:hover {
    background: var(--clr-primary-hover-bg);
    color: var(--clr-primary);
}

.settings-link.active {
    background: var(--clr-primary-active-bg-to);
    color: var(--clr-primary);
    font-weight: 600;
}

.settings-content {
    flex: 1;
    padding: 40px;
}

.settings-subnav {
    /* margin statt nur margin-left setzen: verhindert, dass der Browser-Default
       (margin-block: 1em) zwischen den einzeln gerenderten <ul>-Blöcken je Untermenüpunkt
       (Datenbank/E-Mail/LLM etc.) unnötig große Lücken erzeugt. */
    margin: 2px 0 2px 20px;
    list-style: none;
    padding-left: 10px;
}

.settings-sublink {
    display: block;
    padding: 5px 0;
    color: #666;
}

    .settings-sublink.active {
        font-weight: bold;
        color: #000;
    }


.modal-backdrop {
    position: fixed;
    inset: 0;
    background: none !important;
    backdrop-filter: blur(3px);
    z-index: 1000 !important;
}

.modal-container {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* WICHTIG */
}

.modal-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 420px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1002; /* WICHTIG */
}

.modal-container-wide {
    align-items: flex-start;
    padding-top: 40px;
}

.modal-card-wide {
    width: min(860px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
}



.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}



    .user-avatar:hover {
        filter: brightness(1.1);
    }



.user-dropdown {
    position: absolute;
    top: calc(100% + 8px); 
    right: 0;
    min-width: 220px;
    padding: 12px;
    background: #ffffff; 
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e5e5;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity .15s ease, transform .15s ease;
}



.user-dropdown.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.user-dropdown .dropdown-item.active,
.user-dropdown .dropdown-item:active {
    background-color: rgba(0,0,0,0.05) !important;
    color: #333 !important;
    font-weight: 600;
}




@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Settings-Toast (fly-in badge) ─────────────────────────────────────── */

@keyframes toastFlyIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-24px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.settings-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1055;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 4px 18px rgba(0,0,0,0.13);
    animation: toastFlyIn 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
    white-space: nowrap;
}

.settings-toast-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #a3cfbb;
}

.settings-toast-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f1aeb5;
}


.user-dropdown form {
    margin: 0;
    padding: 0;
}

/* Sprach-Switcher im User-Dropdown */
.lang-switcher {
    cursor: default;
    gap: 8px;
}
.lang-switcher:hover {
    background: transparent !important;
    color: inherit !important;
}
.lang-options {
    display: flex;
    gap: 4px;
}
.lang-btn {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    color: #555;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.lang-btn:hover {
    background: var(--clr-primary-hover-bg);
    color: var(--clr-primary);
    border-color: var(--clr-primary);
}
.lang-btn.active {
    background: var(--clr-primary);
    color: #fff;
    border-color: var(--clr-primary);
}

.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #333;
    background: transparent;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s, color 0.2s;
}



.user-dropdown .dropdown-item:hover {
    background: var(--clr-primary-hover-bg);
    color: var(--clr-primary);
}



.user-name {
    font-weight: 600;
    margin-bottom: 6px;
    color: #111;
}

.settings-back {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #555;
    text-decoration: none;
    margin-bottom: 10px;
}

    .settings-back:hover {
        color: #000;
    }


.table-responsive {
    max-height: 82vh;
    overflow-y: auto;
}

.table-responsive thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa; 
    z-index: 2;
}





.app-header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}


@media (max-width: 900px) {
    .app-header {
        grid-template-columns: 1fr auto;
    }

    .app-header-center {
        display: none;
    }

    .user-meta {
        display: none;
    }
}



.app-header {
    height: 64px;
    padding: 10px 16px;
    display: grid;
    grid-template-columns: 1fr minmax(240px, 520px) 1fr;
    align-items: center;
    gap: 16px;
    background: rgba(255,255,255,0.90);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #eef0f3;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.04);
    position: sticky;
    top: 0;
    z-index: 80; 
}


.app-header-center {
    display: flex;
    justify-content: center;
}


.app-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.company-logo {
    max-height: 36px;
    max-width: 120px;
    object-fit: contain;
    flex-shrink: 0;
}

.company-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    text-decoration: none;
}

.company-name:hover {
    text-decoration: underline;
}

.title-divider {
    color: #cbd5e1;
    font-weight: 300;
    font-size: 1.2rem;
    align-self: center;
}

.app-title-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}
.app-title-link:hover .app-title {
    color: var(--clr-primary, #0d6efd);
}

.app-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: #0f172a;
    white-space: nowrap;
    transition: color 0.15s;
}


.not-found-icon {
    font-size: 4rem;
    color: #ffc107;
}

/* Ordner-Browser Drag & Drop (SortableJS-Fallback-Ghost - liegt außerhalb des
   Blazor-Komponentenbaums in document.body, daher hier global statt in der
   ProjectFolderBrowser.razor.css). */
.dnd-fallback-ghost {
    opacity: .85;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
    border-radius: 6px;
    background: #fff;
    pointer-events: none;
}

.dnd-droppable {
    outline: 1px dashed #adb5bd;
    outline-offset: -1px;
}

/* Checklisten-Punkte Drag & Drop (ChecklistDetailDialog.razor / checklistDnd.js). */
.checklist-section-items {
    min-height: 12px;
}

.checklist-item-row {
    cursor: grab;
}

.checklist-item-row.sortable-ghost {
    opacity: .4;
}

.checklist-item-row.sortable-chosen {
    box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
}

.not-found-container {
    min-height: 60vh;
}

/* ── Settings-Untermenü-Karten (z.B. /settings/interfaces, /settings/templates) ──
   Klickbare Karten, die auf eine Untermenü-Seite verlinken - Titel + kurze
   Beschreibung, damit man von der Übersichtsseite direkt in die jeweilige
   Unterseite springen kann. */
.settings-nav-card {
    display: block;
    height: 100%;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.settings-nav-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    border-color: var(--clr-primary);
    color: inherit;
    transform: translateY(-1px);
}

.settings-nav-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--clr-primary-hover-bg);
    color: var(--clr-primary);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.settings-nav-card h5 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #212529;
}

.settings-nav-card p {
    margin: 0;
    font-size: 0.82rem;
    color: #6c757d;
    line-height: 1.4;
}
