/**
 * SweetAlert2 테마 (리얼월드)
 * .swal2-popup.rw-swal-custom 일 때 적용
 * 타이틀은 검정, 그 외 배경·본문 등은 Swal2 기본에 가깝게, 레이아웃·형태 조정
 */

.swal2-popup.rw-swal-custom {
    --swal2-width: fit-content;
    --swal2-min-width: 26em;
    --swal2-padding: 1.75em 1.5em;
    --swal2-show-animation: swal2-show 0.28s ease-out;
    --swal2-hide-animation: swal2-hide 0.18s ease-in forwards;
    --swal2-border-radius: 1.25rem;
    --swal2-box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.12);
    --swal2-title-font-size: 1.35rem;
    --swal2-title-color: #000;
    --swal2-input-font-size: 1rem;
    /* default.css 레거시와 동일한 확인 버튼 (테마 페이지에서는 :not 스코프로 레거시 미적용) */
    --swal2-confirm-button-background: #7a04ff;
    --swal2-confirm-button-color: #fff;
    /* SweetAlert2 기본 거부(deny) 톤과 동일 계열 */
    --swal2-deny-button-background: #d14529;
    --swal2-deny-button-color: #fff;
}

.swal2-container:has(.swal2-popup.rw-swal-custom) {
    overflow: visible;
}

.swal2-popup.rw-swal-custom {
    position: relative;
    overflow: visible;
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    width: fit-content !important;
    min-width: var(--swal2-min-width) !important;
    max-width: calc(100vw - 2rem);
    box-sizing: border-box;
}

/*
 * Swal 11+: .swal2-header 없이 .swal2-popup 직계에 .swal2-image → .swal2-title 배치
 * 보이는 imageUrl / 내장 아이콘일 때 상단 패딩으로 타이틀을 아이콘 아래로 내림
 */
.swal2-popup.rw-swal-custom:has(.swal2-image:not(:is([style*="display: none"], [style*="display:none"]))) {
    padding-top: 1.8em;
}

.swal2-popup.rw-swal-custom:has(.swal2-image:not(:is([style*="display: none"], [style*="display:none"]))) .swal2-title {
    margin-top: 2rem;
}

/* 내장 .swal2-icon 만 쓰고 이미지는 숨김/없을 때 */
.swal2-popup.rw-swal-custom:has(.swal2-icon:not(:is([style*="display: none"], [style*="display:none"]))):not(:has(.swal2-image:not(:is([style*="display: none"], [style*="display:none"])))) {
    padding-top: 5.1em;
}

.swal2-popup.rw-swal-custom:has(.swal2-icon:not(:is([style*="display: none"], [style*="display:none"]))):not(:has(.swal2-image:not(:is([style*="display: none"], [style*="display:none"])))) .swal2-title {
    margin-top: 2rem;
}

/*
 * imageUrl(테마 공통: /theme/realworld/img/sweetalert2/icon_default.png)
 * Swal 인라인 width/height 와 맞춤 — transform 애니메이션과 충돌 없이 margin 으로 상단 걸침
 */
.swal2-popup.rw-swal-custom .swal2-image {
    position: absolute;
    left: 50%;
    top: 0;
    width: 80px !important;
    height: 80px !important;
    max-width: 80px;
    max-height: 80px;
    margin: -40px 0 0 -40px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #7a04ff;
    border-radius: 50%;
    overflow: hidden;
}

/* 구버전: div.swal2-image > img / 11.x: img.swal2-image 단일 요소 */
.swal2-popup.rw-swal-custom .swal2-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.swal2-popup.rw-swal-custom img.swal2-image {
    object-fit: contain;
}

.swal2-popup.rw-swal-custom .swal2-html-container,
.swal2-popup.rw-swal-custom .swal2-content {
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
}

.swal2-popup.rw-swal-custom .swal2-title {
    color: #000;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.swal2-popup.rw-swal-custom .swal2-actions {
    margin-top: 2.3rem;
}

/* 소득세 사전확인: 기본 확인/취소 DOM 없을 때 Swal 인라인 display:none 보정(나머지는 Swal 기본 .swal2-actions 스타일) */
.swal2-popup.rw-swal-custom.rw-swal-income-prereq .swal2-actions {
    display: flex !important;
}

/* 소득세 사전확인: 요약 단계에서 본문 줄바꿈 허용 */
.swal2-popup.rw-swal-custom.rw-swal-income-prereq .swal2-html-container {
    white-space: normal;
    overflow-x: visible;
    overflow-y: visible;
}

/* 소득세 사전확인 — 확인 내용 요약(질문·답 한 줄) */
.swal2-popup.rw-swal-custom.rw-swal-income-prereq #rw-income-summary .rw-income-summary-inner {
    text-align: left;
}

.swal2-popup.rw-swal-custom.rw-swal-income-prereq #rw-income-summary .rw-income-summary-title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 0.65rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.swal2-popup.rw-swal-custom.rw-swal-income-prereq #rw-income-summary .rw-income-summary-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.swal2-popup.rw-swal-custom.rw-swal-income-prereq #rw-income-summary .rw-income-summary-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: linear-gradient(180deg, #fafafa 0%, #f3f4f6 100%);
    border: 1px solid #e5e7eb;
    border-radius: 0.65rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.swal2-popup.rw-swal-custom.rw-swal-income-prereq #rw-income-summary .rw-income-summary-q {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #374151;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swal2-popup.rw-swal-custom.rw-swal-income-prereq #rw-income-summary .rw-income-summary-a {
    flex: 0 0 auto;
    font-size: 0.92rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}

/* 제목만(text 없음): .swal2-html-container 가 display none 일 때 하단·버튼 사이 */
.swal2-popup.rw-swal-custom:has(.swal2-html-container:is([style*="display: none"], [style*="display:none"])) .swal2-actions {
    margin-top: 2.3rem;
}

.swal2-popup.rw-swal-custom .swal2-styled.swal2-confirm {
    background-color: #7a04ff;
    color: #fff;
    border-radius: 9999px;
    padding: 0.55em 1.6em;
    font-weight: 600;
    font-size: 0.95rem;
}

/*
 * Swal2는 취소·거부 버튼을 항상 DOM에 두고 display:none 만 토글함.
 * 취소가 숨김·거부가 보이지 않을 때만 확인 버튼을 크게.
 */
.swal2-popup.rw-swal-custom .swal2-actions:has(.swal2-cancel:is([style*="display: none"], [style*="display:none"])):not(:has(.swal2-deny:not(:is([style*="display: none"], [style*="display:none"])))) .swal2-styled.swal2-confirm {
    padding: 0.68em 2.15em;
    font-size: 1.05rem;
    min-width: 8.5rem;
}

.swal2-popup.rw-swal-custom .swal2-styled.swal2-cancel {
    border-radius: 9999px;
    padding: 0.55em 1.6em;
    font-weight: 600;
    font-size: 0.95rem;
}

.swal2-popup.rw-swal-custom .swal2-styled.swal2-deny {
    background-color: var(--swal2-deny-button-background);
    color: var(--swal2-deny-button-color);
    border-radius: 9999px;
    padding: 0.55em 1.6em;
    font-weight: 600;
    font-size: 0.95rem;
}

.swal2-popup.rw-swal-custom .swal2-styled:disabled,
.swal2-popup.rw-swal-custom .swal2-styled[disabled] {
    cursor: not-allowed;
}

/* 확인 + 취소만(거부 숨김) — 두 버튼 조금 더 크게 */
.swal2-popup.rw-swal-custom .swal2-actions:has(.swal2-cancel:not(:is([style*="display: none"], [style*="display:none"]))):not(:has(.swal2-deny:not(:is([style*="display: none"], [style*="display:none"])))) .swal2-styled.swal2-confirm,
.swal2-popup.rw-swal-custom .swal2-actions:has(.swal2-cancel:not(:is([style*="display: none"], [style*="display:none"]))):not(:has(.swal2-deny:not(:is([style*="display: none"], [style*="display:none"])))) .swal2-styled.swal2-cancel {
    padding: 0.65em 1.85em;
    font-size: 1.02rem;
    min-width: 7rem;
}

/* 확인 + 거부 + 취소 세 버튼 모두 보일 때 */
.swal2-popup.rw-swal-custom .swal2-actions:has(.swal2-cancel:not(:is([style*="display: none"], [style*="display:none"]))):has(.swal2-deny:not(:is([style*="display: none"], [style*="display:none"]))) .swal2-styled.swal2-confirm,
.swal2-popup.rw-swal-custom .swal2-actions:has(.swal2-cancel:not(:is([style*="display: none"], [style*="display:none"]))):has(.swal2-deny:not(:is([style*="display: none"], [style*="display:none"]))) .swal2-styled.swal2-deny,
.swal2-popup.rw-swal-custom .swal2-actions:has(.swal2-cancel:not(:is([style*="display: none"], [style*="display:none"]))):has(.swal2-deny:not(:is([style*="display: none"], [style*="display:none"]))) .swal2-styled.swal2-cancel {
    padding: 0.6em 1.35em;
    font-size: 1rem;
    min-width: 5.85rem;
}

.swal2-popup.rw-swal-custom .swal2-close {
    font-size: 1.75rem;
    transition: transform 0.15s ease;
}

.swal2-popup.rw-swal-custom .swal2-close:hover {
    transform: scale(1.05);
}

