/* =============================================
   한꼬마 (hancoma.com) - 커스텀 스타일
   Bootstrap 5 기반
   ============================================= */

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --secondary: #5f6368;
    --success: #34a853;
    --bg-light: #f8f9fa;
    --border-color: #e8eaed;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.1);
}

/* Core Web Vitals: CLS 방지 - 레이아웃 시프트 최소화 */
img, video { height: auto; }
* { box-sizing: border-box; }

/* 기본 */
body {
    font-family: 'Apple SD Gothic Neo', 'Malgun Gothic', '맑은 고딕', sans-serif;
    color: #333;
    background: #fff;
    line-height: 1.7;
    /* 폰트 렌더링 최적화 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* 헤더 */
.top-bar { font-size: .8rem; }
.main-header { border-bottom: 1px solid var(--border-color); z-index: 1000; }
.navbar-brand { font-size: 1.4rem; letter-spacing: -.5px; }
.header-search { width: 220px; border-radius: 20px 0 0 20px; font-size: .9rem; }
.header-search:focus { width: 280px; transition: width .3s; }

/* 히어로 영역 (메인) */
.hero-section {
    background: linear-gradient(135deg, #1a3c6e 0%, #1a73e8 100%);
    padding: 80px 0;
    color: #fff;
}
.hero-section h1 { font-size: 2.2rem; font-weight: 700; }
.hero-section .lead { font-size: 1.1rem; opacity: .85; }
.hero-search .form-control {
    border-radius: 30px 0 0 30px;
    padding: 14px 24px;
    font-size: 1rem;
    border: none;
    box-shadow: none;
}
.hero-search .btn {
    border-radius: 0 30px 30px 0;
    padding: 14px 28px;
    font-size: 1rem;
}

/* 통계 카드 */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -.5px;
}

/* 자격증 유형 배지 — 전역 (search·cert 공통) */
.cert-type-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    line-height: 1.4;
    white-space: nowrap;
}

/* 자격증 메타 정보 — 전역 */
.cert-meta {
    font-size: .82rem;
    color: var(--secondary);
}

/* 자격증 카드 (index·department 그리드용) */
.cert-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: box-shadow .2s, border-color .2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.cert-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: inherit;
}
.cert-card .cert-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

/* 검색 결과 리스트 컨테이너 */
.cert-list {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

/* 검색 결과 개별 아이템 */
.search-result-item {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    transition: background .15s;
    background: #fff;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f8f9fa; }
.search-result-item .cert-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}
.search-result-item .cert-title:hover { text-decoration: underline; }

/* 검색 유형 탭 */
.search-type-nav .btn {
    font-size: .85rem;
    border-radius: 20px;
    padding: 5px 14px;
}

/* 검색 결과 없음 */
.search-empty {
    padding: 60px 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
}
.search-empty .empty-icon {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 16px;
}
.search-empty p { color: var(--secondary); }

/* 자격 상세 - 히어로 */
.cert-hero {
    background: linear-gradient(135deg, #1a3c6e 0%, #1a73e8 100%);
    border-radius: 16px;
    padding: 36px 40px;
    color: #fff;
}
.cert-hero-title {
    color: #fff;
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.3;
    word-break: keep-all;
}
.cert-hero-meta { color: rgba(255,255,255,.8); font-size: .9rem; }
.cert-hero-meta a { color: rgba(255,255,255,.95); text-decoration: none; }
.cert-hero-meta a:hover { color: #fff; text-decoration: underline; }

/* 핵심 정보 카드 */
.kf-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 16px;
    height: 100%;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}
.kf-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.kf-label {
    font-size: .68rem;
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}
.kf-value {
    font-size: .9rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.5;
    word-break: keep-all;
    min-width: 0;
}
.kf-value a { color: var(--primary); text-decoration: none; }
.kf-value a:hover { text-decoration: underline; }

/* 상세 정보 테이블 */
.info-table th {
    width: 130px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: .88rem;
    color: var(--secondary);
    vertical-align: middle;
    border-right: 2px solid var(--border-color);
}
.info-table td { vertical-align: middle; }
.hover-bg-light:hover { background: #f8f9fa; }

/* 사이드바 */
.sidebar-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}
.sidebar-card .card-header {
    background: #f8f9fa;
    font-weight: 600;
    font-size: .9rem;
}

/* 부처 태그 */
.dept-badge {
    display: inline-block;
    background: #e8f0fe;
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .82rem;
    text-decoration: none;
}
.dept-badge:hover {
    background: var(--primary);
    color: #fff;
}

/* 섹션 제목 */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a1a;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 20px;
}

/* 풋터 */
.main-footer { font-size: .88rem; }
.main-footer a.text-white-50 { text-decoration: none; transition: color .15s; }
.main-footer a.text-white-50:hover { color: #fff !important; }

/* 자동완성 드롭다운 */
.autocomplete-wrap { position: relative; }
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow-md);
    z-index: 1100;
    max-height: 340px;
    overflow-y: auto;
}
.autocomplete-item {
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: .88rem;
    transition: background .1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover,
.autocomplete-item.ac-active { background: #f0f4ff; }
.autocomplete-item mark { background: #fff3cd; padding: 0 1px; border-radius: 2px; }

/* 페이지네이션 */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    color: var(--primary);
}
.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* 테이블 */
.table-hover > tbody > tr:hover { background: #f0f4ff; }

/* 반응형 */
@media (max-width: 768px) {
    .hero-section { padding: 48px 0; }
    .hero-section h1 { font-size: 1.6rem; }
    .header-search { width: 160px; }
    .header-search:focus { width: 160px; }
    .cert-hero { padding: 24px 20px; }
    .cert-hero-title { font-size: 1.4rem; }
    .info-table th { width: 90px; font-size: .82rem; }
    .kf-card { padding: 14px 12px; gap: 10px; }
    .kf-icon { width: 36px; height: 36px; font-size: 1rem; }
}

/* 유틸 */
.text-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bg-gradient-primary {
    background: linear-gradient(135deg, #1a3c6e, #1a73e8);
}
.rounded-xl { border-radius: 12px; }
.shadow-hover { transition: box-shadow .2s; }
.shadow-hover:hover { box-shadow: var(--shadow-md); }
