/* Padrão único de dropdowns para o painel administrativo e frontend. */
.project-select {
    position: relative;
    width: 100%;
    min-width: 0;
}

.project-select-native {
    position: absolute !important;
    inset: auto auto 0 0 !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    min-height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.project-select-trigger {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    padding: 0.68rem 0.85rem;
    border: 1px solid var(--admin-border-color, #d9e0ea);
    border-radius: 12px;
    background: var(--admin-card-bg, #ffffff);
    color: var(--admin-text, #263244);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.project-select-trigger:hover,
.project-select.is-open .project-select-trigger,
.project-select-trigger:focus-visible {
    outline: none;
    border-color: var(--admin-primary, var(--primary-color, #3a86ff));
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.15);
}

.project-select-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.project-select-trigger.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.project-select-current {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.project-select-current > i:first-child,
.project-select-option-main > i:first-child,
.project-menu-fallback-icon {
    width: 1.1rem;
    color: var(--admin-primary, var(--primary-color, #3a86ff));
    text-align: center;
    flex-shrink: 0;
}

.project-select-current > span,
.project-select-option-main > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-select-chevron {
    color: #64748b;
    font-size: 0.72rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.project-select.is-open .project-select-chevron {
    transform: rotate(180deg);
}

.project-select-menu {
    position: fixed;
    z-index: 20050;
    display: none;
    max-height: min(310px, 55vh);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.45rem;
    border: 1px solid var(--admin-border-color, #d9e0ea);
    border-radius: 14px;
    background: var(--admin-card-bg, #ffffff);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.project-select-menu.is-open {
    display: grid;
    gap: 0.2rem;
    animation: projectDropdownIn 0.16s ease-out;
}

.project-select-menu::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar,
.role-dropdown-menu::-webkit-scrollbar,
.smart-select-menu::-webkit-scrollbar,
.quick-edit-menu::-webkit-scrollbar,
.icon-select-menu::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.project-select-menu::-webkit-scrollbar-thumb,
.dropdown-menu::-webkit-scrollbar-thumb,
.role-dropdown-menu::-webkit-scrollbar-thumb,
.smart-select-menu::-webkit-scrollbar-thumb,
.quick-edit-menu::-webkit-scrollbar-thumb,
.icon-select-menu::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #94a3b8;
}

.project-select-group {
    padding: 0.5rem 0.7rem 0.25rem;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.project-select-option {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.58rem 0.72rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--admin-text, #263244);
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    text-align: left;
}

.project-select-option:hover,
.project-select-option.is-highlighted {
    background: rgba(58, 134, 255, 0.08);
}

.project-select-option.is-selected {
    background: rgba(58, 134, 255, 0.14);
    color: var(--admin-primary, var(--primary-color, #2563eb));
    font-weight: 750;
}

.project-select-option:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.project-select-option-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.58rem;
}

.project-select-check {
    color: var(--admin-primary, var(--primary-color, #2563eb));
    visibility: hidden;
    flex-shrink: 0;
}

.project-select-option.is-selected .project-select-check {
    visibility: visible;
}

/* Menus já customizados passam a usar o mesmo acabamento. */
.dropdown-menu,
.role-dropdown-menu,
.smart-select-menu,
.quick-edit-menu,
.icon-select-menu,
.search-suggestions-dropdown {
    border-radius: 14px !important;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

.dropdown-menu,
.role-dropdown-menu,
.smart-select-menu,
.quick-edit-menu,
.icon-select-menu {
    max-height: min(360px, 65vh);
    overflow-y: auto;
}

/* Os menus da appbar devem crescer com o conteúdo; a página cuida da rolagem. */
.navbar .dropdown-menu,
.navbar .submenu-content {
    max-height: none !important;
    overflow: visible !important;
}

@media (min-width: 993px) {
    .navbar .dropdown-menu,
    .navbar .submenu-content {
        width: max-content;
        min-width: 220px;
        max-width: min(360px, calc(100vw - 2rem));
    }
}

.dropdown-menu a,
.dropdown-menu button,
.role-dropdown-menu .dropdown-item {
    border-radius: 9px;
}

html[data-theme="dark"] .project-select-trigger,
html[data-theme="dark"] .project-select-menu,
[data-theme="dark"] .project-select-trigger,
[data-theme="dark"] .project-select-menu {
    background: #1f2937;
    border-color: #3b4657;
    color: #f8fafc;
}

html[data-theme="dark"] .project-select-option,
[data-theme="dark"] .project-select-option {
    color: #f8fafc;
}

html[data-theme="dark"] .project-select-option:hover,
html[data-theme="dark"] .project-select-option.is-highlighted,
[data-theme="dark"] .project-select-option:hover,
[data-theme="dark"] .project-select-option.is-highlighted {
    background: rgba(96, 165, 250, 0.14);
}

html[data-theme="dark"] .project-select-option.is-selected,
[data-theme="dark"] .project-select-option.is-selected {
    background: rgba(96, 165, 250, 0.22);
    color: #bfdbfe;
}

/* Cores semânticas compartilhadas por filtros e ações em massa. */
.project-select-option[data-tone="success"] {
    color: #15803d;
}

.project-select-option[data-tone="success"] .project-select-option-main > i:first-child {
    color: #16a34a;
}

.project-select-option[data-tone="success"]:hover,
.project-select-option[data-tone="success"].is-highlighted,
.project-select-option[data-tone="success"].is-selected {
    background: #dcfce7;
    color: #166534;
}

.project-select-option[data-tone="warning"] {
    color: #b45309;
}

.project-select-option[data-tone="warning"] .project-select-option-main > i:first-child {
    color: #f59e0b;
}

.project-select-option[data-tone="warning"]:hover,
.project-select-option[data-tone="warning"].is-highlighted,
.project-select-option[data-tone="warning"].is-selected {
    background: #fef3c7;
    color: #92400e;
}

.project-select-option[data-tone="danger"] {
    color: #dc2626;
}

.project-select-option[data-tone="danger"] .project-select-option-main > i:first-child {
    color: #ef4444;
}

.project-select-option[data-tone="danger"]:hover,
.project-select-option[data-tone="danger"].is-highlighted,
.project-select-option[data-tone="danger"].is-selected {
    background: #fee2e2;
    color: #991b1b;
}

.project-select-option[data-tone="neutral"] {
    color: #475569;
}

.project-select-option[data-tone="neutral"] .project-select-option-main > i:first-child {
    color: #64748b;
}

.project-select-option[data-tone="neutral"]:hover,
.project-select-option[data-tone="neutral"].is-highlighted,
.project-select-option[data-tone="neutral"].is-selected {
    background: #e2e8f0;
    color: #334155;
}

.project-select-option[data-tone="info"] {
    color: #6d28d9;
}

.project-select-option[data-tone="info"] .project-select-option-main > i:first-child {
    color: #7c3aed;
}

.project-select-option[data-tone="info"]:hover,
.project-select-option[data-tone="info"].is-highlighted,
.project-select-option[data-tone="info"].is-selected {
    background: #ede9fe;
    color: #5b21b6;
}

.project-select-trigger[data-tone="success"] .project-select-current,
.project-select-trigger[data-tone="success"] .project-select-current > i:first-child {
    color: #15803d;
}

.project-select-trigger[data-tone="warning"] .project-select-current,
.project-select-trigger[data-tone="warning"] .project-select-current > i:first-child {
    color: #b45309;
}

.project-select-trigger[data-tone="danger"] .project-select-current,
.project-select-trigger[data-tone="danger"] .project-select-current > i:first-child {
    color: #dc2626;
}

.project-select-trigger[data-tone="neutral"] .project-select-current,
.project-select-trigger[data-tone="neutral"] .project-select-current > i:first-child {
    color: #475569;
}

.project-select-trigger[data-tone="info"] .project-select-current,
.project-select-trigger[data-tone="info"] .project-select-current > i:first-child {
    color: #6d28d9;
}

@keyframes projectDropdownIn {
    from { opacity: 0; transform: translateY(-5px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
    .project-select-menu {
        max-height: min(280px, 48vh);
    }
}
