/* ==========================================================================
   BOK EOK 경제지표 대시보드 - 전용 스타일시트
   ========================================================================== */

/* 1. 상단 하이라이트 카드 (가로 스와이프 지원) */
.time-highlight-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.time-hl-card {
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    padding: 18px 20px;
    box-shadow: var(--m-shadow);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 110px;
    text-decoration: none !important;
}

.time-hl-card:hover {
    transform: translateY(-2px);
    border-color: var(--m-primary);
    box-shadow: var(--m-shadow-md);
}

.time-hl-title {
    font-size: var(--m-text-sm);
    color: var(--m-text-soft);
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-hl-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
}

.time-hl-value {
    font-size: var(--m-text-xl);
    font-weight: 800;
    color: var(--m-text);
    font-family: 'Pretendard Variable', sans-serif;
    letter-spacing: -0.02em;
}

.time-hl-unit {
    font-size: var(--m-text-xs);
    font-weight: 500;
    color: var(--m-text-faint);
    margin-left: 2px;
}

.time-hl-change {
    font-size: var(--m-text-xs);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--m-radius-sm);
    font-family: monospace;
}

/* 변동 방향 배지 색상 */
.time-change-up {
    background-color: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}
.time-change-down {
    background-color: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
}
.time-change-stable {
    background-color: rgba(148, 163, 184, 0.08);
    color: #64748b;
}

.time-hl-date {
    font-size: 10px;
    color: var(--m-text-faint);
    margin-top: 8px;
    text-align: right;
}

/* 2. 대시보드 구조 분할 */
.time-dashboard-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 30px;
}

/* 3. 좌측: 지표 탐색기 */
.time-explorer-card {
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    box-shadow: var(--m-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 680px;
    overflow: hidden;
}

.time-search-box-wrap {
    position: relative;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.time-search-input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    font-size: var(--m-text-base);
    background: var(--m-surface-2);
    color: var(--m-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.time-search-input:focus {
    border-color: var(--m-primary);
    box-shadow: 0 0 0 3px var(--m-primary-soft);
    background: var(--m-surface);
}

.time-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--m-text-faint);
    pointer-events: none;
    display: flex;
    align-items: center;
}

/* 카테고리 탭 (가로 스크롤 가능) */
.time-cat-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--m-border);
    scrollbar-width: none; /* Firefox */
    flex-shrink: 0;
}

.time-cat-tabs::-webkit-scrollbar {
    display: none; /* Safari, Chrome */
}

.time-cat-tab {
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: var(--m-text-xs);
    font-weight: 600;
    color: var(--m-text-soft);
    background: var(--m-surface-2);
    border: 1px solid transparent;
    border-radius: var(--m-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.time-cat-tab:hover {
    color: var(--m-text);
    background: var(--m-border);
}

.time-cat-tab.is-active {
    color: white;
    background: var(--m-primary);
    border-color: var(--m-primary);
}

/* 지표 리스트 스크롤 영역 */
.time-indicator-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

/* 리스트 커스텀 스크롤바 */
.time-indicator-list::-webkit-scrollbar {
    width: 6px;
}
.time-indicator-list::-webkit-scrollbar-track {
    background: transparent;
}
.time-indicator-list::-webkit-scrollbar-thumb {
    background: var(--m-border);
    border-radius: 4px;
}
.time-indicator-list::-webkit-scrollbar-thumb:hover {
    background: var(--m-text-faint);
}

.time-ind-item {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    border-radius: var(--m-radius);
    border: 1px solid transparent;
    text-decoration: none !important;
    background: transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.time-ind-item:hover {
    background: var(--m-surface-2);
}

.time-ind-item.is-active {
    background: var(--m-primary-soft);
    border-color: rgba(79, 70, 229, 0.2);
}

.time-ind-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.time-ind-class {
    font-size: 10px;
    font-weight: 700;
    color: var(--m-primary);
    text-transform: uppercase;
}

.time-ind-cycle-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--m-surface-2);
    color: var(--m-text-soft);
}

.time-ind-item.is-active .time-ind-cycle-badge {
    background: rgba(79, 70, 229, 0.15);
    color: var(--m-primary);
}

.time-ind-name {
    font-size: var(--m-text-base);
    font-weight: 600;
    color: var(--m-text);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-ind-value-summary {
    font-size: var(--m-text-xs);
    font-weight: 500;
    color: var(--m-text-soft);
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
}

.time-ind-value-summary-val {
    font-weight: 700;
    color: var(--m-text);
    font-family: monospace;
}

/* 4. 우측: 분석 패널 */
.time-analysis-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.time-main-card {
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    box-shadow: var(--m-shadow);
    padding: 24px;
}

.time-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-b: 1px solid var(--m-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.time-analysis-title-group h2 {
    font-size: var(--m-text-xl);
    font-weight: 800;
    color: var(--m-text);
    margin-bottom: 4px;
}

.time-analysis-subtitle {
    font-size: var(--m-text-sm);
    color: var(--m-text-faint);
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-analysis-cycle-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    background: var(--m-surface-2);
    color: var(--m-text-soft);
}

.time-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.time-summary-cell {
    background: var(--m-surface-2);
    border-radius: var(--m-radius);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.time-summary-label {
    font-size: var(--m-text-xs);
    color: var(--m-text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.time-summary-value {
    font-size: var(--m-text-lg);
    font-weight: 800;
    color: var(--m-text);
    font-family: 'Pretendard Variable', monospace;
}

.time-summary-value em {
    font-size: var(--m-text-sm);
    font-weight: 500;
    color: var(--m-text-faint);
    font-style: normal;
    margin-left: 2px;
}

.time-chart-container {
    position: relative;
    width: 100%;
    height: 380px;
    margin-bottom: 12px;
}

/* 5. 역사 데이터 테이블 */
.time-table-section-title {
    font-size: var(--m-text-base);
    font-weight: 700;
    color: var(--m-text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.time-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    background: var(--m-surface);
}

.time-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--m-text-sm);
    text-align: left;
}

.time-data-table th {
    background: var(--m-surface-2);
    font-weight: 700;
    color: var(--m-text-soft);
    padding: 10px 14px;
    border-bottom: 1px solid var(--m-border);
    font-size: var(--m-text-xs);
}

.time-data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--m-border);
    color: var(--m-text);
}

.time-data-table tr:last-child td {
    border-bottom: 0;
}

.time-data-table tr:hover td {
    background: rgba(79, 70, 229, 0.02);
}

.time-table-date {
    font-family: monospace;
    font-weight: 600;
}

.time-table-value {
    font-family: monospace;
    font-weight: 700;
}

.time-table-change {
    font-family: monospace;
    font-weight: 600;
}

/* 6. 모바일 탭 디자인 */
.time-mobile-tabs {
    display: none;
    border-bottom: 1px solid var(--m-border);
    margin-bottom: 20px;
    position: sticky;
    top: 57px; /* modern 헤더 네비게이션 아래 밀림 방지 */
    background: var(--m-bg);
    z-index: 5;
    padding-top: 4px;
}

.time-mobile-tab {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
    font-size: var(--m-text-base);
    font-weight: 700;
    color: var(--m-text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-mobile-tab.is-active {
    color: var(--m-primary);
    border-bottom-color: var(--m-primary);
}

/* 7. 다크모드 대응 보정 */
[data-theme="dark"] .time-hl-card {
    background: var(--m-surface);
    border-color: var(--m-border);
}

[data-theme="dark"] .time-change-up {
    background-color: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .time-change-down {
    background-color: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .time-change-stable {
    background-color: rgba(148, 163, 184, 0.15);
}

/* 8. 반응형 미디어 쿼리 */
@media (max-width: 880px) {
    .time-dashboard-body {
        grid-template-columns: 100%;
    }

    /* 상단 하이라이트 모바일 그리드 레이아웃 */
    .time-highlight-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }
    
    .time-hl-card {
        min-height: auto;
        padding: 14px 16px;
    }
    
    .time-hl-value {
        font-size: var(--m-text-lg);
    }

    .time-highlight-row .time-hl-card:last-child {
        grid-column: span 2;
    }

    @media (max-width: 480px) {
        .time-highlight-row {
            grid-template-columns: 1fr;
        }
        .time-highlight-row .time-hl-card:last-child {
            grid-column: span 1;
        }
    }
    
    /* 모바일 탭 제어 활성화 */
    .time-mobile-tabs {
        display: flex;
    }
    
    .time-explorer-card {
        height: 520px;
    }
    
    /* 화면 전환 제어를 위해 클래스 기반으로 토글 */
    .time-mobile-hide {
        display: none !important;
    }
    
    .time-chart-container {
        height: 240px;
    }
}

/* ==========================================================================
   대시보드 메인 스위처 및 뉴스 전용 CSS
   ========================================================================== */

/* 1. 상단 한국은행 통계 <-> 실시간 경제 뉴스 대전환 탭 */
.time-main-switcher {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--m-border);
}

.time-switcher-tab {
    padding: 10px 4px;
    font-size: var(--m-text-lg);
    font-weight: 800;
    color: var(--m-text-muted);
    text-decoration: none !important;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.time-switcher-tab:hover {
    color: var(--m-text);
}

.time-switcher-tab.is-active {
    color: var(--m-primary);
    border-bottom-color: var(--m-primary);
}

/* 2. 뉴스 카테고리 필터링 뱃지 바 */
.time-news-filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 20px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.time-news-filter-bar::-webkit-scrollbar {
    display: none;
}

.time-news-filter-pill {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: var(--m-text-sm);
    font-weight: 700;
    color: var(--m-text-soft);
    background: var(--m-surface-2);
    border: 1px solid var(--m-border);
    border-radius: 9999px;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.time-news-filter-pill:hover {
    color: var(--m-text);
    background: var(--m-border);
}

.time-news-filter-pill.is-active {
    color: white;
    background: var(--m-primary);
    border-color: var(--m-primary);
    box-shadow: 0 2px 8px var(--m-primary-soft);
}

/* 3. 뉴스 카드 컨테이너 (PC에서는 2열 배치) */
.time-news-list-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.time-news-card {
    background: var(--m-surface);
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-lg);
    box-shadow: var(--m-shadow);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    min-height: 200px;
}

.time-news-card:hover {
    transform: translateY(-2px);
    border-color: var(--m-primary);
    box-shadow: var(--m-shadow-md);
}

.time-news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.time-news-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* 뉴스 키워드별 고유 컬러 뱃지 */
.badge-general { background-color: rgba(148, 163, 184, 0.08); color: #64748b; }
.badge-estate { background-color: rgba(245, 158, 11, 0.08); color: #d97706; }
.badge-rates { background-color: rgba(59, 130, 246, 0.08); color: #2563eb; }
.badge-stock { background-color: rgba(239, 68, 68, 0.08); color: #dc2626; }
.badge-macro { background-color: rgba(139, 92, 246, 0.08); color: #7c3aed; }
.badge-crypto { background-color: rgba(16, 185, 129, 0.08); color: #059669; }

.time-news-time {
    font-size: var(--m-text-xs);
    color: var(--m-text-faint);
    font-weight: 500;
}

.time-news-title {
    font-size: var(--m-text-md);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

.time-news-title a {
    color: var(--m-text) !important;
    text-decoration: none !important;
    transition: color 0.15s ease;
}

.time-news-title a:hover {
    color: var(--m-primary) !important;
}

.time-news-desc {
    font-size: var(--m-text-sm);
    color: var(--m-text-soft);
    line-height: 1.6;
    margin-bottom: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.time-news-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--m-border);
    padding-top: 12px;
    margin-top: auto;
}

.time-news-source {
    font-size: var(--m-text-xs);
    color: var(--m-text-faint);
    font-weight: 600;
}

.time-news-links {
    display: flex;
    gap: 8px;
}

.time-news-link-btn {
    font-size: var(--m-text-xs);
    font-weight: 700;
    color: var(--m-text-soft);
    text-decoration: none !important;
    padding: 4px 10px;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-sm);
    background: var(--m-surface-2);
    transition: all 0.15s ease;
}

.time-news-link-btn:hover {
    background: var(--m-border);
    color: var(--m-text);
}

.time-news-link-btn.primary-link {
    background: var(--m-primary);
    color: white !important;
    border-color: var(--m-primary);
}

.time-news-link-btn.primary-link:hover {
    opacity: 0.9;
}

/* 4. 다크모드 대응 */
[data-theme="dark"] .badge-general { background-color: rgba(148, 163, 184, 0.15); }
[data-theme="dark"] .badge-estate { background-color: rgba(245, 158, 11, 0.15); }
[data-theme="dark"] .badge-rates { background-color: rgba(59, 130, 246, 0.15); }
[data-theme="dark"] .badge-stock { background-color: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .badge-macro { background-color: rgba(139, 92, 246, 0.15); }
[data-theme="dark"] .badge-crypto { background-color: rgba(16, 185, 129, 0.15); }

/* 5. 모바일 뷰 뉴스 그리드 전환 */
@media (max-width: 880px) {
    .time-news-list-container {
        grid-template-columns: 100%;
        gap: 16px;
    }
}

/* 6. 뉴스 페이징 디자인 */
.time-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    margin-bottom: 24px;
}

.time-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-width: 36px;
    padding: 0 10px;
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    background: var(--m-surface);
    color: var(--m-text-soft);
    font-size: var(--m-text-sm);
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-page-btn:hover {
    background: var(--m-surface-2);
    color: var(--m-text);
    border-color: var(--m-border-hover);
}

.time-page-btn.is-active {
    background: var(--m-primary);
    color: white !important;
    border-color: var(--m-primary);
    box-shadow: 0 2px 8px var(--m-primary-soft);
}

