/* =====================================================================
   Event Log Viewer — tool-specific styles
   Builds on ../common/theme.css (Radeus Labs shared theme). Only the
   pieces unique to this tool live here; everything structural (header,
   hero, panels, buttons, footer) comes from theme.css.
   ===================================================================== */

/* Category colors — categorical accents, distinct at a glance.
   System/Fault/Cleared/Target reuse brand tokens; Ephemeris/Setting/Other
   add semantic hues. Each has a soft tint for the row + a solid for the dot. */
:root {
  --cat-system:   #00205B;  --cat-system-bg:   #eaf0fb;
  --cat-fault:    #BF0D23;  --cat-fault-bg:    #fdecee;
  --cat-cleared:  #0e9f6e;  --cat-cleared-bg:  #e7f7f1;
  --cat-eph:      #c97c12;  --cat-eph-bg:      #fbf1e2;
  --cat-target:   #2C51C0;  --cat-target-bg:   #eaeffb;
  --cat-setting:  #0e7490;  --cat-setting-bg:  #e5f4f8;
  --cat-other:    #5a6478;  --cat-other-bg:    #eef0f4;
}

/* Wider content area for this data-dense tool. */
.ev-wide { max-width: 1320px; }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(0,32,91,0.06);
  padding: 1px 5px;
  border-radius: 3px;
}
.hero code { background: rgba(255,255,255,0.12); color: #cdd9f3; }

/* ── Controls panel ─────────────────────────────────────────────────── */
.ev-controls { margin-bottom: 24px; }

/* Drop zone */
.ev-dropzone {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--light-bg);
  padding: 22px 26px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.ev-dropzone:hover,
.ev-dropzone:focus-visible {
  border-color: var(--blue);
  background: #e9f0ff;
  outline: none;
}
.ev-dropzone.is-dragover {
  border-color: var(--blue);
  background: #e1ebff;
  box-shadow: 0 0 0 3px rgba(44,81,192,0.15);
}
.ev-dropzone-icon { width: 38px; height: 38px; color: var(--blue); flex-shrink: 0; }
.ev-dropzone-text { line-height: 1.5; }
.ev-dropzone-text strong {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--navy);
}
.ev-dropzone-text span { font-size: 13px; color: var(--muted); }

.ev-link-btn {
  font: inherit;
  color: var(--blue);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ev-link-btn:hover { color: var(--red); }

/* Toolbar (search + filters + files) */
.ev-toolbar { margin-top: 22px; }
.ev-toolbar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.ev-toolbar-row + .ev-toolbar-row { margin-top: 16px; }

.ev-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 360px;
  min-width: 240px;
}
.ev-search-wrap svg {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.ev-search-wrap input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 34px 10px 36px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.ev-search-wrap input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(44,81,192,0.15);
}
.ev-search-clear {
  position: absolute;
  right: 8px;
  border: none; background: none;
  font-size: 20px; line-height: 1;
  color: var(--muted); cursor: pointer;
  padding: 2px 6px;
}
.ev-search-clear:hover { color: var(--red); }

.ev-check {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.ev-check input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }

/* Category filter chips */
.ev-cat-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cat-color, var(--navy));
  background: var(--white);
  border: 1.5px solid var(--cat-color, var(--border));
  border-radius: 999px;
  padding: 6px 13px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, opacity 0.15s;
}
.ev-cat-chip .ev-cat-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cat-color, var(--muted));
  flex-shrink: 0;
}
.ev-cat-chip .ev-cat-count {
  font-size: 10px;
  opacity: 0.7;
  font-weight: 600;
}
.ev-cat-chip.is-active {
  background: var(--cat-color, var(--navy));
  color: var(--white);
}
.ev-cat-chip.is-active .ev-cat-dot { background: rgba(255,255,255,0.85); }
.ev-cat-chip.is-off { opacity: 0.4; }
.ev-cat-chip.is-off:hover { opacity: 0.7; }

/* File chips */
.ev-files-row { align-items: flex-start; }
.ev-files-label {
  font-family: var(--font-head);
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  padding-top: 5px;
}
.ev-file-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--navy);
  background: var(--light-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 6px 4px 10px;
}
.ev-file-chip .ev-file-count { color: var(--muted); font-size: 11px; }
.ev-file-chip-remove {
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  padding: 0 3px; border-radius: 3px;
}
.ev-file-chip-remove:hover { color: var(--red); background: rgba(191,13,35,0.08); }

/* ── Summary ────────────────────────────────────────────────────────── */
.ev-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.ev-stat {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}
.ev-stat.is-fault { border-left-color: var(--cat-fault); }
.ev-stat.is-cleared { border-left-color: var(--cat-cleared); }
.ev-stat.is-time { border-left-color: var(--blue); }
.ev-stat-label {
  font-family: var(--font-head);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 5px;
}
.ev-stat-value {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 800; color: var(--navy);
  line-height: 1.1;
}
.ev-stat.is-fault .ev-stat-value { color: var(--cat-fault); }
.ev-stat-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.ev-stat-value.is-small { font-size: 14px; font-weight: 700; }

/* ── Results table ──────────────────────────────────────────────────── */
.ev-results { padding: 0; overflow: hidden; }
.ev-table-scroll { overflow-x: auto; }
.ev-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.ev-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--navy);
  color: var(--white);
  font-family: var(--font-head);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 14px;
  white-space: nowrap;
}
.ev-table tbody td {
  padding: 4px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ev-table tbody tr:hover { background: var(--light-bg); }
.ev-table tbody tr.is-cat-fault   { background: var(--cat-fault-bg); }
.ev-table tbody tr.is-cat-fault:hover { background: #fbe1e5; }

.ev-col-idx { width: 76px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; text-align: right; white-space: nowrap; }
.ev-col-time { width: 156px; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; }
.ev-time-date { color: var(--muted); }
.ev-time-clock { color: var(--text); font-weight: 600; margin-left: 7px; }
.ev-time-range { display: block; color: var(--blue); font-size: 11px; margin-top: 1px; }

/* Collapsed rows: distinct index (the range) + a left accent so folded runs stand out */
.ev-table tbody tr.is-collapsed td.ev-col-idx { color: var(--navy); font-weight: 700; }
.ev-table tbody tr.is-collapsed td:first-child { box-shadow: inset 3px 0 0 var(--blue); }

/* Multi-event cycles: head + member rows share a tinted band so the repeating
   pattern reads as one block. Members show a bullet instead of a number. */
.ev-table tbody tr.is-cycle-head td,
.ev-table tbody tr.is-cycle-member td { background: #eef4ff; border-bottom-color: #d8e3fb; }
.ev-table tbody tr.is-cycle-head:hover td,
.ev-table tbody tr.is-cycle-member:hover td { background: #e3ecff; }
.ev-table tbody tr.is-cycle-member .ev-col-event { padding-left: 22px; }
.ev-idx-member { color: var(--blue); font-weight: 700; }

/* Day / file group dividers — make day & file changes obvious in the timeline */
.ev-group-row td { padding: 0 !important; border-bottom: none; }
.ev-group { display: flex; align-items: center; gap: 9px; font-family: var(--font-head); }
.ev-group svg { width: 14px; height: 14px; flex-shrink: 0; }
.ev-group--day {
  background: var(--navy);
  color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 7px 14px;
}
.ev-group--day .ev-group-count {
  margin-left: auto;
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: rgba(255,255,255,0.6);
}
.ev-group--file {
  background: var(--light-bg);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 5px 14px;
}
.ev-group--file svg { color: var(--blue); }
.ev-col-cat { width: 116px; }
.ev-col-file { width: 150px; color: var(--muted); font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
.ev-col-event { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; color: var(--text); }

/* Category badge in a row */
.ev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-head);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cat-color, var(--muted));
  background: var(--cat-bg, var(--light-bg));
  border-radius: 3px;
  padding: 3px 8px;
  white-space: nowrap;
}
.ev-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cat-color, var(--muted)); }

/* Highlighted search hits */
.ev-hl { background: #fff2a8; border-radius: 2px; padding: 0 1px; }

/* Event detail emphasis: "changed from A to B" + fault text */
.ev-event-from { color: var(--muted); }
.ev-event-arrow { color: var(--blue); font-weight: 700; }
.ev-event-to { color: var(--text); font-weight: 600; }
.ev-repeat-count {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-head);
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  color: #fff;
  background: var(--navy);
  border-radius: 999px;
  padding: 1px 9px;
  vertical-align: middle;
}

/* Show-more footer */
.ev-showmore {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--light-bg);
}
.ev-showmore-text { font-size: 13px; color: var(--muted); }
.ev-showmore-text strong { color: var(--navy); font-weight: 700; }

/* Empty / placeholder */
.ev-empty { padding: 40px; text-align: center; color: var(--muted); font-size: 14px; }
.ev-placeholder {
  text-align: center;
  padding: 56px 30px;
  color: var(--muted);
}
.ev-placeholder svg { width: 52px; height: 52px; color: var(--border); margin-bottom: 16px; }
.ev-placeholder p { margin: 0; font-size: 16px; color: var(--text); }
.ev-placeholder .ev-placeholder-sub { font-size: 13px; color: var(--muted); margin-top: 8px; max-width: 460px; margin-left: auto; margin-right: auto; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .ev-col-file { display: none; }
  .ev-dropzone { flex-direction: column; text-align: center; }
  .ev-search-wrap { flex-basis: 100%; }
}
