:root {
    --primary: #79b51c;
    --primary-glow: rgba(121, 181, 28, 0.15);
    --bg: #f8fafc;
    --sidebar: #ffffff;
    --card: #ffffff;
    --text: #0f172a;
    --text-dim: #64748b;
    --border: #e2e8f0;
    --radius: 20px;
    --font-main: 'Plus Jakarta Sans';
}

body.dark-mode {
    --bg: #0f172a;
    --sidebar: #1e293b;
    --card: #1e293b;
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --border: #334155;
}

* { 
    margin: 0; padding: 0; box-sizing: border-box; 
    font-family: var(--font-main), sans-serif; 
    letter-spacing: -0.01em; /* Subtiler moderner Look */
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition: all 0.3s;
    line-height: 1.5; /* Bessere Grund-Lesbarkeit */
}

/* App Wrapper als Flex-Container für Desktop */
#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
#sidebar {
    width: 320px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 40px 24px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header { margin-bottom: 40px; }
.sidebar-header h1 { 
    font-size: clamp(24px, 5vw, 28px); 
    font-weight: 800; 
    letter-spacing: -1px; 
    margin-top: 8px; 
    overflow-wrap: break-word;
}

.search-container {
    position: relative;
    margin-bottom: 30px;
}

.search-container i {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-dim); width: 18px;
}

.search-container input {
    width: 100%; padding: 14px 14px 14px 44px;
    background: var(--bg); border: 2px solid transparent; border-radius: 14px;
    font-size: 15px; color: var(--text); outline: none; transition: 0.3s;
}

.search-container input:focus { border-color: var(--primary); background: var(--sidebar); }

#categoryNav { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    color: var(--text-dim); font-weight: 700; cursor: pointer;
    transition: 0.2s;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary-glow); color: var(--primary); }
.nav-link i { width: 20px; }

/* Sidebar Subcategories */
.sidebar-subcats {
    display: flex;
    flex-direction: column;
    gap: 0px;
    padding-left: 20px;
    margin-top: 2px;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease-out;
}

.nav-sub-link {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 14px; border-radius: 12px;
    color: var(--text-dim); font-size: 14px; font-weight: 600; cursor: pointer;
    transition: 0.2s;
}

.nav-sub-link:hover { background: var(--bg); color: var(--text); }
.nav-sub-link.active { background: var(--primary-glow); color: var(--primary); }
.nav-sub-link i { width: 16px; height: 16px; }

.sidebar-footer {
    display: flex; gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border);
}

.icon-btn {
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Content Area */
#contentArea {
    flex: 1; min-width: 0; padding: 60px 5vw;
}

.welcome-screen {
    min-height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center;
}

.welcome-screen h2 { 
    font-size: clamp(32px, 8vw, 48px); 
    font-weight: 800; 
    margin-bottom: 16px; 
    line-height: 1.1;
    overflow-wrap: break-word;
    hyphens: auto;
}

.drill-down { animation: fadeIn 0.4s ease-out; }

.breadcrumbs {
    font-size: 11px; font-weight: 800; color: var(--primary); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: 24px;
    overflow-wrap: break-word;
}

.crumb { cursor: pointer; transition: 0.2s; }
.crumb:hover { text-decoration: underline; }

.node-content {
    margin-bottom: 40px; line-height: 1.6; 
    font-size: clamp(16px, 4vw, 18px); 
    color: var(--text-dim);
    overflow-wrap: break-word;
    hyphens: auto;
}

.children-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;
}

.child-card {
    position: relative;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0; cursor: pointer; transition: 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
    display: flex; flex-direction: column; height: 100%;
}

.child-card-content {
    padding: 24px; flex: 1;
}

.child-card-action {
    padding: 15px 24px;
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    color: var(--primary); font-weight: 700; font-size: 14px;
    background: rgba(140, 198, 63, 0.05); /* very light primary */
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    transition: 0.3s;
}

.child-card:hover .child-card-action {
    background: var(--primary);
    color: white;
}

.child-card:hover { transform: translateY(-5px); box-shadow: 0 12px 30px rgba(0,0,0,0.05); border-color: var(--primary); }

.child-card h3 { 
    font-size: clamp(18px, 4vw, 20px); 
    font-weight: 800; 
    margin-bottom: 12px; 
    overflow-wrap: break-word;
    hyphens: auto;
}

.content-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 30px; box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.card-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-preview-list li {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-preview-list li::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
}
.child-card p { font-size: 14px; color: var(--text-dim); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Admin View */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.admin-actions { display: flex; gap: 12px; }

.btn-primary {
    background: var(--primary); color: #fff; border: none; padding: 12px 24px;
    border-radius: 12px; font-weight: 800; cursor: pointer;
}

.btn-secondary {
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    padding: 12px 24px; border-radius: 12px; font-weight: 700; cursor: pointer;
}

.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-item {
    background: var(--card); border: 1px solid var(--border); padding: 16px 24px;
    border-radius: 16px; display: flex; justify-content: space-between; align-items: center;
}

/* Modals - Fix für Desktop-Sichtbarkeit */
.modal {
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); 
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center; 
    z-index: 9999; /* Sehr hoch für Priorität */
    padding: 20px;
    animation: modal-fade-in 0.3s ease;
}

.modal.hidden { display: none !important; }

.modal-content {
    background: var(--card); 
    width: 100%; 
    max-width: 650px; 
    border-radius: 32px;
    padding: 40px; 
    position: relative; 
    max-height: 95vh; 
    overflow-y: auto;
    box-shadow: 0 40px 100px rgba(0,0,0,0.3);
    /* Animation für flüssigen Wechsel */
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.modal-inner {
    animation: modalContentReveal 0.4s cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes modalContentReveal {
    from { opacity: 0; transform: translateY(15px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.close-btn {
    position: absolute; 
    top: 20px; 
    right: 20px; 
    background: var(--bg); 
    border: none;
    padding: 10px; 
    border-radius: 100px; 
    cursor: pointer; 
    color: var(--text);
    z-index: 10;
}

/* Saubere Navigation unten in der Box (nur noch für Counter) */
.clean-modal-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
    .clean-modal-nav {
        display: none; /* Zähler ist bereits in der mobilen Nav-Leiste enthalten */
    }
}

.nav-counter {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dim);
}

/* Neue linke und rechte Navigationspfeile */
.modal-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--primary);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.modal-nav-arrow:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-arrow.left-arrow {
    left: calc(50% - 325px - 80px); /* 325px is half of 650px max-width, plus margin */
}

.modal-nav-arrow.right-arrow {
    right: calc(50% - 325px - 80px);
}

.modal-nav-arrow i {
    width: 28px;
    height: 28px;
}

.modal-nav-arrow.hidden {
    display: none !important;
}

    @media (max-width: 900px) {
    .modal-nav-arrow {
        display: none !important; /* Pfeile auf Mobile ausgeblendet - Navigation ist jetzt im Modal */
    }
    #detailModal .modal-content {
        padding: 30px 20px;
        width: calc(100% - 32px); /* Volle Breite, nur kleiner Seitenabstand */
        max-width: none;
    }
}

.icon-library {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.group-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 10px;
}

.icon-pick {
    width: 44px;
    height: 44px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text);
}

.icon-pick:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.1);
}

.icon-pick i { width: 20px; }

.modal-title {
    font-size: clamp(24px, 6vw, 32px);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.1;
    overflow-wrap: break-word;
    hyphens: auto;
    color: var(--text);
}

.modal-text-content {
    padding: 0 10px;
}

/* Mobile Inline Navigation Bar */
.modal-mobile-nav {
    display: none; /* Hidden on desktop */
}

@media (max-width: 900px) {
    .modal-mobile-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 32px;
        padding-top: 20px;
        border-top: 1px solid var(--border);
        gap: 8px;
    }

    .modal-mobile-nav-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 10px 18px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 100px;
        color: var(--primary);
        font-weight: 700;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;
    }

    .modal-mobile-nav-btn:hover {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

    .modal-mobile-nav-btn.hidden {
        visibility: hidden; /* Preserve layout space even when hidden */
        pointer-events: none;
    }

    .modal-mobile-nav-btn i {
        width: 16px;
        height: 16px;
    }

    .modal-mobile-counter {
        font-size: 14px;
        font-weight: 700;
        color: var(--text-dim);
        text-align: center;
        flex-shrink: 0;
    }
}

/* Rich Text Content */
.rich-text { 
    color: var(--text-dim); 
    line-height: 1.6; 
}
.rich-text p {
    margin-bottom: 1.1em;
}
.rich-text p:last-child {
    margin-bottom: 0;
}
.rich-text ul, .rich-text ol {
    margin-bottom: 1.1em;
    padding-left: 24px;
}
.rich-text li {
    margin-bottom: 0.4em;
}
.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4, .rich-text h5, .rich-text h6 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: var(--text);
    font-weight: 700;
}
.rich-text h1:first-child, .rich-text h2:first-child, .rich-text h3:first-child, .rich-text h4:first-child, .rich-text h5:first-child, .rich-text h6:first-child {
    margin-top: 0;
}
.rich-text img { max-width: 100%; border-radius: 12px; }

/* Table styling for Rich Text */
.rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 15px;
    text-align: left;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.rich-text th, .rich-text td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}
.rich-text th {
    background-color: var(--primary-glow);
    color: var(--primary);
    font-weight: 700;
}
.rich-text tr:last-child td {
    border-bottom: none;
}
.rich-text tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}
body.dark-mode .rich-text tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Mobile Responsive */
@media (max-width: 900px) {
    #app { flex-direction: column; }
    #sidebar {
        width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border);
        padding: 24px; position: relative;
    }
    #categoryNav {
        flex-direction: row; overflow-x: auto; padding-bottom: 10px;
        scrollbar-width: none;
    }
    #categoryNav::-webkit-scrollbar { display: none; }
    .nav-link { white-space: nowrap; padding: 10px 16px; }
    .sidebar-subcats { display: none !important; }
    #contentArea { padding: 40px 24px; }
    .welcome-screen h2 { font-size: 32px; }
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.accent { color: var(--primary); }
.badge {
    background: var(--primary-glow); color: var(--primary); padding: 6px 12px;
    border-radius: 100px; font-size: 11px; font-weight: 800; text-transform: uppercase;
    display: inline-block;
}

.hidden { display: none !important; }

/* Form grid */
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.input-group input, .input-group select, .input-group textarea {
    width: 100%; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
    color: var(--text); outline: none; font-size: 16px;
}
.input-group textarea { min-height: 150px; }

.actions { display: flex; gap: 12px; margin-top: 20px; }
.actions button { flex: 1; }

.modal-img { width: 100%; height: 250px; object-fit: cover; border-radius: 20px; margin-bottom: 24px; }

/* Trumbowyg Dark Fix */
body.dark-mode .trumbowyg-box, body.dark-mode .trumbowyg-editor {
    background-color: #1e293b !important;
    color: #fff !important;
    border-color: var(--border) !important;
}
body.dark-mode .trumbowyg-button-pane {
    background-color: #0f172a !important;
    border-bottom: 1px solid var(--border) !important;
}

/* ==========================================
   NEW PREMIUM LAYOUTS & MOBILE STYLING
   ========================================== */

/* Mobile elements default hidden on Desktop */
#mobileHeader, .mobile-tabs-wrapper, .drawer-overlay, .mobile-drawer {
    display: none;
}

/* Dashboard Portal Cards on Home (for Dashboard Layout) */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.dashboard-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 15px 35px var(--primary-glow);
}

.dashboard-card:hover::before {
    transform: scaleX(1);
}

.dashboard-card-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.dashboard-card:hover .dashboard-card-icon {
    background: var(--primary);
    color: #ffffff;
    transform: scale(1.1) rotate(5deg);
}

.dashboard-card h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 10px;
}

.dashboard-card p {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 16px;
    flex: 1;
}

.dashboard-card-count {
    font-size: 12px;
    font-weight: 700;
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 100px;
    color: var(--text-dim);
}

/* Visual Tree Admin styling (Intuitive Hierarchy) */
.admin-tree-cat {
    margin-bottom: 25px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--sidebar);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.01);
}

.admin-tree-cat-header {
    background: var(--primary-glow);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.admin-tree-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 16px;
    color: var(--text);
}

.admin-tree-title i {
    color: var(--primary);
}

.admin-tree-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-tree-action {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    transition: all 0.2s;
}

.btn-tree-action:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-tree-action.primary {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.btn-tree-action.primary:hover {
    background: #619216;
    color: #ffffff;
}

.btn-tree-action.delete:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.admin-tree-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-tree-sub {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg);
    margin-bottom: 8px;
}

.admin-tree-sub-header {
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.admin-tree-sub-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
}

.admin-tree-sub-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Tree leaf item (Entry) */
.admin-tree-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
}

.admin-tree-item:hover {
    border-color: var(--primary);
}

.admin-tree-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-tree-item-info {
    display: flex;
    flex-direction: column;
}

.admin-tree-item-title {
    font-size: 14px;
    font-weight: 700;
}

.admin-tree-item-meta {
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.admin-tree-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-sort {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: 0.2s;
}

.btn-sort:hover {
    background: var(--bg);
    color: var(--primary);
}

.btn-sort:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Sticky top bar for batch operations in Admin */
.admin-top-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

/* ==========================================
   MOBILE MEDIA QUERIES (WIDTH < 900px)
   ========================================== */
@media (max-width: 900px) {
    #app {
        flex-direction: column;
        padding-top: 60px; /* Space for sticky header */
    }

    /* Hide desktop sidebar */
    #sidebar {
        display: none !important;
    }

    /* Slick Mobile Sticky Header */
    #mobileHeader {
        display: flex;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 60px;
        background: var(--sidebar);
        border-bottom: 1px solid var(--border);
        justify-content: space-between;
        align-items: center;
        padding: 0 16px;
        z-index: 999;
        box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    }

    .mobile-header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .mobile-header-right {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
    }

    .mobile-title {
        font-weight: 800;
        font-size: 17px;
        letter-spacing: -0.5px;
    }

    .mobile-icon-btn {
        background: transparent;
        border: none;
        color: var(--text);
        width: 38px;
        height: 38px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: 0.2s;
    }

    .mobile-icon-btn:hover {
        background: var(--bg);
        color: var(--primary);
    }

    .mobile-icon-btn i {
        width: 20px;
        height: 20px;
    }

    /* Floating / Expandable Search Bar on Mobile */
    .mobile-search-wrapper {
        position: fixed;
        top: 60px; left: 0; right: 0;
        background: var(--sidebar);
        border-bottom: 1px solid var(--border);
        padding: 10px 16px;
        z-index: 998;
        animation: slideDown 0.2s ease-out;
    }

    @keyframes slideDown {
        from { transform: translateY(-10px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .mobile-search-wrapper .search-container {
        margin-bottom: 0;
    }

    .mobile-search-wrapper input {
        padding: 10px 10px 10px 38px;
        font-size: 14px;
    }

    /* LAYOUT: TABS - Horizontal Pill Navigation */
    .body-layout-tabs #app {
        padding-top: 110px; /* Space for header + tabs */
    }

    .body-layout-tabs .mobile-tabs-wrapper {
        display: flex;
        position: fixed;
        top: 60px; left: 0; right: 0;
        height: 50px;
        background: var(--sidebar);
        border-bottom: 1px solid var(--border);
        align-items: center;
        z-index: 997;
    }

    .mobile-tabs-nav {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        width: 100%;
        padding: 0 16px;
        gap: 8px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        align-items: center;
        height: 100%;
    }

    .mobile-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .mobile-tabs-nav .nav-link {
        white-space: nowrap;
        padding: 6px 14px;
        font-size: 13px;
        border-radius: 20px;
        background: var(--bg);
        border: 1px solid var(--border);
        display: flex;
        align-items: center;
        gap: 6px;
        color: var(--text-dim);
    }

    .mobile-tabs-nav .nav-link.active {
        background: var(--primary-glow);
        border-color: var(--primary);
        color: var(--primary);
        font-weight: 700;
    }

    .mobile-tabs-nav .nav-link i {
        width: 14px;
        height: 14px;
    }

    /* Scroll Indicators / Fades to show scrolling is possible */
    .tabs-scroll-fade {
        position: absolute;
        top: 0; bottom: 0;
        width: 32px;
        pointer-events: none;
        z-index: 2;
        transition: opacity 0.3s;
    }

    .tabs-scroll-fade.left {
        left: 0;
        background: linear-gradient(90deg, var(--sidebar), transparent);
        opacity: 0; /* Fade in when scrolled */
    }

    .tabs-scroll-fade.right {
        right: 0;
        background: linear-gradient(270deg, var(--sidebar), transparent);
    }

    .scroll-chevron-indicator {
        position: absolute;
        right: 4px;
        background: var(--sidebar);
        box-shadow: -5px 0 10px rgba(0,0,0,0.05);
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
        pointer-events: none;
        animation: pulseChevron 2s infinite;
        z-index: 3;
    }

    @keyframes pulseChevron {
        0%, 100% { transform: translateX(0); opacity: 0.8; }
        50% { transform: translateX(4px); opacity: 1; }
    }

    /* LAYOUT: DRAWER - Collapsible Hamburger Menu */
    .body-layout-drawer #hamburgerBtn {
        display: flex !important;
    }

    .drawer-overlay {
        display: block;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        z-index: 9999;
        transition: opacity 0.3s ease;
    }

    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 300px;
        background: var(--sidebar);
        z-index: 10000;
        box-shadow: 10px 0 40px rgba(0,0,0,0.15);
        transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
        padding: 20px;
    }

    .mobile-drawer.hidden {
        transform: translateX(-100%);
        display: flex !important; /* Keep it flex, let transform handle visibility */
    }

    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--border);
    }

    .drawer-nav {
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .drawer-nav .nav-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 10px;
        color: var(--text-dim);
        font-weight: 700;
        cursor: pointer;
    }

    .drawer-nav .nav-link.active {
        background: var(--primary-glow);
        color: var(--primary);
    }

    .drawer-nav .sidebar-subcats {
        display: flex !important; /* Force subcategories in drawer menu */
        margin-left: 20px;
        border-left: 1px solid var(--border);
        padding-left: 14px;
        margin-bottom: 12px;
    }

    /* LAYOUT: DASHBOARD (Welcome screen category portal) */
    .body-layout-dashboard #app {
        padding-top: 60px;
    }

    /* Content adjustments on mobile */
    #contentArea {
        padding: 24px 16px;
    }

    .welcome-screen {
        height: auto;
        min-height: 50vh;
        padding: 20px 0;
        align-items: flex-start;
    }

    .welcome-screen h2 {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .welcome-screen p {
        font-size: 15px;
    }

    /* Modals mobile spacing */
    .modal-content {
        padding: 25px 20px;
        border-radius: 24px;
    }
}

/* Layout dashboard tweaks for wide screen */
.body-layout-dashboard #sidebar {
    display: none !important; /* Hide sidebar entirely on desktop for pure dashboard grid */
}

/* Show back button when dashboard layout has content */
.dashboard-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    margin-bottom: 20px;
    background: var(--primary-glow);
    padding: 8px 16px;
    border-radius: 100px;
    transition: 0.2s;
    border: none;
}

.dashboard-back-btn:hover {
    background: var(--primary);
    color: white;
}

/* Desktop Dashboard Header styles */
.desktop-dashboard-header {
    display: none; /* Hidden by default in other layouts */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.body-layout-dashboard .desktop-dashboard-header {
    display: flex; /* Show only in dashboard layout */
}

.desktop-dashboard-header .brand {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.desktop-dashboard-header .brand h1 {
    font-size: 28px;
    font-weight: 800;
    margin-top: 0;
}

.desktop-dashboard-header .actions {
    display: flex;
    gap: 12px;
}

/* Hide on mobile since mobileHeader is active */
@media (max-width: 900px) {
    .body-layout-dashboard .desktop-dashboard-header {
        display: none !important;
    }
}

/* ==========================================
   DRAG & DROP STYLES
   ========================================== */

/* Element das gerade gezogen wird */
.admin-tree-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    border: 2px dashed var(--primary) !important;
}

/* Drag-Handle Cursor */
.drag-handle {
    cursor: grab;
    display: flex;
    align-items: center;
}
.drag-handle:active {
    cursor: grabbing;
}

/* Drop Zone - standardmäßig unsichtbar */
.drop-zone {
    display: none;
    border: 2px dashed transparent;
    border-radius: 10px;
    padding: 6px 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
    align-items: center;
    min-height: 38px;
}

/* Sichtbar wenn ein Drag-Vorgang aktiv ist */
.drop-zone.drop-zone-active {
    display: flex;
    border-color: var(--border);
    background: var(--bg);
}

/* Hover-State: Element darüber */
.drop-zone.drop-zone-over {
    border-color: var(--primary);
    background: var(--primary-glow);
    transform: scale(1.01);
}

.drop-zone-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.drop-zone.drop-zone-over .drop-zone-label {
    color: var(--primary);
}

/* Bild im Editor mit Hover-Highlight */
.trumbowyg-editor img {
    cursor: pointer;
    transition: outline 0.2s;
    outline: 2px solid transparent;
    border-radius: 4px;
}

.trumbowyg-editor img:hover {
    outline: 2px solid var(--primary);
}

/* =====================================================
   PREMIUM PICTURE GALLERY STYLES
   ===================================================== */
.gallery-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.gallery-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
    background: #000;
}

.gallery-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-image {
    transform: scale(1.05);
}

.gallery-overlay-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0) 100%);
    padding: 24px 16px 14px 16px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: all 0.3s ease;
}

.gallery-card:hover .gallery-overlay-caption {
    padding-bottom: 18px;
}

.gallery-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 4px;
    margin-bottom: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.gallery-zoom-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
    z-index: 2;
}

.gallery-card:hover .gallery-zoom-btn {
    opacity: 1;
    transform: scale(1);
}

.gallery-zoom-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* =====================================================
   BRAND LOGO STYLES
   ===================================================== */
.brand-logo {
    height: auto;
    object-fit: contain;
}

.sidebar-header .brand-logo {
    max-height: 48px;
    margin-bottom: 8px;
}

.mobile-brand .brand-logo {
    max-height: 32px;
}

.desktop-dashboard-header .brand .brand-logo {
    max-height: 44px;
}

/* Numbering style (x., x.x, x.x.x) - subtle and not too dominant */
.heading-number {
    color: var(--text-dim);
    font-weight: 500;
    opacity: 0.6;
    margin-right: 0.3em;
    font-size: 0.95em;
}

.heading-number-main {
    margin-right: 0.3em;
}

/* Card number badge on top right corner of tiles */
.card-number-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 8px;
    opacity: 0.85;
    pointer-events: none;
    z-index: 5;
    letter-spacing: 0.02em;
}

/* Position badge on top-left for gallery cards to avoid zoom button overlap */
.gallery-card .card-number-badge {
    left: 8px;
    right: auto;
    top: 8px;
}

/* Symmetrical placement on top-left in details modal opposing close button on the right */
.modal-content .card-number-badge {
    top: 24px;
    left: 24px;
    right: auto;
}

/* Custom classes for cleaned text formatting */
.text-primary {
    color: var(--primary) !important;
}

/* Detail Modal Header styling */
#detailModal .modal-content {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    background: var(--primary);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffffff;
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header-category {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #ffffff;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.modal-scroll-area {
    padding: 35px 40px;
    overflow-y: auto;
    flex: 1;
}

.modal-number-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

@media (max-width: 900px) {
    #detailModal .modal-content {
        max-width: 100% !important;
        width: calc(100% - 32px) !important;
        border-radius: 24px;
    }
    .modal-header {
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        padding: 14px 20px;
    }
    .modal-scroll-area {
        padding: 24px 20px;
    }
}
