/**
 * iSATManager — Modales neumórficos (bottom sheet mobile / centrado desktop)
 * Uso: añadir clase `isat-modal` al .modal y las clases isat-* en el markup.
 */

.isat-modal .modal-dialog {
    margin: 0 auto;
    max-width: 480px;
}

.isat-modal .modal-content,
.isat-modal__content {
    border: none;
    background: #F8F9FB;
    border-radius: 28px;
    box-shadow: 0 12px 48px rgba(51, 51, 51, 0.18);
    overflow: hidden;
}

.isat-modal .modal-backdrop.show {
    background: rgba(30, 41, 59, 0.35);
}

.isat-modal__handle {
    width: 40px;
    height: 4px;
    background: #D1D5DB;
    border-radius: 99px;
    margin: 10px auto 4px;
    flex-shrink: 0;
}

.isat-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1.25rem 1rem;
    background: transparent;
    border: none;
}

.isat-modal__title {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0;
    color: var(--cpm-neutral);
    line-height: 1.2;
}

.isat-modal__close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--cpm-neutral-light);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    padding: 0;
}

.isat-modal__close:hover {
    background: rgba(51, 51, 51, 0.06);
    color: var(--cpm-neutral);
}

.isat-modal__body {
    padding: 0 1.25rem 1rem;
}

.isat-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem 1.5rem;
    border: none;
    background: transparent;
}

/* Campos */
.isat-field {
    margin-bottom: 1.125rem;
}

.isat-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.125rem;
}

.isat-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #4B5563;
    margin-bottom: 0.5rem;
}

.isat-input,
.isat-modal .form-control,
.isat-modal .form-select {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 14px;
    background: #FFFFFF;
    color: var(--cpm-neutral);
    font-family: var(--cpm-font);
    font-size: 0.9375rem;
    box-shadow: inset 2px 2px 6px rgba(51, 51, 51, 0.07), inset -2px -2px 5px rgba(255, 255, 255, 0.95);
    transition: box-shadow 0.15s ease;
}

.isat-input::placeholder,
.isat-modal .form-control::placeholder {
    color: #9CA3AF;
}

.isat-input:focus,
.isat-modal .form-control:focus,
.isat-modal .form-select:focus {
    outline: none;
    box-shadow: inset 2px 2px 8px rgba(51, 51, 51, 0.1), inset -2px -2px 6px rgba(255, 255, 255, 1), 0 0 0 2px rgba(142, 209, 233, 0.45);
}

.isat-input--textarea,
.isat-modal textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.isat-input-wrap {
    position: relative;
}

.isat-input-wrap__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.isat-input-wrap--icon .isat-input,
.isat-input-wrap--icon .form-control,
.isat-input-wrap--icon .form-select {
    padding-left: 2.75rem;
}

.isat-input-wrap--icon-right .isat-input,
.isat-input-wrap--icon-right .form-control {
    padding-right: 2.75rem;
}

.isat-input-wrap__icon--right {
    left: auto;
    right: 1rem;
}

/* Segmentos (prioridad, estado…) */
.isat-segment {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.isat-segment--2 {
    grid-template-columns: repeat(2, 1fr);
}

.isat-segment__btn {
    min-height: 44px;
    border: none;
    border-radius: 12px;
    background: #FFFFFF;
    color: var(--cpm-neutral);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--cpm-font);
    box-shadow: 2px 2px 8px rgba(51, 51, 51, 0.06), -2px -2px 6px rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.15s, box-shadow 0.15s;
}

.isat-segment__btn.active {
    color: #1E6B8C;
    box-shadow: inset 1px 1px 4px rgba(51, 51, 51, 0.06), 0 0 0 2px #8ED1E9;
}

/* Botones */
.isat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 14px;
    font-family: var(--cpm-font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.875rem 1.25rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.isat-btn:active {
    transform: scale(0.98);
}

.isat-btn--primary {
    background: #8ED1E9;
    color: #1E3A4F;
    box-shadow: 0 4px 14px rgba(142, 209, 233, 0.45);
}

.isat-btn--primary:hover {
    background: #7BC8E4;
    color: #1E3A4F;
}

.isat-btn--ghost {
    background: #FFFFFF;
    color: #4B5563;
    box-shadow: 2px 2px 10px rgba(51, 51, 51, 0.07), -2px -2px 8px rgba(255, 255, 255, 0.95);
}

.isat-btn--ghost:hover {
    background: #F9FAFB;
    color: var(--cpm-neutral);
}

/* Mobile: centrado con aire en los bordes */
@media (max-width: 991.98px) {
    .isat-modal {
        padding: 0 !important;
    }

    .isat-modal .modal-dialog {
        margin: 1.25rem auto;
        max-width: calc(100% - 2.5rem);
        width: 100%;
        min-height: calc(100% - 2.5rem);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .isat-modal .modal-content {
        width: 100%;
        max-height: calc(100vh - 2.5rem - env(safe-area-inset-bottom, 0px));
        border-radius: 28px;
        display: flex;
        flex-direction: column;
        box-shadow: 0 12px 48px rgba(51, 51, 51, 0.18);
    }

    .isat-modal__body {
        overflow-y: auto;
        flex: 1;
        min-height: 0;
    }

    .isat-modal__handle {
        display: block;
    }
}

body.project-detail-open .isat-modal.show {
    z-index: 1100;
}

body.project-detail-open .modal-backdrop.show {
    z-index: 1090;
}

/* Desktop: centrado */
@media (min-width: 992px) {
    .isat-modal .modal-dialog {
        margin: 1.75rem auto;
    }

    .isat-modal__handle {
        display: none;
    }
}

/* Ocultar cabecera/pie Bootstrap por defecto si se mezclan clases */
.isat-modal .modal-header:not(.isat-modal__header),
.isat-modal .modal-footer:not(.isat-modal__footer) {
    display: none;
}
