/* ═══════════════════════════════════════════════════════════
   TOM SELECT - TEMA GRIÔ BURGER
   ═══════════════════════════════════════════════════════════ */

/* Wrapper do Tom Select */
.ts-wrapper {
    position: relative;
}

/* Input principal */
.ts-control {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid rgba(220, 20, 60, 0.2) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 16px !important;
    color: #1a1a1a !important;
    transition: all 0.3s ease !important;
    min-height: 50px !important;
}

/* Hover no input */
.ts-control:hover {
    border-color: rgba(220, 20, 60, 0.4) !important;
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.1) !important;
}

/* Focus no input */
.ts-wrapper.focus .ts-control {
    border-color: #DC143C !important;
    box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.1) !important;
    background: white !important;
}

/* Placeholder */
.ts-control input::placeholder {
    color: rgba(0, 0, 0, 0.4) !important;
}

/* Items selecionados (tags) */
.ts-control .item {
    background: linear-gradient(135deg, #DC143C, #FF1744) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 12px !important;
    margin: 2px 4px 2px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Botão de remover item */
.ts-control .item .remove {
    color: white !important;
    opacity: 0.8 !important;
    border: none !important;
    margin: 0 0 0 4px !important;
    padding: 0 4px !important;
    font-size: 18px !important;
    transition: opacity 0.2s ease !important;
}

.ts-control .item .remove:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-radius: 3px !important;
}

/* Dropdown */
.ts-dropdown {
    background: white !important;
    border: 2px solid #DC143C !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px rgba(220, 20, 60, 0.2) !important;
    margin-top: 4px !important;
    z-index: 9999 !important;
}

/* Opções do dropdown */
.ts-dropdown .option {
    padding: 12px 16px !important;
    color: #1a1a1a !important;
    font-size: 15px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

/* Hover nas opções */
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.1), rgba(255, 23, 68, 0.05)) !important;
    color: #DC143C !important;
}

/* Opção selecionada */
.ts-dropdown .option.selected {
    background: rgba(220, 20, 60, 0.15) !important;
    color: #DC143C !important;
    font-weight: 600 !important;
}

/* Grupo de opções */
.ts-dropdown .optgroup-header {
    background: rgba(220, 20, 60, 0.05) !important;
    color: #DC143C !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 8px 16px !important;
}

/* Input de busca no dropdown */
.ts-dropdown .dropdown-input-wrap {
    padding: 8px !important;
    border-bottom: 1px solid rgba(220, 20, 60, 0.1) !important;
}

.ts-dropdown .dropdown-input {
    border: 1px solid rgba(220, 20, 60, 0.2) !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    width: 100% !important;
}

.ts-dropdown .dropdown-input:focus {
    outline: none !important;
    border-color: #DC143C !important;
    box-shadow: 0 0 0 2px rgba(220, 20, 60, 0.1) !important;
}

/* Mensagem de "não encontrado" */
.ts-dropdown .no-results {
    padding: 16px !important;
    text-align: center !important;
    color: rgba(0, 0, 0, 0.5) !important;
    font-style: italic !important;
}

/* Loading state */
.ts-wrapper.loading .ts-control::after {
    content: '' !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    margin-top: -8px !important;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid rgba(220, 20, 60, 0.2) !important;
    border-top-color: #DC143C !important;
    border-radius: 50% !important;
    animation: ts-spin 0.6s linear infinite !important;
}

@keyframes ts-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Disabled state */
.ts-wrapper.disabled .ts-control {
    background: rgba(0, 0, 0, 0.05) !important;
    color: rgba(0, 0, 0, 0.4) !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* ===== VARIAÇÃO PARA FORMULÁRIOS NA SEÇÃO ANCESTRAL ===== */
.secao-ancestral .ts-control {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 215, 0, 0.3) !important;
    color: white !important;
}

.secao-ancestral .ts-control input {
    color: white !important;
}

.secao-ancestral .ts-control input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.secao-ancestral .ts-wrapper.focus .ts-control {
    border-color: var(--grio-amarelo-oxum) !important;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2) !important;
    background: rgba(255, 255, 255, 0.15) !important;
}

.secao-ancestral .ts-control .item {
    background: linear-gradient(135deg, var(--grio-dourado-realeza), var(--grio-amarelo-oxum)) !important;
}

/* Animação de entrada do dropdown */
.ts-dropdown {
    animation: dropdown-slide-down 0.2s ease-out;
}

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

/* Scrollbar customizada no dropdown */
.ts-dropdown-content {
    max-height: 300px !important;
    overflow-y: auto !important;
}

.ts-dropdown-content::-webkit-scrollbar {
    width: 8px;
}

.ts-dropdown-content::-webkit-scrollbar-track {
    background: rgba(220, 20, 60, 0.05);
    border-radius: 4px;
}

.ts-dropdown-content::-webkit-scrollbar-thumb {
    background: rgba(220, 20, 60, 0.3);
    border-radius: 4px;
}

.ts-dropdown-content::-webkit-scrollbar-thumb:hover {
    background: rgba(220, 20, 60, 0.5);
}
