/**
 * Enum Tree Select - Estilos para campo personalizado hierárquico
 */

/* === Wrapper === */
.enum-tree-wrapper {
    position: relative;
    width: 100%;
}

/* === Display (campo visível que mostra a seleção) === */
.enum-tree-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    min-height: 35px;
    padding: 6px 12px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out;
    user-select: none;
}

.enum-tree-display:hover {
    border-color: #66afe9;
}

.enum-tree-open .enum-tree-display {
    border-color: #66afe9;
    box-shadow: 0 0 0 1px rgba(102, 175, 233, 0.6);
}

.enum-tree-display-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
}

.enum-tree-placeholder {
    color: #999;
}

.enum-tree-display-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.enum-tree-open .enum-tree-display-arrow {
    transform: rotate(180deg);
}

.enum-tree-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 14px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    border-radius: 50%;
    margin-left: 4px;
    margin-right: 4px;
    flex-shrink: 0;
    line-height: 1;
}

.enum-tree-clear:hover {
    color: #d9534f;
    background-color: #f5f5f5;
}

/* === Path display === */
.enum-tree-path-separator {
    color: #999;
    margin: 0 2px;
    font-size: 13px;
}

.enum-tree-path-part {
    color: #333;
}

.enum-tree-display-text .enum-tree-path-part:last-child {
    font-weight: 600;
    color: #0088cc;
}

/* === Dropdown === */
.enum-tree-dropdown {
    position: fixed;
    z-index: 9999;
    background-color: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 350px;
    display: flex;
    flex-direction: column;
}

/* === Busca === */
.enum-tree-search-wrapper {
    padding: 8px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.enum-tree-search-wrapper .enum-tree-search {
    font-size: 13px;
    height: 30px;
    padding: 4px 8px;
}

/* === Container da árvore === */
.enum-tree-container {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 280px;
    padding: 4px 0;
}

/* === Árvore === */
.enum-tree-root {
    list-style: none;
    margin: 0;
    padding: 0 8px;
}

.enum-tree-children {
    list-style: none;
    margin: 0;
    padding: 0 0 0 20px;
}

/* === Nó da árvore === */
.enum-tree-node {
    margin: 0;
    padding: 0;
}

.enum-tree-node-content {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.1s;
    user-select: none;
}

.enum-tree-node-content:hover {
    background-color: #f0f6fc;
}

.enum-tree-node-content.enum-tree-selected {
    background-color: #e8f4fd;
    border-left: 3px solid #0088cc;
    padding-left: 5px;
}

.enum-tree-node-content.enum-tree-selected .enum-tree-label {
    font-weight: 600;
    color: #0088cc;
}

/* === Seta de expandir/colapsar === */
.enum-tree-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 8px;
    color: #999;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-right: 6px;
}

.enum-tree-arrow-open {
    transform: rotate(90deg);
}

.enum-tree-arrow-empty {
    visibility: hidden;
}

/* === Label do nó === */
.enum-tree-label {
    flex: 1;
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}

/* === Botão selecionar nó intermediário === */
.enum-tree-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #0088cc;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    margin-left: 4px;
}

.enum-tree-node-content:hover .enum-tree-select-btn {
    opacity: 0.6;
}

.enum-tree-select-btn:hover {
    opacity: 1 !important;
}

/* === Nó toggle (com filhos) === */
.enum-tree-toggle .enum-tree-label {
    font-weight: 500;
    color: #555;
}

/* === Nó folha === */
.enum-tree-leaf .enum-tree-label {
    color: #333;
}

.enum-tree-leaf:hover .enum-tree-label {
    color: #0088cc;
}

/* === Scrollbar customizada === */
.enum-tree-container::-webkit-scrollbar {
    width: 6px;
}

.enum-tree-container::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.enum-tree-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.enum-tree-container::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* === Modo view (somente leitura) === */
.enum-tree-view-value {
    padding: 6px 0;
    color: #333;
}

.enum-tree-view-value .enum-tree-path-separator {
    color: #999;
    margin: 0 4px;
}

.enum-tree-view-value .enum-tree-path-part:last-child {
    font-weight: 600;
}

/* === Responsivo === */
@media (max-width: 768px) {
    .enum-tree-dropdown {
        max-height: 250px;
    }
    
    .enum-tree-container {
        max-height: 200px;
    }
}
