/* =============================================
   OMEN AI v3 — Analytics Dashboard Styles
   Dark theme (separate admin page).
   Uses local RBNO / Gotham fonts.
   ============================================= */

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

:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --accent: #ed3237;
  --white: #ffffff;
  --white-60: rgba(255, 255, 255, 0.60);
  --white-06: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --success: #22c97a;
  --error: #ed3237;
  --warn: #ffb020;
  --muted: #555555;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'RBNO', 'Arial', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}

.accent {
  color: var(--accent);
}

/* === HEADER === */
.dash-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  height: 56px;
  background: rgba(10, 10, 10, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dash-logo {
  font-family: 'Gotham', 'Arial', sans-serif;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 4px;
  flex-shrink: 0;
  color: var(--white);
}

.dash-logo span {
  color: var(--accent);
}

.dash-title {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--white-60);
}

.dash-meta {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* === MAIN === */
.dash-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* === KPI ROW === */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-value {
  font-family: 'RBNO', sans-serif;
  font-weight: 800;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: 1px;
  line-height: 1;
  color: var(--white);
}

.kpi-value.accent {
  color: var(--accent);
}

.kpi-label {
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* === GRID === */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
}

.dash-card.wide {
  grid-column: 1 / -1;
}

.card-title {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--white-60);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.card-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: none;
}

/* === BAR CHART === */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--white-60);
  width: 28px;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 6px;
  background: var(--white-06);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.bar-fill.bar-low {
  background: var(--success);
}

.bar-fill.bar-mid {
  background: var(--warn);
}

.bar-fill.bar-high {
  background: var(--error);
}

.bar-pct {
  font-size: 11px;
  color: var(--white-60);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* === WRONG ANSWERS LIST === */
.list-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wrong-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wrong-key {
  font-size: 12px;
  color: var(--white);
  line-height: 1.4;
}

.wrong-count {
  font-size: 10px;
  color: var(--error);
  align-self: flex-start;
}

.wrong-bar {
  height: 3px;
  background: var(--white-06);
  border-radius: 2px;
  overflow: hidden;
}

.wrong-fill {
  height: 100%;
  background: var(--error);
  border-radius: 2px;
  opacity: 0.7;
  transition: width 0.5s ease;
}

/* === HEATMAP === */
.heatmap-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  height: 100px;
}

.heat-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  height: 100%;
}

.heat-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 2px 2px 0 0;
  transition: height 0.5s ease;
}

.heat-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  text-align: center;
}

.heat-val {
  font-size: 9px;
  color: var(--white-60);
}

/* === SESSIONS TABLE === */
.search-input {
  margin-left: auto;
  background: var(--white-06);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--white);
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 6px 12px;
  outline: none;
  width: 220px;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 2px;
}

#sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#sessions-table th {
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 300;
}

#sessions-table td {
  padding: 12px 14px;
  color: var(--white-60);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

#sessions-table tr:hover td {
  background: var(--white-06);
}

#sessions-table td:first-child {
  color: var(--white);
}

.mono {
  font-family: 'RBNO', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.center {
  text-align: center;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px;
}

.badge {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
}

.badge.pass {
  background: rgba(34, 201, 122, 0.12);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge.fail {
  background: rgba(255, 59, 48, 0.12);
  color: var(--error);
  border: 1px solid var(--error);
}

.detail-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--white-60);
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.detail-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

/* === MODAL === */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.active {
  display: flex;
}

.modal-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--white);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--white);
}

.modal-body {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-section h3 {
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.modal-section p {
  font-size: 13px;
  color: var(--white-60);
  line-height: 1.8;
}

.modal-section p b {
  color: var(--white);
  font-weight: 500;
}

.modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}

.modal-table th {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-weight: 300;
}

.modal-table td {
  padding: 8px 10px;
  color: var(--white-60);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dash-card.wide {
    grid-column: auto;
  }
}

@media (max-width: 600px) {
  .kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .dash-main {
    padding: 16px 12px 40px;
  }

  .dash-header {
    padding: 0 16px;
  }
}

/* === UI FRAME (dark-theme variant) === */
#ui-frame {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#ui-frame .frame-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.frame-glass-blur {
  position: absolute;
  inset: 0;
  background: var(--bg);
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1920 1080' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1919.99,61.25V0H0v1080s68.09-.53,97.1-.53h1822.9V61.25ZM1714.59,1031.29h-23.15l-35.64,33.72H14.83V61.86h1890.33v783.81l-190.57,185.62Z' fill='black'/%3E%3C/svg%3E");
  mask-size: 100% 100%;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 1920 1080' preserveAspectRatio='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1919.99,61.25V0H0v1080s68.09-.53,97.1-.53h1822.9V61.25ZM1714.59,1031.29h-23.15l-35.64,33.72H14.83V61.86h1890.33v783.81l-190.57,185.62Z' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
}

.frame-main-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1.5;
}

.frame-acc1 {
  fill: rgba(255, 255, 255, 0.10);
  fill-rule: evenodd;
}

.frame-acc2 {
  fill: var(--accent);
  fill-rule: evenodd;
}

/* === TOOLBAR (date filter + report button) === */
.dash-toolbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-sep {
  font-size: 11px;
  color: var(--muted);
}

.date-input {
  background: var(--white-06);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--white);
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  color-scheme: dark;
}

.date-input:focus {
  border-color: var(--accent);
}

.date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.6);
  cursor: pointer;
}

.filter-clear {
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.filter-clear:hover {
  border-color: var(--accent);
  color: var(--white);
}

.report-btn {
  background: var(--accent);
  border: none;
  border-radius: 2px;
  color: var(--white);
  font-family: 'RBNO', sans-serif;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  padding: 9px 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.report-btn:hover {
  opacity: 0.80;
}

/* === TIME OF DAY CHART === */
.tod-chart {
  width: 100%;
}

.tod-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 110px;
  padding-bottom: 28px;
  position: relative;
}

.tod-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
}

.tod-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%;
  min-height: 0;
}

.tod-bar {
  width: 100%;
  background: var(--accent);
  opacity: 0.65;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  position: relative;
  transition: height 0.4s ease, opacity 0.2s;
}

.tod-bar:hover {
  opacity: 1;
}

.tod-count {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--white-60);
  white-space: nowrap;
  pointer-events: none;
}

.tod-label {
  position: absolute;
  bottom: 0;
  font-size: 8px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0;
}

/* ══════════════════════════════
   TRAINING FEEDBACK / RATINGS
   ══════════════════════════════ */
.ratings-avg-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.rating-avg-card {
  flex: 1;
  min-width: 140px;
  background: var(--white-06);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rating-avg-val {
  font-family: 'RBNO', sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
}

.rating-avg-max {
  font-size: 13px;
  font-weight: 300;
  color: var(--white-60);
}

.rating-avg-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.rating-avg-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.rating-avg-label {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--white-60);
}

.ratings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}

.ratings-table th {
  font-size: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0 8px 8px;
  border-bottom: 0.5px solid var(--border);
  font-weight: 300;
}

.ratings-table td {
  padding: 8px 8px;
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
  color: var(--white-60);
  vertical-align: middle;
}

.ratings-table .center { text-align: center; }
.ratings-table .mono   { font-family: monospace; font-size: 11px; }
