/* SolarFinder Design System - Inspired by Flipt v2 (Developer-grade, Clean, Elegant) */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, Menlo, monospace;

  /* Color Palette - Dark Mode Default */
  --bg-app: #09090b;
  --bg-surface: #121215;
  --bg-surface-elevated: #18181b;
  --bg-surface-hover: #222227;
  --border-subtle: #27272a;
  --border-hover: #3f3f46;
  --border-active: #52525b;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-inverse: #09090b;

  /* Accent Colors */
  --accent-solar: #10b981; /* Emerald 500 */
  --accent-solar-glow: rgba(16, 185, 129, 0.15);
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.15);
  --accent-rose: #ef4444;
  --accent-rose-glow: rgba(239, 68, 68, 0.15);
  --accent-brand: #3b82f6;

  /* Radius & Shadows */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  --shadow-glow-emerald: 0 0 25px -5px rgba(16, 185, 129, 0.3);
  --shadow-glow-amber: 0 0 25px -5px rgba(245, 158, 11, 0.3);
  --shadow-glow-rose: 0 0 25px -5px rgba(239, 68, 68, 0.3);

  color-scheme: dark;
}

/* Light Theme Override */
html.light {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-active: #94a3b8;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
  color-scheme: light;
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Subtle background grid pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: radial-gradient(var(--border-subtle) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* Layout Container */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Top Navigation Bar */
.navbar {
  border-bottom: 1px solid var(--border-subtle);
  background-color: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

html.light .navbar {
  background-color: rgba(255, 255, 255, 0.85);
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.version-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-solar);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-solar);
  box-shadow: 0 0 8px var(--accent-solar);
  animation: pulse-dot-anim 2s infinite;
}

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

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Main Content */
main {
  flex: 1;
  padding: 2.5rem 0 4rem 0;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--accent-cyan);
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero-gradient-text {
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto;
}

/* Cards */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-interactive:hover {
  border-color: var(--border-hover);
}

/* Form Card */
.form-card {
  max-width: 680px;
  margin: 0 auto 2.5rem auto;
  position: relative;
  overflow: hidden;
}

.form-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #10b981, #06b6d4, #3b82f6);
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.form-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sample-btn {
  font-size: 0.8rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sample-btn:hover {
  background: rgba(6, 182, 212, 0.16);
  border-color: var(--accent-cyan);
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 0.75rem 0.9rem 0.75rem 2.4rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all 0.15s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-solar);
  box-shadow: 0 0 0 3px var(--accent-solar-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.submit-btn {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
}

.submit-btn:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

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

/* Stepper / Loading Animation */
.stepper-card {
  max-width: 680px;
  margin: 0 auto 2.5rem auto;
  border-left: 3px solid var(--accent-cyan);
}

.stepper-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.step-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.step-item.done {
  color: var(--accent-solar);
}

.step-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.step-item.active .step-icon {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background-color: rgba(6, 182, 212, 0.1);
  animation: pulse-ring 1.5s infinite;
}

.step-item.done .step-icon {
  border-color: var(--accent-solar);
  color: white;
  background-color: var(--accent-solar);
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(6, 182, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

/* Error Banner */
.error-card {
  max-width: 680px;
  margin: 0 auto 2.5rem auto;
  border-left: 4px solid var(--accent-rose);
  background-color: rgba(239, 68, 68, 0.05);
}

.error-title {
  color: var(--accent-rose);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Results Dashboard */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 880px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-out;
}

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

/* Hero Status Banner */
.status-hero {
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}

.status-hero.status-feasible {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.03) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: var(--shadow-glow-emerald);
}

.status-hero.status-limited {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(245, 158, 11, 0.03) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: var(--shadow-glow-amber);
}

.status-hero.status-saturated {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.03) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  box-shadow: var(--shadow-glow-rose);
}

.status-info {
  flex: 1;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.status-badge.feasible {
  background-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge.limited {
  background-color: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.status-badge.saturated {
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-hero h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.status-hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 540px;
}

/* Gauge Meter */
.gauge-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radial-chart {
  position: relative;
  width: 120px;
  height: 120px;
}

.radial-chart svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.gauge-bg {
  fill: none;
  stroke: var(--bg-surface-elevated);
  stroke-width: 8;
}

.gauge-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-in-out;
}

.gauge-center {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-pct {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
}

.gauge-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .status-hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

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

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.detail-row:last-child {
  border-bottom: none;
}

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

.detail-val {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  gap: 1rem;
}

.secondary-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.65rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.secondary-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* History Card */
.history-section {
  max-width: 680px;
  margin: 3rem auto 0 auto;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.history-header h3 {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-item:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-surface-hover);
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.history-consumer {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
}

.history-dtr {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Footer */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 0;
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
