/* Embudos simplificados (SpcEmbudosAdmin / SpcPipelineTemplatesAdmin) */

/* ---------- Drawer de etapa (FunnelStageDrawer) ----------
   Fuera de un MudLayout el drawer temporal queda position:absolute (sin .mud-drawer-fixed): abría arriba del
   documento con la página desplazada y, cerrado, quedaba 420px a la derecha (scroll horizontal a 390px, Tab
   llegaba a sus campos). Se fija al viewport abierto y cerrado, y cerrado se oculta tras la animación de salida
   (mismo patrón que .spc-chats-drawer en spc-chats.css). El z-index temporal de MudBlazor (appbar + 2) ya lo
   deja sobre el app bar. */
.mud-drawer.mud-drawer-temporary.funnel-stage-drawer {
    position: fixed;
    top: 0;
    height: 100dvh;
    overflow: hidden;
}
.mud-drawer.mud-drawer-temporary.funnel-stage-drawer.mud-drawer--closed {
    visibility: hidden;
    transition: transform 225ms cubic-bezier(0, 0, 0.2, 1) 0ms, visibility 0s linear 225ms;
}
/* El overlay del drawer sigue al drawer: también al viewport mientras está abierto. */
body:has(.funnel-stage-drawer.mud-drawer--open) .mud-overlay.mud-overlay-drawer { position: fixed; }

.funnel-stage-drawer .mud-drawer-content { height: 100%; overflow: hidden; }
.funnel-stage-drawer__panel { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.funnel-stage-drawer__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.funnel-stage-drawer__actions { padding: 0.75rem 1rem; border-top: 1px solid var(--mud-palette-lines-default); }

/* ---------- Filas de etapa (FunnelEditor) ----------
   Área clicable (role=button) y acciones son hermanas. En pantallas angostas el grupo chip + botones baja a una
   segunda línea en vez de montarse sobre el nombre. */
.stage-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    padding: 0.5rem;
}
.stage-row__main {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border-radius: var(--mud-default-borderradius);
}
.stage-row__main:focus-visible { outline: 3px solid var(--mud-palette-primary); outline-offset: 2px; }
.stage-row__handle { cursor: grab; flex-shrink: 0; }
.stage-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage-row__name,
.stage-row__description { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-row__name { font-weight: 600; font-size: var(--mud-typography-body1-size); line-height: var(--mud-typography-body1-lineheight); }
.stage-row__description { font-size: var(--mud-typography-caption-size); color: var(--mud-palette-text-secondary); }
.stage-row__actions { display: flex; align-items: center; gap: 0.25rem; flex: 0 0 auto; margin-left: auto; }
.stage-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* "Agregar etapa aquí": no ocupa espacio hasta hover o foco dentro de la fila (sigue alcanzable con Tab:
   no usa display/visibility, y al enfocarlo :focus-within lo expande). En pantallas táctiles siempre visible. */
.stage-insert {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 150ms ease-in, opacity 150ms ease-in;
}
.stage-item:hover .stage-insert,
.stage-item:focus-within .stage-insert {
    max-height: 40px;
    opacity: 1;
    transition: max-height 200ms ease-out, opacity 200ms ease-out;
}
@media (hover: none) {
    .stage-insert { max-height: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .stage-insert, .stage-item:hover .stage-insert, .stage-item:focus-within .stage-insert { transition: none; }
}

/* ---------- Chips de etapa en la galería (FunnelOptionCard) ----------
   Neutros con punto de color: el texto usa el color de texto del tema, el color de la etapa es solo el punto. */
.funnel-stage-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.funnel-stage-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-size: var(--mud-typography-caption-size);
    line-height: 1.5;
}
.funnel-stage-chip__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ---------- SpcEmbudosAdmin ----------
   Lista: alto natural en pantallas chicas (el editor va debajo); desde md (960px) tope de 700px con scroll. */
@media (min-width: 960px) {
    .funnel-list-panel { max-height: 700px; overflow-y: auto; }
}
.funnel-editor-heading { margin: 0; font-weight: 700; }
.funnel-editor-heading:focus { outline: none; }
.funnel-editor-heading:focus-visible { outline: 3px solid var(--mud-palette-primary); outline-offset: 2px; }

/* Embudo seleccionado en la lista "Mis Embudos" (antes solo lo indicaba el título del editor). */
.funnel-list-item { border-radius: 8px; border-left: 3px solid transparent; }
.funnel-list-item--selected {
    background: var(--mud-palette-primary-hover);
    border-left-color: var(--mud-palette-primary);
}
