﻿/* =========================================================
   Root / Variables
   ========================================================= */
:root {
    /* 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-Layout (Aufbau wie AdminLTE, Farben aus consign-theme.css)
   Sidebar | Kopfzeile / Seitenkopf mit Brotkrumen / Inhalt / Fußzeile
   .toggled: Desktop = schmale Sidebar (nur Symbole), mobil = Sidebar eingeblendet
   Markup: Components/Layout/MainLayout.razor, Menü: NavMenu.razor
   ========================================================= */
:root {
    --sidebar-width: 250px;
    --sidebar-mini-width: 4.6rem;
    --topbar-height: 3.6rem;
    --content-bg: var(--gray-100);
    --line: #dee2e6;
    --elevation-1: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24);
    --card-shadow: 0 0 1px rgba(0, 0, 0, .125), 0 1px 3px rgba(0, 0, 0, .2);
}

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

.app-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid var(--line);
    box-shadow: 2px 0 12px rgba(21, 101, 192, .06);
    z-index: 20;
    transition: width var(--transition-slow), flex-basis var(--transition-slow), transform var(--transition-slow);
}

.brand-link {
    height: var(--topbar-height);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 0 1.1rem;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    overflow: hidden;
}

.brand-logo {
    height: 1.75rem;
    width: auto;
}

.brand-sub {
    color: var(--text-muted);
    font-size: .95rem;
    padding-left: .6rem;
    border-left: 1px solid var(--line);
    white-space: nowrap;
}

/* Kurzzeichen für die schmale Sidebar: „C“ in der Logofarbe */
.brand-mark {
    display: none;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    color: #ffffff;
    background: #36338a;
}

.avatar {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 600;
    color: #ffffff;
    background: var(--consign-gradient);
    box-shadow: var(--elevation-1);
}

.avatar-sm { width: 1.9rem; height: 1.9rem; font-size: .72rem; }
.avatar-lg { width: 3.4rem; height: 3.4rem; font-size: 1.1rem; }

.user-panel {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.1rem;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.user-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---------- Sidebar-Menü ---------- */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .5rem 0 1rem;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .2); border-radius: 3px; }

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

.nav-header {
    padding: .9rem .9rem .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .15rem;
    padding: .55rem .8rem;
    border-radius: .3rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-nav .nav-icon {
    width: 1.6rem;
    text-align: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--gray-500);
    flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
    background: var(--consign-primary-tint);
    color: var(--consign-primary-strong);
}

.sidebar-nav .nav-link:hover .nav-icon { color: var(--consign-primary); }

/* Aktiver Eintrag: der eine kräftige Akzent der Oberfläche (ConSign-Verlauf) */
.sidebar-nav .nav-link.active {
    background: var(--consign-gradient);
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--elevation-1);
}

.sidebar-nav .nav-link.active .nav-icon { color: #ffffff; }

.sidebar-nav .nav-link:focus-visible,
.topbar-btn:focus-visible,
.topbar-user:focus-visible,
.user-menu-item:focus-visible,
.brand-link:focus-visible {
    outline: 3px solid rgba(var(--consign-primary-rgb), .45);
    outline-offset: 1px;
}

/* ---------- Rechte Seite: Kopfzeile, Seitenkopf, Inhalt, Fußzeile ---------- */
.app-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: 0 .75rem;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.topbar-btn,
.topbar-link {
    height: 2.5rem;
    min-width: 2.5rem;
    padding: 0 .75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: .3rem;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
}

.topbar-btn:hover,
.topbar-link:hover {
    background: var(--consign-primary-tint);
    color: var(--consign-primary-strong);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.user-menu { position: relative; }

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    height: 2.5rem;
    padding: 0 .6rem;
    border: 0;
    border-radius: .3rem;
    background: transparent;
    color: var(--text-primary);
}

.topbar-user:hover { background: var(--consign-primary-tint); }

.user-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + .35rem);
    z-index: 1041;
    width: 17rem;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: .3rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
    overflow: hidden;
}

.user-menu-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: 1.1rem 1rem;
    color: #ffffff;
    background: var(--consign-gradient);
    text-align: center;
}

.user-menu-head span:last-child { font-size: .85rem; opacity: .9; }
.user-menu-head .avatar { background: rgba(255, 255, 255, .25); box-shadow: none; }

.user-menu-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .65rem 1rem;
    border: 0;
    border-top: 1px solid var(--line);
    background: #ffffff;
    color: var(--text-primary);
    text-align: left;
    text-decoration: none;
}

.user-menu-item:hover { background: var(--gray-50); }

.app-main {
    flex: 1;
    min-width: 0;
}

.content-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: 1.1rem 1.5rem .6rem;
}

.content-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-primary);
}

.content-header .breadcrumb {
    margin: 0;
    font-size: .9rem;
    background: transparent;
}

.content-header .breadcrumb a { text-decoration: none; }

.app-content {
    max-width: 1600px;
    padding: 0 1.5rem 1.5rem;
}

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

.app-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .25rem 1rem;
    padding: .85rem 1.5rem;
    font-size: .9rem;
    background: #ffffff;
    border-top: 1px solid var(--line);
    color: var(--text-secondary);
}

.sidebar-backdrop { display: none; }

/* ---------- Desktop: schmale Sidebar (nur Symbole, Titel als Tooltip) ---------- */
@media (min-width: 992px) {
    .app-layout.toggled .app-sidebar {
        flex-basis: var(--sidebar-mini-width);
        width: var(--sidebar-mini-width);
    }

    .app-layout.toggled .brand-logo,
    .app-layout.toggled .brand-sub,
    .app-layout.toggled .user-info,
    .app-layout.toggled .nav-header,
    .app-layout.toggled .nav-text {
        display: none;
    }

    .app-layout.toggled .brand-mark { display: inline-flex; }
    .app-layout.toggled .brand-link,
    .app-layout.toggled .user-panel { justify-content: center; padding-left: 0; padding-right: 0; }
    .app-layout.toggled .sidebar-nav .nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
    .app-layout.toggled .nav-list { padding-top: .5rem; }
}

/* ---------- Kleine Bildschirme: Sidebar als Ebene über dem Inhalt ---------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1030;
        transform: translateX(-100%);
        box-shadow: none;
    }

    .app-layout.toggled .app-sidebar {
        transform: none;
        box-shadow: 0 14px 28px rgba(0, 0, 0, .25), 0 10px 10px rgba(0, 0, 0, .22);
    }

    .app-layout.toggled .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1025;
        background: rgba(0, 0, 0, .35);
    }

    .content-header { padding: .9rem 1rem .5rem; }
    .content-header h1 { font-size: 1.35rem; }
    .app-content { padding: 0 1rem 1rem; }
    .app-footer { padding: .75rem 1rem; }
}

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

/* =========================================================
   Karten (AdminLTE: weiß, feiner Schatten, Linie in Primärfarbe oben)
   ========================================================= */
.card {
    --bs-card-border-radius: .3rem;
    --bs-card-inner-border-radius: .3rem;
    border: 0;
    border-top: 3px solid var(--consign-primary);
    border-radius: .3rem;
    background-color: #ffffff;
    box-shadow: var(--card-shadow);
    margin-bottom: 1rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, .125);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    padding: .75rem 1.25rem;
}

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

.card.rounded-0 { border-radius: .3rem !important; }

.card-body { padding: 1.25rem; }

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

/* Unterkarten: ohne Primärlinie, flacher */
.card .card {
    border: 1px solid rgba(0, 0, 0, .125);
    box-shadow: none;
}

.card .card .card-header {
    background: var(--gray-50);
    color: var(--text-primary);
    font-size: .95rem;
    padding: .6rem 1rem;
}

.card .card > .card-header.rounded-0,
.card .card > .card-header:first-child {
    border-radius: .3rem .3rem 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;
    border-top: 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;
}
