/* Base común de las páginas del portal web (inicio y tributos): colores, tarjetas,
   cabecera con buscador y perfil. Todo cuelga de .portal */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.portal {
    --tinta: #112c3f;
    --texto: #3c4a56;
    --suave: #6b7c89;
    --borde: #e3e8ee;
    --fondo: #f4f6f8;
    --azul: #3c6583;
    --verde: #307f7f;
    --rojo: #c93636;

    background: var(--fondo);
    color: var(--texto);
    font-family: 'Inter', sans-serif;
}

.portal a {
    color: inherit;
    text-decoration: none;
}

.portal .icon-class {
    position: static;
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--azul);
}

/* Cabecera: buscador y perfil */

.portal .cabecera-portal {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.75rem;
}

.portal .cabecera-acciones {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 340px;
}

.portal .telon {
    position: fixed;
    inset: 0;
    z-index: 900;
}

.portal .buscador,
.portal .perfil {
    position: relative;
    z-index: 901;
}

.portal .buscador {
    flex: 1;
    min-width: 0;
}

.portal .buscador .icon-class {
    position: absolute;
    top: 50%;
    left: 0.8rem;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: var(--suave);
}

.portal .buscador input {
    width: 100%;
    height: 2.6rem;
    padding: 0 0.9rem 0 2.4rem;
    border: 1px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    font-size: 0.9rem;
    color: var(--tinta);
    outline: none;
}

.portal .buscador input:focus {
    border-color: var(--azul);
}

.portal .avatar {
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border: none;
    border-radius: 50%;
    background: var(--tinta);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.portal .desplegable {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(17, 44, 63, 0.12);
}

.portal .resultados {
    width: 28rem;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.4rem 0;
}

.portal .resultados .vacio {
    margin: 0;
    padding: 0.6rem 1rem;
}

.portal .resultados-grupo {
    padding: 0.6rem 1rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--suave);
}

.portal .resultado {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0.45rem 1rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.portal .resultado:hover {
    background: var(--fondo);
}

.portal .resultado strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--tinta);
}

.portal .resultado span {
    font-size: 0.8rem;
    color: var(--suave);
}

.portal .perfil-menu {
    width: 15rem;
    padding: 0.4rem 0;
}

.portal .perfil-usuario {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 0.7rem;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid var(--borde);
}

.portal .perfil-usuario strong {
    font-size: 0.9rem;
    color: var(--tinta);
}

.portal .perfil-usuario span {
    font-size: 0.8rem;
    color: var(--suave);
    overflow-wrap: anywhere;
}

.portal .perfil-menu a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.portal .perfil-menu a:hover {
    background: var(--fondo);
    color: var(--tinta);
}

/* Tarjetas */

.portal .tarjeta {
    background: #fff;
    border: 1px solid var(--borde);
    border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.portal a.tarjeta:hover {
    border-color: #c6d2dc;
    box-shadow: 0 4px 14px rgba(17, 44, 63, 0.06);
}

.portal .flecha {
    align-self: flex-end;
    display: grid;
    place-items: center;
    flex: none;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--borde);
    border-radius: 50%;
    color: var(--azul);
}

/* Color y nombre de cada tributo. Valen para sus tarjetas y portadas (.acento-…) y para la raíz
   de sus tablas, que es donde llega la clase que se le pasa al Grid */
.acento-iae, div:has(> .tabla-portal.acento-iae) { --acento: #6e5aa8; --acento-nombre: "IAE"; }
.acento-ibi, div:has(> .tabla-portal.acento-ibi) { --acento: #3c6583; --acento-nombre: "IBI"; }
.acento-residuos, div:has(> .tabla-portal.acento-residuos) { --acento: #4e8f49; --acento-nombre: "TRSU"; }
.acento-agua, div:has(> .tabla-portal.acento-agua) { --acento: #1597af; --acento-nombre: "Agua"; }

.portal .con-acento .flecha {
    border-color: color-mix(in srgb, var(--acento) 35%, transparent);
    color: var(--acento);
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.portal a.con-acento:hover {
    border-color: var(--acento);
    box-shadow: 0 0 0 1px var(--acento);
}

.portal .con-acento:hover .flecha {
    border-color: var(--acento);
    background: var(--acento);
    color: #fff;
}

/* Portada de cada tributo (Components/Portal/PortadaTributo.razor) */

.pagina-tributo {
    min-height: 100vh;
    padding: 2rem 2.25rem 3rem;
}

.portal .migas {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--suave);
}

.portal .migas a:hover {
    color: var(--tinta);
}

.portal .migas span:last-child {
    color: var(--tinta);
}

.portal .portada {
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.portal .portada img {
    display: block;
    width: 100%;
    height: clamp(160px, 30vh, 300px);
    object-fit: cover;
    background: #dfe6ec;
    border-bottom: 4px solid var(--acento, var(--azul));
}

.portal .portada-pie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 2rem;
}

.portal .portada h1 {
    margin: 0 0 0.4rem;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--tinta);
}

.portal .portada p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--suave);
}

.portal .aviso {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex: none;
    padding: 0.7rem 1.25rem;
    border: 1px solid var(--borde);
    border-radius: 999px;
    background: #fff;
    font-size: 0.95rem;
    color: var(--tinta);
    white-space: nowrap;
    transition: border-color 0.15s;
}

.portal .aviso:hover {
    border-color: var(--acento, var(--azul));
}

.portal .aviso strong {
    font-weight: 700;
}

.portal .aviso .punto {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rojo);
}

.portal .aviso.al-dia .punto {
    background: var(--verde);
}

.portal .accesos-tributo {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}

.portal .acceso-tributo {
    display: flex;
    flex-direction: column;
    min-height: 190px;
    padding: 1.5rem;
}

.portal .icono-circulo {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--fondo);
}

.portal .icono-circulo .icon-class {
    color: var(--acento, var(--azul));
}

.portal .acceso-tributo h3 {
    margin: auto 0 0.35rem;
    padding-top: 1.25rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tinta);
}

.portal .acceso-tributo-pie {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.portal .acceso-tributo-pie p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--suave);
}

@media (max-width: 1100px) {
    .portal .accesos-tributo {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .pagina-tributo {
        padding: 1.25rem 1rem 2rem;
    }

    .portal .cabecera-portal {
        flex-direction: column-reverse;
        gap: 1.25rem;
    }

    .portal .cabecera-acciones {
        width: 100%;
    }

    .portal .resultados {
        width: calc(100vw - 2rem);
    }

    .portal .portada-pie {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem;
    }

    .portal .portada h1 {
        font-size: 2.25rem;
    }

    .portal .accesos-tributo {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Cabecera de las páginas de listado: la pone MainLayout encima de cada página */

.portal.cabecera-listado {
    padding-top: 1rem;
    background: transparent;
}

.portal.cabecera-listado .cabecera-portal {
    align-items: center;
    margin-bottom: 1rem;
}

.portal.cabecera-listado .migas {
    padding-top: 0;
}

/* Desplegables de página: ejercicio de los recibos (SelectorEjercicio), tributo de las simulaciones… */

.selector-portal {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #6b7c89;
}

.selector-portal label {
    font-weight: 600;
    color: #3c4a56;
}

.selector-portal select {
    height: 2.25rem;
    padding: 0 2rem 0 0.75rem;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    background-color: #fff;
    font-weight: 600;
    color: #112c3f;
    cursor: pointer;
}

.selector-portal select:focus {
    border-color: #3c6583;
    outline: none;
}

/* Selector por segmentos (sustituye a los desplegables de dos o tres opciones) */
.segmentos-portal {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e3e8ee;
    border-radius: 10px;
    background: #f4f6f9;
    font-family: 'Inter', sans-serif;
}

.segmentos-portal button {
    min-width: 5.5rem;
    height: 2rem;
    padding: 0 1rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7c89;
}

.segmentos-portal button:hover {
    color: #112c3f;
}

.segmentos-portal button.activo {
    background: #fff;
    color: #112c3f;
    box-shadow: 0 1px 2px rgba(17, 44, 63, 0.12);
}

.segmentos-portal {
    flex-wrap: wrap;
    /* Dentro de una columna flex (listados a pantalla completa) no debe estirarse */
    align-self: flex-start;
}

/* Cambio de pestaña: el segmento activo se desliza en color y el contenido aparece.
   Solo opacidad y colores: no se usa transform porque en un ancestro rompe la posición
   de los desplegables position:fixed del Grid. */
.segmentos-portal button {
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

@keyframes aparecer-pestana {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Para que se repita en cada cambio, el elemento tiene que ser nuevo: en las páginas va con @key */
.contenido-pestana {
    animation: aparecer-pestana 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .segmentos-portal button { transition: none; }
    .contenido-pestana { animation: none; }
}

/* Pestañas del paquete (Tabs) pintadas como segmentos: el icono a la escala del botón */
.segmentos-portal .icon-class {
    width: 0.95rem;
    height: 0.95rem;
    margin-right: 0.4rem !important;
}

.segmentos-portal.compacto {
    margin-bottom: 0;
}

.segmentos-portal.compacto button {
    font-weight: 500;
    font-size: 0.8rem;
}
