/* =========================================================
   Basis / Global
========================================================= */

html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    margin-bottom: 60px;
    background-color: #f5f7fb;
    overflow-x: hidden;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.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;
}

/* =========================================================
   App Layout
========================================================= */

.app-shell {
    display: flex;
    min-height: 100vh;
    background-color: #f5f7fb;
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    min-height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.03);
}

.app-topbar-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #111827;
}

.app-content {
    flex: 1 1 auto;
    padding: 1.5rem;
}

.app-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    font-size: 0.9rem;
}

/* =========================================================
   Sidebar Desktop
========================================================= */

.app-sidebar {
    width: 236px;
    min-width: 236px;
    max-width: 236px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    background: #1f2937;
    color: #fff;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.sidebar-brand {
    padding: 1rem 0.9rem 0.8rem 0.9rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.08rem;
    font-weight: 700;
    display: inline-block;
    line-height: 1.2;
}

    .sidebar-brand-link:hover {
        color: #fff;
    }

.sidebar-subtitle {
    color: #9ca3af;
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sidebar-section-title {
    margin-top: 0.55rem;
    margin-bottom: 0.1rem;
    padding: 0 0.5rem;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #9ca3af;
}

    .sidebar-section-title:first-child {
        margin-top: 0;
    }

.sidebar-link {
    color: #e5e7eb;
    text-decoration: none;
    padding: 0.48rem 0.65rem;
    border-radius: 0.6rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    display: block;
    font-size: 0.92rem;
    line-height: 1.2;
}

    .sidebar-link:hover {
        background-color: #374151;
        color: #fff;
    }

    .sidebar-link.active {
        background: #374151;
        color: #fff;
        font-weight: 600;
        box-shadow: none;
    }

/* =========================================================
   Sidebar / Offcanvas Mobile
========================================================= */

.offcanvas .sidebar-nav {
    height: 100%;
    overflow-y: auto;
    padding: 0.75rem;
}

.offcanvas .sidebar-section-title {
    color: #6c757d;
}

.offcanvas .sidebar-link {
    color: #212529;
}

    .offcanvas .sidebar-link:hover {
        background-color: #f1f3f5;
        color: #212529;
        transform: none;
    }

    .offcanvas .sidebar-link.active {
        background: #374151;
        color: #fff;
        font-weight: 600;
        box-shadow: none;
    }

/* =========================================================
   Cards / Tables / General UI
========================================================= */

.card {
    border: none;
    border-radius: 1rem;
}

.table {
    background: #fff;
}

.dashboard-tile {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 14px;
}

    .dashboard-tile:hover {
        transform: translateY(-4px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, .15) !important;
    }

/* =========================================================
   Artikel / Kategorie Navigation
========================================================= */

.artikel-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.artikel-header-sticky {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #f8f9fa;
    padding-top: 0.25rem;
    padding-bottom: 0.75rem;
}

.artikel-nur-aktiv-wrap {
    padding-top: 2rem;
}

.kategorie-sidebar {
    position: sticky;
    top: 190px;
}

.kategorie-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.kategorie-group + .kategorie-group {
    margin-top: 0.35rem;
}

.kategorie-link-haupt {
    font-weight: 600;
}

.kategorie-subnav {
    margin-top: 0.2rem;
    margin-left: 0.75rem;
    border-left: 2px solid #e9ecef;
    padding-left: 0.5rem;
}

.kategorie-link-sub {
    font-size: 0.95rem;
}

.kategorie-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    border-radius: 0.6rem;
    color: #212529;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

    .kategorie-link:hover {
        background-color: #f3f5f7;
        color: #212529;
        text-decoration: none;
    }

    .kategorie-link.active {
        background-color: #e9f2ff;
        color: #0d6efd;
        font-weight: 600;
    }

.kategorie-count {
    min-width: 2rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background-color: #eef1f4;
    color: #6c757d;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.4;
}

.kategorie-link.active .kategorie-count {
    background-color: #0d6efd;
    color: #fff;
}

.artikel-tabelle-wrap {
    max-height: calc(100vh - 290px);
    overflow-y: auto;
}

.artikel-table-head th {
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: #fff;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* =========================================================
   Scanner
========================================================= */

.scanner-frame {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 1rem;
    overflow: hidden;
    background: #111827;
    min-height: 260px;
}

    .scanner-frame video {
        border-radius: 1rem;
    }

.scan-success {
    background-color: #d1e7dd !important;
    transition: background-color 0.2s ease;
}

#scanHistoryList .list-group-item {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* =========================================================
   Timeline
========================================================= */

.timeline {
    position: relative;
    padding-left: 30px;
}

    .timeline::before {
        content: '';
        position: absolute;
        left: 10px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: #dee2e6;
    }

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-marker {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.timeline-content {
    padding-left: 10px;
}

/* =========================================================
   Responsive
========================================================= */

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .app-sidebar {
        position: static;
        width: 100%;
        height: auto;
        box-shadow: none;
    }

    .app-topbar {
        position: static;
        min-height: auto;
        padding: 1rem 1.25rem;
    }

    .app-topbar-title {
        font-size: 1rem;
    }

    .app-content {
        padding: 1.25rem;
    }

    .app-footer {
        padding: 1rem 1.25rem;
    }
}

@media (max-width: 767.98px) {
    .scanner-frame {
        min-height: 320px;
    }
}

/* =========================================================
   Sidebar Enhanced: Suche + einklappbare Gruppen
========================================================= */

.sidebar-nav-enhanced {
    gap: 0.35rem;
}

.sidebar-search-wrap {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #1f2937;
    padding-bottom: 0.45rem;
    margin-bottom: 0.2rem;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar-search-input {
    border-radius: 0.6rem;
    font-size: 0.88rem;
    padding: 0.42rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

    .sidebar-search-input::placeholder {
        color: #c7cdd7;
    }

    .sidebar-search-input:focus {
        background-color: rgba(255, 255, 255, 0.12);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.18);
        box-shadow: none;
    }

.sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0.15rem 0.1rem;
    border-radius: 0.45rem;
    text-align: left;
}

    .sidebar-group-toggle:hover .sidebar-section-title {
        color: #cfd6df;
    }

.sidebar-group-chevron {
    color: #9ca3af;
    font-size: 0.72rem;
    padding-right: 0.35rem;
    transition: transform 0.15s ease;
}

.sidebar-group.collapsed .sidebar-group-chevron {
    transform: rotate(-90deg);
}

.sidebar-group-body {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.sidebar-group.collapsed .sidebar-group-body {
    display: none;
}

/* Wenn Suche aktiv ist */
.sidebar-link.sidebar-search-hidden {
    display: none !important;
}

.sidebar-group.sidebar-search-hidden {
    display: none !important;
}

/* Offcanvas Suchfeld */
.offcanvas .sidebar-search-wrap {
    background: #fff;
    box-shadow: 0 1px 0 #dee2e6;
}

.offcanvas .sidebar-search-input {
    background: #fff;
    color: #212529;
    border: 1px solid #dee2e6;
}

    .offcanvas .sidebar-search-input::placeholder {
        color: #6c757d;
    }

/* Container */

.container-parent-row {
    background-color: rgba(13, 110, 253, 0.08);
    border-left: 4px solid #0d6efd;
}

.container-child-row {
    background-color: rgba(0, 0, 0, 0.02);
}

    .container-parent-row .artikel-anzeige-input,
    .container-child-row .artikel-anzeige-input {
        font-weight: 600;
    }

    .container-child-row td:nth-child(3),
    .container-child-row td:nth-child(4) {
        padding-left: 1.5rem;
    }

.container-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    border-radius: 999px;
    background: #0d6efd;
    color: #fff;
    vertical-align: middle;
}

.container-child-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    border-radius: 999px;
    background: #6c757d;
    color: #fff;
    vertical-align: middle;
}