/*  반응형 커스텀 모달 HTML 및 스타일 */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --kakao-color: #fee500;
    --kakao-text: #191919;
    --border-color: #e5e7eb;
}

/* 통합된 모달 오버레이 */
.custom-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-out, visibility 0.2s;
}
.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 기본 모달 박스 */
.custom-modal-box {
    background: var(--bg-color);
    width: 100%;
    max-width: 380px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.custom-modal-overlay.active .custom-modal-box {
    transform: scale(1);
}
.custom-modal-content {
    padding: 32px 24px 24px 24px;
    text-align: center;
}
.custom-modal-icon {
    width: 48px;
    height: 48px;
    background-color: #e0f2fe;
    color: #0284c7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    font-size: 22px;
    font-weight: bold;
}
.custom-modal-icon.error {
    background-color: #fee2e2; 
    color: #ef4444;
}
.custom-modal-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-color);
    font-weight: 500;
    word-break: keep-all;
    margin: 0;
}
.custom-modal-footer {
    padding: 0 24px 24px 24px;
}
.custom-modal-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.custom-modal-btn:hover {
    background-color: var(--primary-hover);
}


/* 비밀번호 전용 커스텀 모달 박스 */
.pass-modal-box {
    background-color: var(--bg-color);
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(15px);
    transition: transform 0.2s;
    box-sizing: border-box;
}
.custom-modal-overlay.active .pass-modal-box { 
    transform: translateY(0); 
}

/* 비밀번호 모달 헤더 */
.pass-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.pass-modal-header h3 {
    margin: 0; 
    font-size: 16px; 
    font-weight: 700; 
    color: var(--text-color);
}
.pass-close-x {
    background: none; 
    border: none; 
    font-size: 24px; 
    color: #999999;
    cursor: pointer; 
    padding: 0; 
    line-height: 1; 
    transition: color 0.15s;
}
.pass-close-x:hover { 
    color: var(--text-color); 
}

/* 비밀번호 모달 바디 (아이프레임) */
.pass-modal-body {
    width: 100%;
    height: 200px;
    background-color: var(--bg-color);
}
.pass-modal-body iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}


/* 아이프레임 전체 화면/대형 모달 */
.custom-iframe-modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(15, 23, 42, 0.65); 
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px; 
    box-sizing: border-box;
}
.custom-iframe-modal.active {
    display: flex;
}

.iframe-modal-box {
    background: var(--bg-color);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    animation: modalScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.iframe-modal-box1 {
    background: var(--bg-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 95% !important;
    max-height: 95% !important;
}

/* 통합된 아이프레임 모달 헤더 */
.iframe-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.iframe-modal-header #iframeModalTitle {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* 통합된 아이프레임 닫기 버튼 */
.iframe-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}
.iframe-close-btn:hover {
    color: var(--text-color);
}

/* 통합된 아이프레임 모달 바디 */
.iframe-modal-body {
    flex: 1;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-color);
}
.iframe-modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* 애니메이션 */
@keyframes modalScaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 반응형 미디어 쿼리 */
@media (min-width: 768px) {
    .custom-iframe-modal {
        padding: 80px 20px;
    }
}