﻿/* =========================================================
   Root / Variables
   ========================================================= */
:root {
    --sidebar-width: 280px;
    --sidebar-dock-width: 70px;
    --header-height: 56px;
    
    /* Sidebar: weiss, aktiver Eintrag im ConSign-Verlauf (Referenz ConSign.Demo) */
    --sidebar-bg-top: #ffffff;
    --sidebar-bg-bottom: #f8f9fc;
    --sidebar-border: rgba(15, 23, 42, .07);
    --sidebar-hover: var(--consign-primary-tint);
    --sidebar-active-bg: var(--consign-gradient);
    --sidebar-active-accent: var(--consign-primary);

    /* Text (neutral wie in ConSign.Demo) */
    --text-primary: #343a40;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;

    /* Primaerfarbe: einzige Quelle ist die Blau-Skala in consign-theme.css */
    --primary-color: var(--consign-primary);
    --primary-hover: var(--consign-primary-hover);
    --primary-active: var(--consign-primary-active);
    --primary-light: rgba(var(--consign-primary-rgb), .12);

    /* Feedback Colors */
    --success-color: #2e7d32;
    --danger-color: #dc3545;
    --danger-hover: #c82333;
    --warning-color: #ffc107;
    --info-color: #0d6efd;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f5f6f8;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4f566b;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07);
    --shadow-lg: 0 6px 20px rgba(0,0,0,.06);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.1);
    
    /* Z-Index */
    --z-dropdown: 1000;
    --z-sidebar: 1000;
    --z-header: 1001;
    --z-modal: 1050;
    --z-tooltip: 1100;
}

/* =========================================================
   FontAwesome Icon Support - CRITICAL FIX
   ========================================================= */

/* Ensure FontAwesome icons are visible in all contexts */
i.fas,
i.far,
i.fab,
i.fa {
    display: inline-block !important;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
}

/* Icons in buttons */
.e-btn i,
.btn i,
button i {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

/* Icon spacing */
i + span,
i + .visually-hidden {
    margin-left: 0.35rem;
}

.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }

/* =========================================================
   App Grid Layout
   ========================================================= */
.app-layout {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Desktop: Fixed sidebar layout */
@media (min-width: 992px) {
    .app-layout {
        grid-template-columns: 280px 1fr;
        grid-template-areas:
            "sidebar header"
            "sidebar main";
    }
}

/* Mobile: Overlay sidebar layout */
@media (max-width: 991.98px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }
}

/* =========================================================
   Syncfusion AppBar Styling
   ========================================================= */
/* Schrift wie ConSign.Demo */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
}

.e-appbar.app-appbar {
    grid-area: header;
    height: var(--header-height);
    background: rgba(255, 255, 255, .92) !important;
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--sidebar-border);
    box-shadow: 0 2px 10px rgba(21, 101, 192, 0.06);
    z-index: 1001;
    padding: 0 1rem;
    display: flex;
    align-items: center;
}

.e-appbar.app-appbar .e-btn.e-inherit {
    color: var(--text-primary);
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.e-appbar.app-appbar .e-btn.e-inherit i,
.e-appbar.app-appbar .e-btn.e-inherit .fas {
    font-size: 1.1rem;
}

.e-appbar.app-appbar .e-btn.e-inherit .e-icons {
    font-size: 1.4rem;
}

.e-appbar.app-appbar .e-btn.e-inherit:hover {
    background: var(--consign-primary-tint);
    color: var(--primary-hover);
}

.e-appbar.app-appbar .e-btn.e-inherit.text-danger {
    color: #dc3545 !important;
}

.e-appbar.app-appbar .e-btn.e-inherit.text-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333 !important;
}

/* Visually Hidden für Screen Reader */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.header-toggle-btn {
    margin-right: 0.75rem;
}

.header-logo {
    height: 28px;
    width: auto;
    display: block;
    margin-right: auto;
}

.header-user {
    font-size: .9rem;
    color: var(--text-secondary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

/* Initialen-Avatar im Demo-Verlauf */
.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--consign-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(21, 101, 192, .3);
}

/* =========================================================
   Syncfusion Sidebar Styling
   (Selektor ueber .app-layout: SfSidebar uebernimmt CssClass="custom-sidebar"
    in 34.x nicht zuverlaessig ins DOM)
   ========================================================= */
.app-layout > .e-sidebar {
    grid-area: sidebar;
    background: linear-gradient(180deg, var(--sidebar-bg-top) 0%, var(--sidebar-bg-bottom) 100%);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 2px 0 12px rgba(21, 101, 192, .06);
    z-index: 1000;
}

/* Desktop: Fixed sidebar, always visible */
@media (min-width: 992px) {
    .app-layout > .e-sidebar {
        position: relative !important;
        width: 280px !important;
        height: 100% !important;
        transform: none !important;
        visibility: visible !important;
    }
    
    /* No overlay on desktop */
    .e-sidebar-overlay {
        display: none !important;
    }
}

/* Mobile: Overlay sidebar */
@media (max-width: 991.98px) {
    .app-layout > .e-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh !important;
        width: 280px !important;
        transition: transform 0.3s ease;
        z-index: 1002 !important; /* ueber der AppBar (1001); SfSidebar setzt inline 1000 */
    }
    
    .app-layout > .e-sidebar.e-close {
        transform: translateX(-100%);
    }
    
    .app-layout > .e-sidebar.e-open {
        transform: translateX(0);
    }
}

.sidebar-content {
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--sidebar-border);
    min-height: 80px;
    background: #ffffff;
    position: relative;
}

/* duenne Verlaufslinie unter dem Logo (Demo-Akzent) */
.sidebar-header::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: -1px;
    height: 3px;
    border-radius: 3px;
    background: var(--consign-gradient);
    opacity: .85;
}

.sidebar-section-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: .75rem 1rem .25rem;
}

.sidebar-logo-full {
    max-width: 180px;
    height: auto;
    display: block;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--sidebar-active-accent);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

/* =========================================================
   Nav Menu Styling
   ========================================================= */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 1rem 0.5rem;
    flex: 1;
    overflow-y: auto;
}

.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* =========================================================
   Main Content
   ========================================================= */
.app-main {
    grid-area: main;
    min-height: 0;
    overflow-y: auto;
    background: var(--consign-gradient-soft);
    background-attachment: fixed;
    position: relative;
}

.app-content {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    animation: consign-fade-in .35s ease-out;
}

.app-content.fullscreen {
    padding: 0;
}

@keyframes consign-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .app-content { animation: none; }
}

/* =========================================================
   Mobile / Responsive
   ========================================================= */
@media (max-width: 991.98px) {
    .header-logo {
        display: block !important;
    }
}

/* =========================================================
   Nav Menu (Eintraege)
   ========================================================= */
.nav-items-expanded {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.nav-item-expanded {
    display: flex;
    align-items: center;
    padding: .65rem .9rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: .75rem;
    font-weight: 500;
    transition: background-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.nav-item-expanded:hover {
    background-color: var(--sidebar-hover);
    color: var(--consign-primary-strong);
    transform: translateX(3px);
}

.nav-item-expanded.active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(21, 101, 192, .28);
    transform: none;
}

.nav-item-expanded .nav-icon {
    font-size: 1rem;
    width: 2.1rem;
    height: 2.1rem;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-right: .75rem;
    flex-shrink: 0;
    border-radius: .6rem;
    color: var(--consign-primary);
    background: var(--consign-primary-tint);
    transition: inherit;
}

.nav-item-expanded.active .nav-icon {
    color: #ffffff;
    background: rgba(255, 255, 255, .2);
}

.nav-text {
    font-size: .95rem;
    white-space: nowrap;
}

/* =========================================================
   Cards (Demo: runde Ecken, weicher Schatten, Kopf im Verlauf)
   ========================================================= */
.card {
    --bs-card-border-radius: 1rem;
    --bs-card-inner-border-radius: calc(1rem - 1px);
    border: 1px solid rgba(21, 101, 192, .06);
    border-radius: 1rem;
    background-color: #ffffff;
    box-shadow: 0 .5rem 1.5rem rgba(21, 101, 192, .08);
}

/* Seitenkopf: blauer Verlauf mit weisser Schrift (wie Demo-Workflowkarten) */
.card-header {
    background: var(--consign-gradient);
    border-bottom: 0;
    font-weight: 600;
    font-size: 1.25rem;
    color: #ffffff;
    padding: 1rem 1.25rem;
    letter-spacing: .01em;
}

/* Die Seiten setzen .rounded-0 (Bootstrap, !important) - oben trotzdem rund */
.card > .card-header.rounded-0,
.card > .card-header:first-child {
    border-radius: calc(1rem - 1px) calc(1rem - 1px) 0 0 !important;
}

.card-body {
    padding: 1.25rem;
}

.card-text {
    color: var(--text-secondary);
}

/* Unterkarten: heller Blauton, Akzentstrich links */
.card .card {
    box-shadow: none;
    border: 1px solid rgba(21, 101, 192, .1);
    border-radius: .75rem;
}

.card .card .card-header {
    background: var(--consign-primary-tint);
    color: var(--consign-primary-strong);
    font-size: .95rem;
    padding: .65rem 1rem;
    border-left: 4px solid var(--consign-accent);
}

.card .card > .card-header.rounded-0,
.card .card > .card-header:first-child {
    border-radius: calc(.75rem - 1px) calc(.75rem - 1px) 0 0 !important;
}

.dialog-header {
    font-weight: 600;
}

/* =========================================================
   Buttons: leichter Hover-Lift wie in der Demo
   ========================================================= */
.btn,
.e-btn {
    transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.btn-primary:hover,
.e-btn.e-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(var(--consign-primary-rgb), .3);
}

/* =========================================================
   Dashboard (Home)
   ========================================================= */
.dashboard-card {
    border: 0;
    overflow: hidden;
    position: relative;
    transition: transform .3s ease, box-shadow .3s ease;
}

.dashboard-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--consign-gradient);
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(21, 101, 192, .15);
}

.dashboard-icon {
    display: flex;
    justify-content: center;
}

.dashboard-icon i {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--consign-primary);
    background: var(--consign-primary-tint);
    border: 2px solid var(--consign-primary-subtle);
}

/* =========================================================
   Anmeldeseiten (Login, Passwort): Demo-Hero-Verlauf
   ========================================================= */
.auth-shell {
    min-height: 100vh;
    min-height: 100dvh;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, .18) 0, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255, 255, 255, .12) 0, transparent 45%),
        var(--consign-gradient);
    position: relative;
    overflow: hidden;
}

.auth-shell .card {
    border: 0;
    box-shadow: 0 1.5rem 3rem rgba(13, 71, 161, .3) !important;
    animation: consign-fade-in .4s ease-out;
}

.auth-shell .form-label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* =========================================================
   Platzhalter-Chips (Texte-Editor, PlaceholderHelp.razor)
   ========================================================= */
.placeholder-palette {
    background: #ffffff;
    border: 1px solid rgba(21, 101, 192, .12);
    border-radius: .75rem;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}

.placeholder-palette-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem 1rem;
    margin-bottom: .5rem;
    color: var(--consign-primary-strong);
}

.placeholder-group + .placeholder-group {
    margin-top: .5rem;
}

.placeholder-group-title {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .3rem;
}

.placeholder-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.placeholder-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .65rem .3rem .45rem;
    border-radius: 999px;
    border: 1px solid var(--consign-primary-subtle);
    background: var(--consign-primary-tint);
    color: var(--consign-primary-strong);
    font-size: .85rem;
    line-height: 1.2;
    cursor: grab;
    user-select: none;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.placeholder-chip:hover {
    background: #ffffff;
    border-color: var(--consign-primary-soft);
    box-shadow: 0 4px 10px rgba(21, 101, 192, .15);
    transform: translateY(-1px);
}

.placeholder-chip:active {
    cursor: grabbing;
}

.placeholder-chip:focus-visible {
    outline: 2px solid var(--consign-primary);
    outline-offset: 2px;
}

.placeholder-chip-grip {
    font-size: .7rem;
    opacity: .5;
}

.placeholder-chip-token {
    font-family: Consolas, 'Courier New', monospace;
    font-weight: 600;
}

.placeholder-chip-label {
    color: var(--text-muted);
    font-size: .78rem;
}

/* Tablet-Felder gelb (Demo-Sekundaerfarbe), Firmendaten gruen abgesetzt */
.placeholder-chip-tablet {
    background: #fff8e1;
    border-color: #ffe082;
    color: #8a5a00;
}

.placeholder-chip-company {
    background: #e8f5e9;
    border-color: #c8e6c9;
    color: #1b5e20;
}

.placeholder-issues ul {
    margin: .25rem 0 0;
    padding-left: 1.25rem;
}

/* =========================================================
   Startseite nach Login (Index.razor)
   ========================================================= */
.welcome-logo {
    max-width: 200px;
    width: 100%;
    height: auto;
}

.welcome-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.welcome-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: .75rem;
    background: var(--consign-primary-tint);
    border: 1px solid var(--consign-primary-subtle);
    border-left: 4px solid var(--consign-accent);
}

.welcome-avatar {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--consign-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(21, 101, 192, .3);
}

.welcome-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .15rem 1rem;
    color: var(--text-primary);
}

.welcome-details dt {
    font-weight: 600;
    color: var(--consign-primary-strong);
}

.welcome-details dd {
    margin: 0;
}
