/* Freespeed Power Analyzer — stylesheet */

:root {
  --blue:   #2563EB;
  --blue-light: #EFF6FF;
  --red:    #DC2626;
  --text:   #1E293B;
  --muted:  #64748B;
  --border: #E2E8F0;
  --bg:     #F8FAFC;
  --white:  #FFFFFF;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
}

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

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ── Layout ── */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  max-width: 1400px;
}

/* ── Sidebar ── */
.sidebar-title { font-size: 18px; font-weight: 700; color: var(--blue); }
.sidebar-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
hr { border: none; border-top: 1px solid var(--border); }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}
.upload-area input[type=file] { display: none; }
.upload-area .upload-icon { font-size: 28px; }
.upload-area p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.upload-area strong { color: var(--blue); cursor: pointer; }

#upload-status { font-size: 12px; color: var(--muted); min-height: 16px; }
#upload-status.error { color: var(--red); }

/* ── Landing ── */
#landing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  min-height: 60vh;
}
#landing h1 { font-size: 28px; font-weight: 700; }
#landing p  { color: var(--muted); max-width: 480px; }
.landing-steps { list-style: none; display: flex; flex-direction: column; gap: 8px; padding: 0; }
.landing-steps li { display: flex; gap: 10px; align-items: flex-start; }
.step-num {
  background: var(--blue);
  color: white;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}

/* ── Session view ── */
#session-view { display: none; }

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }

/* Metric cards */
.metrics-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.metric-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 130px;
  box-shadow: var(--shadow);
}
.metric-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 20px; font-weight: 700; margin-top: 2px; }

/* Device badges */
.devices-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.device-badge {
  background: var(--blue-light);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
}
.device-badge .badge-name { font-weight: 600; }
.device-badge .badge-ref  { font-size: 11px; color: var(--blue); }
.device-badge .badge-type { font-size: 11px; color: var(--muted); font-style: italic; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  background: none; border: none; padding: 10px 20px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Section headers */
.section { margin-bottom: 28px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.section-sub   { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

/* Chart container */
.chart-wrap { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.chart-loading { text-align: center; padding: 60px; color: var(--muted); }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* Agreement metrics */
.agree-metrics { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.agree-metric {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 100px;
  box-shadow: var(--shadow);
}
.agree-metric-label { font-size: 11px; color: var(--muted); }
.agree-metric-value { font-size: 18px; font-weight: 700; margin-top: 2px; }

/* Details/summary (collapsible) */
details { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
summary { padding: 10px 14px; cursor: pointer; font-weight: 500; list-style: none; }
summary::marker, summary::-webkit-details-marker { display: none; }
summary::before { content: "▶ "; font-size: 10px; color: var(--muted); }
details[open] summary::before { content: "▼ "; }
.details-body { padding: 0 14px 14px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  background: var(--bg);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* Info box */
.info-box {
  background: var(--blue-light);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 700px) {
  #sidebar { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border); }
  #app { flex-direction: column; }
  #main { padding: 16px; }
}
