/* ============================================================
   PR345 — Lily Project Health Score
   TradeRail Field Portal
   ============================================================ */

/* ── Color Variables ──────────────────────────────────────── */
:root {
  --pr345-green:  #22c55e;
  --pr345-yellow: #eab308;
  --pr345-orange: #f97316;
  --pr345-red:    #ef4444;
  --pr345-purple: #7C3AED;
  --pr345-bg:     #ffffff;
  --pr345-surface: #f8fafc;
  --pr345-border: #e2e8f0;
  --pr345-text:   #1e293b;
  --pr345-muted:  #64748b;
  --pr345-small:  #94a3b8;
}

/* ── Score Badge ──────────────────────────────────────────── */
.pr345-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
  border: 3px solid transparent;
  flex-shrink: 0;
}

.pr345-score-badge--green  { background: var(--pr345-green);  border-color: var(--pr345-green); }
.pr345-score-badge--yellow { background: var(--pr345-yellow); border-color: var(--pr345-yellow); color: #1e293b; }
.pr345-score-badge--orange { background: var(--pr345-orange); border-color: var(--pr345-orange); }
.pr345-score-badge--red    { background: var(--pr345-red);    border-color: var(--pr345-red); }

/* Large circular badge variant */
.pr345-score-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 22px;
  color: #ffffff;
  border: 4px solid transparent;
  flex-shrink: 0;
}

.pr345-score-circle--green  { background: var(--pr345-green);  border-color: var(--pr345-green); }
.pr345-score-circle--yellow { background: var(--pr345-yellow); border-color: var(--pr345-yellow); color: #1e293b; }
.pr345-score-circle--orange { background: var(--pr345-orange); border-color: var(--pr345-orange); }
.pr345-score-circle--red    { background: var(--pr345-red);    border-color: var(--pr345-red); }

/* ── Score Ring (stream cards) ────────────────────────────── */
.pr345-score-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.pr345-score-ring svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.pr345-score-ring-value {
  font-weight: 700;
  font-size: 13px;
  color: var(--pr345-text);
  z-index: 1;
}

.pr345-ring-track   { fill: none; stroke: #e2e8f0; stroke-width: 4; }
.pr345-ring-fill    { fill: none; stroke-width: 4; stroke-linecap: round; }
.pr345-ring-fill--green  { stroke: var(--pr345-green); }
.pr345-ring-fill--yellow { stroke: var(--pr345-yellow); }
.pr345-ring-fill--orange { stroke: var(--pr345-orange); }
.pr345-ring-fill--red    { stroke: var(--pr345-red); }

/* ── Project Card ─────────────────────────────────────────── */
.pr345-project-card {
  background: var(--pr345-bg);
  border: 1px solid var(--pr345-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}

.pr345-project-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.pr345-project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pr345-project-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--pr345-text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pr345-project-sub {
  font-size: 12px;
  color: var(--pr345-muted);
  margin-top: 4px;
}

/* ── Score Breakdown Panel (collapsible drawer) ───────────── */
.pr345-breakdown-panel {
  background: var(--pr345-surface);
  border: 1px solid var(--pr345-border);
  border-radius: 0 0 10px 10px;
  border-top: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.pr345-breakdown-panel.is-open {
  max-height: 2000px;
}

.pr345-breakdown-inner {
  padding: 16px;
}

/* Stream row */
.pr345-stream-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--pr345-border);
}

.pr345-stream-row:last-of-type {
  border-bottom: none;
}

.pr345-stream-info {
  flex: 1;
  min-width: 0;
}

.pr345-stream-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--pr345-text);
}

.pr345-stream-weight {
  font-size: 11px;
  color: var(--pr345-muted);
}

.pr345-stream-factors {
  margin-top: 6px;
}

.pr345-factor-positive {
  font-size: 12px;
  color: var(--pr345-green);
  margin-bottom: 2px;
}

.pr345-factor-negative {
  font-size: 12px;
  color: var(--pr345-red);
  margin-bottom: 2px;
}

.pr345-stream-action {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pr345-purple);
  text-decoration: none;
}

.pr345-stream-action:hover {
  text-decoration: underline;
}

/* Trend arrow */
.pr345-trend {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

.pr345-trend--up    { color: var(--pr345-green); }
.pr345-trend--down  { color: var(--pr345-red); }
.pr345-trend--flat  { color: var(--pr345-muted); }

/* Using text characters only (no emoji) */
.pr345-trend--up::before   { content: '\2191'; margin-right: 2px; }
.pr345-trend--down::before { content: '\2193'; margin-right: 2px; }
.pr345-trend--flat::before { content: '\2192'; margin-right: 2px; }

/* ── Breakdown Panel Bottom ───────────────────────────────── */
.pr345-breakdown-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--pr345-border);
}

.pr345-disclaimer {
  font-size: 11px;
  color: var(--pr345-small);
  font-style: italic;
  line-height: 1.5;
}

/* ── 30-Day History Chart ─────────────────────────────────── */
.pr345-history-chart {
  background: var(--pr345-bg);
  border: 1px solid var(--pr345-border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
}

.pr345-history-chart svg {
  width: 100%;
  height: 120px;
  display: block;
}

.pr345-history-axis-label {
  font-size: 10px;
  fill: var(--pr345-muted);
}

.pr345-history-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pr345-history-line--green  { stroke: var(--pr345-green); }
.pr345-history-line--yellow { stroke: var(--pr345-yellow); }
.pr345-history-line--orange { stroke: var(--pr345-orange); }
.pr345-history-line--red    { stroke: var(--pr345-red); }

.pr345-history-annotation {
  font-size: 10px;
  fill: var(--pr345-muted);
}

.pr345-history-stats {
  margin-top: 8px;
  font-size: 11px;
  color: var(--pr345-muted);
  line-height: 1.6;
}

/* ── Summary Strip (landing page) ────────────────────────── */
.pr345-summary-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pr345-summary-tile {
  flex: 1;
  min-width: 120px;
  background: var(--pr345-surface);
  border: 1px solid var(--pr345-border);
  border-radius: 8px;
  padding: 12px 16px;
  text-align: center;
}

.pr345-summary-tile-count {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.pr345-summary-tile-label {
  font-size: 11px;
  color: var(--pr345-muted);
  margin-top: 4px;
}

.pr345-summary-tile--green  .pr345-summary-tile-count { color: var(--pr345-green); }
.pr345-summary-tile--yellow .pr345-summary-tile-count { color: var(--pr345-yellow); }
.pr345-summary-tile--orange .pr345-summary-tile-count { color: var(--pr345-orange); }
.pr345-summary-tile--red    .pr345-summary-tile-count { color: var(--pr345-red); }

/* ── Lily Insight Bar ─────────────────────────────────────── */
.pr345-lily-insight-bar {
  border-left: 4px solid var(--pr345-purple);
  padding: 10px 14px;
  background: #faf5ff;
  border-radius: 0 6px 6px 0;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--pr345-text);
  line-height: 1.6;
}

.pr345-lily-insight-bar strong {
  color: var(--pr345-purple);
}

/* ── Demo Panel ───────────────────────────────────────────── */
.pr345-demo-panel {
  max-width: 800px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--pr345-text);
  padding: 20px;
}

.pr345-demo-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--pr345-text);
}

.pr345-project-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Expand toggle ────────────────────────────────────────── */
.pr345-expand-btn {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--pr345-purple);
  cursor: pointer;
  font-weight: 600;
}

.pr345-expand-btn:hover {
  text-decoration: underline;
}

/* ── Two-tap confirm pattern ──────────────────────────────── */
.pr345-confirm-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid var(--pr345-orange);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}

.pr345-confirm-inline-yes,
.pr345-confirm-inline-no {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.pr345-confirm-inline-yes {
  background: var(--pr345-orange);
  color: #ffffff;
}

.pr345-confirm-inline-no {
  background: var(--pr345-surface);
  color: var(--pr345-text);
  border: 1px solid var(--pr345-border);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .pr345-summary-strip {
    gap: 8px;
  }
  .pr345-summary-tile {
    min-width: 80px;
    padding: 8px 10px;
  }
  .pr345-summary-tile-count {
    font-size: 22px;
  }
  .pr345-score-circle {
    width: 56px;
    height: 56px;
    font-size: 18px;
  }
}
