/* ==========================================================================
   Stellect - Constellation App Styles
   A cosmic design system with glass-morphism and gradient aesthetics
   ========================================================================== */

/* ==========================================================================
   CSS Reset
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

button {
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* Background Colors */
  --bg-void: #050510;
  --bg-deep: #0A0A1A;
  --bg-nebula-blue: #0A1628;
  --bg-nebula-purple: #1A0A2E;

  /* Accent Colors */
  --accent-star: #FBBF24;
  --accent-lime: #C4F82A;
  --accent-blue: #60A5FA;
  --accent-purple: #A78BFA;

  /* Surface Colors */
  --surface-card: #12122A;
  --surface-elevated: #1E1E3A;

  /* Text Colors */
  --text-primary: #FFFFFF;
  --text-secondary: #A1A1C0;
  --text-tertiary: #6B6B8A;

  /* Border Colors */
  --border-subtle: #2A2A4A;
  --border-glow: #6366F1;

  /* Overlay Colors */
  --overlay-dim: #05051099;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-3xl: 40px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Star Colors */
  --star-bright: #FFFFFF;
  --star-medium: #C4B5FD;
  --star-dim: #6B7280;
  --star-gold: #FBBF24;
  --star-amber: #F59E0B;
  --star-orange: #FB923C;
  --star-red: #EF4444;
  --star-pink: #EC4899;
  --star-purple: #A78BFA;
  --star-violet: #8B5CF6;
  --star-indigo: #6366F1;
  --star-blue: #60A5FA;
  --star-sky: #38BDF8;
  --star-cyan: #22D3EE;
  --star-teal: #2DD4BF;
  --star-emerald: #34D399;
  --star-green: #4ADE80;
  --star-lime: #C4F82A;
  --star-yellow: #FACC15;
  --star-rose: #FB7185;
  --star-fuchsia: #E879F9;
  --star-lavender: #DDD6FE;
  --star-slate: #94A3B8;
  --star-gray: #9CA3AF;

  /* Gradients */
  --gradient-card: linear-gradient(180deg, #1A1040 0%, #0D0D2B 100%);
  --gradient-lime: linear-gradient(135deg, #C4F82A 0%, #A3D921 100%);
  --gradient-placeholder: linear-gradient(135deg, #1E1E3A 0%, #2A2A4A 100%);

  /* Shadows */
  --shadow-glow-lime: 0 4px 24px rgba(196, 248, 42, 0.3);
  --shadow-glow-purple: 0 8px 32px rgba(99, 102, 241, 0.4);
  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Body & Background
   ========================================================================== */

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(circle at 20% 30%, var(--bg-nebula-purple) 0%, transparent 50%),
    radial-gradient(circle at 80% 60%, var(--bg-nebula-blue) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, var(--bg-nebula-blue) 0%, transparent 40%),
    var(--bg-void);
  background-attachment: fixed;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  position: relative;
}

/* ==========================================================================
   Canvas
   ========================================================================== */

#star-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: auto;
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: #050510CC;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-star);
  flex-shrink: 0;
}

.navbar-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.navbar-nav {
  display: flex;
  align-items: center;
}

.btn-view-cards {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-view-cards:hover {
  background: var(--surface-card);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

.btn-view-cards svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Card Overlay & Modal
   ========================================================================== */

.card-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.card-overlay-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-dim);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card-overlay.active {
  opacity: 1;
  pointer-events: auto;
  animation: fadeIn 0.3s ease;
}

.card-modal {
  position: relative;
  width: 500px;
  max-width: 90vw;
  background: var(--gradient-card);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: var(--shadow-card), var(--shadow-glow-purple);
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

.card-image-container {
  width: 100%;
  height: 320px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
  background: var(--gradient-placeholder);
  position: relative;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
  text-align: center;
}

.card-rarity {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-star);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 100px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.card-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  margin-top: var(--space-sm);
}

.card-description {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: center;
  max-width: 400px;
}

.card-actions {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
  padding: 0 var(--space-lg) var(--space-lg);
  width: 100%;
}

.btn-save {
  padding: 14px 32px;
  background: var(--gradient-lime);
  color: var(--bg-void);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow-lime);
  transition: all 0.2s ease;
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(196, 248, 42, 0.4);
}

.btn-save:active {
  transform: translateY(0);
}

.btn-close {
  padding: 14px 24px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.btn-close:hover {
  background: var(--surface-elevated);
  border-color: var(--text-tertiary);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast-notification {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  width: 320px;
  max-width: 90vw;
  background: var(--surface-elevated);
  border: 1px solid rgba(196, 248, 42, 0.19);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: 0 4px 20px rgba(196, 248, 42, 0.08);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
  animation: slideUpToast 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-icon {
  width: 20px;
  height: 20px;
  color: var(--accent-lime);
  flex-shrink: 0;
}

.toast-message {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

/* ==========================================================================
   Guide Text
   ========================================================================== */

.guide-text {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-tertiary);
  text-align: center;
  z-index: 50;
  pointer-events: none;
}

/* ==========================================================================
   Effect Info Tooltip
   ========================================================================== */

.effect-info-tooltip {
  position: fixed;
  max-width: 360px;
  background: linear-gradient(180deg, #1A1040 0%, #0D0D2B 100%);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: var(--space-md);
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.effect-info-tooltip.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.effect-info-tooltip.fade-out {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.effect-info-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.effect-info-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.effect-info-desc {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm);
}

.effect-info-link {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.effect-info-link:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}

.effect-info-link[hidden] {
  display: none;
}

/* ==========================================================================
   Accuracy Badge
   ========================================================================== */

.effect-info-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}

.effect-info-badge.confirmed {
  background: rgba(74, 222, 128, 0.15);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.effect-info-badge.observed {
  background: rgba(96, 165, 250, 0.15);
  color: #60A5FA;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.effect-info-badge.theoretical {
  background: rgba(167, 139, 250, 0.15);
  color: #A78BFA;
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.effect-info-badge.stylized {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slideUpToast {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(100px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Star animation class (apply to canvas elements via JS) */
.star-twinkle {
  animation: twinkle 3s ease-in-out infinite;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
  .navbar-container {
    padding: 0 var(--space-md);
  }

  .navbar-title {
    font-size: 18px;
  }

  .navbar-icon {
    width: 24px;
    height: 24px;
  }

  .card-modal {
    width: 90vw;
  }

  .card-image-container {
    height: 240px;
  }

  .card-name {
    font-size: 24px;
  }

  .card-actions {
    flex-direction: column;
  }

  .btn-save,
  .btn-close {
    width: 100%;
  }

  .guide-text {
    font-size: 12px;
    padding: 0 var(--space-md);
  }
}

@media (max-width: 480px) {
  .navbar {
    height: 56px;
  }

  .btn-view-cards {
    padding: 8px 16px;
    font-size: 13px;
  }

  .card-content {
    padding: var(--space-md);
  }

  .card-name {
    font-size: 22px;
  }

  .card-desc {
    font-size: 13px;
  }
}

/* ==========================================================================
   Accessibility & Motion Preferences
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .star-twinkle {
    animation: none;
  }
}

/* Focus states for keyboard navigation */
button:focus-visible,
.btn-view-cards:focus-visible {
  outline: 2px solid var(--accent-lime);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-subtle: #4A4A6A;
    --text-secondary: #D1D1E0;
  }
}
