/* ── 글꼴 플로어 (최소 14px, 60대 가독성) ── */
body { font-size: 14px; }
.text-xs,
.text-\[8px\], .text-\[9px\], .text-\[10px\], .text-\[11px\], .text-\[12px\], .text-\[13px\] {
    font-size: 14px !important;
}

/* ── 스크롤바 ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f1117; }
::-webkit-scrollbar-thumb { background: #2a2d35; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3d45; }

/* ── 필터 탭 pill ── */
.src-tab {
    display: inline-block;
    border: 1px solid transparent;
    color: #6b7280;
    background: transparent;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.src-tab:hover { color: #fff; background: rgba(31,41,55,0.8); }
.src-tab.active { border-color: #3498db; color: #3498db; background: rgba(52,152,219,0.1); }

/* ── 기본 레이아웃 (데스크톱) ── */
.g-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── 컨테이너 중앙 정렬 (좌우 균등 축소) ── */
#dashboardContent {
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════
   반응형 브레이크포인트 (디자인팀 기준, 데스크톱 퍼스트)
   ═══════════════════════════════════════════════════ */

/* ── 1600px ── */
@media (max-width: 1600px) {
    /* 카드 내부 패딩 소폭 축소 */
    .card-section { padding: 16px !important; }
}

/* ── 1440px ── */
@media (max-width: 1440px) {
    .card-section { padding: 14px !important; }
    .sov-stats .text-2xl { font-size: 20px !important; }
    .sov-stats .text-xl { font-size: 16px !important; }
    #dashboardContent { padding-left:24px !important; padding-right:24px !important; }
}

/* ── 1280px ── */
@media (max-width: 1280px) {
    #dashboardContent { padding-left:20px !important; padding-right:20px !important; }
    .card-section { padding: 14px !important; }
    .card-section.collapsed { padding: 10px 12px !important; }

    #recentPanel  { height: auto !important; min-height: 200px; }
    #keywordPanel { height: auto !important; min-height: 150px; }

    #chartMention,
    #chartSentiment { height: 280px !important; }

    /* SOV 반응형 — 바 숨김, 수치 컴팩트 */
    .sov-bar { display: none !important; }
    .sov-row { flex-wrap: wrap; gap: 0.5rem; }
    .sov-stats {
        flex: none !important;
        width: 100% !important;
        justify-content: flex-end !important;
        gap: 12px !important;
    }
    .sov-stats > div,
    .sov-stats > span { width: auto !important; text-align: right !important; }
    .sov-stats > div { width: auto !important; }
    .sov-row .w-32 { width: 70px !important; }
    .sov-row .w-32 .text-lg, .sov-row .w-32 .text-base { font-size: 14px !important; }
    .sov-stats .text-2xl { font-size: 18px !important; }
    .sov-stats .text-xl { font-size: 15px !important; }
    .sov-stats .text-lg { font-size: 14px !important; }

    /* 감성 분석 도넛 + 바 수직 배치 */
    .sentiment-content { flex-direction: column !important; gap: 12px !important; }
    .sentiment-content > div:first-child { width: 120px !important; height: 120px !important; }
    .sentiment-content > div:last-child { min-width: 0 !important; }
}

/* ── 1024px ── */
@media (max-width: 1024px) {
    .g-kpi { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    #dashboardContent { padding-left:16px !important; padding-right:16px !important; }

    /* 카드 그리드 2열 유지 (768px에서 1열 전환) */
    .cards-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem; }

    /* 헤더 축소 */
    header .mx-auto { gap: 4px; }

    /* 필터 탭 축소 */
    .src-tab { padding: 4px 10px; font-size: 14px; }

    /* 패널 패딩 */
    #recentPanel  { padding: 10px !important; }
    #keywordPanel { padding: 10px !important; }
}

/* ── 768px ── */
@media (max-width: 768px) {
    /* 카드 그리드 1열 전환 */
    .cards-grid { grid-template-columns: 1fr !important; }
    #dashboardContent { padding-left:10px !important; padding-right:10px !important; }
    .g-kpi { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .g-kpi > div { padding: 12px !important; height: 130px !important; }
    .g-kpi > div .text-\[48px\] { font-size: 36px !important; }
    .g-kpi > div .text-\[34px\] { font-size: 26px !important; }
    .g-kpi > div .text-\[28px\] { font-size: 22px !important; }
    .g-kpi > div .text-\[15px\] { font-size: 14px !important; }

    .card-section { padding: 12px !important; }
    .card-section.collapsed { padding: 8px 10px !important; }

    /* 차트 높이 축소 */
    #mentionTrendChart { height: 160px !important; }

    /* 감성 도넛 축소 */
    .sentiment-content > div:first-child { width: 100px !important; height: 100px !important; }

    /* 헤더 줄바꿈 */
    header { flex-wrap: wrap; }

    /* KPI 1열 전환 */
    .g-kpi { grid-template-columns: 1fr; }
    .g-kpi > div { height: 110px !important; }

    /* 헤더 구분선 숨김 */
    header .h-6.w-px { display: none !important; }
    header .mx-auto { gap: 4px !important; }

    /* 헤더 버튼 축소 */
    header button[data-region],
    header button[data-id] {
        font-size: 14px !important;
        padding: 4px 8px !important;
    }

    /* 모드 스위치 축소 */
    #modeSwitchWrap { height: 36px !important; }
    #modeChartBtn,
    #modeAiBtn { padding: 0 12px !important; font-size: 14px !important; }

    /* AI 모드 라벨/변경사항/가이드 숨김 */
    #modeSwitchLabel { display: none !important; }
    header a[href*="changelog"] { display: none !important; }
    header a[title*="가이드"] { display: none !important; }

    /* 일정 버튼 아이콘만 */
    #schedHistHeaderBtn { font-size: 0 !important; padding: 6px 8px !important; }
    #schedHistHeaderBtn svg { width: 18px !important; height: 18px !important; }

    /* SOV 추가 축소 */
    .sov-row .w-32 { width: 56px !important; }
    .sov-stats .text-2xl { font-size: 15px !important; }

    /* 감성 도넛 축소 */
    .sentiment-content > div:first-child { width: 80px !important; height: 80px !important; }

    /* 지역 카드 그리드 */
    .region-cards-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; }

    /* 텍스트 오버플로우 방지 */
    .card-section { overflow-wrap: break-word; word-break: break-word; }
    .recent-item a, .today-item a { word-break: break-all; }

    /* 최근자료/키워드 패딩 축소 */
    #recentPanel  { padding: 8px !important; }
    #keywordPanel { padding: 8px !important; }
    .src-tab { padding: 3px 8px; font-size: 14px; }

    /* 테이블 가로 스크롤 */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── 360px (초소형 모바일) ── */
@media (max-width: 360px) {
    .g-kpi > div { height: 95px !important; padding: 10px !important; }
    .g-kpi > div .text-\[48px\] { font-size: 28px !important; }
    .g-kpi > div .text-\[34px\] { font-size: 22px !important; }
    .g-kpi > div .text-\[28px\] { font-size: 18px !important; }

    .card-section { padding: 10px !important; }

    /* 지역 카드 1열 */
    .region-cards-grid { grid-template-columns: 1fr !important; }

    /* 차트 높이 추가 축소 */
    #mentionTrendChart { height: 120px !important; }
}
