/** Estilos para la tabla de resultados. */
table {
    border: 1px solid var(--jui-wp-border) !important;
    border-radius: 3px;
    border-collapse: collapse;
    font-size: var(--cff-font-size-small);
    width: 100%;
}

thead th {
    text-align: center;
    background-color: #ccd8b8 !important;
    border-bottom: 1px solid var(--jui-wp-border) !important;
    z-index: 1;
    display: table-cell;
}

tfoot td {
    text-align: center;
    background-color: #ccd8b8 !important;
    border-bottom: 1px solid var(--jui-wp-border) !important;
    z-index: 1;
}

td {
    padding: 0.25rem;
    text-align: center;
    border-bottom: 1px solid var(--jui-wp-border) !important;
    font-weight: normal;
    display: table-cell;
}

thead, tbody, tfoot {
  display: block;
}

/* Aplicar la altura fija y el scroll únicamente al tbody */
tbody {
  max-height: 370px;
  overflow-y: auto;
  overflow-x: hidden;
}

tbody tr:nth-child(odd) {
    background: #eee !important;
}

thead tr, tbody tr, tfoot tr {
  display: table;
  width: 100%;
  table-layout: fixed; /* Mantiene el ancho constante de las columnas */
}

/** Estilos miscelaneos */
button:disabled,
button[disabled] {
    border: 1px solid #999999;
    background-color: #cccccc;
    color: #666666;
}

.cff-processing-form {
    display: none !important;
}

.ui-dialog-titlebar-maximize {
    cursor: pointer;
}

#info {
    position: absolute;
    top: 20px;
    left: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: small;
    padding: 10px 20px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 100;
}

#selected-info {
    position: absolute;
    bottom: 80px;
    left: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: #a5cee3;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: small;
    pointer-events: none;
    z-index: 100;
    border: 1px solid #020202;
}

#reset-btn {
    position: absolute;
    bottom: 30px;
    left: 40px;
    padding: 12px 24px;
    background: #836a36;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 200;
    transition: background 0.2s;
}

#reset-btn:hover {
    background: #b5915b;
}

#reset-btn:active {
    transform: scale(0.98);
}

/** Estilos para el diálogo de reseleccionar estrado/pantalla*/

#tempPopover,
#tempNuPopover {
    border: none;
    z-index: 1000;
    background: white;
    padding: 7px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.popover-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    color: var(--wp--preset--color--inputtext);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

dialog {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    width: 300px;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.dialog-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 13px !important;
    color: var(--wp--preset--color--inputtext);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

:root {
    --radio-gray: #b9b9b9;
    /* gris del borde normal */
    --radio-orange: #f57c00;
    /* naranja del punto y borde en foco */
    --radio-size: 18px;
    /* tamaño del cuadro */
    --radio-radius: 5px;
    /* esquinas redondeadas */
    --radio-border: 1px;
    /* grosor normal */
    --radio-border-focus: 2px;
    /* grosor en foco */
}

/* Grupo (opcional) */
.radio-group {
    border: 0;
    padding: 0;
    margin: 0;
    display: grid;
    grid-auto-flow: column;
    gap: 20px;
}

.form-group {
    border: 0;
    padding: 0;
    margin: 0;
    display: grid;
    grid-auto-flow: column;
    gap: 20px;
}

.form-group input[type="number"] {
    width: fit-content;
}

/* Cada opción */
.radio {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    user-select: none;
    width: fit-content;
}

/* Ocultamos el radio nativo pero lo dejamos accesible */
.radio>input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* El cuadro visible */
.radio__control {
    width: var(--radio-size);
    height: var(--radio-size);
    border: var(--radio-border) solid var(--radio-gray);
    border-radius: var(--radio-radius);
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    transition: border-color 140ms ease, border-width 140ms ease;
}

/* Punto central (solo si está seleccionado) */
.radio__control::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--radio-orange);
    transform: scale(0);
    transition: transform 140ms ease;
}

/* ✅ Cuando está seleccionado, aparece el punto naranja */
.radio>input:checked+.radio__control::after {
    transform: scale(1);
}

/* ✅ Cuando tiene foco (teclado o clic), borde naranja y más grueso */
.radio>input:focus-visible+.radio__control {
    border-color: var(--radio-orange);
    border-width: var(--radio-border-focus);
}

/* Si prefieres que también se active con mouse (clic), usa focus además de focus-visible */
/* .radio > input:focus + .radio__control{
  border-color: var(--radio-orange);
  border-width: var(--radio-border-focus);
} */

/* ✅ Cuando pierde foco:
   el borde vuelve a gris/delgado automáticamente (reglas base),
   pero si está checked el punto se queda naranja (regla checked). */

/* Texto */
.radio__label {
    font: 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #222;
}


.dialog-content input[type="number"] {
    font-family: var(--cff-font-family);
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: var(--wp--preset--font-size--small, 13px);
}

.btn-confirmar {
    background-color: var(--wp--preset--color--primary);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-confirmar:hover {
    background-color: var(--wp--preset--color--secondary);
}

/** TOAST NOTIFICACIÓN */
/* TOAST CONTAINER (esquina inferior derecha) */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end;
    pointer-events: none;
}

/* Estilo de cada toast moderno */
.toast {
    pointer-events: auto;
    background: #1e293b;
    backdrop-filter: blur(12px);
    background: rgba(30, 41, 59, 0.92);
    border-radius: 20px;
    padding: 12px 18px 12px 20px;
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 360px;
    min-width: 260px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #f1f5f9;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    transform: translateX(100%);
    opacity: 0;
    border-left: 4px solid #3b82f6;
}

/* Estado visible (slide in) */
.toast.show {
    transform: translateX(0);
    opacity: 1;
}

/* Estado oculto para slide out */
.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.toast-message {
    font-family: var(--cff-font-family);
    flex: 1;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

.toast-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e6;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 40px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    font-weight: 600;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* @media (max-width: 480px) { */
.toast {
    max-width: 280px;
    padding: 10px 14px;
}

/*     .card {
        padding: 1.5rem;
    }
} */

/** Contenedor que se crea junto al botón */
.btn-icon-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 8px;
    font-size: 16px;
    font-weight: bold;
    vertical-align: middle;
    line-height: 1;
}

/* Colores por estado */
.status-success {
    color: #28a745;
}

.status-error {
    color: #dc3545;
}

.status-loading {
    color: #007bff;
}

/* Spinner animado con CSS puro */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/** 🔒 Estado deshabilitado: opacidad, cursor y anulación de hover/clics */
button:disabled {
    /* Botón PDF? */
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    /* Anula eventos de mouse (hover, active, etc.) */
    transition: opacity 0.2s ease;
}

.deshabilitado {
    /* Padre del botón PDF? */
    opacity: 0.5;
    pointer-events: none;
    /* bloquea hover y clicks */
    cursor: not-allowed;
    transition: opacity 0.2s ease;
}

/** Estilos para el grupo de pestañas que muestra las tablas de datos
/* Contenedor principal del grupo */
.fieldname35_1 .dfield {
    display: flex;
    align-items: end;
    /* gap: 5px; */
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: var(--cff-font-size-small);
    color: grey;
    font-weight: 500;
    background: #eee;
    padding-left: 18px;
}

/* Transformar los labels en pestañas */
.fieldname35_1 .side_by_side label {
    display: block !important;
    padding: 10px 20px;
    margin-bottom: 0px !important;
}

/* Ocultar el círculo del radio button original */
.fieldname35_1 input[type="radio"] {
    display: none !important;
}

/* Estilo para la pestaña seleccionada */
.fieldname35_1 input[type="radio"]:checked+span {
    color: #020202;
}

.fieldname35_1 input[type="radio"]:checked+span::before {
    /* Aquí podrías añadir un icono si quisieras */
}

/* Resaltado cuando la pestaña está activa */
.fieldname35_1 label:has(input:checked) {
    background: transparent;
    border-bottom: 3px solid #aa7400;
    /* Color de acento */
}

/* Evento hover en la paestaña */
.fieldname35_1 label:hover {
    color: #222;
}

/** Estilos para controles de tabla manual input */
/* Conternedor de controles */
.controlsMI {
    font-size: var(--wp--preset--font-size--small);
    border: 1px solid #ccc;
    border-radius: 0px 0px 5px 5px;
    background: #eee;
    margin-top: 10px;
    padding: 10px;
    height: 52px;
}

/* Botones carrusel */
.carousel-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid #d5cfc2;
    background: #faf8f5;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    user-select: none;
    line-height: 1;
    flex-shrink: 0;
    padding: 0;
}

.carousel-btn:hover {
    background: #f0ebe0;
    border-color: #b8a980;
    color: var(--accent);
    transform: scale(1.08);
}

.carousel-btn:active {
    background: #e5dcc8;
    transform: scale(0.94);
    transition: 0.08s;
}

.carousel-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Celdas editables (Riser) ────────── */
.riser-cell {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    justify-content: center;
}

.riser-input {
    width: 68px !important;
    height: 28px !important;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.4rem 0.2rem;
    border: 2px solid #e0dbd0;
    border-radius: 3px;
    background: #fefdfb;
    color: #2c2416;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.riser-input::-webkit-outer-spin-button,
.riser-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.riser-input:focus {
    outline: none;
    border-color: #8b6914 !important;
    box-shadow: 0 0 0 3px rgba(139, 105, 20, 0.212);
    background: #fff;
}

.riser-input.changed {
    border-color: #8b6914 !important;
    background: #fffef9;
    animation: border-glow 0.6s ease-out;
}

@keyframes border-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(139, 105, 20, 0.5);
    }

    100% {
        box-shadow: 0 0 0 8px rgba(139, 105, 20, 0);
    }
}