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

:root {
  /* Liquid Glass Deep Space Theme */
  --bg-base: #05050A; /* Very deep dark space */
  
  /* Glass Colors */
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-bg-hover: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-light: rgba(255, 255, 255, 0.25);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  
  /* Gold Accents */
  --gold-primary: #FFDF00;
  --gold-glow: rgba(255, 223, 0, 0.5);
  
  /* Semantic Colors */
  --up-color: #34C759; /* iOS Green */
  --up-glow: rgba(52, 199, 89, 0.4);
  --down-color: #FF3B30; /* iOS Red */
  --down-glow: rgba(255, 59, 48, 0.4);
  --neutral-color: #8E8E93;

  /* Text Colors */
  --text-main: rgba(255, 255, 255, 0.95);
  --text-muted: rgba(235, 235, 245, 0.6);

  /* Typography */
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  --font-sans: -apple-system, 'SF Pro Display', 'Inter', sans-serif;
  
  /* Layout Spacing */
  --space-xs: 4px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  
  /* Border Radius - Apple Style */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  
  /* Safe Area */
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.4;
  overflow-x: hidden;
  position: relative;
}

/* ========== DYNAMIC AMBIENT BACKGROUND ========== */
.ambient-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-light {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  transition: background 1s ease, transform 1s ease;
  animation: float 20s infinite alternate ease-in-out;
}

.light-gold {
  top: -10%; left: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(255,215,0,0.2) 0%, rgba(255,215,0,0) 70%);
}

.light-blue {
  bottom: -10%; right: -10%;
  width: 70vw; height: 70vw;
  background: radial-gradient(circle, rgba(10,132,255,0.15) 0%, rgba(10,132,255,0) 70%);
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(10%, 5%) scale(1.1); }
  100% { transform: translate(-5%, 10%) scale(0.9); }
}

/* Typography Helpers */
.font-mono { font-family: var(--font-mono); }
.text-gold { color: var(--gold-primary); text-shadow: 0 0 10px var(--gold-glow); }
.text-up { color: var(--up-color); text-shadow: 0 0 10px var(--up-glow); }
.text-down { color: var(--down-color); text-shadow: 0 0 10px var(--down-glow); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.bold { font-weight: 600; }

/* ========== LAYOUT ========== */
.terminal-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: calc(var(--space-md) + 70px) var(--space-md) var(--space-md) var(--space-md);
  gap: var(--space-md);
}

/* FLOATING GLASS NAVBAR */
.glass-navbar {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-md) * 2);
  max-width: 1400px;
  height: 60px;
  background: var(--glass-bg);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-border-light);
  border-radius: var(--radius-pill);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-lg);
  z-index: 100;
  box-shadow: var(--glass-shadow);
}

.glass-navbar__brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-main);
}

.glass-navbar__brand svg {
  color: var(--gold-primary);
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.glass-navbar__status {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* MAIN GRID */
.terminal-grid {
  display: grid;
  grid-template-columns: 340px 1fr 340px;
  gap: var(--space-md);
  flex: 1;
  min-height: 0; 
  padding-bottom: var(--space-md);
}

/* ========== GLASS CARD COMPONENT ========== */
.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-border-light);
  border-left: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  animation: springFadeIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.1), transparent 50%);
  pointer-events: none;
}

.glass-card:hover {
  background: var(--glass-bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Staggered card animations */
.panel > .glass-card:nth-child(1) { animation-delay: 0.1s; }
.panel > .glass-card:nth-child(2) { animation-delay: 0.2s; }
.panel > .glass-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes springFadeIn {
  0% { opacity: 0; transform: translateY(20px) scale(0.95); filter: blur(10px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.card-header {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header .highlight {
  color: var(--gold-primary);
  background: rgba(255,223,0,0.1);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
}

/* ========== HERO WIDGETS ========== */
.price-hero-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.price-hero {
  text-align: center;
}

.price-hero__pair {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.price-hero__val {
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1px;
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

/* Liquid counting effect */
.price-hero__val.updating {
  transform: scale(1.05);
  text-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.price-hero__change {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  margin-top: 4px;
}

/* ========== CHART AREA ========== */
.chart-container {
  flex: 1;
  position: relative;
  min-height: 450px;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
}

.glass-toolbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  background: rgba(0,0,0,0.2);
  padding: 6px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.05);
}

.glass-btn-group {
  display: flex;
  gap: 2px;
}

.glass-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.glass-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-main);
}

.glass-btn.active {
  background: rgba(255,255,255,0.15);
  color: var(--text-main);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Glass Ripple Effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 0.6s linear;
  background-color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* ========== OTHER COMPONENTS ========== */
/* AI Report */
.ai-report { font-size: 0.95rem; line-height: 1.6; font-weight: 300; }
.ai-report-title { color: var(--gold-primary); font-weight: 500; margin-bottom: var(--space-xs); font-size: 1rem; }
.ai-report-text { color: var(--text-main); margin-bottom: var(--space-md); padding-bottom: var(--space-sm); border-bottom: 1px solid rgba(255,255,255,0.05); }

/* Sentiment Gauge */
.sentiment-score {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  background: linear-gradient(135deg, #FFF, var(--gold-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px var(--gold-glow));
}
.sentiment-bar-container {
  height: 8px;
  background: linear-gradient(90deg, var(--down-color) 0%, rgba(255,255,255,0.2) 50%, var(--up-color) 100%);
  border-radius: 4px;
  margin: var(--space-lg) 0;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.sentiment-marker {
  position: absolute;
  top: -6px;
  width: 20px;
  height: 20px;
  background: #FFF;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255,255,255,0.8), 0 2px 5px rgba(0,0,0,0.5);
  transition: left 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Calculator Form */
.calc-input {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main);
  padding: 10px;
  font-family: var(--font-mono);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.3s;
}
.calc-input:focus {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.05);
}
.calc-result {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.05);
}

/* News List */
.news-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-height: 400px;
}
.news-item {
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  transition: background 0.3s;
}
.news-item:hover { background: rgba(255,255,255,0.05); }

/* ========== MOBILE OPTIMIZATION ========== */
.glass-tab-bar { display: none; }

@media (max-width: 1100px) {
  .terminal-layout { padding-top: 80px; }
  .terminal-grid {
    grid-template-columns: 1fr;
    padding-bottom: calc(80px + var(--safe-bottom));
  }
  
  /* Mobile Bottom Tab Bar */
  .glass-tab-bar {
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: var(--safe-bottom);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    height: 60px;
    background: rgba(20,20,25,0.7);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    z-index: 100;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  }
  
  .tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
  }
  .tab-btn.active { color: var(--gold-primary); }
  .tab-btn svg { width: 24px; height: 24px; }
}

.blink-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background-color: var(--up-color);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--up-color);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(52, 199, 89, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}
