/* navigation.css — V14 Topbar Navigation */

/* ===== Topbar ===== */
.tp-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    z-index: 9990;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

[data-theme="light"] .tp-nav {
    background: #ffffff;
    border-bottom-color: #e2e8f0;
}

/* ===== Left: Brand + Menu ===== */
.tp-nav-left {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

/* Brand */
.tp-nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 4px;
    margin-right: 8px;
    text-decoration: none;
    flex-shrink: 0;
}

.tp-nav-brand-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 12px;
    flex-shrink: 0;
}

.tp-nav-brand-text {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

[data-theme="light"] .tp-nav-brand-text {
    color: #1e293b;
}

/* ===== Nav Links ===== */
.tp-nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    white-space: nowrap;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tp-nav-link:hover {
    color: #e2e8f0;
    background: #1e293b;
}

.tp-nav-link.active,
.tp-nav-dropdown.active > .tp-nav-link {
    color: #3b82f6;
}

[data-theme="light"] .tp-nav-link {
    color: #64748b;
}

[data-theme="light"] .tp-nav-link:hover {
    color: #1e293b;
    background: #f1f5f9;
}

[data-theme="light"] .tp-nav-link.active,
[data-theme="light"] .tp-nav-dropdown.active > .tp-nav-link {
    color: #2563eb;
}

.tp-nav-icon {
    font-size: 14px;
}

.tp-nav-arrow {
    font-size: 10px;
    opacity: 0.6;
}

/* ===== Dropdowns ===== */
.tp-nav-dropdown {
    position: relative;
}

.tp-nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 6px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 9991;
}

[data-theme="light"] .tp-nav-dropdown-menu {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.tp-nav-dropdown.open .tp-nav-dropdown-menu {
    display: block;
}

.tp-nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    transition: all 0.15s;
    white-space: nowrap;
}

.tp-nav-dropdown-item:hover {
    color: #e2e8f0;
    background: #334155;
}

.tp-nav-dropdown-item.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .tp-nav-dropdown-item {
    color: #64748b;
}

[data-theme="light"] .tp-nav-dropdown-item:hover {
    color: #1e293b;
    background: #f1f5f9;
}

[data-theme="light"] .tp-nav-dropdown-item.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.tp-nav-dd-icon {
    font-size: 15px;
    width: 20px;
    text-align: center;
}

/* ===== Right: Actions ===== */
.tp-nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ===== Logout Button ===== */
.tp-nav-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    padding: 0;
    margin-left: 4px;
}

.tp-nav-logout:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

[data-theme="light"] .tp-nav-logout {
    color: #64748b;
}

[data-theme="light"] .tp-nav-logout:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

/* ===== Hamburger (mobile) ===== */
.tp-nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}

.tp-nav-hamburger:hover {
    background: #1e293b;
}

[data-theme="light"] .tp-nav-hamburger {
    color: #1e293b;
}

[data-theme="light"] .tp-nav-hamburger:hover {
    background: #f1f5f9;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .tp-nav-brand-text {
        display: none;
    }
}

@media (max-width: 768px) {
    .tp-nav-hamburger {
        display: block;
    }

    .tp-nav-left {
        display: none;
        position: absolute;
        top: 48px;
        left: 0;
        right: 0;
        background: #0f172a;
        border-bottom: 1px solid #1e293b;
        flex-direction: column;
        padding: 8px;
        gap: 2px;
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    }

    [data-theme="light"] .tp-nav-left {
        background: #ffffff;
        border-bottom-color: #e2e8f0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }

    .tp-nav-left.tp-nav-mobile-open {
        display: flex;
    }

    .tp-nav-brand {
        display: none;
    }

    .tp-nav-link {
        width: 100%;
        padding: 10px 14px;
        font-size: 14px;
        border-radius: 8px;
    }

    .tp-nav-dropdown {
        width: 100%;
    }

    .tp-nav-dropdown > .tp-nav-link {
        width: 100%;
    }

    .tp-nav-dropdown-menu {
        position: static;
        margin-top: 0;
        border: none;
        box-shadow: none;
        padding: 0 0 0 20px;
        background: transparent;
        min-width: 0;
        border-radius: 0;
    }

    .tp-nav-dropdown-item {
        padding: 8px 14px;
        font-size: 13px;
    }

    .tp-nav-dropdown.open .tp-nav-dropdown-menu {
        display: block;
    }
}

/* ===== Global Theme Harmonisierung (V14) ===== */
/* Zwingt alle Seiten auf einheitliches Slate/Blue-Farbschema */

/* Body & Hintergrund */
body {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}
[data-theme="light"] body {
    background: #f8fafc !important;
    color: #1e293b !important;
}

/* Alte Page-Header ausblenden (V14 Topbar ersetzt sie) */
.header:has(.header-actions),
.page-header:has(.header-actions),
.page-header:has(.nav-links) {
    display: none !important;
}

/* Interne Sidebars — Farben angleichen */
.page-sidebar {
    background: #0f172a !important;
    border-right-color: #1e293b !important;
}
[data-theme="light"] .page-sidebar {
    background: #ffffff !important;
    border-right-color: #e2e8f0 !important;
}

.page-sidebar-item {
    color: #94a3b8 !important;
}
.page-sidebar-item:hover {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}
.page-sidebar-item.active {
    background: rgba(59, 130, 246, 0.12) !important;
    color: #3b82f6 !important;
    border-left-color: #3b82f6 !important;
}
[data-theme="light"] .page-sidebar-item { color: #64748b !important; }
[data-theme="light"] .page-sidebar-item:hover { background: #f1f5f9 !important; color: #1e293b !important; }
[data-theme="light"] .page-sidebar-item.active { background: rgba(59, 130, 246, 0.08) !important; color: #2563eb !important; border-left-color: #2563eb !important; }

.page-sidebar-section {
    color: #64748b !important;
}

/* Cards — einheitlich */
.card, .stat-card, .feature-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
[data-theme="light"] .card,
[data-theme="light"] .stat-card,
[data-theme="light"] .feature-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Accent-Farbe: Indigo (#818cf8) → Blue (#3b82f6) */
.stat-card .value {
    color: #3b82f6 !important;
}
.stat-card.green .value { color: #22c55e !important; }
.stat-card.red .value { color: #ef4444 !important; }
.stat-card.yellow .value { color: #eab308 !important; }

/* Stat-Cards Hintergrund */
.stat-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
.stat-card.green { background: rgba(34, 197, 94, 0.08) !important; border-color: rgba(34, 197, 94, 0.2) !important; }
.stat-card.red { background: rgba(239, 68, 68, 0.08) !important; border-color: rgba(239, 68, 68, 0.2) !important; }
.stat-card.yellow { background: rgba(234, 179, 8, 0.08) !important; border-color: rgba(234, 179, 8, 0.2) !important; }

[data-theme="light"] .stat-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

/* Buttons */
.btn-primary {
    background: #3b82f6 !important;
}
.btn-primary:hover {
    background: #2563eb !important;
}

/* Tabellen */
th, td {
    border-bottom-color: #1e293b !important;
}
th { color: #64748b !important; }
td { color: #cbd5e1 !important; }
tr:hover td { background: rgba(59, 130, 246, 0.05) !important; }

[data-theme="light"] th, [data-theme="light"] td { border-bottom-color: #e2e8f0 !important; }
[data-theme="light"] th { color: #64748b !important; }
[data-theme="light"] td { color: #334155 !important; }
[data-theme="light"] tr:hover td { background: rgba(59, 130, 246, 0.03) !important; }

/* Version Badges — einheitlich blau statt lila */
.version-badge {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
}

/* Toggle Switches */
.toggle input:checked + .slider {
    background: #3b82f6 !important;
}

/* Card Headers */
.card-header h3 {
    color: #e2e8f0 !important;
}
[data-theme="light"] .card-header h3 {
    color: #1e293b !important;
}

/* Page Layout — Padding für V14 Topbar */
.page-layout {
    min-height: calc(100vh - 48px) !important;
    margin-top: 0 !important;
}

/* ===== Mobile Page-Sidebar Overlay (V17) ===== */
@media (max-width: 768px) {
    .page-sidebar {
        position: fixed !important;
        top: 48px !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        z-index: 9980 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.25s ease !important;
        overflow-y: auto !important;
    }
    .page-sidebar.sidebar-open {
        transform: translateX(0) !important;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9979;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .page-main {
        margin-left: 0 !important;
    }
}

/* ===== Sidebar Toggle Button (V17) ===== */
.tp-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    margin-right: 4px;
}
.tp-sidebar-toggle:hover {
    background: #1e293b;
    color: #e2e8f0;
}
[data-theme="light"] .tp-sidebar-toggle:hover {
    background: #f1f5f9;
    color: #1e293b;
}
@media (max-width: 768px) {
    .tp-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== Print ===== */
@media print {
    .tp-nav {
        display: none !important;
    }
}
