@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --primary-color: #001961;
    --primary-light: #F0F4FA;
    --bg-color: #F4F6F9;
    --border-color: #E2E6ED;
    --text-main: #111111;
    --text-sub: #777777;
    --point-color: #E73928; /* Q 번호 색상 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
}
h2 {
    font-family: 'Pretendard', sans-serif;
}

/* 전체 페이지 래퍼 (index.html의 <main> 안에 위치 예상) */
.estimate-wrapper {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 36px;
    padding: 40px 20px;
    position: relative;
    width: 100%;
    /* 상단 배경을 위한 가상 요소를 기준점으로 설정 */
    z-index: 0;
}

/* ----------------------------------------
   공통 카드 레이아웃
---------------------------------------- */
.estimate-container {
    background-color: #ffffff;
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 4px 0 rgba(18, 32, 100, 0.25);
    padding: 32px 50px;
    position: relative;
    z-index: 2; /* 배경보다 위에 오도록 설정 */
}

/* ----------------------------------------
   프로그레스 바
---------------------------------------- */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 48px;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 5px;
    background-color: #DAE1F0;
    border-radius: 29px;
    position: relative;
}

.progress-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 29px;
    transition: width 0.3s ease;
}

.progress-badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px 2px 10px;
    border-radius: 100px;
}

/* ----------------------------------------
   질문 타이틀
---------------------------------------- */
.question-header {
    margin-bottom: 18px;
}

.question-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: end;
    gap: 8px;
}

.question-title .q-mark {
    color: var(--point-color);
    font-size: 21px;
}

.question-sub {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 400;
}

/* ----------------------------------------
   옵션 리스트 (라디오, 체크박스 커스텀)
---------------------------------------- */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 32px;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    display: none;
}

.option-item label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.option-item label:hover {
    border-color: #c0c6d0;
}

/* 커스텀 체크 아이콘 (네모꼴) */
.custom-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid #c0c6d0;
    border-radius: 4px;
    margin-right: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    flex-shrink: 0;
}

/* 체크 아이콘 내부의 체크 모양 (가상 요소) */
.custom-checkbox::after {
    content: '';
    display: none; /* 기본은 숨김 */
    width: 10px;
    height: 5px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg);
    margin-top: -2px;
}

/* 선택된 상태 스타일 (옵션 아이템 & 약관 동의 공통 적용) */
.option-item input:checked + label,
.terms-item input:checked + label {
    border-color: #001961E5;
}

.option-item input:checked + label .custom-checkbox,
.terms-item input:checked + label .custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 체크 시 아이콘 보이게 설정 (약관 동의 포함) */
.option-item input:checked + label .custom-checkbox::after,
.terms-item input:checked + label .custom-checkbox::after {
    display: block;
}

/* 옵션 텍스트 (제목 + 설명 조합용) */
.opt-text-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    overflow: hidden;
}

.opt-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    flex-shrink: 0;
}
.option-item input:checked + label .opt-title,
.option-item-expandable.active .opt-title {
    font-weight: 700;
}

.opt-desc {
    font-size: 10px;
    font-weight: 400;
    color: #7282A4;
    letter-spacing: -0.04em;
    white-space: nowrap;
    overflow: hidden;
}

/* ----------------------------------------
   입력 폼 (텍스트, 텍스트에어리어)
---------------------------------------- */
.form-group {
    margin-bottom: 18px;
}

.form-input {
    width: 100%;
    padding: 16px 16px 15px 16px;
    border: 1px solid #E6EDFFE5;
    border-radius: 4px;
    font-size: 15px;
    margin-bottom: 6px;
    outline: none;
}

.form-input::placeholder {
    color: #7282A4;
}

.form-input:focus {
    border-color: var(--primary-color);
}

.form-textarea {
    width: 100%;
    height: 200px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    resize: none;
    outline: none;
}

.form-textarea:focus {
    border-color: var(--primary-color);
}

.textarea-footer {
    text-align: right;
    font-size: 13px;
    color: #7282A4;
}

/* ----------------------------------------
   약관 동의 영역 (Step 6)
---------------------------------------- */
.terms-group {
    margin-block: 36px;
}

.terms-item {
    margin-bottom: 12px;
}

.terms-item.all-agree label {
    font-weight: 600;
    border: none; /* 약관 항목은 테두리 없음 */
    padding-bottom: 12px;
    background-color: transparent;
    border-bottom: 1px solid #E6EDFF !important;
}

.terms-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
    border: none;
    background-color: transparent;
}

.terms-item input {
    display: none;
}

/* 약관 체크박스 크기 미세 조정 */
.terms-item label .custom-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    margin-right: 8px;
}

.text-req { color: #7282A4; }
.text-opt { color: #7282A4; }

/* ----------------------------------------
   하단 버튼 그룹
---------------------------------------- */
.btn-group {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.btn {
    flex: 1;
    padding: 17px 16px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    line-height: 22px;
}

.btn-prev {
    background-color: #F7F9FE;
    color: var(--primary-color);
    border: 1px solid #A9B7DA80;
    max-width: 120px;
}

.btn-next, .btn-submit {
    background-color: var(--primary-color);
    color: white;
}

.btn-next:hover, .btn-submit:hover {
    background-color: #000F3A;
    color: #ffffff;
}

/* ----------------------------------------
   최종 결과 페이지 전용 (Step 7)
---------------------------------------- */
.estimate-wrapper.result-mode {
    align-items: flex-start;
    padding: 0;
    margin-top: 0;
}

.estimate-wrapper.result-mode::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 264px; /* 디자인에 맞춰 높이 조절 */
    background-color: var(--primary-color);
    z-index: 1; /* 컨텐츠(.result-container)보다는 뒤에, 기본 배경보다는 앞에 */
}

.result-container {
    width: 100%;
    max-width: 800px;
    margin: 80px auto 40px;
    position: relative;
    z-index: 2; /* 배경 위로 올라오도록 설정 */
}

.result-title-area {
    text-align: center;
    color: white;
    margin-bottom: 70px;
    position: relative;
}

.result-title-area h2 {
    font-size: 28px;
    font-weight: 400;
    line-height: 1.4;
}

.result-title-area h2 strong {
    font-size: 34px;
    font-weight: 700;
}

.character-img {
    position: absolute;
    right: 80px;
    top: 0;
    width: 120px;
    z-index: -1;
}

.receipt-card {
    background-color: white;
    border-radius: 12px;
    padding: 59px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.receipt-logo {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 48px;
    color: #333;
}
.receipt-logo img {
    width: 80px;
    height: auto;
    margin-bottom: 4px;
}

.receipt-table {
    width: 100%;
}

.receipt-table th {
    text-align: left;
    padding-bottom: 12px;
    border-bottom: 1px solid #E6EDFF;
    font-size: 16px;
}

.receipt-table th.right {
    text-align: right;
}

.receipt-list {
    list-style: none;
    padding: 18px 0 7px;
    border-bottom: 2px solid #333;
}

.receipt-item {
    display: flex;
    margin-bottom: 10px;
    font-size: 16px;
    color: #7282A4;
    position: relative;
}

.item-name {
    background: transparent;
    padding-right: 0;
    z-index: 2;
}
.product-name {
    width: 200px;
}
.extension-name {
    display: inline-block;
    width: 70px;
}

.item-name.depth1 { color: #72809C; }

.item-price {
    background: transparent;
    padding-left: 0;
    z-index: 2;
    color: #72809C;
}

.receipt-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
}

.receipt-total .label {
    font-size: 18px;
    font-weight: 700;
}

.receipt-total .price {
    font-size: 24px;
    font-weight: 800;
}

.receipt-notice {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-bottom: 52px;
}

.action-buttons {
    display: flex;
    gap: 6px;
}

.action-btn {
    flex: 1;
    padding: 18px 0;
    text-align: center;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none; /* 기본 테두리 제거 */
}

.btn-consult {
    background-color: var(--primary-color);
    color: white;
}

.btn-trial {
    background-color: #F4F6F9;
    color: var(--primary-color);
    border: 1px solid #E2E6ED;
}

.btn-pdf {
    background-color: #F4F6F9;
    color: var(--primary-color);
    border: 1px solid #E2E6ED;
}

/* ----------------------------------------
   확장형 옵션 아이템 (노무관리 드롭다운용)
---------------------------------------- */
.option-item-expandable {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

/* 체크 시 테두리 색상 변경 */
.option-item-expandable.active {
    border-color: var(--primary-color);
}

.option-item-expandable > input {
    display: none;
}

.option-item-expandable > label {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
}

.option-item-expandable > input:checked + label .custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.option-item-expandable > input:checked + label .custom-checkbox::after {
    display: block;
}

/* 드롭다운 하단 영역 */
.dropdown-area {
    padding: 0 16px 16px 46px; /* 좌측 텍스트 라인에 맞춤 */
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-dropdown {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 130px;
}

.btn-dropdown .arrow {
    font-size: 10px;
    color: #999;
}

/* 선택된 항목 표시 태그 */
.selected-values {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.selected-values span {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

/* 드롭다운 리스트 패널 */
.dropdown-panel {
    position: absolute;
    top: 42px; /* 버튼 바로 아래 위치 */
    left: 46px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    z-index: 10;
    width: 200px;
    padding: 8px 0;
}

.dropdown-opt input {
    display: none;
}

.dropdown-opt label {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.dropdown-opt label:hover {
    background-color: #f9f9f9;
}

.dropdown-opt input:checked + label .custom-checkbox {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.dropdown-opt input:checked + label .custom-checkbox::after {
    display: block;
}

/* 전체 화면을 덮는 오버레이 */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* 반투명 검은색 배경 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* 화면의 가장 위로 올림 */
    color: #ffffff;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
}

/* hidden 클래스가 있으면 화면에서 숨김 */
#loading-overlay.hidden {
    display: none;
}

/* 빙글빙글 도는 애니메이션 효과 */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #ffffff; /* 돌아가는 포인트 색상 */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 모바일 줄바꿈용 클래스 (기본은 숨김) */
.mobile-br {
    display: none;
}

@media (max-width: 768px) {
    .estimate-wrapper {
        padding: 0;
    }

    .estimate-container {
        border-radius: 0;
    }

    .question-title {
        display: block;
    }

    .dropdown-trigger {
        flex-direction: column;
        align-items: flex-start;
    }

    .receipt-table th:first-child,
    .product-name {
        width: 80px !important;
        min-width: 80px; /* 최소 너비 설정 */
        flex-shrink: 0; /* 너비가 줄어들지 않도록 설정 */
    }

    .receipt-total .price {
        text-align: right;
    }

    .action-buttons {
        flex-wrap: wrap;
    }

    .btn-consult {
        width: 100%;
        flex: 0 0 100%;
    }

    .btn-trial, .btn-pdf {
        flex: 1;
    }

    /* 모바일에서만 줄바꿈 보이게 설정 */
    .mobile-br {
        display: block;
    }

    /* 옵션 텍스트 줄바꿈 처리 */
    .opt-text-wrap {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        white-space: normal; /* 줄바꿈 허용 */
    }

    .opt-title {
        white-space: normal; /* 제목도 줄바꿈 허용 */
    }

    .opt-desc {
        white-space: normal; /* 설명도 줄바꿈 허용 */
        overflow: visible; /* 내용이 잘리지 않도록 설정 */
    }
}