/* ============================================================
 * agreement-completion
 * 개인정보 수집 이용 동의 전문 모달 + 신청 완료 토스트
 * application-form 위에 stacking
 * ============================================================ */

/* ============== 동의 전문 모달 ============== */

.agree-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000;                /* application-form(999999) 위 */
    background: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.agree-shell {
    max-width: 520px;
    margin: 60px auto 40px;
    padding: 0 16px;
    position: relative;
}

.agree-modal {
    /* 컬러 토큰 */
    --ag-primary: #5D2BF4;
    --ag-primary-hover: #4b22c4;
    --ag-text-strong: #111928;
    --ag-text: #1F2A37;
    --ag-text-muted: #6B7280;
    --ag-border: #E5E7EB;
    --ag-bg-white: #FFFFFF;
    --ag-bg-readonly: #F9FAFB;

    background: var(--ag-bg-white);
    border-radius: 16px;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ag-text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.agree-modal *,
.agree-modal *::before,
.agree-modal *::after {
    box-sizing: border-box;
}

/* 헤더 */
.agree-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ag-border);
    gap: 8px;
}

.agree-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: var(--ag-text-strong);
    margin: 0;
    line-height: 1.3;
    text-align: left;
}

.agree-back,
.agree-close {
    background: transparent;
    border: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    color: var(--ag-text-strong);
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}

.agree-back {
    font-size: 28px;
    margin-right: -4px;
}

.agree-back:hover,
.agree-close:hover {
    color: var(--ag-primary);
}

/* 본문 (스크롤 가능) */
.agree-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.agree-intro {
    font-size: 13px;
    font-weight: 400;
    color: var(--ag-text);
    margin: 0 0 18px 0;
    line-height: 1.7;
}

.agree-section {
    margin-bottom: 16px;
}

.agree-section:last-of-type {
    margin-bottom: 0;
}

.agree-section-heading {
    font-size: 14px;
    font-weight: 700;
    color: var(--ag-text-strong);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.agree-section-body {
    font-size: 13px;
    font-weight: 400;
    color: var(--ag-text);
    margin: 0;
    line-height: 1.7;
    white-space: pre-line;
}

.agree-section-list {
    list-style: disc;
    padding-left: 20px;
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--ag-text);
    line-height: 1.7;
}

.agree-section-list li {
    margin: 0;
}

.agree-footer-note {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px dashed var(--ag-border);
    font-size: 12px;
    color: var(--ag-text-muted);
    line-height: 1.5;
}

.agree-footer-note p {
    margin: 0;
}

.agree-footer-note p + p {
    margin-top: 4px;
}

/* 푸터 */
.agree-footer {
    flex-shrink: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--ag-border);
    background: var(--ag-bg-readonly);
}

.agree-confirm {
    display: block;
    width: 100%;
    padding: 14px 16px;
    background: var(--ag-primary);
    color: var(--ag-bg-white);
    border: 0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease;
    font-family: inherit;
}

.agree-confirm:hover {
    background: var(--ag-primary-hover);
}

.agree-confirm:active {
    transform: translateY(1px);
}

.agree-confirm:focus-visible {
    outline: 2px solid var(--ag-primary);
    outline-offset: 2px;
}

/* ============== 신청 완료 토스트 ============== */
/* prefix `apf-toast`로 Bootstrap의 .toast (`.toast:not(.show){display:none}` 등) 충돌 회피 */

.apf-toast-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 32px;
    z-index: 1000001;                /* 가장 위 */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;            /* 빈 컨테이너는 클릭 통과 */
    padding: 0 16px;
}

.apf-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 360px;
    max-width: 100%;
    padding: 14px 16px;
    background: #1F2A37;
    color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    font-family: 'Pretendard', sans-serif;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}

.apf-toast.apf-toast-show {
    transform: translateY(0);
    opacity: 1;
}

.apf-toast.apf-toast-hide {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

.apf-toast-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #10B981;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.apf-toast-content {
    flex: 1;
    min-width: 0;
}

.apf-toast-title {
    font-size: 14px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.apf-toast-desc {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.45;
}

.apf-toast-close {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    width: 24px;
    height: 24px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.apf-toast-close:hover {
    color: #FFFFFF;
}

/* ============== Mobile (≤768px) ============== */
@media (max-width: 768px) {
    .agree-shell {
        max-width: 100%;
        margin: 0;
        padding: 0;
        height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .agree-modal {
        border-radius: 0;
        max-height: 100dvh;
        flex: 1;
    }

    .agree-header {
        padding: 16px 20px;
    }

    .agree-title {
        font-size: 17px;
    }

    .agree-body {
        padding: 16px 20px;
    }

    .agree-footer {
        padding: 14px 20px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0));
    }

    /* 토스트 모바일 위치/크기 */
    .apf-toast-container {
        bottom: calc(20px + env(safe-area-inset-bottom, 0));
    }

    .apf-toast {
        width: 100%;
        padding: 12px 14px;
    }

    .apf-toast-title {
        font-size: 13px;
    }

    .apf-toast-desc {
        font-size: 12px;
    }
}
