/**
 * shared-header-kit/header-kit.css
 * 공용 표준 상단 헤더 컴포넌트 스타일시트 (v1.0)
 */

:root {
    --hk-bg: #ffffff;
    --hk-text: #111111;
    --hk-text-muted: #868e96;
    --hk-btn-bg: #f1f3f5;
    --hk-btn-hover: #e9ecef;
    --hk-btn-active: #dee2e6;
    --hk-border: #e9ecef;
    --hk-brand-orange: #ff7f00;
    --hk-wifi-online: #2563eb;
    --hk-wifi-offline: #ea580c;
    --hk-pro-green: #12b886;
}

html.dark {
    --hk-bg: #1e293b;
    --hk-text: #f8fafc;
    --hk-text-muted: #94a3b8;
    --hk-btn-bg: #334155;
    --hk-btn-hover: #475569;
    --hk-btn-active: #64748b;
    --hk-border: #334155;
    --hk-wifi-online: #60a5fa;
    --hk-wifi-offline: #fb923c;
}

/* 상단 헤더 래퍼 */
.top-header {
    background-color: var(--hk-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--hk-border);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-inner {
    max-width: 1380px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* 좌측 브랜드 (로고 + 반응형 타이틀) */
.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    min-width: 0;
    flex-shrink: 1;
}

.app-logo-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative !important;
    overflow: visible !important;
    flex-shrink: 0;
}

.app-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--hk-text);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-full { display: inline; }
.title-short { display: none; }

@media (max-width: 720px) {
    .title-full { display: none; }
    .title-short { display: inline; }
}

@media (max-width: 480px) {
    .header-inner { padding: 8px 10px; gap: 6px; }
    .brand-wrap { gap: 8px; }
    .app-logo-box { width: 42px; height: 42px; border-radius: 10px; }
    .brand-text h1 { font-size: 15px; }
    .header-actions { gap: 4px !important; }
    .hdr-btn, .hdr-btn-pro, .hdr-btn-net, #btnDarkMode, #btnManual {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        font-size: 11px !important;
    }
    .lang-btn {
        width: auto !important;
        height: 34px !important;
        min-width: 0 !important;
        padding: 0 6px !important;
        border-radius: 8px !important;
        gap: 3px !important;
    }
    .flag-icon-circle { width: 20px; height: 20px; }
}

/* 우측 일원화 액션 컨트롤 그룹 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 공통 헤더 버튼 및 뱃지 */
.hdr-btn {
    height: 38px;
    min-width: 38px;
    padding: 0 10px;
    border-radius: 10px;
    border: none;
    background-color: var(--hk-btn-bg);
    color: var(--hk-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    user-select: none;
    transition: background-color 0.15s ease, transform 0.1s ease, color 0.15s ease;
    box-sizing: border-box;
}

.hdr-btn:hover {
    background-color: var(--hk-btn-hover);
}

.hdr-btn:active {
    background-color: var(--hk-btn-active);
    transform: scale(0.97);
}

/* 1. 상단 버전 뱃지 숨김 (모바일 1줄 공간 확보 — 버전은 하단 푸터 및 매뉴얼에 표기) */
.hdr-btn-ver,
#appVersionBadge {
    display: none !important;
}

/* 2. Pro/Free 라이선스 뱃지 (정사각형 비율) */
.hdr-btn-pro {
    font-weight: 900;
    letter-spacing: -0.2px;
    cursor: pointer;
    width: 38px;
    height: 38px;
    padding: 0;
    text-align: center;
}

.hdr-btn-pro.is-pro {
    color: #ffffff;
    background-color: var(--hk-pro-green);
}

.hdr-btn-pro.is-trial {
    color: #ffffff;
    background-color: #f59f00;
}

.hdr-btn-pro.is-free {
    color: var(--hk-text);
    background-color: var(--hk-btn-bg);
}

/* 3. WiFi 통신 상태 뱃지 */
.hdr-btn-net {
    width: 38px;
    height: 38px;
    padding: 0;
    cursor: pointer;
}

.hdr-btn-net .wifi-svg {
    transition: color 0.2s ease;
}

.hdr-btn-net.online .wifi-svg {
    color: var(--hk-wifi-online);
}

.hdr-btn-net.offline .wifi-svg {
    color: var(--hk-wifi-offline);
}

/* 하단 푸터 좌측 ISKorea 메인페이지 이동 링크 + 우측 저작권 표준 레이아웃 */
.isk-footer-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
    flex-wrap: wrap;
}

.isk-home-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--hk-text, inherit);
    padding: 4px 11px 4px 5px;
    border-radius: 999px;
    border: 1px solid var(--hk-border, rgba(128, 128, 128, 0.24));
    background-color: var(--hk-btn-bg, rgba(128, 128, 128, 0.08));
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.isk-home-link:hover {
    border-color: var(--hk-brand-orange, #ff7f00);
    box-shadow: 0 2px 8px rgba(255, 127, 0, 0.18);
    transform: translateY(-1px);
}

.isk-home-link img {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
}

.isk-footer-right {
    text-align: right;
    margin-left: auto;
}

@media (max-width: 520px) {
    .isk-footer-bar {
        gap: 8px;
    }
    .isk-home-link {
        font-size: 11px;
        padding: 3px 9px 3px 4px;
    }
    .isk-home-link img {
        width: 20px;
        height: 20px;
    }
    .isk-footer-right {
        font-size: 11px;
    }
}

/* 4. 다크모드 토글 버튼 */
#btnDarkMode {
    width: 38px;
    height: 38px;
    padding: 0;
}

/* 5. 원형 국기 언어 선택 드롭다운 */
.lang-dropdown-wrap {
    position: relative;
    display: inline-block;
}

.lang-btn {
    padding: 0 8px;
    gap: 4px;
}

.flag-icon-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}

.flag-icon-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lang-caret {
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.lang-dropdown-wrap.open .lang-caret {
    transform: rotate(180deg);
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    background-color: var(--hk-bg);
    border: 1px solid var(--hk-border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 6px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lang-dropdown-menu.hidden {
    display: none !important;
}

.lang-item {
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--hk-text);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.12s ease;
}

.lang-item:hover {
    background-color: var(--hk-btn-bg);
}

.lang-item.active {
    background-color: var(--hk-btn-bg);
    color: var(--hk-brand-orange);
    font-weight: 800;
}

/* 6. 도움말 버튼 */
#btnManual {
    width: 38px;
    height: 38px;
    padding: 0;
}

/* 7. 하단 접이식 규격·공식 핵심 가이드 (검색엔진 본문 색인 및 현장 요약용) */
.isk-seo-guide {
    width: 100%;
    margin: 14px 0 8px 0;
    border: 1px solid var(--hk-border, rgba(128, 128, 128, 0.22));
    border-radius: 10px;
    background-color: var(--hk-bg, #ffffff);
    color: var(--hk-text, #111111);
    font-size: 12.5px;
    line-height: 1.65;
    overflow: hidden;
}

.isk-seo-guide > summary {
    list-style: none;
    cursor: pointer;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 800;
    color: var(--hk-text-muted, #64748b);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    user-select: none;
}

.isk-seo-guide > summary::-webkit-details-marker {
    display: none;
}

.isk-seo-guide > summary::after {
    content: "▼";
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.isk-seo-guide[open] > summary {
    border-bottom: 1px solid var(--hk-border, rgba(128, 128, 128, 0.2));
    color: var(--hk-text, #111111);
}

.isk-seo-guide[open] > summary::after {
    transform: rotate(180deg);
}

.isk-seo-body {
    padding: 12px 14px;
    font-size: 12px;
    color: var(--hk-text-muted, #64748b);
}

.isk-seo-body h2 {
    margin: 0 0 6px 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--hk-text, #111111);
}

.isk-seo-body p {
    margin: 0 0 8px 0;
}

.isk-seo-body ul {
    margin: 0 0 8px 0;
    padding-left: 18px;
}

.isk-seo-body li {
    margin-bottom: 4px;
}

.isk-seo-links {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--hk-border, rgba(128, 128, 128, 0.24));
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11.5px;
    font-weight: 700;
}

.isk-seo-links a {
    color: var(--hk-brand-orange, #ff7f00);
    text-decoration: none;
}

.isk-seo-links a:hover {
    text-decoration: underline;
}

@media print {
    .isk-seo-guide {
        display: none !important;
    }
}
