/* ============================================================================
 * DAJAVATA QUANT & GLOBAL MARKET HUB (KRX + US) STYLESHEET
 * 8대 모듈: Rising Stocks, Promising Stock Ranking, Market View, Peer Group,
 *          ETF Finder, Market Calendar, Guru Portfolio, Money Flow
 * ============================================================================ */

.quant-hub-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 26px 60px 26px;
    background: var(--bg-main, #0b0f19);
    color: var(--text-main, #f1f5f9);
    box-sizing: border-box;
    gap: 18px;
}

.quant-hub-container > * {
    flex-shrink: 0;
}

/* 상단 통합 헤더 & KRX/US 마켓 토글 */
.qh-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
}

.qh-title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qh-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qh-badge {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.qh-title-row h1 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    color: var(--text-main, #f8fafc);
}

.qh-subtitle {
    font-size: 12.5px;
    color: var(--text-muted, #94a3b8);
    margin: 0;
}

/* 🇰🇷 국내주식 / 🇺🇸 미국주식 마켓 스위처 */
.qh-controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.qh-market-switch {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border, #334155);
    border-radius: 9px;
    padding: 3px;
    gap: 4px;
}

body.light-theme .qh-market-switch {
    background: #e2e8f0;
}

.qh-mkt-btn {
    border: none;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 12.5px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s ease;
    font-family: inherit;
}

.qh-mkt-btn:hover {
    color: var(--text-main, #fff);
}

.qh-mkt-btn.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.35);
}

/* 8대 모듈 퀵 네비게이션 탭 바 */
.qh-module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 10px;
}

.qh-mod-tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.qh-mod-tab:hover {
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-main, #f8fafc);
}

.qh-mod-tab.active {
    background: rgba(37, 99, 235, 0.16);
    border-color: rgba(59, 130, 246, 0.5);
    color: #60a5fa;
    font-weight: 700;
}

body.light-theme .qh-mod-tab.active {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

/* 서브 필터 바 & 키보드 스타일 태그 (GoodStock123 스타일) */
.qh-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 10px;
}

.qh-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.qh-filter-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.qh-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 6px;
    border: 1px solid var(--border, #334155);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main, #e2e8f0);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.qh-pill:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.qh-pill.active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #fff;
}

.qh-kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 10px;
    font-weight: 800;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    color: #93c5fd;
    font-family: monospace;
}

.qh-count {
    font-size: 10.5px;
    opacity: 0.78;
}

.qh-search-input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border, #334155);
    color: var(--text-main, #fff);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    min-width: 200px;
    outline: none;
    font-family: inherit;
}

body.light-theme .qh-search-input {
    background: #ffffff;
}

.qh-search-input:focus {
    border-color: #3b82f6;
}

/* KPI 요약 카드 그리드 */
.qh-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.qh-kpi-card {
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qh-kpi-label {
    font-size: 11.5px;
    color: var(--text-muted, #94a3b8);
    font-weight: 600;
}

.qh-kpi-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main, #f8fafc);
}

.qh-kpi-sub {
    font-size: 11px;
    color: var(--text-muted, #64748b);
}

/* 시그널 배지 (Rising Stocks 6대 시그널) */
.qh-sig-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
    margin-bottom: 2px;
}

.qh-sig-guru { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.qh-sig-growth { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.qh-sig-turnover { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.qh-sig-news { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.qh-sig-breakout { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.qh-sig-analyst { background: rgba(20, 184, 166, 0.18); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.4); }

body.light-theme .qh-sig-guru { color: #7e22ce; }
body.light-theme .qh-sig-growth { color: #047857; }
body.light-theme .qh-sig-turnover { color: #b45309; }
body.light-theme .qh-sig-news { color: #1d4ed8; }
body.light-theme .qh-sig-breakout { color: #b91c1c; }
body.light-theme .qh-sig-analyst { color: #0f766e; }

/* 데이터 테이블 박스 */
.qh-table-card {
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.qh-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.qh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.qh-table th {
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-muted, #94a3b8);
    font-weight: 700;
    font-size: 11.5px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border, #1e293b);
    text-align: left;
    white-space: nowrap;
}

body.light-theme .qh-table th {
    background: #f1f5f9;
}

.qh-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border, #1e293b);
    color: var(--text-main, #e2e8f0);
    vertical-align: middle;
}

.qh-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.06);
}

.qh-table .right { text-align: right; }
.qh-table .center { text-align: center; }

.qh-pos { color: #ef4444; font-weight: 700; }
.qh-neg { color: #3b82f6; font-weight: 700; }

.qh-chart-btn {
    border: 1px solid rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    font-family: inherit;
}

.qh-chart-btn:hover {
    background: #2563eb;
    color: #fff;
}

/* 구루 포트폴리오 그리드 & 상세 드로어 */
.qh-split-layout {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 1100px) {
    .qh-split-layout {
        grid-template-columns: 1fr;
    }
}

.qh-guru-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.qh-guru-card {
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 10px;
    padding: 13px 15px;
    cursor: pointer;
    transition: all 0.16s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.qh-guru-card:hover, .qh-guru-card.active {
    border-color: #3b82f6;
    background: rgba(37, 99, 235, 0.09);
    transform: translateY(-1px);
}

/* 캘린더 그리드 */
.qh-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.qh-cal-day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    padding: 6px 0;
}

.qh-cal-cell {
    min-height: 92px;
    background: var(--bg-card, #111827);
    border: 1px solid var(--border, #1e293b);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.15s ease;
}

.qh-cal-cell:hover, .qh-cal-cell.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.qh-cal-date {
    font-size: 12.5px;
    font-weight: 700;
}

/* 머니 플로우 바 차트 */
.qh-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 210px;
    padding: 20px 12px 6px 12px;
    border-bottom: 1px solid var(--border, #1e293b);
    overflow-x: auto;
}

.qh-bar-col {
    flex: 1;
    min-width: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}

.qh-bar-fill {
    width: 100%;
    max-width: 28px;
    background: linear-gradient(180deg, #3b82f6, #1d4ed8);
    border-radius: 4px 4px 0 0;
    transition: height 0.25s ease;
}

.qh-bar-val {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-main, #cbd5e1);
}

.qh-bar-lbl {
    font-size: 10px;
    color: var(--text-muted, #64748b);
}

/* ==========================================================================
   [Hallmark + Taste-Skill] 글로벌 퀀트 허브 금융 터미널 숫자 정렬 & 서피스 폴리싱
   ========================================================================== */
.qh-table td,
.qh-kpi-val,
.qh-pos,
.qh-neg,
.qh-count,
.qh-cal-badge,
.qh-bar-val {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.qh-header-banner,
.qh-kpi-card,
.qh-table-card,
.qh-peer-left,
.qh-peer-right {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 6px 20px rgba(0, 0, 0, 0.22);
}

.qh-kpi-card {
    transition: transform 0.16s ease, border-color 0.16s ease;
}

.qh-kpi-card:hover {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.35);
}


