/* ══════════════════════════════════════════════════════════════
   Page-specific Styles
   ══════════════════════════════════════════════════════════════ */

/* ── Auth Page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-dark);
  padding: 2rem;
}

.auth-card {
  max-width: 28rem;
  width: 100%;
}

.auth-card .logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card .logo h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-tabs {
  display: flex;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.auth-tabs button {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: none;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.auth-tabs button.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.server-banner {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.server-banner.offline {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive) / 0.3);
}

.server-banner.online {
  background: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
  border: 1px solid hsl(var(--success) / 0.3);
}

/* ── Onboarding ── */
.onboarding-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-dark);
  padding: 2rem;
}

.onboarding-card {
  max-width: 36rem;
  width: 100%;
}

.step-indicator {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.step-dot {
  flex: 1;
  height: 0.25rem;
  border-radius: 9999px;
  background: hsl(var(--muted));
  transition: background 0.3s ease;
}

.step-dot.completed {
  background: hsl(var(--primary));
}

.step-dot.current {
  background: hsl(var(--primary) / 0.5);
}

/* ── Trend Card ── */
.trend-card {
  cursor: pointer;
  transition: all 0.2s ease;
}

.trend-card:hover {
  border-color: hsl(var(--primary) / 0.5);
}

.trend-card.selected {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.3);
}

.trend-score {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

/* ── Pipeline Progress ── */
.pipeline-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  transition: all 0.3s ease;
}

.pipeline-step.active {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}

.pipeline-step.completed {
  background: hsl(var(--success) / 0.15);
  color: hsl(var(--success));
}

.pipeline-step .step-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.pipeline-step .step-connector {
  width: 2rem;
  height: 2px;
  background: hsl(var(--border));
  flex-shrink: 0;
}

/* ── Score Bars (Predict page) ── */
.factor-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.factor-bar .label {
  font-size: 0.8125rem;
  width: 8rem;
  flex-shrink: 0;
}

.factor-bar .bar-track {
  flex: 1;
  height: 0.5rem;
  background: hsl(var(--muted));
  border-radius: 9999px;
  overflow: hidden;
}

.factor-bar .bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.8s ease;
}

.factor-bar .value {
  font-size: 0.8125rem;
  font-weight: 600;
  width: 2.5rem;
  text-align: right;
}

/* ── Calendar ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: hsl(var(--border));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-header-cell {
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--card));
}

.calendar-cell {
  background: hsl(var(--card));
  min-height: 5rem;
  padding: 0.375rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.calendar-cell:hover {
  background: hsl(var(--muted));
}

.calendar-cell.today {
  outline: 2px solid hsl(var(--primary));
  outline-offset: -2px;
}

.calendar-cell.selected {
  background: hsl(var(--primary) / 0.1);
}

.calendar-cell.other-month {
  opacity: 0.3;
}

.calendar-cell .day-number {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.calendar-event {
  font-size: 0.625rem;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chatbot ── */
.chatbot-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.4);
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
}

.chatbot-panel {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  width: 24rem;
  height: 32rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 16px 48px hsl(0 0% 0% / 0.4);
  z-index: 45;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease-out;
}

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

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.6;
  animation: chatFadeIn 0.25s ease-out;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  align-self: flex-end;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-bottom-right-radius: 4px;
}

.chat-message.assistant {
  align-self: flex-start;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border-bottom-left-radius: 4px;
}

.chat-message.assistant strong {
  color: hsl(var(--primary));
  font-weight: 600;
}

.chat-message.assistant em {
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

.chat-message.assistant .chat-code {
  background: hsl(var(--background));
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
}

.chat-message.assistant .chat-list-item {
  display: flex;
  gap: 0.35rem;
  padding: 0.15rem 0;
}

.chat-message.assistant .chat-list-num,
.chat-message.assistant .chat-list-bullet {
  color: hsl(var(--primary));
  font-weight: 600;
  flex-shrink: 0;
}

.chatbot-input {
  padding: 0.75rem;
  border-top: 1px solid hsl(var(--border));
  display: flex;
  gap: 0.5rem;
}

.chatbot-input textarea {
  flex: 1;
  resize: none;
  min-height: 2.25rem;
  max-height: 5rem;
}

/* ── Kill Switch ── */
.kill-switch-card {
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.kill-switch-card.active {
  border-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.05);
}

.severity-badge.critical {
  background: hsl(var(--destructive) / 0.15);
  color: hsl(var(--destructive));
}

.severity-badge.high {
  background: hsl(var(--warning) / 0.15);
  color: hsl(var(--warning));
}

.severity-badge.medium {
  background: hsl(var(--info) / 0.15);
  color: hsl(var(--info));
}

/* ── Location Picker ── */
.location-picker-compact {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.location-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.location-cascading {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .location-cascading {
    grid-template-columns: 1fr;
  }
}

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed hsl(var(--border));
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
}

.upload-area .icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: hsl(var(--muted-foreground));
}

/* ══════════════════════════════════════════════════════════════
   Result Cards — Visual polish for AI feature outputs
   ══════════════════════════════════════════════════════════════ */

/* Animate result sections when they appear */
.result-section {
  animation: resultSlideIn 0.4s ease-out;
}

@keyframes resultSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Score circles — used by Creator Score, Virality, Growth, etc. */
.score-ring {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.score-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 5px;
  background: conic-gradient(var(--ring-color, hsl(var(--primary))) var(--ring-pct, 0%), hsl(var(--border)) 0%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}

.score-ring-inner {
  text-align: center;
  z-index: 1;
}

.score-ring-value {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
}

.score-ring-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

/* Grade badge — A+, B+, etc. */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 700;
}

.grade-badge.grade-a { background: hsl(142 71% 45% / 0.15); color: #22c55e; }
.grade-badge.grade-b { background: hsl(270 85% 65% / 0.15); color: hsl(var(--primary)); }
.grade-badge.grade-c { background: hsl(38 92% 50% / 0.15); color: #f59e0b; }
.grade-badge.grade-d { background: hsl(0 84% 60% / 0.15); color: #ef4444; }

/* Metric card with icon accent */
.metric-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px hsl(0 0% 0% / 0.25);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary) / 0.3));
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Progress bar — horizontal fill bars */
.progress-bar {
  height: 8px;
  background: hsl(var(--muted));
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(300 80% 68%));
}

.progress-bar-fill.green { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-bar-fill.yellow { background: linear-gradient(90deg, #d97706, #f59e0b); }
.progress-bar-fill.red { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* Risk level indicators */
.risk-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.risk-indicator.low { background: hsl(142 71% 45% / 0.12); color: #22c55e; }
.risk-indicator.medium { background: hsl(38 92% 50% / 0.12); color: #f59e0b; }
.risk-indicator.high { background: hsl(0 84% 60% / 0.12); color: #ef4444; }
.risk-indicator.critical { background: hsl(0 84% 60% / 0.2); color: #ef4444; border: 1px solid hsl(0 84% 60% / 0.3); }

/* Stat highlight — big number with label */
.stat-highlight {
  text-align: center;
  padding: 1.25rem 1rem;
}

.stat-highlight-value {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(300 80% 72%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-highlight-label {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Section headers within results */
.result-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: hsl(var(--border));
}

/* Recommendation items */
.recommendation-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  transition: border-color 0.2s ease;
}

.recommendation-item:hover {
  border-color: hsl(var(--primary) / 0.4);
}

.recommendation-item .rec-icon {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: hsl(var(--primary) / 0.12);
  color: hsl(var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
}

.recommendation-item .rec-text {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Impact badges */
.impact-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 2rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.impact-badge.high { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); }
.impact-badge.medium { background: hsl(38 92% 50% / 0.15); color: #f59e0b; }
.impact-badge.low { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }

/* Competitor card accent */
.competitor-card {
  border-left: 3px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.competitor-card:hover {
  border-left-color: hsl(var(--primary));
  transform: translateX(4px);
}

/* Brand match score ring (small) */
.match-score-sm {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
  border: 3px solid;
}

/* Trend arrows */
.trend-up { color: #22c55e; }
.trend-down { color: #ef4444; }
.trend-flat { color: hsl(var(--muted-foreground)); }

/* Animate staggered children */
.stagger-in > * {
  animation: resultSlideIn 0.35s ease-out both;
}
.stagger-in > *:nth-child(1) { animation-delay: 0s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.18s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.24s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.36s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.42s; }

/* Premium headline style — crisp white, worldclass-product look.
   (Was a purple gradient; product-wide decision: headings render white.) */
.gradient-text {
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: currentColor;
  background-clip: initial;
  color: #fff;
  letter-spacing: -0.015em;
}
.light .gradient-text { color: hsl(222 47% 11%); }

/* Glow border on key results */
.glow-card {
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.2), 0 4px 20px hsl(var(--primary) / 0.1);
}

.glow-card:hover {
  box-shadow: 0 0 0 1px hsl(var(--primary) / 0.4), 0 8px 30px hsl(var(--primary) / 0.15);
}
