/**
 * ═══════════════════════════════════════════════════════════════════════════════
 * KAIRO BIORHYTHM COMPASS STYLES
 * ═══════════════════════════════════════════════════════════════════════════════
 *
 * Visual design principles:
 * - Orientation, not measurement
 * - No numbers, no charts, no "good/bad"
 * - Motion communicates life, not progress
 * - Silence is a first-class UI state
 *
 * ═══════════════════════════════════════════════════════════════════════════════
 */

/* ─────────────────────────────────────────────────────────────────────────────
   VARIABLES
   ───────────────────────────────────────────────────────────────────────────── */

:root {
  --biorhythm-bg: #0f0d1a;
  --biorhythm-bg-elevated: rgba(255, 255, 255, 0.03);
  --biorhythm-border: rgba(255, 255, 255, 0.08);
  --biorhythm-text: var(--slate-200);
  --biorhythm-text-muted: var(--slate-400);
  --biorhythm-text-dim: var(--slate-500);

  --biorhythm-primary: var(--violet-500);
  --biorhythm-stable: var(--violet-400);
  --biorhythm-sensitive: var(--pink-400);
  --biorhythm-glow: var(--violet-500);

  --biorhythm-transition-fast: 0.2s ease;
  --biorhythm-transition-slow: 0.5s ease;
  --biorhythm-transition-settle: 1.2s ease-out;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MAIN CONTAINER
   ───────────────────────────────────────────────────────────────────────────── */

/* Tab content wrapper - fits within KAIRO layout */
/* Note: Fixed positioning is handled by kairo-ui.css for all diagnostic tabs */
#content-biorhythm {
  padding: 0 !important;
  margin: 0 !important;
  background: var(--biorhythm-bg);
  overflow-y: auto;
}

/* Ensure it displays correctly when shown */
#content-biorhythm[style*="display: block"] {
  display: block !important;
}

.biorhythm-panel {
  background: var(--biorhythm-bg);
  min-height: 100%;
  padding: 1.5rem 2rem;
  color: var(--biorhythm-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.biorhythm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--biorhythm-border);
}

.biorhythm-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.biorhythm-title-icon {
  font-size: 1.5rem;
}

.biorhythm-subtitle {
  font-size: 0.875rem;
  color: var(--biorhythm-text-muted);
  margin-top: 0.25rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   PATIENT SELECTOR
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.biorhythm-patient-select {
  background: var(--biorhythm-bg-elevated);
  border: 1px solid var(--biorhythm-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  color: var(--biorhythm-text);
  font-size: 0.875rem;
  min-width: 200px;
  cursor: pointer;
  transition: border-color var(--biorhythm-transition-fast);
}

.biorhythm-patient-select:hover {
  border-color: var(--biorhythm-glow);
}

.biorhythm-patient-select:focus {
  outline: none;
  border-color: var(--biorhythm-stable);
  box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.2);
}

/* ─────────────────────────────────────────────────────────────────────────────
   COMPASS CONTAINER
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-main {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  max-width: 1100px;
}

@media (max-width: 1000px) {
  .biorhythm-main {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }
}

.biorhythm-compass-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#biorhythm-compass-container {
  position: relative;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #1a1625 0%, #0f0d1a 70%);
  box-shadow:
    0 0 60px rgba(139, 92, 246, 0.1),
    inset 0 0 30px rgba(0, 0, 0, 0.5);
  transition: opacity var(--biorhythm-transition-slow);
}

.biorhythm-compass-canvas {
  display: block;
  border-radius: 50%;
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RING LEGEND
   ───────────────────────────────────────────────────────────────────────────── */

/* Visual Key - What ring properties mean */
.biorhythm-visual-key {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(139, 92, 246, 0.08);
  border-radius: 8px;
  max-width: 400px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: center;
}

.biorhythm-key-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
}

.biorhythm-key-label {
  font-weight: 600;
  color: var(--biorhythm-text);
}

.biorhythm-key-equals {
  color: var(--biorhythm-text-dim);
}

.biorhythm-key-value {
  color: var(--biorhythm-text-muted);
}

.biorhythm-legend {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--biorhythm-bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--biorhythm-border);
  max-width: 400px;
}

.biorhythm-legend-title {
  font-size: 0.75rem;
  color: var(--biorhythm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  text-align: center;
}

.biorhythm-legend-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.biorhythm-legend-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.biorhythm-legend-item:hover {
  background: rgba(139, 92, 246, 0.1);
}

.biorhythm-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.biorhythm-legend-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--biorhythm-text);
  min-width: 70px;
}

.biorhythm-legend-desc {
  font-size: 0.75rem;
  color: var(--biorhythm-text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   INTERPRETATION DISPLAY
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-interpretation-section {
  margin-top: 2rem;
  text-align: center;
  max-width: 500px;
}

.biorhythm-interpretation {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--biorhythm-text);
  padding: 1rem 1.5rem;
  background: var(--biorhythm-bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--biorhythm-border);
  transition: all var(--biorhythm-transition-slow);
}

.biorhythm-interpretation.whisper {
  color: var(--biorhythm-text-muted);
  font-style: italic;
}

.biorhythm-interpretation.silence {
  color: var(--biorhythm-text-dim);
  font-size: 0.875rem;
  border-color: transparent;
  background: transparent;
}

/* ─────────────────────────────────────────────────────────────────────────────
   WINDOW BADGES
   ───────────────────────────────────────────────────────────────────────────── */

#biorhythm-windows {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.biorhythm-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.025em;
}

.biorhythm-badge.stability {
  background: rgba(167, 139, 250, 0.15);
  color: var(--biorhythm-stable);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.biorhythm-badge.sensitivity {
  background: rgba(244, 114, 182, 0.15);
  color: var(--biorhythm-sensitive);
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.biorhythm-badge.intervention {
  background: rgba(74, 222, 128, 0.15);
  color: var(--green-400);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.biorhythm-badge.neutral {
  background: rgba(148, 163, 184, 0.1);
  color: var(--biorhythm-text-dim);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR PANELS
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.biorhythm-card {
  background: var(--biorhythm-bg-elevated);
  border: 1px solid var(--biorhythm-border);
  border-radius: 12px;
  padding: 1.25rem;
}

.biorhythm-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--biorhythm-text-muted);
  margin-bottom: 1rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MOTION CONTROLS
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-motion-controls {
  display: flex;
  gap: 0.5rem;
}

.biorhythm-motion-btn {
  flex: 1;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--biorhythm-border);
  border-radius: 6px;
  color: var(--biorhythm-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--biorhythm-transition-fast);
}

.biorhythm-motion-btn:hover {
  background: var(--biorhythm-bg-elevated);
  color: var(--biorhythm-text);
}

.biorhythm-motion-btn.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--biorhythm-glow);
  color: var(--biorhythm-stable);
}

/* ─────────────────────────────────────────────────────────────────────────────
   FEEDBACK BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-feedback {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.biorhythm-feedback-btn {
  flex: 1;
  padding: 0.625rem;
  background: transparent;
  border: 1px solid var(--biorhythm-border);
  border-radius: 8px;
  color: var(--biorhythm-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--biorhythm-transition-fast);
}

.biorhythm-feedback-btn:hover {
  transform: scale(1.05);
}

.biorhythm-feedback-btn[data-outcome="positive"]:hover {
  background: rgba(74, 222, 128, 0.1);
  border-color: var(--green-400);
}

.biorhythm-feedback-btn[data-outcome="neutral"]:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--biorhythm-text-dim);
}

.biorhythm-feedback-btn[data-outcome="negative"]:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--red-400);
}

.biorhythm-feedback-label {
  font-size: 0.7rem;
  color: var(--biorhythm-text-dim);
  text-align: center;
  margin-top: 0.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   DATA SOURCE INDICATOR
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-sources {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.biorhythm-source {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--biorhythm-text-muted);
}

.biorhythm-source-icon {
  width: 20px;
  text-align: center;
}

.biorhythm-source-status {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.biorhythm-source-status.connected {
  background: rgba(74, 222, 128, 0.15);
  color: var(--green-400);
}

.biorhythm-source-status.disconnected {
  background: rgba(148, 163, 184, 0.1);
  color: var(--biorhythm-text-dim);
}

/* ─────────────────────────────────────────────────────────────────────────────
   TOOLTIP
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-tooltip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 13, 26, 0.98);
  border: 1px solid var(--biorhythm-primary);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
  pointer-events: auto;
  animation: biorhythm-tooltip-in 0.3s ease-out;
  z-index: 100;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.biorhythm-tooltip-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--biorhythm-primary);
  margin-bottom: 0.5rem;
}

.biorhythm-tooltip-desc {
  font-size: 0.8rem;
  color: var(--biorhythm-text);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.biorhythm-tooltip-details {
  font-size: 0.85rem;
  color: var(--biorhythm-text-muted);
  line-height: 1.8;
  padding: 0.75rem 1rem;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  text-align: left;
}

.biorhythm-tooltip-details strong {
  color: var(--biorhythm-stable);
  font-size: 1rem;
  display: block;
  margin-bottom: 0.25rem;
}

.biorhythm-tooltip-dismiss {
  font-size: 0.7rem;
  color: var(--biorhythm-text-dim);
  margin-top: 0.5rem;
}

@keyframes biorhythm-tooltip-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  text-align: center;
  color: var(--biorhythm-text-dim);
}

.biorhythm-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.biorhythm-empty-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--biorhythm-text-muted);
  margin-bottom: 0.5rem;
}

.biorhythm-empty-text {
  font-size: 0.875rem;
  max-width: 300px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ACCESSIBILITY: REDUCED MOTION
   ───────────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .biorhythm-compass-canvas,
  .biorhythm-tooltip,
  .biorhythm-badge,
  .biorhythm-feedback-btn {
    animation: none !important;
    transition: none !important;
  }

  #biorhythm-compass-container {
    transition: opacity 0.1s !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOADING STATE
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
}

.biorhythm-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--biorhythm-border);
  border-top-color: var(--biorhythm-glow);
  border-radius: 50%;
  animation: biorhythm-spin 1s linear infinite;
}

@keyframes biorhythm-spin {
  to { transform: rotate(360deg); }
}

.biorhythm-loading-text {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--biorhythm-text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   THEME: LIGHT MODE (for clinician view)
   ───────────────────────────────────────────────────────────────────────────── */

.biorhythm-panel.light-theme {
  --biorhythm-bg: #fafafa;
  --biorhythm-bg-elevated: #ffffff;
  --biorhythm-border: rgba(0, 0, 0, 0.08);
  --biorhythm-text: var(--slate-800);
  --biorhythm-text-muted: var(--slate-500);
  --biorhythm-text-dim: var(--slate-400);
  --biorhythm-stable: var(--violet-600);
  --biorhythm-sensitive: #db2777;
}

.biorhythm-panel.light-theme #biorhythm-compass-container {
  background: radial-gradient(circle at center, var(--slate-100) 0%, var(--slate-200) 70%);
  box-shadow:
    0 0 40px rgba(124, 58, 237, 0.08),
    inset 0 0 20px rgba(0, 0, 0, 0.05);
}
