/* 기본 리셋 및 폰트 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Pretendard', -apple-system, sans-serif;
    background-color: #e6f0fa;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    color: #2c3e50;
}

/* 신뢰를 주는 밝은 파란색 계열 바탕 */

#app-container {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

/* 화면 전환용 클래스 */
.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    height: 100vh;
}

.screen.active {
    display: flex;
}

/* 공통 상단 네비게이션바 */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}

.nav-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
}

/* 1. 입력 폼 스타일 */
.form-wrapper {
    padding: 30px 24px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 28px;
}

.form-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 12px;
}

.help-text {
    font-size: 13px;
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
}

.help-icon {
    color: #3b82f6;
    font-size: 14px;
    margin-left: 2px;
    cursor: pointer;
}

/* 이름 등 일반 인풋 */
#userName {
    width: 100%;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: 0.2s;
    color: #1e293b;
    background: #f8fafc;
}

#userName:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 성별 토글 버튼 (파란색 계열) */
.toggle-group {
    display: flex;
    gap: 0;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 14px;
}

.toggle-btn {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: 0.2s;
    border-radius: 10px;
}

.toggle-btn.active {
    color: #2563eb;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* 생년월일시 (자연스러운 박스형 입력폼) */
.date-time-box {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    margin-bottom: 12px;
}

.dt-row {
    display: flex;
    align-items: center;
    padding: 12px 18px;
}

.dt-label {
    width: 60px;
    font-size: 14px;
    color: #64748b;
    font-weight: 600;
}

.clean-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    color: #1e293b;
    background: transparent;
}

.dt-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0 18px;
}

/* 체크박스 그룹 */
.checkbox-row {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #475569;
    padding-left: 5px;
    margin-top: 15px;
}

.checkbox-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
    cursor: pointer;
}

/* 하단 큰 버튼들 */
.bottom-btns {
    margin-top: auto;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.primary-btn {
    width: 100%;
    padding: 18px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.primary-btn:hover {
    background: #2563eb;
}


/* 2. 결과 화면 스타일 */
.result-wrapper {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

/* 프로필 요약 */
.profile-summary {
    padding: 25px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 6px solid #f8fafc;
}

.profile-avatar {
    font-size: 32px;
    background: #e0f2fe;
    color: #0284c7;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-info h2 {
    font-size: 19px;
    font-weight: 800;
    margin-bottom: 6px;
    color: #1e293b;
}

.res-desc {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

/* 정교한 만세력 표 */
.manseoryok-board {
    padding: 25px 20px;
}

.m-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    table-layout: fixed;
}

.m-table th {
    padding: 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    background: #f8fafc;
}

.m-table td {
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    text-align: center;
    padding: 10px 4px;
}

.m-table td.label {
    width: 45px;
    background: #f8fafc;
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

.hanja-row td:not(.label) {
    font-size: 26px;
    font-weight: 900;
    padding: 20px 0;
    position: relative;
    color: #1e293b;
}

.hanja-row td span {
    font-size: 22px;
    margin-left: 2px;
}

.element-tag {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 11px;
    font-weight: 700;
}

/* 오행 색상 (텍스트) - 신뢰감 있는 톤 조정 */
.wood {
    color: #059669;
}

.fire {
    color: #dc2626;
}

.earth {
    color: #b45309;
}

.metal {
    color: #475569;
}

.water {
    color: #2563eb;
}

/* 오행 색상 (배경) */
.wood-bg {
    color: #059669;
    background: #ecfdf5;
    font-size: 12px;
    font-weight: 600;
}

.fire-bg {
    color: #dc2626;
    background: #fef2f2;
    font-size: 12px;
    font-weight: 600;
}

.earth-bg {
    color: #b45309;
    background: #fffbeb;
    font-size: 12px;
    font-weight: 600;
}

.metal-bg {
    color: #475569;
    background: #f1f5f9;
    font-size: 12px;
    font-weight: 600;
}

.water-bg {
    color: #2563eb;
    background: #eff6ff;
    font-size: 12px;
    font-weight: 600;
}

/* 하단 세부 정보 행 */
.detail-row td:not(.label) {
    font-size: 12px;
    color: #64748b;
    padding: 10px 0;
    font-weight: 500;
}

/* 챗봇 (풀이 자세히 보기) 영역 */
.chat-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.chat-header-bar {
    background: #334155;
    color: #fff;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

.chat-box {
    flex: 1;
    min-height: 250px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    max-width: 85%;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bubble {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.5;
    color: #1e293b;
}

.bot .bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.user .bubble {
    background: #bfdbfe;
    color: #1e3a8a;
    border-top-right-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

.chat-input-area input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    outline: none;
    font-size: 15px;
    background: #f8fafc;
    transition: 0.2s;
}

.chat-input-area input:focus {
    border-color: #3b82f6;
    background: #fff;
}

.chat-input-area button {
    padding: 0 24px;
    border-radius: 24px;
    background: #3b82f6;
    color: white;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    font-size: 15px;
}

.chat-input-area button:hover {
    background: #2563eb;
}


/* 모달 스타일 */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #fff;
    width: 85%;
    max-width: 350px;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: popUp 0.3s ease-out;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 16px;
}

.modal-body {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 24px;
    max-height: 300px;
    overflow-y: auto;
}

.modal-close-btn {
    width: 100%;
    padding: 14px;
    background: #3b82f6;
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
}

.modal-close-btn:hover {
    background: #2563eb;
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}