/* =========================================================
   MODAL CONFIGURACIÓN DE IMPUESTOS
   ========================================================= */

.modal-config-impuestos {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

.modal-config-impuestos[aria-hidden="false"] {
    display: block;
}

.modal-config-impuestos-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

.modal-config-impuestos-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(1020px, 92vw);
    max-height: 88vh;
    margin: 6vh auto;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    font-family: inherit;
}

/* ---------- HEADER ---------- */

.modal-config-impuestos-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-config-impuestos-title {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
}

.modal-config-impuestos-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #475569;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.modal-config-impuestos-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* ---------- BODY ---------- */

.modal-config-impuestos-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: #f8fafc;
}

.modal-config-impuestos-body::-webkit-scrollbar {
    width: 8px;
}

.modal-config-impuestos-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

.modal-config-impuestos-body::-webkit-scrollbar-track {
    background: transparent;
}

.config-editor-loading {
    padding: 40px 0;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* ---------- AVISO IA ---------- */

.modal-impuestos-aviso-ia {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border-radius: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.modal-impuestos-aviso-sin-info {
    background: #fffbeb;
    border-color: #fde68a;
}

.modal-impuestos-aviso-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    color: #2563eb;
    background: #dbeafe;
}

.modal-impuestos-aviso-sin-info .modal-impuestos-aviso-icon {
    color: #b45309;
    background: #fef3c7;
}

.modal-impuestos-aviso-contenido {
    flex: 1;
}

.modal-impuestos-aviso-titulo {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.modal-impuestos-aviso-texto {
    font-size: 13px;
    line-height: 1.5;
    color: #475569;
}

.modal-impuestos-aviso-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.modal-impuestos-aviso-link:hover {
    text-decoration: underline;
}

.modal-config-toast {
    position: absolute;
    left: 50%;
    bottom: 74px; /* justo encima del footer */
    transform: translateX(-50%) translateY(10px);
    z-index: 5;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;

    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
}

.modal-config-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.modal-config-toast.exito {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.modal-config-toast.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.modal-config-toast ion-icon {
    font-size: 16px;
}

/* ---------- GRUPOS (ICA, RETE-ICA, etc.) ---------- */

.config-editor-grupo {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.config-editor-grupo-header {
    padding: 14px 18px;
    background: #f1f5f9;
    border-bottom: 1px solid #e5e7eb;
}

.config-editor-grupo-titulo {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #0f172a;
    text-transform: uppercase;
}

.config-editor-grupo-contenido {
    padding: 4px 18px 12px;
}

/* ---------- CONCEPTO (PERIODICIDAD / FECHA DE PAGO) ---------- */

.config-editor-concepto {
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.config-editor-concepto:last-child {
    border-bottom: none;
}

.config-editor-concepto-titulo {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.config-editor-sin-info {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
}

/* ---------- CAMPOS (selects, inputs) ---------- */

.config-editor-campo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.config-editor-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    min-width: 90px;
}

.config-editor-periodicidad,
.config-editor-mes {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    font-size: 13px;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.config-editor-periodicidad:hover,
.config-editor-mes:hover {
    border-color: #94a3b8;
}

.config-editor-periodicidad:focus,
.config-editor-mes:focus,
.config-editor-dia:focus,
.config-editor-anio:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.config-editor-fecha-controles {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.config-editor-dia,
.config-editor-anio {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    font-size: 13px;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.config-editor-dia {
    width: 60px;
    text-align: center;
}

.config-editor-anio {
    width: 80px;
    text-align: center;
}

/* Quita las flechitas del input number (opcional, más limpio) */
.config-editor-dia::-webkit-inner-spin-button,
.config-editor-anio::-webkit-inner-spin-button {
    opacity: 0.4;
}

/* ---------- BLOQUE "DETECTADO POR IA" ---------- */

.config-editor-fecha-ia {
    margin-top: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #475569;
}

.config-editor-fecha-ia strong {
    color: #1e293b;
}

.config-editor-fecha-ia > div {
    margin-top: 4px;
}

/* ---------- ARTÍCULOS (para conceptos que listan texto legal) ---------- */

.config-editor-articulo {
    padding: 10px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
}

.config-editor-articulo:first-child {
    border-top: none;
}

.config-editor-articulo-numero {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.config-editor-articulo-titulo {
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.config-editor-articulo-contenido {
    color: #64748b;
    line-height: 1.55;
}

/* ---------- FOOTER ---------- */

.modal-config-impuestos-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}


.btn-config-cancelar {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.btn-config-cancelar:hover {
    background: #f1f5f9;
}


.btn-config-guardar:hover {
    background: #1d4ed8;
}

.btn-config-guardar:active,
.btn-config-cancelar:active {
    transform: scale(0.98);
}

.btn-config-guardar:disabled {
    background: #93c5fd;
    border-color: #93c5fd;
    cursor: not-allowed;
}

.btn-config-guardar ion-icon {
    font-size: 16px;
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 640px) {
    .modal-config-impuestos-container {
        width: 96vw;
        margin: 4vh auto;
        max-height: 92vh;
    }

    .config-editor-label {
        min-width: 100%;
    }

    .config-editor-campo {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Botón cancelar */

.btn-config-cancelar {
    padding: 9px 16px;

    background: #ffffff;

    border: 1px solid #d1d5db;

    border-radius: 6px;

    color: #475569;

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;
}

.btn-config-cancelar:hover {
    background: #f8fafc;
}


/* Botón guardar */

.btn-config-guardar {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 9px 16px;

    background: #0875d1;

    border: 1px solid #0875d1;

    border-radius: 6px;

    color: #ffffff;

    font-size: 11px;
    font-weight: 700;

    cursor: pointer;
}

.btn-config-guardar:hover {
    background: #075fa8;
}


/* Bloquear scroll del documento */

body.modal-config-impuestos-abierto {
    overflow: hidden;
}