/**
 * RESONANZ TREE VIEW STYLES
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 * Styling für hierarchische Baumansicht:
 * Resonanz → Kategorien → Nuancen (Bedürfnisse)
 *
 * © 2025 Ti-age.de Alle Rechte vorbehalten.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.resonanz-tree-view {
    display: none; /* Standardmäßig ausgeblendet */
    background: var(--bg-card, #1a1a2e);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

.tree-header {
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(139, 92, 246, 0.2);
    padding-bottom: 12px;
}

.tree-header h3 {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary, #f0f0f0);
}

.tree-subtitle {
    font-size: 13px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TREE NODES - ALLGEMEIN
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-node {
    margin: 4px 0;
}

.tree-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.tree-node-header:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.tree-node-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--node-color, #8B5CF6);
    border-radius: 8px 0 0 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tree-node-header:hover::before {
    opacity: 1;
}

.tree-node-children {
    margin-left: 20px;
    padding-left: 16px;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EBENE 1 - RESONANZ (R1-R4)
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-node-resonanz {
    margin-bottom: 16px;
}

.tree-node-resonanz > .tree-node-header {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    font-weight: 600;
    font-size: 16px;
}

.tree-node-resonanz.expanded > .tree-node-header {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.tree-node-resonanz > .tree-node-header:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* Aktive Dimensionen - Farbliche Hervorhebung (alle Kategorien aktiv) */
.tree-node-resonanz.active > .tree-node-header {
    background: var(--node-color, #8B5CF6) !important;
    border-color: var(--node-color, #8B5CF6) !important;
    box-shadow: 0 0 12px rgba(var(--node-color-rgb, 139, 92, 246), 0.3);
}

.tree-node-resonanz.active > .tree-node-header .tree-node-label,
.tree-node-resonanz.active > .tree-node-header .tree-node-icon,
.tree-node-resonanz.active > .tree-node-header .tree-node-count,
.tree-node-resonanz.active > .tree-node-header .tree-node-description {
    color: #ffffff;
}

/* Teilweise aktive Dimensionen - Dezente Hervorhebung (einige Kategorien aktiv) */
.tree-node-resonanz.partially-active > .tree-node-header {
    background: color-mix(in srgb, var(--node-color, #8B5CF6) 25%, transparent) !important;
    border-color: var(--node-color, #8B5CF6) !important;
    border-style: dashed;
}

.tree-node-resonanz.partially-active > .tree-node-header .tree-node-label {
    color: var(--node-color, #8B5CF6);
}

/* Tree Node Content für Resonanz - Anklickbar für Filter */
.tree-node-resonanz .tree-node-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EBENE 2 - KATEGORIEN (#K1-#K18)
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-node-kategorie {
    margin-bottom: 8px;
}

.tree-node-kategorie > .tree-node-header {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 500;
    font-size: 14px;
}

.tree-node-kategorie.expanded > .tree-node-header {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

.tree-node-kategorie > .tree-node-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Aktive Kategorien - Farbliche Hervorhebung */
.tree-node-kategorie.active > .tree-node-header {
    background: var(--node-color, #8B5CF6) !important;
    border-color: var(--node-color, #8B5CF6) !important;
    box-shadow: 0 0 12px rgba(var(--node-color-rgb, 139, 92, 246), 0.3);
}

.tree-node-kategorie.active > .tree-node-header .tree-node-label {
    color: #ffffff;
    font-weight: 600;
}

.tree-node-kategorie.active > .tree-node-header .tree-node-id {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.tree-node-kategorie.active > .tree-node-header .tree-node-count {
    color: rgba(255, 255, 255, 0.9);
}

/* Tree Node Content - Anklickbar für Filter */
.tree-node-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
}

.tree-expand-icon {
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EBENE 3 - NUANCEN/BEDÜRFNISSE (#B1-#B220)
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-node-nuance > .tree-node-header {
    cursor: default;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
}

.tree-node-nuance > .tree-node-header:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: none;
}

.tree-node-nuance > .tree-node-header::before {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TREE NODE ELEMENTE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Expand/Collapse Icon */
.tree-expand-icon {
    font-size: 12px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    min-width: 16px;
    display: inline-flex;
    justify-content: center;
    transition: transform 0.2s ease;
}

.tree-node.expanded > .tree-node-header .tree-expand-icon {
    transform: rotate(0deg);
}

/* Node Icon (nur bei Resonanz-Ebene) */
.tree-node-icon {
    font-size: 18px;
    min-width: 24px;
    display: inline-flex;
    justify-content: center;
}

/* Bullet Point (nur bei Nuancen) */
.tree-node-bullet {
    color: var(--node-color, #8B5CF6);
    font-size: 20px;
    min-width: 16px;
    display: inline-flex;
    justify-content: center;
    line-height: 1;
}

/* Node Label */
.tree-node-label {
    flex: 0 0 auto;
    color: var(--text-primary, #f0f0f0);
    font-weight: inherit;
}

/* Node ID (z.B. #K4, #B12) */
.tree-node-id {
    font-size: 11px;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Count Badge */
.tree-node-count {
    font-size: 12px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    font-weight: 500;
    margin-left: auto;
}

/* Description (nur bei Resonanz-Ebene) */
.tree-node-description {
    font-size: 12px;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.4));
    font-weight: 400;
    font-style: italic;
    margin-left: auto;
    display: none; /* Standardmäßig versteckt */
}

.tree-node-resonanz > .tree-node-header .tree-node-description {
    display: inline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONEN
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-node-children {
    animation: slideDown 0.2s ease-out;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .resonanz-tree-view {
        padding: 16px;
        margin: 16px 0;
    }

    .tree-node-header {
        padding: 8px 10px;
        gap: 6px;
        font-size: 14px;
    }

    .tree-node-resonanz > .tree-node-header {
        font-size: 15px;
    }

    .tree-node-kategorie > .tree-node-header {
        font-size: 13px;
    }

    .tree-node-nuance > .tree-node-header {
        font-size: 12px;
    }

    .tree-node-description {
        display: none !important; /* Auf Mobile immer verstecken */
    }

    .tree-node-children {
        margin-left: 12px;
        padding-left: 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    .resonanz-tree-view {
        background: #0f0f1a;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOOLBAR (optional - für Expand/Collapse All Buttons)
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tree-toolbar-btn {
    padding: 6px 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    color: var(--text-primary, #f0f0f0);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tree-toolbar-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.tree-toolbar-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TREE VIEW HEADER & RESET BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.tree-view-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tree-reset-btn {
    padding: 8px 16px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 8px;
    color: #ff3b30;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tree-reset-btn:hover {
    background: rgba(255, 59, 48, 0.2);
    border-color: rgba(255, 59, 48, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
}

.tree-reset-btn:active {
    transform: translateY(0);
}

/* Aktive Filter-Tags Anzeige */
.active-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-right: 12px;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: color-mix(in srgb, var(--tag-color) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--tag-color) 40%, transparent);
    border-radius: 12px;
    color: var(--tag-color);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.active-filter-tag:hover {
    background: color-mix(in srgb, var(--tag-color) 25%, transparent);
    border-color: color-mix(in srgb, var(--tag-color) 60%, transparent);
}

.filter-tag-label {
    display: inline;
}

.filter-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    background: color-mix(in srgb, var(--tag-color) 20%, transparent);
    border: none;
    border-radius: 50%;
    color: var(--tag-color);
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tag-remove:hover {
    background: var(--tag-color);
    color: #ffffff;
    transform: scale(1.1);
}

.filter-tag-remove:active {
    transform: scale(0.95);
}
