/* ============================================================
   Cosmic Dharma — Premium Vedic Astrology UI v3.0
   Ultra-modern dark cosmic theme with polished light mode
   ============================================================ */

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

:root {
  --cosmic-900: #050510;
  --cosmic-800: #0a0a1a;
  --cosmic-700: #0f0f2e;
  --cosmic-600: #161640;
  --cosmic-500: #1e1e54;
  --cosmic-400: #2a2a6e;
  --neon-blue: #00d4ff;
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-gold: #f59e0b;
  --neon-green: #10b981;
  --glass-bg: rgba(15, 15, 46, 0.6);
  --glass-border: rgba(168, 85, 250, 0.15);
  --card-radius: 16px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
}

/* === Global Styles === */
body {
  background: var(--cosmic-900);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(88, 28, 135, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(15, 23, 42, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(30, 58, 138, 0.1) 0%, transparent 50%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   LIGHT MODE — Premium clean theme (#F8F9FB)
   ============================================================ */
html:not(.dark) {
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(100, 100, 180, 0.12);
  --neon-purple: #7c3aed;
  --neon-blue: #0284c7;
  --neon-pink: #db2777;
  --neon-gold: #d97706;
  --neon-green: #059669;
}

html:not(.dark) body {
  background: #F8F9FB;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(2, 132, 199, 0.03) 0%, transparent 50%);
  color: #1a1a2e;
}

/* Light mode cards — no glassmorphism, subtle shadows */
html:not(.dark) .glass-card,
html:not(.dark) .glass-card-static {
  background: rgba(255, 255, 255, 0.92) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: rgba(100, 100, 180, 0.1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 20px rgba(0, 0, 0, 0.03) !important;
}

html:not(.dark) .glass-card:hover {
  border-color: rgba(124, 58, 237, 0.2) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.04) !important;
  transform: translateY(-1px);
}

/* Light mode text */
html:not(.dark) .text-white { color: #1a1a2e !important; }
html:not(.dark) .text-white\/30 { color: rgba(26, 26, 46, 0.4) !important; }
html:not(.dark) .text-white\/40 { color: rgba(26, 26, 46, 0.5) !important; }
html:not(.dark) .text-white\/50 { color: rgba(26, 26, 46, 0.6) !important; }
html:not(.dark) .text-white\/60 { color: rgba(26, 26, 46, 0.7) !important; }
html:not(.dark) .text-white\/70 { color: rgba(26, 26, 46, 0.8) !important; }
html:not(.dark) .text-white\/80 { color: rgba(26, 26, 46, 0.9) !important; }

/* Light mode nav and sidebar */
html:not(.dark) nav {
  background: rgba(248, 249, 251, 0.9) !important;
  border-color: rgba(100, 100, 180, 0.08) !important;
}

html:not(.dark) .sidebar {
  background: rgba(248, 249, 251, 0.98) !important;
  border-color: rgba(100, 100, 180, 0.1) !important;
}

html:not(.dark) .sidebar-overlay.active {
  background: rgba(0, 0, 0, 0.2);
}

html:not(.dark) .sidebar-link { color: rgba(26, 26, 46, 0.5) !important; }
html:not(.dark) .sidebar-link:hover { background: rgba(124, 58, 237, 0.06) !important; color: rgba(26, 26, 46, 0.8) !important; }
html:not(.dark) .sidebar-link.active { background: rgba(124, 58, 237, 0.08) !important; color: #7c3aed !important; border-left-color: #7c3aed !important; }

/* Light mode inputs */
html:not(.dark) .cosmic-input {
  background: #fff !important;
  border-color: rgba(100, 100, 180, 0.15) !important;
  color: #1a1a2e !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .cosmic-input:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html:not(.dark) .cosmic-input::placeholder { color: rgba(26, 26, 46, 0.35) !important; }

/* Light mode buttons */
html:not(.dark) .btn-primary {
  background: linear-gradient(135deg, #7c3aed, #4f46e5, #0284c7) !important;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2) !important;
}

html:not(.dark) .btn-primary:hover {
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3) !important;
}

html:not(.dark) .btn-secondary {
  background: rgba(124, 58, 237, 0.06) !important;
  border-color: rgba(124, 58, 237, 0.2) !important;
  color: #7c3aed !important;
}

/* Light mode neon text — softer, no glow */
html:not(.dark) .neon-text-blue { color: #0284c7 !important; text-shadow: none !important; }
html:not(.dark) .neon-text-purple { color: #7c3aed !important; text-shadow: none !important; }
html:not(.dark) .neon-text-gold { color: #d97706 !important; text-shadow: none !important; }
html:not(.dark) .neon-text-pink { color: #db2777 !important; text-shadow: none !important; }
html:not(.dark) .neon-text-cyan { color: #0891b2 !important; text-shadow: none !important; }

/* Light mode remove all neon glows */
html:not(.dark) .neon-glow-blue,
html:not(.dark) .neon-glow-purple,
html:not(.dark) .neon-glow-gold { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important; }

/* Light mode tabs */
html:not(.dark) .tab-btn { color: rgba(26, 26, 46, 0.5) !important; }
html:not(.dark) .tab-btn:hover { color: rgba(26, 26, 46, 0.7) !important; background: rgba(124, 58, 237, 0.06) !important; }
html:not(.dark) .tab-btn.active { background: rgba(124, 58, 237, 0.1) !important; border-color: rgba(124, 58, 237, 0.25) !important; color: #7c3aed !important; box-shadow: none !important; }

/* Light mode tables */
html:not(.dark) tr { border-color: rgba(100, 100, 180, 0.06) !important; }
html:not(.dark) tr:hover { background: rgba(124, 58, 237, 0.03) !important; }

/* Light mode severity meter */
html:not(.dark) .severity-meter { background: rgba(0, 0, 0, 0.06) !important; }
html:not(.dark) .timeline-bar { background: rgba(0, 0, 0, 0.06) !important; }

/* Light mode chart */
html:not(.dark) .si-cell { background: rgba(124, 58, 237, 0.02) !important; border-color: rgba(100, 100, 180, 0.15) !important; }
html:not(.dark) .si-cell:hover { background: rgba(124, 58, 237, 0.06) !important; }
html:not(.dark) .si-cell-asc { background: rgba(124, 58, 237, 0.06) !important; border-color: rgba(124, 58, 237, 0.4) !important; }
html:not(.dark) .si-center { background: rgba(248, 249, 251, 0.9) !important; border-color: rgba(100, 100, 180, 0.1) !important; }
html:not(.dark) .si-sign-num { color: rgba(124, 58, 237, 0.55) !important; }
html:not(.dark) .si-asc-label { color: #7c3aed !important; }

/* Light mode stars — hidden */
html:not(.dark) .stars-bg { opacity: 0 !important; }

/* Light mode scrollbar */
html:not(.dark) ::-webkit-scrollbar-thumb { background: rgba(100, 100, 180, 0.2) !important; }

/* Light mode planet badge */
html:not(.dark) .planet-badge { background: rgba(124, 58, 237, 0.06) !important; border-color: rgba(124, 58, 237, 0.12) !important; }

/* Light mode dasha row */
html:not(.dark) .dasha-row-wrap:hover { background: rgba(124, 58, 237, 0.04) !important; }
html:not(.dark) .dasha-row-wrap.current { background: rgba(124, 58, 237, 0.06) !important; border-left-color: #7c3aed !important; }

/* ============================================================
   DARK MODE (default)
   ============================================================ */

/* === Animated Stars Background === */
.stars-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  transition: opacity 0.6s ease;
}

.stars-bg .star {
  position: absolute;
  width: 2px; height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--duration, 3s) ease-in-out infinite;
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: var(--max-opacity, 0.8); transform: scale(1); }
}

/* === Glassmorphism Cards (dark mode only) === */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: rgba(168, 85, 250, 0.3);
  box-shadow: 0 8px 40px rgba(168, 85, 250, 0.08), 0 0 60px rgba(0, 212, 255, 0.03);
  transform: translateY(-2px);
}

.glass-card-static {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
}

/* === Neon Glow Effects (dark mode) === */
.neon-glow-blue { box-shadow: 0 0 20px rgba(0, 212, 255, 0.25), 0 0 50px rgba(0, 212, 255, 0.08); }
.neon-glow-purple { box-shadow: 0 0 20px rgba(168, 85, 250, 0.25), 0 0 50px rgba(168, 85, 250, 0.08); }
.neon-glow-gold { box-shadow: 0 0 20px rgba(245, 158, 11, 0.25), 0 0 50px rgba(245, 158, 11, 0.08); }

.neon-text-blue { color: var(--neon-blue); text-shadow: 0 0 15px rgba(0, 212, 255, 0.4); }
.neon-text-purple { color: var(--neon-purple); text-shadow: 0 0 15px rgba(168, 85, 250, 0.4); }
.neon-text-gold { color: var(--neon-gold); text-shadow: 0 0 15px rgba(245, 158, 11, 0.4); }
.neon-text-pink { color: var(--neon-pink); text-shadow: 0 0 15px rgba(236, 72, 153, 0.4); }
.neon-text-cyan { color: #06b6d4; text-shadow: 0 0 15px rgba(6, 182, 212, 0.4); }

/* === Buttons === */
.btn-primary {
  background: linear-gradient(135deg, #a855f7, #6366f1, #00d4ff);
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
  color: white;
  font-weight: 600;
  padding: 12px 32px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before { left: 100%; }

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(168, 85, 250, 0.35);
}

.btn-secondary {
  background: rgba(168, 85, 250, 0.1);
  border: 1px solid rgba(168, 85, 250, 0.3);
  color: #a855f7;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  font-family: var(--font-display);
}

.btn-secondary:hover {
  background: rgba(168, 85, 250, 0.18);
  border-color: rgba(168, 85, 250, 0.45);
  transform: translateY(-1px);
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* === Form Inputs === */
.cosmic-input {
  background: rgba(15, 15, 46, 0.8);
  border: 1px solid rgba(168, 85, 250, 0.2);
  border-radius: 12px;
  padding: 14px 18px;
  color: white;
  font-size: 15px;
  font-family: var(--font-sans);
  transition: var(--transition-smooth);
  width: 100%;
  outline: none;
}

.cosmic-input:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 250, 0.12), 0 0 15px rgba(168, 85, 250, 0.06);
}

.cosmic-input::placeholder { color: rgba(255, 255, 255, 0.3); }

/* === Chart Styles === */
.chart-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.chart-container svg { width: 100%; height: auto; }

.planet-in-chart {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.planet-in-chart:hover {
  filter: drop-shadow(0 0 6px var(--neon-blue));
}

/* === Chart Tooltip === */
.chart-tooltip {
  position: fixed;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  max-width: 200px;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(168, 85, 250, 0.25);
  color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html:not(.dark) .chart-tooltip {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(100, 100, 180, 0.15) !important;
  color: #1a1a2e !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
}

.chart-tooltip.visible { opacity: 1; }

/* === Severity Meter === */
.severity-meter {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.severity-meter .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.severity-low .fill { background: linear-gradient(90deg, #10b981, #34d399); }
.severity-medium .fill { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.severity-high .fill { background: linear-gradient(90deg, #ef4444, #f87171); }

/* === Timeline === */
.timeline-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.timeline-bar .progress {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue));
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Tabs === */
.tab-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-display);
}

.tab-btn:hover { color: rgba(255, 255, 255, 0.75); background: rgba(168, 85, 250, 0.08); }

.tab-btn.active {
  background: rgba(168, 85, 250, 0.15);
  border-color: rgba(168, 85, 250, 0.35);
  color: white;
  box-shadow: 0 0 15px rgba(168, 85, 250, 0.1);
}

/* === Sidebar Overlay === */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 1024px) {
  .sidebar-overlay { display: none !important; }
}

/* === Sidebar === */
.sidebar {
  width: 280px;
  height: 100vh;
  background: rgba(10, 10, 26, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(168, 85, 250, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  left: 0; top: 0;
  z-index: 40;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-smooth);
  cursor: pointer;
  text-decoration: none;
  margin: 2px 12px;
  border-left: 3px solid transparent;
}

.sidebar-link:hover { background: rgba(168, 85, 250, 0.08); color: rgba(255, 255, 255, 0.75); }

.sidebar-link.active {
  background: rgba(168, 85, 250, 0.12);
  color: white;
  border-left-color: var(--neon-purple);
}

.sidebar-link i { width: 20px; text-align: center; font-size: 15px; }

/* === Dashboard Content === */
.dashboard-content {
  padding: 24px;
  padding-top: 24px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 250, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 250, 0.4); }

/* === Animations === */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulse-glow { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-in-left { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes chart-draw { from { opacity: 0; stroke-dashoffset: 1000; } to { opacity: 1; stroke-dashoffset: 0; } }
@keyframes planet-appear { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }

.animate-float { animation: float 6s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }
.animate-spin-slow { animation: spin-slow 30s linear infinite; }
.animate-fade-in { animation: fade-in 0.5s ease forwards; }
.animate-slide-left { animation: slide-in-left 0.4s ease forwards; }
.animate-slide-right { animation: slide-in-right 0.4s ease forwards; }
.animate-scale-in { animation: scale-in 0.35s ease forwards; }

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* === Skeleton Loader === */
.skeleton {
  background: linear-gradient(90deg,
    rgba(168, 85, 250, 0.05) 25%,
    rgba(168, 85, 250, 0.1) 50%,
    rgba(168, 85, 250, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

html:not(.dark) .skeleton {
  background: linear-gradient(90deg,
    rgba(100, 100, 180, 0.06) 25%,
    rgba(100, 100, 180, 0.12) 50%,
    rgba(100, 100, 180, 0.06) 75%
  ) !important;
  background-size: 200% 100% !important;
}

/* === Collapsible Sections === */
.section-collapse-toggle {
  cursor: pointer;
  user-select: none;
}

.section-collapse-toggle .collapse-icon {
  transition: transform 0.3s ease;
}

.section-collapse-toggle.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.collapsible-content {
  max-height: 5000px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
}

/* === Zodiac Wheel === */
.zodiac-wheel {
  position: relative;
  width: 400px;
  height: 400px;
  margin: 0 auto;
}

.zodiac-ring {
  position: absolute;
  border: 2px solid rgba(168, 85, 250, 0.2);
  border-radius: 50%;
  animation: spin-slow 60s linear infinite;
}

.zodiac-symbol {
  position: absolute;
  font-size: 20px;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.zodiac-symbol:hover {
  transform: scale(1.3);
  filter: drop-shadow(0 0 8px var(--neon-purple));
}

/* ============================================================
   RESPONSIVE — Comprehensive breakpoints for ALL devices
   ============================================================ */

/* === Extra-small devices (phones <360px, e.g. iPhone SE, Galaxy Fold) === */
@media (max-width: 359px) {
  body { font-size: 13px; }
  .glass-card { border-radius: 10px; }
  .glass-card:hover { transform: none; }
  .btn-primary { padding: 10px 20px; font-size: 14px; border-radius: 10px; }
  .btn-secondary { padding: 8px 16px; font-size: 13px; }
  .cosmic-input { padding: 10px 14px; font-size: 14px; border-radius: 10px; }
  .tab-btn { padding: 6px 10px; font-size: 11px; border-radius: 8px; }
  .sidebar { width: 260px; }
  .sidebar-link { padding: 9px 14px; font-size: 13px; margin: 2px 8px; }
  .ni-chart { max-width: 280px; }
  .si-chart { max-width: 280px; }
  .si-planet { font-size: 7px; }
  .si-sign-num { font-size: 8px; }
  .si-asc-label { font-size: 6px; }
  .zodiac-wheel { width: 200px; height: 200px; }
  .dasha-row-header { gap: 8px; }
  .dasha-row-header .w-10 { width: 32px; height: 32px; min-width: 32px; }
  .dasha-detail-inner { padding-left: 40px; }
  .dasha-sub-item { padding: 6px 8px; }
  .dasha-sub-item .text-xs { font-size: 10px; }
  .dasha-sub-item .text-\[10px\] { font-size: 9px; }
  .planet-badge { padding: 3px 6px; font-size: 10px; }
  .chart-container { max-width: 280px; }
  .severity-meter { height: 6px; }
}

/* === Small devices (phones 360px-480px) === */
@media (min-width: 360px) and (max-width: 479px) {
  .ni-chart { max-width: 320px; }
  .si-chart { max-width: 320px; }
  .zodiac-wheel { width: 240px; height: 240px; }
  .dasha-row-header { gap: 10px; }
  .dasha-detail-inner { padding-left: 48px; }
}

/* === Mobile (all phones <640px) === */
@media (max-width: 639px) {
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); }
  .dashboard-content { margin-left: 0 !important; padding: 12px !important; padding-top: 56px !important; }
  .zodiac-wheel { width: 260px; height: 260px; }
  .mobile-menu-btn { display: flex !important; }

  /* Prevent hover effects on touch devices */
  .glass-card:hover { transform: none; }

  /* Stack grids for mobile */
  .grid.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid.lg\:grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.lg\:grid-cols-3 { grid-template-columns: 1fr; }
  .grid.lg\:grid-cols-5 { grid-template-columns: 1fr; }

  /* Dasha responsive */
  .dasha-row-wrap { padding: 10px 12px; }
  .dasha-detail-inner { padding-left: 0; padding-top: 10px; }
  .dasha-detail-inner .grid { grid-template-columns: 1fr !important; }
  .dasha-sub-item { padding: 8px 10px; }

  /* Chart responsive */
  .ni-chart { max-width: 340px; }
  .si-chart { max-width: 340px; }
  .chart-container { max-width: 340px; }

  /* Table responsive */
  table { font-size: 12px; }
  th, td { padding: 6px 4px !important; }

  /* Ashtakavarga bar chart */
  .grid.grid-cols-12 { gap: 1px; }
  .grid.grid-cols-12 .text-\[9px\] { font-size: 7px; }
  .grid.grid-cols-12 .text-\[8px\] { font-size: 6px; }

  /* Insights strength circles */
  .grid.lg\:grid-cols-6 { grid-template-columns: repeat(3, 1fr); }
}

/* === Tablets small (640px-767px) === */
@media (min-width: 640px) and (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dashboard-content { margin-left: 0 !important; padding: 16px !important; padding-top: 56px !important; }
  .mobile-menu-btn { display: flex !important; }
  .zodiac-wheel { width: 300px; height: 300px; }
  .ni-chart { max-width: 380px; }
  .si-chart { max-width: 380px; }

  /* Dasha responsive */
  .dasha-detail-inner { padding-left: 56px; }

  /* Glass card don't fly on tap */
  .glass-card:hover { transform: none; }
}

/* === Tablets (768px-1023px) === */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .dashboard-content { margin-left: 0 !important; padding: 20px !important; padding-top: 56px !important; }
  .mobile-menu-btn { display: flex !important; }
  .zodiac-wheel { width: 340px; height: 340px; }
  .ni-chart { max-width: 420px; }
  .si-chart { max-width: 420px; }

  /* Better grid on tablets */
  .grid.lg\:grid-cols-5 { grid-template-columns: 1fr 1fr; }
  .grid.lg\:grid-cols-5 > :first-child { grid-column: 1 / -1; }
}

/* === Small desktops (1024px-1279px) === */
@media (min-width: 1024px) and (max-width: 1279px) {
  .mobile-menu-btn { display: none !important; }
  .sidebar { transform: translateX(0); }
  .dashboard-content { margin-left: 280px; }
  .zodiac-wheel { width: 380px; height: 380px; }
}

/* === Desktops (1280px+) === */
@media (min-width: 1280px) {
  .mobile-menu-btn { display: none !important; }
  .sidebar { transform: translateX(0); }
  .dashboard-content { margin-left: 280px; }
  .zodiac-wheel { width: 400px; height: 400px; }
}

/* === Large desktops (1536px+) === */
@media (min-width: 1536px) {
  .dashboard-content { max-width: 1400px; }
  .ni-chart { max-width: 500px; }
  .si-chart { max-width: 480px; }
}

/* === Ultra-wide monitors (1920px+) === */
@media (min-width: 1920px) {
  .dashboard-content { max-width: 1600px; }
}

/* === Touch device optimization === */
@media (hover: none) and (pointer: coarse) {
  .glass-card:hover { transform: none; box-shadow: none; border-color: var(--glass-border); }
  .dasha-row-wrap:hover { background: transparent; }
  .dasha-row-wrap.current:hover { background: rgba(168, 85, 250, 0.1); }
  .dasha-sub-item:hover { background: transparent; }
  .planet-badge:hover { background: rgba(168, 85, 250, 0.08); box-shadow: none; }
  .si-cell:hover { background: rgba(15, 15, 46, 0.25); border-color: rgba(168, 85, 250, 0.2); }
  .btn-primary:hover { transform: none; }
  .btn-secondary:hover { transform: none; }
  .sidebar-link { padding: 13px 20px; }
}

/* === Landscape phones (short height) === */
@media (max-height: 500px) and (orientation: landscape) {
  .zodiac-wheel { width: 180px; height: 180px; }
  .ni-chart { max-width: 300px; }
  .si-chart { max-width: 300px; }
  .sidebar { overflow-y: auto; }
}

/* === Sidebar overlay backdrop on mobile === */
@media (max-width: 1023px) {
  .sidebar {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }
}

/* === North Indian Chart === */
.ni-chart {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1;
  margin: 0 auto;
  --ni-line: rgba(168, 85, 250, 0.3);
  --ni-line-dim: rgba(168, 85, 250, 0.18);
  --ni-sign-color: rgba(168, 85, 250, 0.55);
  --ni-asc-color: #a855f7;
}

.ni-chart .ni-svg {
  width: 100%;
  height: auto;
  display: block;
}

.ni-chart svg text {
  font-family: var(--font-display);
  font-weight: 500;
}

/* Chart SVG light mode adjustments */
html:not(.dark) .ni-chart {
  --ni-line: rgba(100, 100, 180, 0.3) !important;
  --ni-line-dim: rgba(100, 100, 180, 0.15) !important;
  --ni-sign-color: rgba(100, 80, 180, 0.55) !important;
  --ni-asc-color: #7c3aed !important;
}

html:not(.dark) .ni-chart svg line,
html:not(.dark) .ni-chart svg rect,
html:not(.dark) .ni-chart svg polygon {
  stroke: rgba(100, 100, 180, 0.25) !important;
}

/* === South Indian Chart === */
.si-chart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  max-width: 420px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.si-cell {
  border: 1px solid rgba(168, 85, 250, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 3px;
  position: relative;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: rgba(15, 15, 46, 0.25);
  border-radius: 4px;
  min-height: 0;
  overflow: hidden;
}

.si-cell:hover {
  background: rgba(168, 85, 250, 0.12);
  border-color: rgba(168, 85, 250, 0.4);
}

.si-cell-asc {
  border-color: rgba(168, 85, 250, 0.5) !important;
  background: rgba(168, 85, 250, 0.06) !important;
}

.si-sign-num {
  position: absolute;
  top: 2px;
  left: 5px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(168, 85, 250, 0.45);
  font-family: var(--font-display);
  line-height: 1;
}

.si-asc-label {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 7px;
  font-weight: 700;
  color: #a855f7;
  font-family: var(--font-display);
  line-height: 1;
}

.si-planets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 4px;
  padding-top: 10px;
}

.si-planet {
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease;
  font-family: var(--font-display);
  line-height: 1.2;
}

.si-planet:hover {
  transform: scale(1.3);
  filter: drop-shadow(0 0 4px currentColor);
}

.si-center {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  border: 1px solid rgba(168, 85, 250, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 16, 0.4);
  border-radius: 4px;
  padding: 8px;
  text-align: center;
}

/* === Loading Spinner === */
.cosmic-loader {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(168, 85, 250, 0.1);
  border-top-color: var(--neon-purple);
  animation: spin-slow 1s linear infinite;
}

html:not(.dark) .cosmic-loader {
  border-color: rgba(124, 58, 237, 0.1) !important;
  border-top-color: #7c3aed !important;
}

/* === Planet Badge === */
.planet-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(168, 85, 250, 0.08);
  border: 1px solid rgba(168, 85, 250, 0.18);
  transition: var(--transition-smooth);
  cursor: pointer;
}

.planet-badge:hover {
  background: rgba(168, 85, 250, 0.15);
  border-color: rgba(168, 85, 250, 0.35);
  box-shadow: 0 0 12px rgba(168, 85, 250, 0.15);
}

.planet-badge.retro { border-color: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.planet-badge.exalted { border-color: rgba(16, 185, 129, 0.35); color: #6ee7b7; }
.planet-badge.debilitated { border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; }

html:not(.dark) .planet-badge.retro { color: #dc2626 !important; }
html:not(.dark) .planet-badge.exalted { color: #059669 !important; }
html:not(.dark) .planet-badge.debilitated { color: #dc2626 !important; }

/* === Pricing Cards === */
.pricing-card {
  position: relative;
  overflow: hidden;
}

.pricing-card.featured::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-blue), var(--neon-pink));
}

/* === Dasha Timeline === */
.dasha-row-wrap {
  display: block;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: var(--transition-smooth);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.dasha-row-wrap:hover { background: rgba(168, 85, 250, 0.06); }
.dasha-row-wrap.current { background: rgba(168, 85, 250, 0.1); border-left-color: var(--neon-purple); }

.dasha-row-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.dasha-chevron {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.dasha-row-wrap.expanded .dasha-chevron {
  transform: rotate(180deg);
}

.dasha-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
}

.dasha-row-wrap.expanded .dasha-detail {
  max-height: 2000px;
  opacity: 1;
}

.dasha-detail-inner {
  padding-top: 12px;
  padding-left: 56px;
}

.dasha-sub-item {
  transition: background 0.2s ease;
}

.dasha-sub-item:hover {
  background: rgba(168, 85, 250, 0.08);
}

/* === Theme Toggle Animation === */
.theme-toggle-btn {
  position: relative;
  overflow: hidden;
}

.theme-toggle-btn i {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.theme-toggle-btn:active i {
  transform: rotate(180deg) scale(0.8);
}

/* === Page Transitions === */
.page-enter { animation: fade-in 0.35s ease forwards; }

/* === Print/PDF Styles === */
@media print {
  body {
    background: white !important;
    color: black !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .glass-card, .glass-card-static {
    background: white !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    page-break-inside: avoid;
  }

  .sidebar, .sidebar-overlay, .no-print, .mobile-menu-btn, .stars-bg { display: none !important; }
  .dashboard-content { margin-left: 0 !important; padding: 0 !important; }

  /* PDF brand header */
  .pdf-header {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #7c3aed;
  }

  .pdf-header .brand {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #7c3aed;
  }

  .pdf-header .subtitle {
    font-size: 12px;
    color: #666;
  }

  /* Hide interactive elements */
  .tab-btn, button, .btn-primary, .btn-secondary { display: none !important; }
  
  /* Better table printing */
  table { page-break-inside: avoid; }
  tr { page-break-inside: avoid; }
  
  /* Ensure chart fits on page */
  .ni-chart, .si-chart { max-width: 350px !important; }
  
  h1, h2, h3 { page-break-after: avoid; color: #1a1a2e !important; }
  p { color: #333 !important; }
}

/* Hide PDF header in normal view */
.pdf-header { display: none; }
