/* eventqc.css - Event-based Quality Control Styling for JU SeisComP Network */

#panel-eventqc {
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
  color: #1e293b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header & Controls */
.eventqc-header-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.eventqc-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.eventqc-title-row h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eventqc-title-row .eventqc-subtitle {
  font-size: 13px;
  color: #64748b;
  font-weight: normal;
  margin-left: 8px;
}

/* Summary Cards Grid */
.eventqc-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.eventqc-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.eventqc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  border-color: #94a3b8;
}

.eventqc-card.active-filter {
  border-color: #2563eb;
  background: #f0f7ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.2);
}

.eventqc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: #94a3b8;
}

.eventqc-card.c-blue::before { background: #2563eb; }
.eventqc-card.c-teal::before { background: #0d9488; }
.eventqc-card.c-green::before { background: #16a34a; }
.eventqc-card.c-amber::before { background: #d97706; }
.eventqc-card.c-red::before { background: #dc2626; }
.eventqc-card.c-purple::before { background: #9333ea; }

.eventqc-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eventqc-card-val {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

.eventqc-card-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* Filter Toolbar */
.eventqc-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.eventqc-quick-btns {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.eventqc-quick-btn {
  background: #f8fafc;
  border: none;
  border-right: 1px solid #cbd5e1;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.eventqc-quick-btn:last-child {
  border-right: none;
}

.eventqc-quick-btn:hover {
  background: #e2e8f0;
}

.eventqc-quick-btn.active {
  background: #1e3a8a;
  color: #ffffff;
}

.eventqc-date-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
}

.eventqc-input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: #1e293b;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s;
}

.eventqc-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}

.eventqc-btn {
  background: #1e3a8a;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.eventqc-btn:hover {
  background: #1d4ed8;
}

.eventqc-btn.secondary {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.eventqc-btn.secondary:hover {
  background: #e2e8f0;
}

.eventqc-btn.warn {
  background: #ea580c;
}
.eventqc-btn.warn:hover {
  background: #c2410c;
}

/* Event List Table Section */
.eventqc-table-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.eventqc-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eventqc-table-wrap {
  overflow-x: auto;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
}

.eventqc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.eventqc-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 9px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.eventqc-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.eventqc-table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s;
}

.eventqc-table tbody tr:hover {
  background: #f8fafc;
}

.eventqc-table tbody tr.selected {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-normal {
  background: #dcfce7;
  color: #15803d;
}

.badge-warning {
  background: #fef3c7;
  color: #b45309;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-muted {
  background: #f1f5f9;
  color: #64748b;
}

/* Event Detail Section */
.eventqc-detail-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
  overflow: hidden;
  margin-bottom: 24px;
}

.eventqc-detail-header {
  background: #0f172a;
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.eventqc-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.eventqc-detail-id {
  font-size: 18px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.eventqc-detail-info-item {
  display: flex;
  flex-direction: column;
}

.eventqc-detail-info-item span:first-child {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.eventqc-detail-info-item span:last-child {
  font-size: 13px;
  color: #f1f5f9;
  font-weight: 600;
}

/* Sub Navigation Tabs */
.eventqc-subtabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 16px;
  overflow-x: auto;
  gap: 4px;
}

.eventqc-subtab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.eventqc-subtab-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.eventqc-subtab-btn.active {
  color: #1e3a8a;
  border-bottom-color: #1e3a8a;
  background: #ffffff;
}

.eventqc-subpanel {
  padding: 20px;
  display: none;
}

.eventqc-subpanel.active {
  display: block;
}

/* Charts & Plots */
.eventqc-plot-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  position: relative;
}

.eventqc-plot-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eventqc-canvas-wrap {
  width: 100%;
  position: relative;
  border: 1px solid #f1f5f9;
  border-radius: 6px;
  background: #fafafa;
}

.eventqc-canvas {
  width: 100%;
  height: 420px;
  display: block;
}

.eventqc-tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  pointer-events: none;
  display: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  line-height: 1.4;
}

/* Band Buttons */
.eventqc-band-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.eventqc-band-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}

.eventqc-band-btn:hover {
  background: #e2e8f0;
}

.eventqc-band-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

/* Waveform Viewer Styling */
.eventqc-wf-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.eventqc-wf-sta-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.eventqc-wf-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11.5px;
  color: #475569;
}

.eventqc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.eventqc-legend-box {
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.wf-canvas-full {
  width: 100%;
  height: 220px;
  display: block;
  background: #ffffff;
}

.wf-canvas-zoom {
  width: 100%;
  height: 200px;
  display: block;
  background: #ffffff;
}

.eventqc-wf-polarity-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
}

.pol-pos {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.pol-neg {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.pol-und {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* Modal for Station Historical Trend */
.eventqc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.eventqc-modal {
  background: #ffffff;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
  overflow: hidden;
}

.eventqc-modal-head {
  padding: 14px 20px;
  background: #1e293b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eventqc-modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.eventqc-modal-close {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 20px;
  cursor: pointer;
}

.eventqc-modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* Empty / Loading states */
.eventqc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #64748b;
  font-size: 14px;
  gap: 10px;
}

.eventqc-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: eqc-spin 0.8s linear infinite;
}

@keyframes eqc-spin {
  to { transform: rotate(360deg); }
}


/* ==========================================================================
   EventQC v1.1 Enhancements: Detection QC & Modal Layout
   ========================================================================== */

/* Detection Status Badges */
.badge-detected {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.badge-not-detected {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.badge-no-data {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-not-eligible {
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
}

/* Detection Sub-Tab Layout */
.eventqc-detection-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.eventqc-det-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.eventqc-det-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
}

.eventqc-det-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.eventqc-detection-regions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eventqc-detection-region-group {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
}

.eventqc-detection-region-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eventqc-detection-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.eventqc-det-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.eventqc-det-card:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.eventqc-det-card.status-detected { border-left: 4px solid #16a34a; }
.eventqc-det-card.status-not_detected { border-left: 4px solid #dc2626; }
.eventqc-det-card.status-no_data { border-left: 4px solid #64748b; }
.eventqc-det-card.status-not_eligible { border-left: 4px solid #cbd5e1; opacity: 0.85; }

.eventqc-det-sta-name {
  font-weight: 700;
  color: #0f172a;
  font-size: 13px;
}

.eventqc-det-sta-dist {
  font-size: 11px;
  color: #64748b;
}

.eventqc-det-sta-icons {
  display: flex;
  gap: 8px;
  font-size: 11px;
  margin-top: 4px;
}

/* Enhanced Modal Styles */
.eventqc-modal {
  max-width: 960px !important;
  width: 95% !important;
}

.eventqc-modal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.eventqc-modal-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
}

.eventqc-modal-kpi-card .kpi-title {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
}

.eventqc-modal-kpi-card .kpi-val {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 3px;
}

.eventqc-modal-kpi-card .kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.eventqc-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
  margin-bottom: 20px;
  background: #ffffff;
}

.eventqc-matrix-table th, .eventqc-matrix-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  text-align: center;
}

.eventqc-matrix-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
}

.eventqc-cell-rate {
  font-weight: 700;
  font-size: 13px;
}

.eventqc-cell-count {
  font-size: 11px;
  color: #64748b;
}

.matrix-rate-high { background: #f0fdf4; color: #166534; }
.matrix-rate-mid { background: #fefce8; color: #854d0e; }
.matrix-rate-low { background: #fef2f2; color: #991b1b; }
.matrix-rate-none { background: #f8fafc; color: #94a3b8; }
