/* 통합 대시보드 CSS — reports/report-common.css를 기반으로 이식.
   벤치마크 고유 스타일은 여기 추가하지 말 것: 탭이 늘어날수록 셀렉터 충돌 위험이 커진다.
   탭 고유 위젯이 필요하면 js/tabs/<b>.js가 인라인 style로 처리하거나, 정말 여러 탭이
   공유하게 되면 그때 이 파일에 새 규칙을 추가할 것. */

:root {
    --graviton: #10b981;
    --intel: #3b82f6;
    --amd: #ef4444;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container { max-width: 1600px; margin: 0 auto; padding: 2rem; }

/* ---------- Navbar (탭) ---------- */
.navbar {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 0.75rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.navbar-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.navbar-brand:hover { color: var(--graviton); }
.navbar-links { display: flex; gap: 0.25rem; flex-wrap: wrap; align-items: center; }
.navbar-links button {
    color: #9ca3af;
    background: none;
    border: none;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
.navbar-links button:hover { background: rgba(255,255,255,0.1); color: #fff; }
.navbar-links button.active { background: rgba(99, 102, 241, 0.3); color: #a5b4fc; }
@media (max-width: 768px) {
    .navbar { padding: 0.5rem 1rem; }
    .navbar-links button { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
}

/* ---------- Hero ---------- */
header.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
    color: white;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    border-radius: 1rem;
    text-align: center;
}
header.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
header.hero p { opacity: 0.9; font-size: 1.1rem; }
header.hero .header-meta { margin-top: 1rem; opacity: 0.8; font-size: 0.9rem; }
/* Overview 탭만 다크 그라데이션(기존 다크 랜딩의 유일한 계승 요소) */
header.hero.overview { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%, #0f3460 100%); }

/* ---------- Summary cards ---------- */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.summary-card {
    background: var(--card);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.summary-card h3 { color: var(--muted); font-size: 0.875rem; margin-bottom: 0.5rem; }
.summary-card .value { font-size: 1.75rem; font-weight: 700; }
.summary-card .detail { color: var(--muted); font-size: 0.875rem; margin-top: 0.25rem; }
.summary-card .expand-toggle {
    margin-top: 0.5rem; background: none; border: none; color: var(--intel);
    font-size: 0.8rem; cursor: pointer; padding: 0;
}
.summary-card .expand-body { display: none; margin-top: 0.75rem; font-size: 0.8rem; color: var(--muted); }
.summary-card .expand-body.open { display: block; }

/* ---------- TOC ---------- */
.toc { background: var(--card); border-radius: 1rem; padding: 1.5rem; margin-bottom: 2rem; }
.toc h2 { margin-bottom: 1rem; font-size: 1.25rem; }
.toc ul { list-style: none; columns: 2; }
.toc li { margin-bottom: 0.5rem; }
.toc a { color: var(--intel); text-decoration: none; cursor: pointer; }
.toc a:hover { text-decoration: underline; }
@media (max-width: 768px) { .toc ul { columns: 1; } }

/* ---------- Section ---------- */
.section {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}
.section .description { color: var(--muted); margin-bottom: 1rem; font-size: 0.9rem; }

/* ---------- Charts ---------- */
.chart-container { position: relative; height: 400px; margin: 1.5rem 0; padding: 1rem; background: #fafbfc; border-radius: 0.75rem; border: 1px solid var(--border); }
.chart-container.tall { height: 500px; }
.chart-container.extra-tall { height: 800px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 1200px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Tabs (가격/메트릭 스위처) ---------- */
.tab-buttons { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-btn { padding: 0.5rem 1rem; border: 1px solid var(--border); background: var(--card); border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; transition: all 0.2s; font-family: inherit; }
.tab-btn:hover { background: #f1f5f9; }
.tab-btn.active { background: var(--graviton); color: white; border-color: var(--graviton); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.metric-tab {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
}
.metric-tab:hover { border-color: var(--intel); color: var(--intel); background: #eff6ff; }
.metric-tab.active { background: var(--intel); border-color: var(--intel); color: white; }
.metric-tab .tab-icon { font-size: 1rem; }

/* ---------- Legend / Insights / Analysis ---------- */
.legend-custom { display: flex; gap: 1.5rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.legend-color { width: 14px; height: 14px; border-radius: 3px; }

.insights {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.insights h4 { color: #92400e; margin-bottom: 0.5rem; }
.insights ul { margin-left: 1.5rem; color: #78350f; }

.analysis-box { background: #f1f5f9; border-radius: 0.5rem; padding: 1rem; margin-top: 1rem; }
.analysis-box h4 { margin-bottom: 0.5rem; color: var(--text); }

.warn-box {
    background: #fee2e2;
    border-left: 4px solid var(--amd);
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.warn-box h4 { color: #991b1b; margin-bottom: 0.5rem; }

/* ---------- Table ---------- */
.table-filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.table-filters input, .table-filters select {
    padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.875rem; font-family: inherit;
}
table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.875rem; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { background: #e2e8f0; }
th.sort-active::after { content: ' \25BC'; font-size: 0.7em; }
th.sort-active.asc::after { content: ' \25B2'; font-size: 0.7em; }
tr:hover { background: #f8fafc; }
.table-count { color: var(--muted); font-size: 0.85rem; margin-top: 0.5rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-graviton { background: #d1fae5; color: #065f46; }
.badge-intel { background: #dbeafe; color: #1e40af; }
.badge-amd { background: #fee2e2; color: #991b1b; }

/* ---------- Detail modal (redis 인스턴스 상세 — 다른 탭도 필요하면 재사용) ---------- */
.detail-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center;
}
.detail-modal.show { display: flex; }
.detail-content { background: white; border-radius: 1rem; padding: 2rem; max-width: 500px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); }
.detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.detail-header h3 { font-size: 1.25rem; color: var(--text); }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--muted); padding: 0.25rem; }
.close-btn:hover { color: var(--text); }
.detail-section { margin-bottom: 1.5rem; }
.detail-section h4 { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.detail-item { background: var(--bg); padding: 0.75rem; border-radius: 0.5rem; }
.detail-item .label { font-size: 0.7rem; color: var(--muted); }
.detail-item .value { font-size: 1rem; font-weight: 600; color: var(--text); }
table tr.clickable-row { cursor: pointer; }

/* ---------- Heatmap (Overview) ---------- */
.heatmap-cell { text-align: center; font-size: 0.8rem; }
.heatmap-na { color: var(--muted); }

footer { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.875rem; }

@media (max-width: 768px) {
    .container { padding: 1rem; }
    header.hero h1 { font-size: 1.5rem; }
    .chart-container { height: 300px; }
}
