/* La carcasa del modal (.modal-entidad, .iv-*) es una copia de events.css, que solo se carga en eventos.
   Si cambia el aspecto de los modales alli, hay que replicarlo aqui. */

/* Geometria fijada por id: cada tema trae su propio bootstrap y algunos descentran el modal */
#modal-newsletter-preferencias .modal-dialog {
    position: relative;
    width: auto;
    max-width: 720px;
    margin: 30px auto;
    float: none;
    left: auto;
    right: auto;
}

#modal-newsletter-preferencias .modal-content {
    width: 100%;
    margin: 0;
    float: none;
    left: auto;
    right: auto;
}

@media (max-width: 767px) {
    #modal-newsletter-preferencias .modal-dialog {
        margin: 10px;
    }
}

.modal-entidad .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.15), 0 0 0 1px rgba(0,0,0,.05);
    overflow: hidden;
    padding: 0;
}

.modal-entidad .iv-modal-header {
    display: flex;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid #eef0f2;
    background: #fafbfc;
    gap: 14px;
}

.modal-entidad .iv-modal-header .iv-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.modal-entidad .iv-modal-header .iv-modal-icon.icon-primary {
    background: rgba(var(--color-principal-rgb, 0,123,255), .1);
    color: var(--color-principal, #007bff);
}

.modal-entidad .iv-modal-header .iv-modal-title {
    flex: 1;
}

.modal-entidad .iv-modal-header .iv-modal-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

.modal-entidad .iv-modal-header .iv-modal-title p {
    margin: 2px 0 0;
    font-size: 13px;
    color: #6b7280;
    font-weight: 400;
}

.modal-entidad .iv-modal-header .iv-modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    font-size: 18px;
    transition: all .2s ease;
    flex-shrink: 0;
    text-decoration: none;
}

    .modal-entidad .iv-modal-header .iv-modal-close:hover {
        background: #f3f4f6;
        color: #374151;
        text-decoration: none;
    }

.modal-entidad .iv-modal-body {
    padding: 24px 28px;
}

.modal-entidad .iv-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 28px;
    border-top: 1px solid #eef0f2;
    background: #fafbfc;
}

.modal-entidad .iv-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.modal-entidad .iv-btn-primary {
    background: var(--color-principal, #007bff);
    color: #fff;
}

    .modal-entidad .iv-btn-primary:hover {
        filter: brightness(.93);
    }

    .modal-entidad .iv-btn-primary[disabled],
    .modal-entidad .iv-btn-primary[disabled]:hover {
        opacity: .5;
        cursor: not-allowed;
        filter: none;
    }

.modal-entidad .iv-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

    .modal-entidad .iv-btn-secondary:hover {
        background: #e5e7eb;
    }

.nl-pref-idioma {
    margin-bottom: 18px;
}

    .nl-pref-idioma label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: #374151;
        margin-bottom: 6px;
    }

    .nl-pref-idioma select {
        max-width: 260px;
    }

.nl-pref-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
}

.nl-pref-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all .2s ease;
}

    .nl-pref-card:hover {
        border-color: #c7d2fe;
        background: #fafbff;
        box-shadow: 0 2px 8px rgba(99, 102, 241, .08);
    }

.nl-pref-card--selected {
    border-color: var(--color-principal, #007bff);
    box-shadow: 0 0 0 3px rgba(var(--color-principal-rgb, 0, 123, 255), .1);
}

.nl-pref-card__check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.nl-pref-checkbox {
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 2px solid #d1d5db;
    background: #fff;
    transition: all .2s ease;
    position: relative;
    accent-color: var(--color-principal);
}

.nl-pref-checkbox--checked {
    border-color: var(--color-principal, #007bff);
    background: var(--color-principal, #007bff);
}

    .nl-pref-checkbox--checked::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 6px;
        width: 5px;
        height: 10px;
        border-right: 2px solid #fff;
        border-bottom: 2px solid #fff;
        transform: rotate(45deg);
    }

.nl-pref-card__body {
    flex: 1;
    min-width: 0;
}

.nl-pref-card__title {
    font-size: 15px;
    font-weight: 600 !important;
    color: #1a1a2e;
    word-break: break-word;
}

.nl-pref-card__freq {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .nl-pref-card__freq label {
        margin: 0;
        font-size: 12px;
        color: #6b7280;
        font-weight: 500;
        white-space: nowrap;
    }

    .nl-pref-card__freq select {
        width: auto;
        min-width: 120px;
    }

@media (max-width: 767px) {

    .modal-entidad .iv-modal-header {
        padding: 16px 18px;
    }

    .modal-entidad .iv-modal-body {
        padding: 18px;
    }

    .modal-entidad .iv-modal-footer {
        padding: 16px 18px;
        flex-direction: column-reverse;
        align-items: stretch;
    }

        .modal-entidad .iv-modal-footer .iv-btn {
            width: 100%;
        }

    .nl-pref-card {
        flex-wrap: wrap;
    }

    .nl-pref-card__body {
        flex: 1 1 auto;
    }

    .nl-pref-card__freq {
        flex: 1 1 100%;
        padding-left: 36px;
    }

        .nl-pref-card__freq select {
            flex: 1;
            min-width: 0;
        }

    .nl-pref-idioma select {
        max-width: none;
    }
}
