/* ========================================
   UI/UX Enhancements for Celestial Compass
   ======================================== */

/* ======================
   Enhanced Mobile Responsiveness
   ====================== */

/* General chart container spacing to avoid logo overlap */
.chart-container {
  margin-top: 280px !important;
}

@media (max-width: 768px) {
  /* Better mobile navigation */
  .menu-panel {
    width: 280px !important;
    right: -280px !important;
  }
  
  /* Improved chart container on mobile */
  .chart-container {
    padding: 10px !important;
    margin-top: 180px !important;
  }
  
  /* Mobile-friendly form elements */
  .cosmic-card {
    margin: 10px !important;
    padding: 15px !important;
  }
  
  /* Better button sizing on mobile */
  .btn-cosmic {
    padding: 12px 20px !important;
    font-size: 14px !important;
  }
  
  /* Chat popup mobile optimization */
  .chat-popup {
    width: 95% !important;
    height: 70vh !important;
    bottom: 10px !important;
    right: 2.5% !important;
    left: 2.5% !important;
  }
    /* Planet info cards mobile layout */
  .planet-item {
    margin-bottom: 15px !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    padding: 15px !important;
  }
  
  .planet-item model-viewer {
    margin-right: 0 !important;
    margin-bottom: 10px !important;
    align-self: center !important;
  }
  
  .planet-item > div {
    width: 100% !important;
    text-align: center !important;
  }
  
  /* Navigation improvements */
  .floating-back-btn {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .menu-panel {
    width: 100% !important;
    right: -100% !important;
  }
    .chart-container {
    margin-top: 160px !important;
  }
  
  .tier-price {
    font-size: 2rem !important;
  }
  
  .feature-list li {
    padding: 8px 0 !important;
    font-size: 14px !important;
  }
}

/* ======================
   Enhanced Loading States
   ====================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner-large {
  text-align: center;
  color: white;
}

.loading-spinner-large .spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

.loading-spinner-large p {
  font-size: 1.1rem;
  margin-top: 1rem;
  opacity: 0.9;
}

/* Enhanced typing indicator for chat */
.typing-indicator {
  padding: 10px 15px;
  margin: 5px 0;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ======================
   Advanced Micro-animations
   ====================== */
.btn-cosmic {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-cosmic:hover {
  animation: buttonPulse 0.6s ease-in-out;
}

@keyframes buttonPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1.02); }
}

.planet-item {
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.planet-item:hover {
  animation: cardFloat 0.8s ease-in-out;
}

@keyframes cardFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.02); }
}

/* Entrance animations */
.fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.fade-in-left {
  animation: fadeInLeft 0.6s ease-out;
}

.fade-in-right {
  animation: fadeInRight 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ======================
   Enhanced Menu Animations
   ====================== */
.menu-panel {
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.menu-panel.open {
  animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.menu-panel .nav-link {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

.menu-panel.open .nav-link {
  opacity: 1;
  transform: translateX(0);
}

.menu-panel.open .nav-link:nth-child(1) { transition-delay: 0.1s; }
.menu-panel.open .nav-link:nth-child(2) { transition-delay: 0.2s; }
.menu-panel.open .nav-link:nth-child(3) { transition-delay: 0.3s; }
.menu-panel.open .nav-link:nth-child(4) { transition-delay: 0.4s; }

/* ======================
   Enhanced Chat Animations
   ====================== */
.chat-popup {
  transform: translateY(100%) scale(0.8);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-popup.active {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.chat-message {
  opacity: 0;
  transform: translateY(15px);
  animation: messageAppear 0.4s ease-out forwards;
}

@keyframes messageAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user .message-content {
  animation: slideInFromRight 0.3s ease-out;
}

.chat-message.bot .message-content {
  animation: slideInFromLeft 0.3s ease-out;
}

@keyframes slideInFromRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ======================
   Form Enhancement Animations
   ====================== */
.form-control:focus {
  animation: inputFocus 0.3s ease-out;
}

@keyframes inputFocus {
  0% {
    box-shadow: 0 0 0 0 rgba(106, 17, 203, 0.4);
  }
  100% {
    box-shadow: 0 0 0 0.2rem rgba(106, 17, 203, 0.25);
  }
}

.invalid-feedback-enhanced {
  animation: shakeError 0.5s ease-in-out;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.location-suggestions {
  animation: dropdownSlide 0.3s ease-out;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ======================
   Success/Error State Animations
   ====================== */
.success-checkmark {
  animation: checkmarkDraw 0.6s ease-in-out;
}

@keyframes checkmarkDraw {
  0% {
    stroke-dasharray: 0 50;
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dasharray: 50 0;
    stroke-dashoffset: 0;
  }
}

.error-shake {
  animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ======================
   Page Transition Animations
   ====================== */
.page-enter {
  animation: pageEnter 0.6s ease-out;
}

.page-exit {
  animation: pageExit 0.6s ease-in;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageExit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ======================
   Accessibility: Reduced Motion
   ====================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .btn-cosmic::before,
  .planet-item::before {
    display: none !important;
  }
}

/* ======================
   Hardware Acceleration
   ====================== */
.btn-cosmic,
.planet-item,
.menu-panel,
.chat-popup,
.form-control {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ======================
   Dark Mode Enhancements
   ====================== */
.dark-mode .subscription-gatekeeper {
  background: linear-gradient(135deg, rgba(106, 17, 203, 0.2), rgba(37, 117, 252, 0.2));
  border-color: rgba(106, 17, 203, 0.5);
  color: #e0e0e0;
}

.dark-mode .subscription-gatekeeper::before {
  background: #333;
}

.dark-mode .alert-enhanced {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dark-mode .form-control-enhanced {
  background-color: #2a2a2a;
  border-color: #444;
  color: white;
}

.dark-mode .form-control-enhanced:focus {
  background-color: #333;
  border-color: #6a11cb;
}

/* ======================
   Enhanced Progress Indicators
   ====================== */
.progress-enhanced {
  height: 8px;
  border-radius: 4px;
  background-color: #e9ecef;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar-enhanced {
  height: 100%;
  background: linear-gradient(45deg, #6a11cb, #2575fc);
  border-radius: 4px;
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ======================
   Interactive Feedback
   ====================== */
.click-feedback {
  position: relative;
  overflow: hidden;
}

.click-feedback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.click-feedback:active::after {
  width: 300px;
  height: 300px;
}

/* ======================
   Enhanced Card Animations
   ====================== */
.card-hover-enhanced {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card-hover-enhanced:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 25px rgba(0, 0, 0, 0.15);
}

/* ======================
   Status Indicators
   ====================== */
.status-indicator {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active {
  background-color: #d4edda;
  color: #155724;
}

.status-inactive {
  background-color: #f8d7da;
  color: #721c24;
}

.status-pending {
  background-color: #fff3cd;
  color: #856404;
}

.dark-mode .status-active {
  background-color: rgba(40, 167, 69, 0.2);
  color: #4caf50;
}

.dark-mode .status-inactive {
  background-color: rgba(220, 53, 69, 0.2);
  color: #f44336;
}

.dark-mode .status-pending {
  background-color: rgba(255, 193, 7, 0.2);
  color: #ffc107;
}

/* ======================
   Enhanced Form Experience
   ====================== */
.location-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background-color: #f8f9fa;
}

.suggestion-item.no-results {
  color: #6c757d;
  cursor: default;
  font-style: italic;
}

.suggestion-item i {
  margin-right: 10px;
  color: #6a11cb;
  width: 16px;
}

.location-loading {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #6a11cb;
}

.timezone-info {
  margin-top: 5px;
  font-size: 0.85rem;
  color: #6c757d;
  display: flex;
  align-items: center;
  gap: 5px;
}

.timezone-info i {
  color: #6a11cb;
}

.quick-date-buttons {
  margin-top: 8px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.quick-date-buttons .btn {
  font-size: 0.75rem;
  padding: 4px 8px;
}

/* Enhanced loading button animation */
.btn-loading {
  pointer-events: none;
  opacity: 0.8;
  position: relative;
}

.btn-loading .loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 8px;
}

/* ======================
   Enhanced Chat Interface
   ====================== */
.chat-popup {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-message {
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.bot.thinking .message-content {
  background: linear-gradient(-45deg, #e9ecef, #f8f9fa, #e9ecef, #f8f9fa);
  background-size: 400% 400%;
  animation: thinkingGradient 2s ease-in-out infinite;
}

.dark-mode .chat-message.bot.thinking .message-content {
  background: linear-gradient(-45deg, #333, #444, #333, #444);
  background-size: 400% 400%;
}

@keyframes thinkingGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ======================
   Enhanced Planet Cards
   ====================== */
.planet-item {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.planet-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(106, 17, 203, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.planet-item:hover::before {
  opacity: 1;
}

.planet-item:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(106, 17, 203, 0.2);
}

.planet-item.expanded {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 15px 35px rgba(106, 17, 203, 0.3);
}

/* ======================
   Enhanced Accessibility
   ====================== */
.focus-visible {
  outline: 2px solid #6a11cb !important;
  outline-offset: 2px !important;
}

/* Screen reader only content */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .btn-cosmic {
    border: 2px solid currentColor;
  }
  
  .cosmic-card {
    border: 2px solid currentColor;
  }
  
  .planet-item {
    border: 1px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .btn-cosmic::before {
    display: none;
  }
  
  .planet-item::before {
    display: none;
  }
}

/* ======================
   Enhanced Mobile Touch Interactions
   ====================== */

/* Default button positioning for desktop */
.menu-toggle,
button.menu-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1003;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#themeToggleBtn,
button#themeToggleBtn {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 999;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-toggle-btn,
button.chat-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  /* Touch-friendly button sizing */
  .btn {
    min-height: 44px !important;
    padding: 12px 20px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
  
  /* Touch-friendly form inputs */
  .form-control,
  .form-select {
    min-height: 44px !important;
    font-size: 16px !important; /* Prevents zoom on iOS */
    padding: 12px 16px !important;
  }
  
  /* Enhanced mobile navigation - increased specificity for consistency */
  .menu-toggle,
  button.menu-toggle {
    position: fixed !important;
    width: 56px !important;
    height: 56px !important;
    font-size: 18px !important;
    top: auto !important;
    bottom: 80px !important;
    right: 20px !important;
    z-index: 1003 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
  }
  
  /* Mobile theme toggle positioning - increased specificity */
  #themeToggleBtn,
  button#themeToggleBtn {
    position: fixed !important;
    width: 56px !important;
    height: 56px !important;
    font-size: 18px !important;
    top: auto !important;
    bottom: 80px !important;
    left: 20px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999 !important;
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3) !important;
  }
  
  .menu-panel {
    width: 85vw !important;
    right: -85vw !important;
    padding-top: 100px !important;
  }
  
  /* Mobile-optimized chat */
  .chat-popup {
    width: 95vw !important;
    height: 70vh !important;
    right: 2.5vw !important;
    bottom: 10px !important;
    border-radius: 15px 15px 0 0 !important;
  }    /* Mobile chat button positioning - increased specificity with consistent sizing */
  .chat-toggle-btn,
  button.chat-toggle-btn {
    position: fixed !important;
    width: 56px !important;
    height: 56px !important;
    font-size: 18px !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 999 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
  }
  
  /* Mobile planet cards */
  .planet-item {
    margin-bottom: 15px !important;
    padding: 15px !important;
    border-radius: 12px !important;
  }
  
  /* Mobile-friendly charts */
  .chart-container {
    padding: 10px !important;
    margin-top: 80px !important;
  }
  
  /* Touch-friendly house labels */
  .house-label {
    font-size: 14px !important;
    padding: 8px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Mobile date-time picker */
  .flatpickr-calendar {
    max-width: 95vw !important;
    font-size: 16px !important;
  }
  
  .flatpickr-day {
    min-height: 44px !important;
    line-height: 44px !important;
  }
  
  .flatpickr-am-pm {
    min-height: 44px !important;
    min-width: 50px !important;
    font-size: 16px !important;
  }
  
  /* Mobile location suggestions */
  .location-suggestions {
    max-height: 40vh !important;
    font-size: 16px !important;
  }
  
  .suggestion-item {
    padding: 15px !important;
    min-height: 44px !important;
  }
}

@media (max-width: 480px) {
  /* Extra small mobile devices */
  .menu-panel {
    width: 100vw !important;
    right: -100vw !important;
  }
  
  .cosmic-card {
    margin: 5px !important;
    padding: 15px !important;
    border-radius: 10px !important;
  }
  
  .tier-price {
    font-size: 2rem !important;
  }
  
  .feature-list li {
    padding: 12px 0 !important;
    font-size: 14px !important;
  }
  
  /* Mobile button adjustments for very small screens - increased specificity with proper spacing */
  .menu-toggle,
  button.menu-toggle {
    bottom: 80px !important; /* Increased to maintain 10px gap with chat button */
    width: 52px !important;
    height: 52px !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #themeToggleBtn,
  button#themeToggleBtn {
    bottom: 80px !important; /* Increased to maintain consistent positioning */
    width: 52px !important;
    height: 52px !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .chat-toggle-btn,
  button.chat-toggle-btn {
    bottom: 15px !important;
    width: 52px !important;
    height: 52px !important;
    font-size: 16px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Ultra-compact planet items for very small screens */
  .planet-item {
    padding: 10px !important;
    margin-bottom: 10px !important;
  }
  
  .planet-item model-viewer {
    width: 40px !important;
    height: 40px !important;
    margin-bottom: 8px !important;
  }
  
  .planet-item div {
    font-size: 14px !important;
  }
  
  .planet-item strong {
    font-size: 15px !important;
  }
  
  /* Ultra-compact chat for very small screens */
  .chat-popup {
    width: 100vw !important;
    height: 80vh !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
  }
}

/* ======================
   Touch Feedback Animations
   ====================== */
.touch-feedback {
  position: relative;
  overflow: hidden;
}

.touch-feedback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.touch-feedback:active::after {
  width: 200px;
  height: 200px;
}

/* ======================
   Swipe Gesture Indicators
   ====================== */
.swipe-indicator {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 9999;
}

.swipe-indicator.left {
  left: 10px;
  animation: swipeLeftHint 1s ease-in-out;
}

.swipe-indicator.right {
  right: 10px;
  animation: swipeRightHint 1s ease-in-out;
}

@keyframes swipeLeftHint {
  0%, 100% { opacity: 0; transform: translateY(-50%) translateX(0); }
  50% { opacity: 1; transform: translateY(-50%) translateX(-10px); }
}

@keyframes swipeRightHint {
  0%, 100% { opacity: 0; transform: translateY(-50%) translateX(0); }
  50% { opacity: 1; transform: translateY(-50%) translateX(10px); }
}

/* ======================
   Enhanced Responsive Typography
   ====================== */
@media (max-width: 768px) {
  h1 { font-size: 2rem !important; }
  h2 { font-size: 1.75rem !important; }
  h3 { font-size: 1.5rem !important; }
  h4 { font-size: 1.25rem !important; }
  h5 { font-size: 1.1rem !important; }
  h6 { font-size: 1rem !important; }
  
  .lead {
    font-size: 1.1rem !important;
  }
  
  .small, small {
    font-size: 0.85rem !important;
  }
}

/* ======================
   Safe Area Handling for Notched Devices
   ====================== */
@supports (padding: max(0px)) {
  .menu-panel {
    padding-left: max(20px, env(safe-area-inset-left)) !important;
    padding-right: max(20px, env(safe-area-inset-right)) !important;
  }
  
  .chat-popup {
    margin-bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }
  
  .menu-toggle {
    top: max(20px, env(safe-area-inset-top)) !important;
    right: max(20px, env(safe-area-inset-right)) !important;
  }
  
  .chat-toggle-btn {
    bottom: max(20px, env(safe-area-inset-bottom)) !important;
    right: max(20px, env(safe-area-inset-right)) !important;
  }
}

/* ======================
   Chart Container Chat Animation
   ====================== */
.container.chat-open {
  transform: translateX(-200px);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (max-width: 768px) {
  .container.chat-open {
    transform: translateX(0); /* No slide on mobile due to space constraints */
  }
}

/* ======================
   Chat Integration Styles
   ====================== */
.chat-popup {
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chat-popup.active {
  display: flex !important;
  animation: chatSlideIn 0.4s ease-out;
}

@keyframes chatSlideIn {
  from {
    opacity: 0;
    transform: translateY(100%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ======================
   Planet Model Popup Styles
   ====================== */
.planet-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  animation: dramaticBackdropIn 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.planet-popup-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6a11cb 100%);
  border-radius: 25px;
  padding: 40px;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: dramaticPopupIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center center;
  overflow: hidden;
}

/* Add dramatic glow effect behind popup */
.planet-popup-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, 
    rgba(106, 17, 203, 0.3) 0%, 
    rgba(37, 117, 252, 0.2) 30%, 
    transparent 70%);
  animation: dramaticGlow 2s ease-in-out infinite alternate;
  z-index: -1;
}

.planet-popup-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 28px;
  color: white;
  cursor: pointer;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1001;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.planet-popup-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.2) rotate(90deg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.4);
}

.planet-popup-model-container {
  margin-bottom: 25px;
  position: relative;
  animation: modelFloat 3s ease-in-out infinite;
}

/* Add floating particles effect around the model */
.planet-popup-model-container::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  right: -20px;
  bottom: -20px;
  background: radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 20%, rgba(106, 17, 203, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 40% 40%, rgba(37, 117, 252, 0.15) 0%, transparent 50%);
  animation: particleFloat 4s ease-in-out infinite;
  border-radius: 50%;
  pointer-events: none;
}

.planet-popup .enlarged-model {
  width: 350px;
  height: 350px;
  border-radius: 20px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Add hover effect to the model */
.planet-popup .enlarged-model:hover {
  transform: scale(1.05);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 30px rgba(106, 17, 203, 0.3);
}

.planet-popup-info {
  color: white;
  max-width: 450px;
  animation: infoSlideUp 0.6s ease-out 0.3s both;
}

.planet-popup-info h4 {
  color: white;
  margin-bottom: 20px;
  font-size: 1.6rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* Add underline effect to title */
.planet-popup-info h4::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: titleUnderlineGrow 0.8s ease-out 0.5s both;
}

.planet-popup-info p,
.planet-popup-info small {
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  font-size: 1.05rem;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .planet-popup {
    padding: 15px;
  }
  
  .planet-popup-content {
    padding: 25px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 20px;
  }
  
  .planet-popup .enlarged-model {
    width: 280px;
    height: 280px;
  }
  
  .planet-popup-info h4 {
    font-size: 1.3rem;
  }
  
  .planet-popup-close {
    top: 10px;
    right: 15px;
    font-size: 24px;
    width: 40px;
    height: 40px;
  }
  
  .planet-popup-model-container {
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  .planet-popup-content {
    padding: 20px;
    border-radius: 15px;
  }
  
  .planet-popup .enlarged-model {
    width: 220px;
    height: 220px;
  }
  
  .planet-popup-info h4 {
    font-size: 1.15rem;
  }
  
  .planet-popup-info p,
  .planet-popup-info small {
    font-size: 0.95rem;
  }
  
  .planet-popup-close {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
}

/* Dramatic Animation Keyframes */
@keyframes dramaticBackdropIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
  }
}

@keyframes dramaticPopupIn {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(100px) rotateX(45deg);
    filter: blur(10px);
  }
  30% {
    opacity: 0.7;
    transform: scale(0.8) translateY(20px) rotateX(15deg);
    filter: blur(3px);
  }
  60% {
    opacity: 0.9;
    transform: scale(1.1) translateY(-10px) rotateX(-5deg);
    filter: blur(1px);
  }
  80% {
    opacity: 1;
    transform: scale(0.98) translateY(5px) rotateX(2deg);
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotateX(0deg);
    filter: blur(0px);
  }
}

@keyframes dramaticGlow {
  0% {
    opacity: 0.3;
    transform: scale(0.8) rotate(0deg);
  }
  100% {
    opacity: 0.7;
    transform: scale(1.2) rotate(180deg);
  }
}

@keyframes modelFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-8px) rotate(1deg);
  }
  66% {
    transform: translateY(4px) rotate(-1deg);
  }
}

@keyframes particleFloat {
  0%, 100% {
    opacity: 0.6;
    transform: rotate(0deg) scale(1);
  }
  50% {
    opacity: 1;
    transform: rotate(180deg) scale(1.1);
  }
}

@keyframes infoSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleUnderlineGrow {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 60px;
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popupSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Dark mode support for popup */
.dark-mode .planet-popup-content {
  background: linear-gradient(135deg, 
    #1a1a2e 0%, 
    #16213e 25%, 
    #0f3460 50%, 
    #533483 75%, 
    #6a11cb 100%);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 50px rgba(106, 17, 203, 0.3);
}

.dark-mode .planet-popup-content::before {
  background: radial-gradient(circle, 
    rgba(37, 117, 252, 0.4) 0%, 
    rgba(106, 17, 203, 0.3) 30%, 
    transparent 70%);
}
