/* Estilos para la visualización de componentes.
 *
 * Surfaces, borders and text come from the theme tokens, not literal grays.
 * theme-tokens.css tints every neutral toward var(--color-primary) per DESIGN.md's
 * Tinted-Neutral Rule, so a token-based neutral picks up the sponsor's hue while a
 * hardcoded #e5e7eb / #374151 stays a flat gray and reads as foreign next to the
 * rest of the shell. Because the tokens flip with [data-theme], the duplicate
 * dark-mode override blocks this file used to carry are gone — one rule now covers
 * both themes. */
.benefits-table {
    width: 100%;
    overflow: hidden;
    background-color: transparent;
    border-radius: 0.5rem;
    border: 1px solid var(--line);
}

.attribute-group-title {
    font-weight: 600;
    padding-top: 1rem;
    padding-bottom: 1rem;
    padding-right: 1rem;
    padding-left: 1rem;
    color: var(--text);
    background-color: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Header band, not a standalone pill. The enclosing .benefits-table already draws
   the group's border and radius and clips with overflow:hidden, so a full border
   plus its own border-radius here rendered a second outline inside that box and
   left the rows below visually detached from their header. v3 built one continuous
   panel (offering.component.less: radius on the top corners only, border shared
   with the rows); a bottom rule reproduces that inside the existing box. */
.attribute-group.level0 > .attribute-group-title {
    background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--text);
    font-size: 1.125rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-primary) 28%, transparent);
}

[data-theme="dark"] .attribute-group.level0 > .attribute-group-title {
    background-color: color-mix(in srgb, var(--color-primary) 16%, transparent);
    border-bottom-color: color-mix(in srgb, var(--color-primary) 36%, transparent);
    color: var(--text);
}

/* Coverage badge next to the "Benefits" heading. Shape and typography come from
   .auth-shell__badge; this adds a neutral brand tint. The text colour is mixed
   toward --text rather than using var(--color-primary) raw, which measures below
   the 4.5:1 AA floor on both the light and dark panel. */
.component-view__coverage-badge {
    background: color-mix(in srgb, var(--color-primary) 14%, transparent);
    color: color-mix(in srgb, var(--color-primary) 45%, var(--text));
    border: 1px solid color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.attribute-group.level1 > .attribute-group-title {
    background-color: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-left: 1.5rem;
}

/* Nesting indentation. Each level adds 0.5rem on top of the 1rem base, matching
   the scale the macro used to emit as Tailwind `pl-*` utilities. Keeping it here
   instead of in the template decouples it from Tailwind's class extraction —
   the interpolated `pl-{{ level * 2 + 4 }}` was invisible to the scanner, so
   `pl-4` never made it into the build and level-0 headers lost their padding. */
.attribute-group.level2 > .attribute-group-title { padding-left: 2rem; }
.attribute-group.level3 > .attribute-group-title { padding-left: 2.5rem; }
.attribute-group.level4 > .attribute-group-title { padding-left: 3rem; }

/* Leaf rows sit inside their parent group's collapse panel, so their depth is
   the parent's level + 1. Constrained to the wide layout: below 768px the rows
   stack and the responsive block flattens padding back to 0.75rem. */
@media (min-width: 769px) {
    .attribute-group.level0 > .accordion-collapse > .attribute > .attribute-label { padding-left: 1.5rem; }
    .attribute-group.level1 > .accordion-collapse > .attribute > .attribute-label { padding-left: 2rem; }
    .attribute-group.level2 > .accordion-collapse > .attribute > .attribute-label { padding-left: 2.5rem; }
    .attribute-group.level3 > .accordion-collapse > .attribute > .attribute-label { padding-left: 3rem; }
}

.attribute {
    display: flex;
    border-bottom: 1px solid var(--line);
    transition: background-color 0.2s;
}

.attribute:last-child {
    border-bottom: none;
}

.attribute:hover {
    background-color: var(--surface);
}

/* The label column carries a weaker tint than a section header so the two-column
   split reads without competing with the group bands above it. */
.attribute-label {
    flex: 0 0 40%;
    padding-top: 1rem;
    padding-bottom: 1rem;
    padding-right: 1rem;
    padding-left: 1rem;
    font-weight: 500;
    color: var(--text-soft);
    background-color: color-mix(in srgb, var(--surface) 55%, transparent);
    border-right: 1px solid var(--line);
}

.attribute-value {
    flex: 0 0 60%;
    padding: 1rem;
    color: var(--text);
}

/* --color-success, a semantic token that does not vary per sponsor, rather than the
   literal emerald pair this used before. */
.value-zero-amount {
    background-color: color-mix(in srgb, var(--color-success) 16%, transparent);
    color: var(--color-success);
    border-radius: 0.25rem;
    padding: 0.125rem 0.5rem;
    display: inline-block;
    font-weight: 500;
}

.value-limit {
  display: block;
}


/* For responsive display */
@media (max-width: 768px) {
    .attribute {
        flex-direction: column;
    }
    
    .attribute-label,
    .attribute-value {
        flex: 0 0 100%;
        padding: 0.75rem;
    }
    
    .attribute-value {
        border-left: none;
        border-top: 1px solid var(--line);
        background-color: color-mix(in srgb, var(--surface) 55%, transparent);
    }
}

/* Transición suave para la rotación */
.group-toggle-indicator svg {
    transition: transform 0.3s ease;
}

/* Rotación cuando el acordeón está activo */
.accordion-header.active .group-toggle-indicator svg {
    transform: rotate(180deg);
}

/* Etiqueta vertical de cobertura del macro product(), compartida por las vistas
   de producto, asegurado y cubierta opcional. Antes llevaba bg-gray-100 /
   dark:bg-gray-700 y text-gray-900 / dark:text-gray-100 en la plantilla: grises
   fijos que ignoraban los tokens del tema y la marca del patrono, y que ademas
   obligaban a mantener a mano la variante oscura. */
.product-coverage-title {
    background-color: color-mix(in srgb, var(--surface) 70%, transparent);
    border: 1px solid var(--line);
}

.product-coverage-title-text {
    color: var(--text);
}

/* Selector de componentes de la pantalla de importación.
 *
 * Venía con blancos y grises literales (bg-white, border-gray-200, text-gray-800,
 * bg-gray-50 en la cabecera de grupo) más un azul fijo para el estado marcado, así
 * que en modo oscuro las tarjetas quedaban como parches blancos sobre la superficie
 * teñida y nunca recogían el color del patrono. Los colores salen ahora de los
 * tokens, de modo que una sola regla cubre claro y oscuro. */
.component-choice__grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

@media (min-width: 768px) {
    .component-choice__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .component-choice__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.component-choice__group {
    grid-column: 1 / -1;
    width: 100%;
    margin: 1rem 0 0.5rem;
    padding: 0.75rem 1rem;
    background-color: color-mix(in srgb, var(--surface) 70%, transparent);
    border-bottom: 1px solid var(--line);
}

.component-choice__group-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
}

.component-choice__card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background-color: var(--surface);
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.component-choice__card:hover {
    border-color: color-mix(in srgb, var(--color-primary) 45%, var(--line));
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Marcado con el primario del patrono en vez de un azul fijo. */
.component-choice__card--selected {
    border-color: var(--color-primary);
    background-color: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

.component-choice__card--selected:hover {
    background-color: color-mix(in srgb, var(--color-primary) 16%, transparent);
}

/* El input queda fuera de vista pero sigue existiendo para lectores de pantalla y
   para el teclado: antes era display:none y no había forma de llegar tabulando.
   Va con la tarjeta por delante en el selector porque auth-shell.css se importa
   después que este fichero y su .auth-shell__checkbox empataría en especificidad.
   El tema de formularios además mete el input en su propio div, así que hay que
   sacar de la vista el envoltorio y no solo el input. */
.component-choice__card .component-choice__input,
.component-choice__card > div:has(> .component-choice__input) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.component-choice__card:has(.component-choice__input:focus-visible) {
    box-shadow: 0 0 0 3px var(--focus);
}

.component-choice__body {
    flex: 1 1 auto;
    min-width: 0;
}

.component-choice__name {
    display: block;
    font-weight: 500;
    color: var(--text);
}

.component-choice__description {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted);
}

/* La marca de seleccionado la enciende el estado de la tarjeta, no JavaScript. */
.component-choice__check {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-primary);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.component-choice__card--selected .component-choice__check {
    opacity: 1;
}
