body {
    background: #f5f6fa;
}

.popup {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    background: rgba(0,0,0,0.10);
}

.popup-inner {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.13);
    min-width: 800px;
    max-width: 800px;
    width: 90vw;
    padding: 0 0 32px 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    animation: popupIn 0.7s cubic-bezier(.68,-0.55,.27,1.55);
}
@keyframes popupIn {
    0% { opacity: 0; transform: scale(0.92) translateY(40px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.popup-header {
    background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 50%, #10b981 100%);
    border-radius: 20px 20px 0 0;
    padding: 28px 32px 18px 32px;
    color: #fff;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
}
.popup-header-title {
    flex: 1;
}
.popup-header-main {
    font-family: 'Pretendard', 'NEXONLv1GothicBold', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}
.popup-header-desc {
    font-family: 'Pretendard', 'NEXONLv1GothicRegular', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.97;
    line-height: 1.5;
}
.popup-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: 16px;
    margin-top: 2px;
    transition: color 0.2s;
}
.popup-close:hover {
    color: #dbeafe;
}

.popup-section-title {
    font-family: 'Pretendard', 'NEXONLv1GothicBold', sans-serif;
    font-size: 1.08rem;
    font-weight: 600;
    color: #222;
    margin: 24px 0 10px 32px;
}

.popup-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 16px;
    padding: 0 32px;
    margin-bottom: 28px;
}
.popup-card {
    background: #fafbfc;
    border: 1.5px solid #e5e8ef;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 0 10px 0;
    transition: transform 0.18s cubic-bezier(.4,1.2,.4,1), box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(33,118,255,0.04);

    position: relative; /* ::before 가상 요소의 기준점 */
    overflow: hidden;   /* border-radius 밖으로 이미지가 삐져나가지 않도록 함 */
}
.popup-card:hover {
    border: 1.5px solid #e5e8ef;
    box-shadow: 0 2px 8px rgba(33,118,255,0.04);
    transform: translateY(-6px);
    cursor: pointer;
}
.popup-card img {
    width: 38px;
    height: 38px;
    margin-bottom: 10px;
    display: block;
}
.popup-card-text {
    font-family: 'Pretendard', 'NEXONLv1GothicRegular', sans-serif;
    font-size: 0.97rem;
    color: #222;
    text-align: center;
    font-weight: 600;

    text-shadow: 0px 0px 4px rgba(255, 255, 255, 0.7); /* 가독성을 위한 그림자 */
    position: relative; /* z-index를 적용하기 위해 필수 */
    z-index: 1;         /* 배경(z-index: 0)보다 높은 1번 레이어로 올림 */
}
.popup-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    position: relative; /* z-index를 적용하기 위해 필수 */
    z-index: 1;         /* 배경(z-index: 0)보다 높은 1번 레이어로 올림 */
}
.popup-card-icon svg {
    width: 32px;
    height: 32px;
}

.popup-btn {
    background: #3b82f6;
    color: #fff;
    font-family: 'Pretendard', sans-serif;
    font-size: 1.08rem;
    font-weight: 600;
    border: none;
    border-radius: 24px;
    padding: 14px 0;
    margin: 18px auto 0 auto;
    box-shadow: 0 4px 16px rgba(33,118,255,0.10);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    width: 33%;
    min-width: 120px;
    display: block;
}
.popup-btn:hover {
    background: #2563eb;
    transform: scale(1.03);
}

.fade-out {
    animation: fadeOut 0.4s forwards;
}


/* 모든 팝업 카드에 공통으로 적용될 배경 이미지 스타일 */
.popup-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* 배경 이미지 설정 */
    background-size: cover;
    background-position: center;

    /* 핵심: 투명도 30% 설정 */
    opacity: 0.3;

    /* 아이콘/텍스트 등 다른 콘텐츠 뒤로 보내기 */
    z-index: 0;

    /* 부드러운 전환 효과 */
    transition: opacity 0.3s ease-in-out;
}

/* 마우스를 올리면 배경 이미지가 살짝 진해지는 효과 */
.popup-card:hover::before {
    opacity: 0.45;
}

.card-tax::before {
    background-image: url('/assets/popup/tax-bg.png');
}
.card-appraisal::before {
    background-image: url('/assets/popup/appraisal-bg.png');
}
.card-legal::before {
    background-image: url('/assets/popup/legal-bg.png');
}
.card-revaluation::before {
    background-image: url('/assets/popup/revaluation-bg.png');
}
.card-avm::before {
    background-image: url('/assets/popup/avm-bg.png');
}
.card-safe-rent::before {
    background-image: url('/assets/popup/safe-rent-bg.png');
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* 아이콘 애니메이션 */
.popup-card-icon.house-ani svg {
    animation: houseUpDown 1.8s ease-in-out infinite alternate;
}
@keyframes houseUpDown {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}

.popup-card-icon.dollar-ani svg {
    animation: dollarRotate 2.2s linear infinite;
    transform-origin: 50% 50%;
}
@keyframes dollarRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.popup-card-icon.graph-ani svg {
    animation: graphLeftRight 1.6s ease-in-out infinite alternate;
}
@keyframes graphLeftRight {
    0% { transform: translateX(-3px); }
    100% { transform: translateX(3px); }
}

.popup-card-icon.shield-ani svg {
    animation: shieldScale 1.3s ease-in-out infinite alternate;
}
@keyframes shieldScale {
    0% { transform: scale(0.82); }
    100% { transform: scale(1); }
}

@media (max-width: 600px) {
    .popup-inner {
        min-width: 0;
        width: 95vw;
        padding: 0 0 20px 0;
        margin: 20px;
    }
    .popup-header {
        padding: 20px 16px 16px 16px;
    }
    .popup-section-title {
        margin: 20px 0 12px 16px;
    }
    .popup-cards {
        padding: 0 16px;
        gap: 14px 10px;
    }
    .popup-btn {
        margin: 16px auto 0 auto;
        padding: 14px 0;
        font-size: 1rem;
        width: 60%;
        min-width: 100px;
        display: block;
    }
}

/* 어두운 배경 오버레이 */
.expanded-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10003;
    padding: 1rem;
    box-sizing: border-box;
}

/* 모달 흰색 컨텐츠 박스 */
.expanded-modal-content {
    position: relative;
    background-color: #fff;
    border-radius: 0.75rem; /* 12px */
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    max-width: 42rem; /* 672px */
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem; /* 32px */
    box-sizing: border-box;
}

/* 닫기 버튼 */
.expanded-modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af; /* gray-400 */
    padding: 0;
}
.expanded-modal-close-btn:hover {
    color: #374151; /* gray-700 */
}
.expanded-modal-close-btn .icon {
    width: 1.5rem; /* 24px */
    height: 1.5rem; /* 24px */
}

/* 모달 헤더 (제목) */
.expanded-modal-header {
    margin-bottom: 1.5rem; /* 24px */
}
.expanded-modal-title {
    font-size: 1.5rem; /* 24px */
    font-weight: 700;
    color: #111827; /* gray-900 */
}

/* 모달 본문 */
.expanded-modal-body p {
    color: #374151; /* gray-700 */
    line-height: 1.6;
    margin-bottom: 1rem;
}
.expanded-modal-body p:last-child {
    margin-bottom: 0;
}

/* 스텝 가이드 박스 (파란색 배경) */
.step-guide-box {
    background-color: #eff6ff; /* blue-50 */
    padding: 1.25rem; /* 20px */
    border-radius: 0.5rem; /* 8px */
    margin-bottom: 1.5rem; /* 24px */
}

.step-item {
    display: flex;
    align-items: flex-start; /* 텍스트가 길어질 경우를 대비 */
    margin-bottom: 1rem;
}
.step-item:last-child {
    margin-bottom: 0;
}
.step-item p {
    margin: 0;
    flex: 1;
}

.step-number {
    flex-shrink: 0;
    width: 1.75rem; /* 28px */
    height: 1.75rem; /* 28px */
    background-color: #2563eb; /* blue-600 */
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 0.75rem; /* 12px */
}

/* 정보 박스 (하단 파란색 테두리) */
.info-boxes {
    background-color: #dbeafe; /* blue-100 */
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #3b82f6; /* blue-500 */
}
.info-boxes p {
    font-weight: 500;
    color: #1e3a8a; /* blue-800 */
    margin: 0;
}

/* --- 1. 노란색 테마 (자산재평가) --- */
.theme-yellow .step-guide-box { background-color: #fef9c3; /* yellow-100 */ }
.theme-yellow .step-number { background-color: #facc15; /* yellow-400 */ color: #422006; /* yellow-900 */ }
.theme-yellow .info-boxes {
    background-color: #fef3c7; /* yellow-200 */
    border-left-color: #f59e0b; /* yellow-500 */
}
.theme-yellow .info-boxes p { color: #78350f; /* yellow-800 */ }


/* --- 2. 붉은색 테마 (AVM) --- */
.theme-red .step-guide-box { background-color: #fee2e2; /* red-100 */ }
.theme-red .step-number { background-color: #ef4444; /* red-500 */ }
.theme-red .info-boxes {
    background-color: #fecaca; /* red-200 */
    border-left-color: #dc2626; /* red-600 */
}
.theme-red .info-boxes p { color: #991b1b; /* red-800 */ }


/* --- 3. 남색 테마 (안전한 전세) --- */
.theme-navy .step-guide-box { background-color: #e0e7ff; /* indigo-100 */ }
.theme-navy .step-number { background-color: #4f46e5; /* indigo-600 */ }
.theme-navy .info-boxes {
    background-color: #c7d2fe; /* indigo-200 */
    border-left-color: #4338ca; /* indigo-700 */
}
.theme-navy .info-boxes p { color: #3730a3; /* indigo-800 */ }