/*
 * uni-modal.css — 충주 사용자단(mber) 전체 모달 통일 스타일
 *
 * 표준: 신청조회 페이지(mber/apply/chk.jsp) 가드 모달 사양
 * - 적절한 폭(~340-400px), 흰색 둥근 카드, 50% overlay
 * - 제목 + 본문 + 단일/이중 버튼(파란 confirm)
 *
 * 격리 원칙: 모든 자식 셀렉터를 부모(.uniModal) 자식 결합자로 작성하여
 * apply.css/board.css/Bootstrap의 .modal-content/.modal-header 등과 격리.
 * naked .uniModal__* 단독 셀렉터는 사용하지 않음.
 */

.uniModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
}

.uniModal.active {
    display: flex;
}

.uniModal .uniModal__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.uniModal .uniModal__content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-top: 56px;
    padding: 30px 60px;
    border-radius: 11px;
    box-sizing: border-box;
    background-color: white;
    transform: translateY(-100%);
    transition: transform 0.3s ease-out;
    z-index: 2;
}

.uniModal .uniModal__content.active {
    transform: translateY(0);
}

.uniModal .uniModal__content--narrow {
    padding: 30px 40px;
}

.uniModal .uniModal__header {
    width: 100%;
    text-align: center;
}

.uniModal .uniModal__title {
    font-size: 1.1rem;
    font-weight: 600;
}

.uniModal .uniModal__body {
    width: 100%;
    font-size: 0.9rem;
    text-align: center;
}

.uniModal .uniModal__footer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.uniModal .uniModal__close,
.uniModal .uniModal__cancel {
    padding: 8px 30px;
    border: none;
    border-radius: 6px;
    box-sizing: border-box;
    font-weight: 600;
    cursor: pointer;
}

.uniModal .uniModal__close {
    background-color: var(--Primary-light, #3C8CB5);
    color: white;
}

.uniModal .uniModal__cancel {
    background-color: #fff;
    color: #555;
    border: 1px solid #d0d0d0;
}

@media (max-width: 960px) {
    .uniModal .uniModal__content {
        width: 80%;
        padding: 24px 24px;
    }

    .uniModal .uniModal__content--narrow {
        width: 80%;
    }
}

/* AC-1/2/3: 모바일 모달 스크롤 픽스
 * 유의사항 모달처럼 본문이 긴 경우, 소형 viewport에서 body가 잘리고
 * footer(확인 버튼)가 화면 밖으로 나가는 현상 방지.
 * .uniModal__content를 flex column + max-height 제한으로 전환하고
 * .uniModal__body만 overflow-y:auto 처리한다.
 */
@media (max-width: 640px) {
    .uniModal {
        align-items: center;
        padding: 16px;
    }

    .uniModal .uniModal__content {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        /* iOS Safari에서 90vh는 large viewport(주소창 제외) 기준이라 실제 가용 영역을 초과해
         * 본문이 잘림. small viewport(svh) 기준으로 85svh 사용. */
        max-height: 85svh;
        max-height: min(90vh, 85svh);
        margin-top: 0;
        padding: 20px 16px;
        gap: 12px;
        box-sizing: border-box;
        overflow: hidden;
    }

    .uniModal .uniModal__header,
    .uniModal .uniModal__footer {
        flex: 0 0 auto;
    }

    .uniModal .uniModal__body {
        width: 100%;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

body.noscroll {
    overflow: hidden;
}
