/* ================================================================
 * DATEI: css/sidebar.css
 * ZWECK: Sidebar, Group-Tree, Tree-Nodes, Checkboxen, Player-Items
 * AESTHETIC: "Refined Brass Studio" - warm charcoal, brass accents
 * REFERENZIERT: css/variables.css (CSS Custom Properties)
 * REFERENZIERT VON: index.html
 * ================================================================ */

/* ========== SIDEBAR ========== */
.sidebar {
    display: none;
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-slow), transform var(--transition-slow);
}

.sidebar.collapsed {
    width: 0;
    transform: translateX(-100%);
}

.sidebar-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}

.sidebar-header h3 {
    font-family: var(--font-family);
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

/* ========== SEARCH ========== */
.sidebar-search {
    padding: var(--space-3) var(--space-3);
    position: relative;
}

.sidebar-search i {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: var(--font-xs);
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    padding: 6px var(--space-3) 6px 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--brass-subtle);
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

/* ========== GROUP TREE ========== */
.group-tree {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-1) 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
}

.group-tree::-webkit-scrollbar {
    width: 4px;
}

.group-tree::-webkit-scrollbar-track {
    background: transparent;
}

.group-tree::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-pill);
}

/* ========== SIDEBAR FOOTER ========== */
.sidebar-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* ========== TREE NODES ========== */
.tree-node {
    user-select: none;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 5px var(--space-3);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    border-left: 2px solid transparent;
    gap: 2px;
}

.tree-item:hover {
    background: var(--bg-hover);
}

.tree-item.active,
.tree-item.selected {
    background: var(--accent-primary-transparent);
    border-left-color: var(--accent-primary);
}

.tree-item.active .tree-label,
.tree-item.selected .tree-label {
    color: var(--accent-primary);
    font-weight: 600;
}

.tree-item.selected .tree-icon {
    color: var(--accent-primary);
}

/* ========== TREE TOGGLE ========== */
.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.55rem;
    transition: transform var(--transition-normal), color var(--transition-fast);
    flex-shrink: 0;
}

.tree-toggle.open,
.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-toggle.empty,
.tree-toggle.invisible {
    visibility: hidden;
}

/* ========== TREE ICON ========== */
.tree-icon {
    width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 0.75rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.tree-icon.player {
    color: var(--text-secondary);
}

.tree-icon.player.online {
    color: var(--accent-success);
}

.tree-icon.player.offline {
    color: var(--accent-danger);
}

/* ========== TREE LABEL ========== */
.tree-label {
    flex: 1;
    font-family: var(--font-family);
    font-size: var(--font-sm);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.tree-label.path-label {
    color: var(--text-muted);
    font-style: italic;
}

.tree-icon.path-icon {
    color: var(--text-muted);
}

.tree-item.path-only {
    opacity: 0.6;
}

.tree-item.path-only:hover {
    background: var(--bg-hover);
    opacity: 1;
}

/* ========== TREE CHECKBOXEN ========== */
.tree-checkbox {
    width: 14px;
    height: 14px;
    margin-right: var(--space-1);
    accent-color: var(--accent-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.tree-checkbox:hover {
    transform: scale(1.1);
}

/* ========== PLAYER IN TREE ========== */
.tree-player {
    display: flex;
    align-items: center;
    padding: 5px var(--space-3);
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.tree-player:hover {
    background: var(--bg-hover);
}

.tree-player.selected {
    background: var(--accent-primary-transparent);
    border-left-color: var(--accent-primary);
}

.tree-player.offline {
    opacity: 0.55;
}

.tree-player.offline .tree-label {
    color: var(--text-muted);
}

.tree-player.warning .player-status-dot {
    background: var(--accent-warning);
    box-shadow: 0 0 6px var(--warning-subtle);
}

/* ========== PLAYER STATUS DOT ========== */
.player-status-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    margin-right: var(--space-2);
    flex-shrink: 0;
    transition: box-shadow var(--transition-normal);
}

.player-status-dot.online {
    background: var(--accent-success);
    box-shadow: 0 0 5px var(--success-subtle);
}

.player-status-dot.offline {
    background: var(--text-muted);
}

.player-status-dot.warning {
    background: var(--accent-warning);
    box-shadow: 0 0 5px var(--warning-subtle);
}

.player-status-dot.inactive {
    background: var(--text-muted);
    opacity: 0.3;
}

/* ========== TREE WARNING ========== */
.tree-warning {
    color: var(--accent-warning);
    font-size: 0.65rem;
    margin-left: auto;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* ========== TREE EDIT BUTTON ========== */
.tree-edit-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 5px;
    margin-left: auto;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.65rem;
}

.tree-item:hover .tree-edit-btn,
.tree-player:hover .tree-edit-btn {
    opacity: 0.7;
}

.tree-item:hover .tree-edit-btn:hover,
.tree-player:hover .tree-edit-btn:hover {
    opacity: 1;
}

.tree-edit-btn:hover {
    color: var(--accent-primary);
    background: var(--accent-primary-transparent);
}

/* ========== TREE SELECTION TOOLBAR ========== */
.tree-selection-toolbar {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.tree-selection-info {
    font-family: var(--font-family);
    font-size: var(--font-xs);
    color: var(--text-secondary);
}

.tree-selection-info strong {
    color: var(--accent-primary);
    font-weight: 600;
}

.tree-selection-actions {
    display: flex;
    gap: var(--space-1);
}

/* ========== TREE BADGES & COUNTS ========== */
.tree-badge {
    background: var(--accent-primary-transparent);
    color: var(--accent-primary);
    font-family: var(--font-family);
    font-size: var(--font-xs);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    margin-left: var(--space-2);
    line-height: 1.4;
}

.tree-count {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: var(--font-xs);
    font-weight: 500;
    padding: 1px 5px;
    border-radius: var(--radius-pill);
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1.4;
}

/* ========== TREE CHILDREN ========== */
.tree-children {
    display: block;
}

/* ========== TREE INDENTATION LEVELS ========== */
.tree-node[data-level="1"] .tree-item { padding-left: 24px; }
.tree-node[data-level="2"] .tree-item { padding-left: 36px; }
.tree-node[data-level="3"] .tree-item { padding-left: 48px; }
.tree-node[data-level="4"] .tree-item { padding-left: 60px; }
.tree-node[data-level="5"] .tree-item { padding-left: 72px; }
