﻿/* Убираем фиксированный контейнер */
#dropdown-container {
    display: none; /* Больше не нужен */
}

/* Основные стили dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: transparent;
    border: none;
    color: #333;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

    .dropbtn:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .dropbtn:after {
        content: "⋯";
        font-size: 20px;
        line-height: 1;
    }

.dropdown-content {
    display: none;
    position: absolute; /* Изменено с fixed на absolute */
    background-color: #fff;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 8px 0;
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.05);
    top: 100%;
    left: 0;
    right: auto;
    bottom: auto;
}

    .dropdown-content.show {
        display: block;
        animation: fadeIn 0.2s ease-out;
    }

    .dropdown-content a {
        color: #333;
        padding: 10px 16px;
        text-decoration: none;
        display: block;
        font-size: 14px;
        transition: all 0.2s ease;
        white-space: nowrap;
    }

        .dropdown-content a:hover {
            background-color: #f5f5f5;
            color: #0d6efd;
        }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Для таблицы - особые стили */
.table-responsive .dropdown-content {
    position: absolute; /* Используем absolute для таблицы */
}

/* Мобильные стили */
@media (max-width: 768px) {
    .dropdown-content {
        right: 10px;
        width: 200px;
    }
}

/* Ensure dropdown appears above other containers and style consistency for role menu */
.dropdown-menu {
    z-index: 1050;
    background: var(--background-light) !important;
    min-width: 180px; /* keep menu at usable width */
}

/* Force each list item to be block-level so there is exactly one item per row */
.dropdown-menu > li,
.dropdown-menu li {
    display: block !important;
    width: 100% !important;
}

/* Target the anchor elements inside the menu — make them full-width blocks
   so hover background covers the whole menu width regardless of text length */
.dropdown-menu .dropdown-item,
.dropdown-menu a.dropdown-item,
.dropdown-menu button.dropdown-item {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.5rem 1rem !important;
    white-space: normal !important;
    text-align: left !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
}

/* Hover should fill full width of menu */
.dropdown-menu .dropdown-item:hover,
.dropdown-menu a.dropdown-item:hover,
.dropdown-menu button.dropdown-item:hover {
    background: var(--primary-orange) !important;
    color: #ffffff !important;
}

/* Specific class used for action buttons inside other dropdowns */
.dropdown-action-item {
    display: block !important;
    width: 100% !important;
    padding: 0.5rem 1rem !important;
    text-align: left !important;
    background: transparent !important;
    border: none !important;
    box-sizing: border-box !important;
}

.dropdown-action-item:hover {
    background: var(--primary-orange) !important;
    color: #fff !important;
}
