/* ==========================================================================
   MeganExplains — Clean White Theme (Quasar / Vue Style)
   Matches the official megan.aimat.science UI aesthetic
   ========================================================================== */

:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-elevated: #ffffff;
  
  --border-color: #e2e8f0;
  --border-focus: #009688;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-help: #0284c7;

  /* Quasar Teal Brand */
  --q-teal: #009688;
  --q-teal-dark: #00796b;
  --q-teal-light: #e0f2f1;
  --q-teal-border: #80cbc4;

  /* Channel Colors */
  --ch-negative: #38bdf8; /* Blue (Lipophilic / Decreases Solubility) */
  --ch-negative-dark: #0284c7;
  --ch-positive: #fb7185; /* Coral / Red (Hydrophilic / Increases Solubility) */
  --ch-positive-dark: #e11d48;

  --font-sans: 'Roboto', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.06);
}

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

body.light-theme {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  position: sticky;
  top: 0;
  z-index: 50;
}

.q-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.q-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #009688, #00796b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.q-header-titles {
  display: flex;
  flex-direction: column;
}

.q-app-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.q-app-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.q-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.runtime-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.ready {
  background-color: #10b981;
}

.status-dot.loading {
  background-color: #f59e0b;
  animation: q-pulse 1.4s infinite;
}

.status-dot.error {
  background-color: #ef4444;
}

@keyframes q-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.nav-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-toggle-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-toggle-btn.active {
  background-color: var(--q-teal);
  border-color: var(--q-teal);
  color: #ffffff;
  font-weight: 600;
}

/* Workspace & Layout */
.q-main {
  flex: 1;
  padding: 20px 24px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.q-tab-view {
  display: none;
}

.q-tab-view.active {
  display: block;
}

.megan-layout-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 20px;
  align-items: start;
}

/* Quasar Cards */
.q-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.q-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}

.title-with-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.teal-bar {
  width: 4px;
  height: 18px;
  background-color: var(--q-teal);
  border-radius: 2px;
}

.title-with-bar h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.help-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-help);
  text-decoration: none;
}

.help-link:hover {
  text-decoration: underline;
}

/* Forms & Inputs */
.input-field-group {
  margin-bottom: 14px;
}

.input-field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.q-select {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.q-select:focus {
  border-color: var(--q-teal);
  box-shadow: 0 0 0 2px rgba(0, 150, 136, 0.15);
}

.smiles-predict-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.q-input {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.q-input.smiles-font {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.q-input:focus {
  border-color: var(--q-teal);
  box-shadow: 0 0 0 2px rgba(0, 150, 136, 0.15);
}

.q-btn-predict {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 2px solid var(--q-teal);
  color: var(--q-teal);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.q-btn-predict:hover {
  background: var(--q-teal);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 150, 136, 0.25);
}

/* Molecule Metadata Box */
.molecule-meta-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 4px;
}

.meta-item:last-child {
  margin-bottom: 0;
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  color: var(--text-primary);
  font-weight: 600;
}

.q-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--text-secondary);
}

.q-badge.badge-teal {
  background: var(--q-teal-light);
  color: var(--q-teal-dark);
}

.q-badge.badge-success {
  background: #dcfce7;
  color: #166534;
}

.q-badge.badge-warning {
  background: #fef9c3;
  color: #854d0e;
}

.q-badge.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Prediction Highlights Grid */
.prediction-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.pred-highlight-box {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.pred-highlight-box.reference {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.pred-sublabel {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pred-big-number {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--q-teal-dark);
  margin: 4px 0 2px 0;
}

.pred-big-number.true-val {
  color: var(--text-primary);
}

.pred-big-number .unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.pred-subnote {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Atom Table Breakdown */
.atom-breakdown-section {
  margin-top: 14px;
}

.sub-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.sub-header-row h4 {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.latency-text {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.latency-text strong {
  color: #10b981;
}

.q-table-wrap {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-height: 220px;
}

.q-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.q-table th, .q-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
}

.q-table th {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.q-table tr:hover {
  background-color: #f8fafc;
}

/* Uncertainty Estimation */
.uncertainty-content {
  padding: 4px 0;
}

.uncertainty-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.uncertainty-text strong {
  font-family: var(--font-mono);
  color: #0f172a;
}

.accuracy-indicator {
  margin-left: 8px;
  font-size: 12px;
  color: #16a34a;
  font-weight: 600;
}

.uncertainty-bar-container {
  position: relative;
  margin: 10px 0 6px 0;
}

.uncertainty-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.bar-section.green {
  flex: 2;
  background-color: #bbf7d0;
}

.bar-section.yellow {
  flex: 2;
  background-color: #fef08a;
}

.bar-section.red {
  flex: 3;
  background-color: #fecdd3;
}

.uncertainty-needle {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 20px;
  background-color: #0f172a;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  border-radius: 1.5px;
  transform: translateX(-50%);
  transition: left 0.3s ease;
}

.uncertainty-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* Attributional Explanations */
.explanations-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.q-slider {
  accent-color: var(--q-teal);
  cursor: pointer;
}

.badge-val {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: 3px;
}

.q-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.q-btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.dual-explanations-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.channel-view-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.channel-header {
  margin-bottom: 10px;
}

.channel-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-tag {
  font-size: 13px;
  font-weight: 700;
}

.channel-tag.negative {
  color: var(--ch-negative-dark);
}

.channel-tag.positive {
  color: var(--ch-positive-dark);
}

.channel-subdesc {
  font-size: 11px;
  color: var(--text-muted);
}

.canvas-box {
  background-color: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-sm);
  width: 100%;
  height: 270px;
  position: relative;
}

.explanation-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.channel-footer-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.dot-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-swatch.ch0 {
  background-color: var(--ch-negative);
  box-shadow: 0 0 6px var(--ch-negative);
}

.dot-swatch.ch1 {
  background-color: var(--ch-positive);
  box-shadow: 0 0 6px var(--ch-positive);
}

/* Verification Suite Panel */
.verifier-panel-container {
  max-width: 1200px;
  margin: 0 auto;
}

.verifier-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.verifier-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.q-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--q-teal);
  border: none;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.q-btn-primary:hover {
  background: var(--q-teal-dark);
}

.test-suite-summary {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.verifier-table th {
  background-color: #f8fafc;
}

.pass-tag {
  background: #dcfce7;
  color: #166534;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Footer */
.q-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

.q-footer a {
  color: var(--q-teal);
  text-decoration: none;
}

.q-footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 1080px) {
  .megan-layout-grid {
    grid-template-columns: 1fr;
  }
}
