// Estrutura Overlay Local
.matcha-panel-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    pointer-events: none !important; // Permite clicar "através" do overlay (interação com inputs, scroll da página)
    display: block;
}

.matcha-panel-pane {
    position: absolute;
    display: block;
    max-height: 100%;
    pointer-events: auto; // Reativa cliques para o painel em si
    box-sizing: border-box;
}

.matcha-panel {
    border-radius: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    max-height: 280px;
    width: 100%;

    // Animações
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    // Position relative (agora contido no pane)
    position: relative;
    z-index: auto;

    // Estados de abertura
    &.matcha-panel-open {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    // Posicionamento vertical
    &.matcha-panel-top {
        transform-origin: bottom center;
    }

    &.matcha-panel-bottom {
        transform-origin: top center;
    }
}

// Conteúdo do painel
.matcha-panel-content {
    overflow-y: auto;
    flex: 1;
}

@mixin matcha-panel-theme($theme) {
    $accent: map-get($theme, accent);
    $primary: map-get($theme, primary);
    $background: map-get($theme, background);
    $foreground: map-get($theme, foreground);

    // Estilos que dependem do tema
    .matcha-panel {
        background: getSurface($theme);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);

        // Estados de foco e hover
        &:focus-within {
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
        }

        @media (prefers-color-scheme: dark) {
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
    }

    // Responsividade (mantida aqui ou movida para global dependendo da necessidade de tokens)
    @media (max-width: 768px) {
        .matcha-panel {
            max-height: 200px;
            min-width: 120px;
            border-radius: 6px;
        }
    }
}