/*
 * Estilos de las vistas SMR300xx con el diseño del portal "Servicios en Línea"
 * (GUIA_ESTILOS_PORTAL.md de TramitesenLinea), igual que css/portal.css de ConsultaPagos.
 * Las vistas se muestran dentro de un iframe en Trámites en Línea (STL10039).
 *
 * El layout compartido (eMAS.Comun) carga Bootstrap 2 y 3, por eso todo va bajo
 * .portal-vista: así gana en especificidad y no afecta a las vistas aún sin rediseñar.
 */

:root {
    /* Marca */
    --gye-navy:    #132267;
    --gye-navy2:   #1B2E72;
    --gye-azul:    #157AB0;
    --gye-azul2:   #1DA9E1;
    --gye-oro:     #F6B827;
    --gye-oro-h:   #E2A50F;

    /* Tintes de cyan para superficies */
    --gye-azul-bg:  #E8F5FC;
    --gye-azul-bg2: #D3ECF8;
    --gye-azul-bd:  #BFE3F4;

    /* Estado */
    --gye-verde: #12B76A;
    --gye-rojo:  #F04438;
    --gye-amber: #F79009;

    /* Neutros */
    --gye-fondo:  #F0F3FA;
    --gye-blanco: #FFFFFF;
    --gye-borde:  #E2E8F4;
    --gye-txt1:   #0D1529;
    --gye-txt2:   #5A6A8A;
    --gye-txt3:   #98A7C4;

    /* Tipografía */
    --font: 'Barlow', 'Open Sans', sans-serif;
    --gye-font: var(--font);
}

/* ---------- Base ---------- */

html, body {
    background: var(--gye-fondo);
}

.portal-vista {
    padding: 20px 24px;
    color: var(--gye-txt1);
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.5;
}

.portal-vista *,
.portal-vista *::before,
.portal-vista *::after {
    box-sizing: border-box;
}

.portal-vista input,
.portal-vista select,
.portal-vista button,
.portal-vista textarea {
    font-family: inherit;
}

.portal-vista .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ---------- Panel ---------- */

.portal-vista .panel {
    margin: 0;
    background: var(--gye-blanco);
    border: 1px solid var(--gye-borde);
    border-radius: 16px;
    box-shadow: none;
    padding: 20px;
}

.portal-vista .panel-centrado {
    max-width: 860px;
    margin: 0 auto;
}

.portal-vista .panel-ancho {
    max-width: 1100px;
    margin: 0 auto;
}

.portal-vista .panel-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.portal-vista .panel-titulo {
    margin: 0;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--gye-txt1);
}

.portal-vista .panel-subtitulo {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--gye-txt2);
}

/* ---------- Chips de ícono ---------- */

.portal-vista .chip-icono {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.portal-vista .chip-icono .material-symbols-outlined {
    font-size: 20px;
}

.portal-vista .ti-azul  { background: #E8F5FC; color: #132267; }
.portal-vista .ti-amber { background: #FEF6E4; color: #92400E; }
.portal-vista .ti-verde  { background: #E6F9F0; color: #0B7A46; }
.portal-vista .ti-oro    { background: #FFFAE6; color: #92400E; }
.portal-vista .ti-teal   { background: #DCF2F9; color: #0A6E86; }
.portal-vista .ti-purple { background: #EFF0FE; color: #5B21B6; }
.portal-vista .ti-rojo   { background: #FEE9E9; color: #B91C1C; }

/* ---------- Formularios ---------- */

.portal-vista .campo-label {
    display: block;
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--gye-txt2);
}

/* Varios campos cortos en una misma fila */
.portal-vista .campos-fila {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.portal-vista .campos-fila > div {
    width: 180px;
}

/* ---------- Botones ---------- */

.portal-vista .btn-primario {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    margin: 0;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: var(--gye-azul2);
    box-shadow: none;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    text-shadow: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all .16s;
}

.portal-vista .btn-primario:hover,
.portal-vista .btn-primario:focus {
    background: var(--gye-azul);
    color: #fff;
    text-decoration: none;
    outline: none;
}

.portal-vista .btn-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 1.5px solid var(--gye-azul-bd);
    border-radius: 10px;
    background: var(--gye-azul-bg);
    color: var(--gye-azul);
    text-decoration: none;
    cursor: pointer;
    transition: all .16s;
}

.portal-vista .btn-icono:hover,
.portal-vista .btn-icono:focus {
    transform: scale(1.1);
    color: var(--gye-azul);
    text-decoration: none;
    outline: none;
}

.portal-vista .btn-icono .material-symbols-outlined {
    font-size: 20px;
}

/* ---------- Inputs ---------- */

.portal-vista .input {
    display: block;
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--gye-borde);
    border-radius: 10px;
    background: var(--gye-blanco);
    box-shadow: none;
    color: var(--gye-txt1);
    font-size: 13px;
    line-height: normal;
    transition: all .16s;
}

.portal-vista .input:focus {
    border-color: var(--gye-azul2);
    box-shadow: none;
    outline: none;
}

.portal-vista .input::placeholder {
    color: var(--gye-txt3);
}

.portal-vista .input-centro {
    text-align: center;
}

/* ---------- Mensajes de sistema ---------- */

.portal-vista .msg {
    margin: 0 0 16px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.portal-vista .msg-exito       { background: #E7F7EF; border: 1px solid #12B76A; color: #027A48; }
.portal-vista .msg-advertencia { background: #FEF3E2; border: 1px solid #F79009; color: #B54708; }
.portal-vista .msg-error       { background: #FDEDED; border: 1px solid #F04438; color: #B42318; }

/* ---------- Bloques de la página ---------- */

.portal-vista .seccion + .seccion {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--gye-borde);
}

/* Contenedores de resultados (#Resultado, #Visor) vacíos: :empty no los detecta si Razor
   deja espacios o saltos de línea, por eso también se oculta la sección sin elementos hijos. */
.portal-vista .seccion:empty,
.portal-vista .seccion:not(:has(*)) {
    display: none;
}

.portal-vista .seccion-titulo {
    margin: 0 0 10px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--gye-txt1);
}

.portal-vista .texto {
    margin: 0 0 10px;
    color: var(--gye-txt2);
    text-align: justify;
}

.portal-vista .texto strong {
    color: var(--gye-txt1);
    font-weight: 600;
}

/* Captcha + botón de consulta */
.portal-vista .captcha-fila {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* #captchaDiv se recarga por AJAX; display: contents hace que sus hijos
   (imagen, recarga, campo) se acomoden en la misma fila que el botón de la vista. */
.portal-vista .captcha-campos {
    display: contents;
}

.portal-vista .captcha-img {
    height: 40px;
    max-width: none;
    border: 1px solid var(--gye-borde);
    border-radius: 8px;
}

.portal-vista .captcha-fila .input {
    width: 140px;
}

/* Visor del reporte (PDF) */
.portal-vista .visor-reporte {
    display: block;
    width: 100%;
    height: 700px;
    border: 1px solid var(--gye-borde);
    border-radius: 12px;
}

/* Select con el mismo aspecto que .input (flecha nativa) */
.portal-vista select.input {
    padding: 0 10px;
    line-height: 37px;
}

/* Campo + botón en la misma fila (p. ej. identificación + buscar) */
.portal-vista .fila-accion {
    display: flex;
    align-items: center;
    gap: 10px;
}

.portal-vista .fila-accion .campo-flex {
    flex: 1 1 auto;
    min-width: 0;
}

/* Campo corto dentro de una sección */
.portal-vista .campo-corto {
    max-width: 280px;
}

/* Código catastral: Sector · Manzana · Lote · División · Phv · Phh · Número */
.portal-vista .codigo-catastral {
    display: grid;
    grid-template-columns: repeat(7, minmax(56px, 1fr));
    gap: 10px;
    align-items: end;
    max-width: 640px;
}

.portal-vista .codigo-catastral .campo-label {
    white-space: nowrap;
}

/* Nota informativa (texto largo, alineado a la izquierda) */
.portal-vista .nota {
    margin: 16px 0 0;
    padding: 12px 16px;
    border: 1px solid var(--gye-azul-bd);
    border-radius: 10px;
    background: var(--gye-azul-bg);
    color: var(--gye-navy);
    font-size: 12.5px;
}

.portal-vista .nota p {
    margin: 0;
}

.portal-vista .nota p + p {
    margin-top: 6px;
}

/* Botón secundario / de texto */
.portal-vista .btn-secundario {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--gye-txt2);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all .16s;
}

.portal-vista .btn-secundario:hover,
.portal-vista .btn-secundario:focus {
    color: var(--gye-txt1);
    text-decoration: underline;
}

.portal-vista .btn-secundario .material-symbols-outlined {
    font-size: 18px;
}

/* Botón ícono chico dentro de tablas (p. ej. "ver detalle") */
.portal-vista .btn-icono-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.portal-vista .btn-icono-sm .material-symbols-outlined {
    font-size: 18px;
}

/* Acción PDF dentro de tablas */
.portal-vista .btn-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #FDEDED;
    color: #B91C1C;
    text-decoration: none;
    transition: all .16s;
}

.portal-vista .btn-pdf:hover,
.portal-vista .btn-pdf:focus {
    background: #FBD5D5;
    color: #B91C1C;
    outline: none;
}

.portal-vista .btn-pdf .material-icons,
.portal-vista .btn-pdf .material-symbols-outlined {
    font-size: 18px;
}

/* Enlace de texto */
.portal-vista .enlace {
    color: var(--gye-azul2);
    font-weight: 600;
    text-decoration: none;
}

.portal-vista .enlace:hover,
.portal-vista .enlace:focus {
    color: var(--gye-azul);
    text-decoration: underline;
}

/* ---------- Datos clave (contribuyente, totales) ---------- */

.portal-vista .datos-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.portal-vista .datos-resumen:empty {
    display: none;
}

.portal-vista .dato {
    padding: 14px 18px;
    border: 1px solid var(--gye-borde);
    border-radius: 14px;
    background: var(--gye-blanco);
}

.portal-vista .dato-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--gye-txt2);
}

.portal-vista .dato-valor {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--gye-txt1);
}

.portal-vista .dato-cifra {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

/* ---------- Tabla de datos ---------- */

.portal-vista .tabla-contenedor {
    overflow-x: auto;
}

.portal-vista .tabla-datos {
    width: 100%;
    margin: 0;
    border: 1px solid var(--gye-borde);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--gye-blanco);
    font-size: 12.5px;
}

.portal-vista .tabla-datos th {
    background: var(--gye-fondo);
    color: var(--gye-txt2);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    text-align: left;
    white-space: nowrap;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--gye-borde);
}

.portal-vista .tabla-datos td {
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid var(--gye-borde);
    vertical-align: middle;
    color: var(--gye-txt1);
}

.portal-vista .tabla-datos tr:first-child th:first-child { border-top-left-radius: 11px; }
.portal-vista .tabla-datos tr:first-child th:last-child  { border-top-right-radius: 11px; }

.portal-vista .tabla-datos tr:last-child td {
    border-bottom: 0;
}

.portal-vista .tabla-datos tr:hover td {
    background: #f7f9ff;
}

/* Columna identificadora (año, CEP, contrato…) */
.portal-vista .tabla-datos .col-anio,
.portal-vista .tabla-datos .col-clave {
    color: var(--gye-azul2);
    font-weight: 700;
}

/* Códigos / números de referencia */
.portal-vista .tabla-datos .col-codigo {
    font-family: monospace;
    font-size: 11.5px;
    color: var(--gye-txt2);
    white-space: nowrap;
}

/* Texto secundario dentro de la tabla */
.portal-vista .tabla-datos .col-sec {
    font-size: 11.5px;
    color: var(--gye-txt2);
}

.portal-vista .tabla-datos .col-fecha {
    white-space: nowrap;
}

.portal-vista .tabla-datos .col-monto {
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.portal-vista .tabla-datos .col-accion {
    text-align: center;
}

/* ---------- Estado vacío / error ---------- */

.portal-vista .estado-vacio {
    padding: 48px 20px;
    text-align: center;
}

.portal-vista .estado-vacio .estado-icono {
    font-size: 40px;
    color: var(--gye-txt3);
}

.portal-vista .estado-vacio .estado-titulo {
    margin: 10px 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--gye-txt1);
}

.portal-vista .estado-vacio .estado-texto {
    max-width: 520px;
    margin: 0 auto;
    font-size: 13px;
    color: var(--gye-txt2);
    word-break: break-word;
}

/* ---------- Overlay "Procesando…" (Scripts/portal.js) ----------
   Se agrega al final del <body>, fuera de .portal-vista, por eso no va con ese prefijo. */

.overlay-procesando {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    background: rgba(15, 27, 61, .35);
}

.overlay-caja {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-radius: 12px;
    background: var(--gye-blanco);
    box-shadow: 0 8px 32px rgba(15, 27, 61, .16), 0 2px 6px rgba(0, 0, 0, .07);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    color: var(--gye-txt1);
}

.overlay-caja .spinner {
    box-sizing: border-box;
    width: 22px;
    height: 22px;
    border: 3px solid var(--gye-borde);
    border-top-color: var(--gye-azul2);
    border-radius: 50%;
    animation: portal-spin .7s linear infinite;
}

@keyframes portal-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .portal-vista .codigo-catastral {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .portal-vista {
        padding: 12px;
    }

    .portal-vista .panel {
        padding: 16px;
    }

    .portal-vista .captcha-fila .input {
        flex: 1 1 120px;
    }

    .portal-vista .campos-fila > div {
        flex: 1 1 140px;
        width: auto;
    }

    .portal-vista .btn-primario {
        width: 100%;
    }
}
