/* ===================================================
   STABLECOIN ADVISORY TOOLKIT — GLOBAL DESIGN SYSTEM
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ─── CSS TOKENS ─── */
:root {
  --bg-base:        #04080F;
  --bg-surface:     #080D1A;
  --bg-card:        rgba(255, 255, 255, 0.04);
  --bg-card-hover:  rgba(255, 255, 255, 0.07);
  --glass-border:   rgba(255, 255, 255, 0.08);
  --glass-blur:     blur(20px);

  --accent:         #7B61FF;
  --accent-cyan:    #00D4FF;
  --accent-glow:    rgba(123, 97, 255, 0.3);
  --accent-cyan-glow: rgba(0, 212, 255, 0.2);

  --success:        #00C896;
  --warning:        #FFB800;
  --danger:         #FF4D6A;
  --success-bg:     rgba(0, 200, 150, 0.12);
  --warning-bg:     rgba(255, 184, 0, 0.12);
  --danger-bg:      rgba(255, 77, 106, 0.12);

  --text-primary:   #F0F4FF;
  --text-secondary: #8A96B0;
  --text-muted:     #4A5568;

  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --shadow-card:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:    0 0 40px rgba(123, 97, 255, 0.15);

  --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── BACKGROUND EFFECTS ─── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 8s ease-in-out infinite alternate;
}
.bg-orb-1 {
  width: 600px; height: 600px;
  background: rgba(123, 97, 255, 0.08);
  top: -200px; left: -100px;
}
.bg-orb-2 {
  width: 400px; height: 400px;
  background: rgba(0, 212, 255, 0.06);
  bottom: -100px; right: -50px;
  animation-delay: -4s;
}
@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -30px) scale(1.05); }
}

/* ─── GRID OVERLAY ─── */
.grid-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(123,97,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123,97,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ─── LAYOUT ─── */
.app-wrapper { position: relative; z-index: 1; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── NAVBAR ─── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(4, 8, 15, 0.8);
  backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}
.brand-name span {
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.navbar-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
}

/* ─── GLASS CARD ─── */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass-blur);
  transition: var(--transition);
}
.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(123, 97, 255, 0.2);
  box-shadow: var(--shadow-glow);
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9B7FFF);
  color: white;
  box-shadow: 0 4px 20px rgba(123, 97, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(123, 97, 255, 0.5);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent-glow);
}
.btn-success {
  background: linear-gradient(135deg, var(--success), #00A87A);
  color: white;
  box-shadow: 0 4px 20px rgba(0,200,150,0.3);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,200,150,0.45);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-accent  { background: var(--accent-glow); color: var(--accent); }

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 12px 16px;
  transition: var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  background: rgba(123,97,255,0.06);
  box-shadow: 0 0 0 3px rgba(123,97,255,0.15);
}
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A96B0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}
.form-select option { background: #0D1325; color: var(--text-primary); }

/* ─── RANGE SLIDER ─── */
.slider-wrapper { margin-bottom: 24px; }
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.slider-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.slider-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(123,97,255,0.4);
  transition: var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ─── PROGRESS STEPS ─── */
.step-progress {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 40px;
}
.step-item {
  display: flex;
  align-items: center;
  flex: 1;
}
.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.step-circle.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  box-shadow: 0 0 15px rgba(123,97,255,0.4);
}
.step-circle.done {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--glass-border);
  transition: var(--transition);
  margin: 0 -1px;
}
.step-line.done { background: var(--success); }
.step-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  font-weight: 500;
}

/* ─── RADIO / CHECKBOX OPTIONS ─── */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.option-card {
  padding: 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  position: relative;
}
.option-card input[type="radio"],
.option-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.option-card:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}
.option-card.selected {
  border-color: var(--accent);
  background: rgba(123,97,255,0.08);
  box-shadow: 0 0 0 1px var(--accent);
}
.option-icon { font-size: 24px; margin-bottom: 8px; }
.option-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.option-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ─── SECTION HEADING ─── */
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--accent-glow);
  border: 1px solid rgba(123,97,255,0.2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}
.section-title span {
  background: linear-gradient(135deg, var(--accent), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.section-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 560px;
}

/* ─── STAT CARD ─── */
.stat-card {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; font-family: 'Space Grotesk', sans-serif; }
.stat-change { font-size: 12px; margin-top: 4px; }

/* ─── TABLE ─── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── RISK INDICATORS ─── */
.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.risk-low    { background: var(--success-bg); color: var(--success); }
.risk-medium { background: var(--warning-bg); color: var(--warning); }
.risk-high   { background: var(--danger-bg);  color: var(--danger);  }

/* ─── TRAFFIC LIGHT ─── */
.traffic-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
}
.tl-green  { background: rgba(0,200,150,0.2); }
.tl-amber  { background: rgba(255,184,0,0.2); }
.tl-red    { background: rgba(255,77,106,0.2); }

/* ─── HERO ─── */
.hero {
  padding: 80px 40px 60px;
  text-align: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--accent-glow);
  border: 1px solid rgba(123,97,255,0.25);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}
.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}
.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

/* ─── TOOL CARD ─── */
.tool-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-cyan));
  opacity: 0;
  transition: var(--transition);
}
.tool-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(123,97,255,0.3);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.4), var(--shadow-glow);
}
.tool-card:hover::before { opacity: 1; }

.tool-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.tool-icon-wrap {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}
.tool-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}
.tool-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 20px;
}
.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.tool-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.tool-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
}

/* ─── PAGE HEADER ─── */
.page-header {
  padding: 48px 40px 0;
  margin-bottom: 40px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
  transition: var(--transition);
}
.back-link:hover { color: var(--text-primary); }

/* ─── CONTENT PANEL ─── */
.content-panel {
  padding: 32px 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding-bottom: 80px;
}

/* ─── RESULTS SECTION ─── */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* ─── DIVIDER ─── */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: 32px 0;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── UTILITY ─── */
.text-accent { color: var(--accent); }
.text-cyan   { color: var(--accent-cyan); }
.text-success{ color: var(--success); }
.text-warning{ color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted  { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono   { font-family: 'Space Grotesk', sans-serif; }
.fw-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ─── ANIMATIONS ─── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}
.anim-fade-up { animation: fadeInUp 0.5s ease forwards; }
.anim-fade    { animation: fadeIn 0.4s ease forwards; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .navbar { padding: 16px 20px; }
  .hero { padding: 48px 20px 40px; }
  .content-panel { padding: 24px 20px 60px; }
  .page-header { padding: 32px 20px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ─── Saved work (common.js) ─── */
.sa-nav { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.navbar .btn + .sa-nav { margin-left: 10px; }
.sa-btn { font-size: 12px; padding: 7px 14px; }
.sa-status { font-size: 12px; color: var(--text-muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-status.sa-ok { color: var(--success); }
.sa-status.sa-err { color: var(--danger); cursor: help; }
.sa-drawer { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: none; z-index: 1000; justify-content: flex-end; }
.sa-drawer.open { display: flex; }
.sa-drawer-panel { width: min(440px, 100%); height: 100%; overflow-y: auto; background: var(--bg-surface); border-left: 1px solid var(--glass-border); padding: 22px; }
.sa-drawer-head { display: flex; justify-content: space-between; align-items: center; font-size: 16px; color: var(--text-primary); }
.sa-x { background: none; border: 0; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 6px; }
.sa-drawer-note { font-size: 12px; color: var(--text-muted); margin: 8px 0 16px; line-height: 1.5; }
.sa-item { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.sa-open { flex: 1; text-align: left; background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 10px; padding: 10px 12px; cursor: pointer; color: var(--text-primary); display: flex; flex-direction: column; gap: 3px; font: inherit; }
.sa-open:hover, .sa-item.current .sa-open { border-color: var(--accent); }
.sa-title { font-size: 13px; font-weight: 600; }
.sa-meta { font-size: 11px; color: var(--text-muted); }
.sa-del { background: none; border: 1px solid var(--glass-border); border-radius: 10px; color: var(--text-muted); font-size: 11px; padding: 0 10px; cursor: pointer; }
.sa-del:hover { color: var(--danger); border-color: var(--danger); }
.sa-empty { font-size: 13px; color: var(--text-muted); }
@media (max-width: 768px) { .sa-status { display: none; } .navbar-tag { display: none; } }

/* Recent work on the home page */
.recent { max-width: 1100px; margin: 0 auto; padding: 0 40px 60px; }
.recent h2 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; color: var(--text-primary); margin-bottom: 14px; }
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.recent-item { display: block; background: var(--bg-card); border: 1px solid var(--glass-border); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--text-primary); }
.recent-item:hover { border-color: var(--accent); }
.recent-tool { font-size: 11px; color: var(--accent-cyan); text-transform: uppercase; letter-spacing: 0.06em; }
.recent-title { font-size: 14px; font-weight: 600; margin: 4px 0 2px; }
.recent-meta { font-size: 12px; color: var(--text-muted); }
@media (max-width: 768px) { .recent { padding: 0 20px 40px; } }
@media (max-width: 768px) {
  .navbar { flex-wrap: wrap; row-gap: 10px; }
  .sa-nav { margin-left: auto; }
  .option-grid[style*="repeat(5"] { grid-template-columns: repeat(2, 1fr) !important; }
}
