/* ControlPanel.module.css - Control panel styles */

/* ============== Control Panel Container ============== */
.controlPanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary, #141414);
  border-right: 1px solid var(--border-color, #333);
  width: 280px;
  overflow-y: auto;
}

/* ============== Section ============== */
.section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  max-width: 100%;
  width: 100%;
}

.sectionTitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary, #888);
  letter-spacing: 0.5px;
}

/* ============== View Toggle ============== */
.viewToggle {
  display: flex;
  background: var(--bg-primary, #1a1a1a);
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--border-color, #333);
}

.viewBtn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #888);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.viewBtn:hover {
  color: var(--text-primary, #e8e8e8);
}

.viewBtn.active {
  background: var(--accent-color, #76b900);
  color: white;
}

/* ============== Test Query ============== */
.testQuery {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.testQueryHeader {
  display: none;
}

.testQueryIcon {
  font-size: 16px;
}

.testQueryTitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #e8e8e8);
  flex: 1;
}

.modeToggle {
  display: flex;
  gap: 4px;
}

.modeBtn {
  padding: 4px 8px;
  border: 1px solid var(--border-color, #333);
  background: transparent;
  color: var(--text-secondary, #888);
  font-size: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.modeBtn:hover {
  border-color: var(--text-secondary, #888);
  color: var(--text-primary, #e8e8e8);
}

.modeBtn.active {
  background: var(--accent-color, #76b900);
  border-color: var(--accent-color, #76b900);
  color: white;
}

.inputGroup {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  position: relative;
}

.queryInput {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color, #333);
  background: var(--bg-primary, #1a1a1a);
  color: var(--text-primary, #e8e8e8);
  font-size: 14px;
  border-radius: 24px;
  resize: none;
  min-height: 44px;
  max-height: 200px;
  font-family: inherit;
  line-height: 1.5;
  transition: all 0.2s ease;
}

.queryInput:focus {
  outline: none;
  border-color: var(--accent-color, #76b900);
  box-shadow: 0 0 0 2px rgba(118, 185, 0, 0.15);
}

.queryInput::placeholder {
  color: var(--text-secondary, #666);
}

.testBtn {
  padding: 10px 24px;
  background: var(--accent-color, #76b900);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 44px;
  flex-shrink: 0;
}

.testBtn:hover:not(:disabled) {
  background: var(--accent-hover, #8ed100);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(118, 185, 0, 0.3);
}

.testBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============== Test Result ============== */
.testResult {
  background: var(--bg-primary, #1a1a1a);
  border: 1px solid var(--border-color, #333);
  border-radius: 6px;
  padding: 12px;
}

.resultHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.resultTitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #e8e8e8);
}

.accurateBadge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #4CAF50;
  color: white;
}

.simulatedBadge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #FF9800;
  color: white;
}

.latencyBadge {
  font-size: 10px;
  color: var(--text-secondary, #888);
  margin-left: auto;
}

.resultSection {
  margin-top: 8px;
}

.resultSectionTitle {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary, #888);
  margin-bottom: 4px;
}

.signalTags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.signalTag {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  color: white;
}

.signalTag.uncertain {
  border: 1px dashed rgba(255, 255, 255, 0.5);
}

.signalScore {
  opacity: 0.8;
  font-size: 9px;
}

.needsVerify {
  font-size: 10px;
}

.noMatch {
  font-size: 11px;
  color: var(--text-secondary, #888);
  font-style: italic;
}

.decisionResult {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-color, #76b900);
}

.decisionResult.fallbackDecision {
  color: #FF9800;
}

.fallbackBadge {
  display: inline-block;
  font-size: 9px;
  background: #FF9800;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
}

.fallbackReason {
  font-size: 10px;
  color: var(--text-secondary, #888);
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(255, 152, 0, 0.1);
  border-radius: 4px;
  border-left: 2px solid #FF9800;
}

.modelTags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.modelTag {
  padding: 3px 8px;
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, #333);
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-primary, #e8e8e8);
}

.warningBanner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: rgba(255, 152, 0, 0.1);
  border: 1px solid rgba(255, 152, 0, 0.3);
  border-radius: 4px;
  font-size: 11px;
  color: #FF9800;
  margin-top: 8px;
}

/* ============== Collapse Controls ============== */
.collapseControls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collapseBtn {
  padding: 10px 16px;
  border: 1px solid var(--border-color, #333);
  background: var(--bg-primary, #1a1a1a);
  color: var(--text-secondary, #888);
  font-size: 12px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}

.collapseBtn:hover {
  border-color: var(--accent-color, #76b900);
  color: var(--text-primary, #e8e8e8);
  background: var(--bg-hover, #222);
}

/* ============== Legend ============== */
.legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legendItem {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary, #888);
}

.legendColor {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.legendLine {
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.legendLineDashed {
  width: 24px;
  height: 2px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--text-secondary, #888) 0,
    var(--text-secondary, #888) 4px,
    transparent 4px,
    transparent 8px
  );
}

/* Mobile Responsive - Hide Legend on mobile */
@media (max-width: 768px) {
  /* Hide the entire legend section on mobile */
  .section:has(.legend) {
    display: none;
  }

  /* Fallback: hide legend directly if :has() is not supported */
  .legend {
    display: none;
  }

  /* Fix signal summary font size on mobile - make it smaller with !important */
  .resultSectionTitle {
    font-size: 8px !important;
  }

  .signalTag {
    font-size: 8px !important;
    padding: 2px 5px !important;
  }

  .signalScore {
    font-size: 7px !important;
  }

  .decisionResult {
    font-size: 9px !important;
  }

  .fallbackBadge {
    font-size: 7px !important;
    padding: 2px 4px !important;
  }

  .fallbackReason {
    font-size: 8px !important;
    padding: 3px 5px !important;
  }

  .noMatch {
    font-size: 9px !important;
  }

  .needsVerify {
    font-size: 8px !important;
  }

  .modelTag {
    font-size: 8px !important;
    padding: 2px 5px !important;
  }

  .resultTitle {
    font-size: 10px !important;
  }

  .accurateBadge,
  .simulatedBadge {
    font-size: 8px !important;
    padding: 2px 4px !important;
  }

  .latencyBadge {
    font-size: 8px !important;
  }

  .warningBanner {
    font-size: 9px !important;
    padding: 6px !important;
  }

}

@media (max-width: 480px) {
  .resultSectionTitle {
    font-size: 7px !important;
  }

  .signalTag {
    font-size: 7px !important;
    padding: 2px 4px !important;
  }

  .signalScore {
    font-size: 6px !important;
  }

  .decisionResult {
    font-size: 8px !important;
  }

  .fallbackBadge {
    font-size: 6px !important;
    padding: 1px 3px !important;
  }

  .fallbackReason {
    font-size: 7px !important;
    padding: 2px 4px !important;
  }

  .noMatch {
    font-size: 8px !important;
  }

  .needsVerify {
    font-size: 7px !important;
  }

  .modelTag {
    font-size: 7px !important;
    padding: 2px 4px !important;
  }

  .resultTitle {
    font-size: 9px !important;
  }

  .accurateBadge,
  .simulatedBadge {
    font-size: 7px !important;
    padding: 1px 3px !important;
  }

  .latencyBadge {
    font-size: 7px !important;
  }

  .warningBanner {
    font-size: 8px !important;
    padding: 5px !important;
  }
}
