/* Header Territory Dropdown Styles */

#territoryDropdown {
    max-width: 450px;
    min-width: 350px;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#territoryDropdown:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

#territoryDropdown:focus,
#territoryDropdown:active {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.2);
}

#territoryDropdownMenu {
    max-width: 500px;
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#territoryDropdownMenu .dropdown-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
    color: #212529 !important;
    text-decoration: none !important;
}

/* Максимально специфічні правила для всіх станів */
#territoryDropdownMenu .dropdown-item,
#territoryDropdownMenu .dropdown-item:link,
#territoryDropdownMenu .dropdown-item:visited,
#territoryDropdownMenu .dropdown-item:focus,
#territoryDropdownMenu .dropdown-item:hover,
#territoryDropdownMenu .dropdown-item:active {
    color: #212529 !important;
    text-decoration: none !important;
}

#territoryDropdownMenu .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    text-decoration: none !important;
    transform: translateX(3px);
}

#territoryDropdownMenu .dropdown-item:active {
    background-color: #e9ecef !important;
    color: #212529 !important;
    text-decoration: none !important;
}

#territoryDropdownMenu .dropdown-item.active {
    background-color: #d4edda !important;
    color: #155724 !important;
    font-weight: 500;
    text-decoration: none !important;
}

#territoryDropdownMenu .dropdown-item.active:hover {
    background-color: #c3e6cb !important;
    color: #155724 !important;
    text-decoration: none !important;
}

/* Додаткові правила для перебиття всіх можливих Bootstrap стилів */
.dropdown-menu .dropdown-item,
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus,
.dropdown-menu .dropdown-item:active {
    color: #212529 !important;
    text-decoration: none !important;
}

#territoryDropdownMenu .dropdown-header {
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 16px 4px;
}

#territoryDropdownMenu .dropdown-divider {
    margin: 4px 0;
}

#territoryDropdownMenu .bi {
    font-size: 13px;
}

#territoryDropdownMenu .bi-check-lg {
    font-size: 14px;
    margin-left: auto;
}

/* Мобільна адаптація */
@media (max-width: 767.98px) {
    #territoryDropdown {
        display: none !important;
    }
    
    #mobileTerritoryTitle {
        font-size: 1.1rem;
        font-weight: 600;
        color: #2d5016;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        max-width: 250px;
    }
}

/* Анімації */
@keyframes territorySelected {
    0% {
        transform: scale(1);
        background-color: #d4edda;
    }
    50% {
        transform: scale(1.02);
        background-color: #c3e6cb;
    }
    100% {
        transform: scale(1);
        background-color: #d4edda;
    }
}

#territoryDropdownMenu .dropdown-item.active {
    animation: territorySelected 0.3s ease-in-out;
}

/* Скролбар для dropdown меню */
#territoryDropdownMenu::-webkit-scrollbar {
    width: 6px;
}

#territoryDropdownMenu::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#territoryDropdownMenu::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#territoryDropdownMenu::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Firefox */
#territoryDropdownMenu {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}
