/* --- Green Hearing V2 공통 스타일 --- */
:root {
    --primary: #3498db; 
    --secondary: #2c3e50; 
    --accent: #f1c40f;
    --text: #333; 
    --bg: #f5f6fa; 
    --white: #ffffff;
    --border: #e0e0e0;
}

/* 1. 기본 스타일 & 어르신 최적화 (글자 확대) */
body, p, span, div, li, td, th { 
    font-family: 'Pretendard', sans-serif; 
    font-size: 17px; /* 가독성을 위해 17px로 상향 */
    line-height: 1.6; 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
}

body { 
    background: var(--bg); 
    padding-top: 60px; /* GNB(상단바) 높이만큼 여백 확보 */ 
}

/* 이미지 반응형 처리 (엑박 방지 레이아웃 보호) */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- 2. GNB (Global Navigation Bar - 상단 메뉴) --- */
.gnb {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 60px;
    background: var(--white); 
    border-bottom: 1px solid var(--border);
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 20px; 
    box-sizing: border-box; 
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.gnb-logo { 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: var(--secondary); 
    text-decoration: none; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.gnb-menu { display: flex; gap: 20px; }

.gnb-item { 
    text-decoration: none; 
    color: #555; 
    font-weight: 600; 
    font-size: 1rem; 
    transition: 0.2s; 
}

.gnb-item:hover, .gnb-item.active { color: var(--primary); }

.gnb-item.pro { 
    color: var(--primary); 
    background: #e3f2fd; 
    padding: 6px 14px; 
    border-radius: 20px; 
}

/* --- 3. UI 요소 (버튼, 입력창 - 터치 영역 확대) --- */
button, .btn { 
    padding: 0 20px; /* 높이는 height로 제어 */
    height: 48px; /* 손가락 터치 최소 높이 확보 */
    font-size: 1.05rem; 
    border-radius: 8px; 
    cursor: pointer; 
    border: none; 
    font-weight: bold; 
    transition: 0.2s; 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    justify-content: center; 
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #2980b9; }
.btn-secondary { background: white; border: 1px solid var(--border); color: #555; }

input, select, textarea { 
    padding: 10px; 
    font-size: 1rem; 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    width: 100%; 
    height: 48px; /* 입력창도 터치하기 편하게 */
    box-sizing: border-box; 
    outline: none; 
    background: white;
}

input:focus, select:focus { border-color: var(--primary); }

/* --- 4. 반응형 테이블 (PC: 표 / Mobile: 카드) --- */
table { 
    width: 100%; 
    border-collapse: collapse; 
    background: white; 
    border-radius: 8px; 
    overflow: hidden; 
}

th { 
    background: #f8f9fa; 
    text-align: left; 
    padding: 12px 15px; 
    font-weight: bold; 
    color: #555; 
    border-bottom: 2px solid var(--border); 
}

td { 
    padding: 12px 15px; 
    border-bottom: 1px solid #eee; 
}

/* --- 5. 모바일 전용 스타일 (768px 이하) --- */
@media (max-width: 768px) {
    /* 레이아웃 깨짐 방지 */
    .gnb { padding: 0 15px; }
    .gnb-menu { display: none; } /* 모바일 메뉴는 추후 추가 예정 */
    
    .container, .workspace, .layout { 
        padding: 15px !important; 
        width: 100% !important; 
        display: block !important; 
    }
    
    .sidebar { 
        width: 100% !important; 
        margin-bottom: 20px; 
        display: none; /* 모바일에서 사이드바 일단 숨김 */ 
    }
    
    /* 폰트 사이즈 조정 */
    h1 { font-size: 1.6rem !important; }
    
    /* 테이블을 카드 형태로 변환 (핵심) */
    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    
    tr { 
        border: 1px solid var(--border); 
        border-radius: 8px; 
        margin-bottom: 15px; 
        background: white; 
        padding: 15px; 
        box-shadow: 0 2px 5px rgba(0,0,0,0.03); 
    }
    
    td { 
        border: none; 
        padding: 8px 0; 
        position: relative; 
        padding-left: 0; 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        border-bottom: 1px solid #f5f5f5;
    }
    
    td:last-child { border-bottom: none; }
    
    /* data-label 속성을 이용해 항목 이름 표시 */
    td:before { 
        content: attr(data-label); 
        font-weight: bold; 
        color: #888; 
        font-size: 0.9rem; 
        margin-right: 10px; 
    }
    
    /* 그리드 레이아웃 1열로 변경 */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
    .audi-layout { flex-direction: column; }
    .history-panel { width: 100% !important; height: auto !important; margin-bottom: 20px; }
    .result-panel { width: 100% !important; }
}

/* 6. 유틸리티 */
.hidden { display: none !important; }
.text-red { color: #e74c3c; }
.text-blue { color: #3498db; }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; }
.bg-new { background: #e3f2fd; color: #2196f3; }
.bg-wait { background: #fff3e0; color: #ff9800; }