/* 1. 디자인 변수 설정 - 이 부분만 바꾸면 전체 색상이 바뀝니다 */
:root {
    --primary-color: #7b68ee;    /* 메인 보라색 */
    --secondary-color: #48d1cc;  /* 보조 민트색 */
    --bg-gradient: linear-gradient(180deg, #f9faff 0%, #e8e8f0 100%);
    --white: #ffffff;
    --text-blue: #1e3a8a;
    --reset-red: #ff5e5e;
    --border-color: #e0e0e0;
    --shadow: 0 8px 24px rgba(0,0,0,0.06);
}

/* 2. 기본 레이아웃 */
body {
    background: var(--bg-gradient);
    margin: 0;
    padding: 0;
    text-align: center;
    font-family: 'Noto Sans KR', sans-serif;
    min-height: 100vh;
    color: var(--text-blue);
    line-height: 1.6;
}

/* 3. 헤더 및 네비게이션 아이콘 */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content h1 {
    font-size: clamp(18px, 4vw, 22px);
    margin: 0;
    color: var(--white);
}

.header-content p {
    font-size: clamp(11px, 3vw, 14px);
    margin: 2px 0 0 0;
    opacity: 0.9;
}

.nav-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

/* 4. 메인 컨테이너 (계산기 몸체) */
.container {
    background: var(--white);
    width: 92%;
    max-width: 600px;
    padding: 25px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    margin: 15px auto;
    box-sizing: border-box;
    text-align: left;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    border-left: 5px solid var(--primary-color);
    padding-left: 12px;
}

/* 5. 입력 요소들 (input, select, radio) */
.input-group { margin-bottom: 20px; }
label { display: block; font-size: 14px; font-weight: bold; color: #444; margin-bottom: 8px; }

input, select {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    outline: none;
    background: #fafafa;
    box-sizing: border-box;
    transition: 0.2s;
}

input:focus { border-color: var(--primary-color); background: var(--white); }

.unit-display {
    margin-top: 5px;
    font-size: 0.85rem;
    color: #0078ff;
    font-weight: 700;
    min-height: 1.2rem;
}

/* 라디오 버튼 그룹 */
.radio-flex { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-item { flex: 1; min-width: 80px; }
.radio-item input { display: none; }
.radio-item label {
    display: block;
    padding: 10px;
    text-align: center;
    background: #f1f3f5;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    color: #777;
    font-weight: 600;
}
.radio-item input:checked + label {
    background: var(--primary-color);
    color: var(--white);
}

/* 6. 버튼 디자인 */
.btn-group { display: flex; gap: 10px; margin-top: 10px; }
button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    font-weight: bold;
    color: var(--white);
    border: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}
.calc-btn { background: #00cc88; border-bottom: 2px solid #00a870; }
.reset-btn { background: var(--reset-red); border-bottom: 2px solid #d94d4d; }

/* 7. 결과 영역 */
.result-box {
    margin-top: 30px;
    padding: 25px;
    border-radius: 20px;
    background: #fdfdff;
    border: 2px solid #eef0ff;
}
.res-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eaedf5;
}
.res-total { font-size: 1.4rem; color: var(--primary-color); font-weight: 800; }

/* 8. 햄버거 메뉴 및 하단 가이드 */
.side-menu {
    display: none;
    position: absolute;
    top: 60px;
    right: 5%;
    background: var(--white); /* 흰색 배경 */
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 240px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid #e0e0e0;
}

/* 메뉴 내부 아이템의 글자색을 명시적으로 지정 */
.menu-item {
    padding: 12px 20px;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    color: #333 !important; /* [핵심] 글자색을 진한 회색이나 검정으로 고정 */
    border-bottom: 1px solid #f9f9f9;
    background-color: var(--white); /* 배경색도 흰색으로 고정 */
}

/* 마우스를 올렸을 때(Hover) 스타일 */
.menu-item:hover {
    background: #f0edff;
    color: var(--primary-color) !important; /* 호버 시 보라색으로 변경 */
}

/* 섹터(카테고리) 제목 글자색도 확인 */
.menu-sector {
    background: #f8f9ff;
    padding: 8px 15px;
    font-size: 12px;
    font-weight: bold;
    color: #888; /* 섹터는 약간 흐린 회색 */
    border-bottom: 1px solid #f0f0f0;
}

.info-container {
    width: 92%;
    max-width: 600px;
    margin: 30px auto;
    padding: 25px;
    background: var(--white);
    border-radius: 20px;
    border: 1px solid #eef0f5;
    text-align: left;
}

.footer {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin: 30px 0 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* 메뉴의 최상단 타이틀 (계산기 목록) */
.menu-header {
    background: #f1f3f5; /* 연한 회색 배경 */
    padding: 15px;
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-color) !important; /* [핵심] 보라색 혹은 검정색으로 명시 */
    text-align: center;
    border-bottom: 2px solid #eee;
    display: block; /* 혹시 안 보일 경우를 대비해 영역 확보 */
}

/* 닫기 버튼도 안 보일 수 있으니 함께 수정 */
.menu-close {
    padding: 12px;
    background: #f8f9fa;
    color: #666 !important; /* 명시적으로 회색 지정 */
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    border-top: 1px solid #eee;
}

.other-calculators {
    margin-top: 25px;
    text-align: center;
}
.other-calculators a {
    text-decoration: none;
    color: #888;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
}
.other-calculators a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 9. 미디어 반응형 보강 */

/* 모바일 (화면 너비 480px 이하) */
@media (max-width: 480px) {
    .container {
        padding: 15px; /* 여백을 줄여 입력창을 더 넓게 확보 */
        width: 95%;
    }
    
    .header {
        padding: 8px 10px;
    }

    .btn-group {
        flex-direction: column; /* 버튼을 가로가 아닌 세로로 배치하여 터치하기 쉽게 함 */
    }

    .side-menu {
        width: 80%; /* 모바일에서는 메뉴가 화면의 80% 정도를 차지하도록 */
        right: 10%;
    }

    .res-row {
        flex-direction: column; /* 결과창 수치를 아래로 내려서 긴 금액도 안 잘리게 함 */
        align-items: flex-start;
    }
    
    .res-total {
        margin-top: 5px;
    }
}

/* 태블릿 (화면 너비 768px 이하) */
@media (max-width: 768px) {
    .side-menu {
        max-height: 70vh; /* 너무 길어지지 않게 조정 */
    }
}