/* Spectacular Enhanced UI - Ultra Premium Effects
   Next-generation visual effects for MDS Genie
   ================================================== */

/* ========================================
   Aurora Borealis Background Effect
   ======================================== */

.aurora-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -2;
  background: var(--spectrum-bg-void);
}

.aurora {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background: 
    radial-gradient(ellipse at 20% 80%, rgba(120, 255, 214, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 119, 225, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(191, 120, 255, 0.2) 0%, transparent 50%);
  animation: aurora-shift 30s ease-in-out infinite;
  filter: blur(40px);
  mix-blend-mode: screen;
}

@keyframes aurora-shift {
  0%, 100% {
    transform: rotate(0deg) scale(1) translate(0, 0);
  }
  25% {
    transform: rotate(90deg) scale(1.2) translate(10%, -10%);
  }
  50% {
    transform: rotate(180deg) scale(0.9) translate(-5%, 15%);
  }
  75% {
    transform: rotate(270deg) scale(1.1) translate(15%, 5%);
  }
}

/* ========================================
   Morphing Blob Shapes
   ======================================== */

.blob-container {
  position: fixed;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.blob {
  position: absolute;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  filter: blur(40px);
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  animation: blob-morph 20s ease-in-out infinite;
  mix-blend-mode: color-dodge;
}

.blob-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  right: -100px;
  animation-delay: 5s;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(14, 165, 233, 0.1) 100%);
}

.blob-3 {
  width: 350px;
  height: 350px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 10s;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(244, 63, 94, 0.1) 100%);
}

@keyframes blob-morph {
  0%, 100% {
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    border-radius: 70% 30% 50% 50% / 30% 70% 30% 70%;
    transform: translate(50px, -50px) rotate(90deg);
  }
  50% {
    border-radius: 30% 70% 40% 60% / 70% 30% 60% 40%;
    transform: translate(-50px, 50px) rotate(180deg);
  }
  75% {
    border-radius: 60% 40% 30% 70% / 40% 60% 70% 30%;
    transform: translate(30px, 30px) rotate(270deg);
  }
}

/* ========================================
   Interactive Particle Network
   ======================================== */

.particle-network {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.particle-network canvas {
  width: 100%;
  height: 100%;
  opacity: 0.5;
}

/* ========================================
   Holographic Text Effects
   ======================================== */

.text-holographic {
  background: linear-gradient(
    45deg,
    #ff0080,
    #ff8c00,
    #ffd700,
    #00ff00,
    #00ffff,
    #0080ff,
    #8000ff,
    #ff0080
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holographic-shift 3s ease-in-out infinite;
  filter: brightness(1.2) contrast(1.1);
  text-shadow: 
    0 0 20px rgba(255, 255, 255, 0.5),
    0 0 40px rgba(255, 0, 128, 0.5),
    0 0 60px rgba(0, 255, 255, 0.5);
}

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

/* ========================================
   Glitch Text Effect
   ======================================== */

.text-glitch {
  position: relative;
  display: inline-block;
}

.text-glitch::before,
.text-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.text-glitch::before {
  animation: glitch-1 0.5s infinite;
  color: #00ffff;
  z-index: -1;
}

.text-glitch::after {
  animation: glitch-2 0.5s infinite;
  color: #ff00ff;
  z-index: -2;
}

@keyframes glitch-1 {
  0%, 100% {
    clip-path: inset(0 0 0 0);
    transform: translate(0);
  }
  20% {
    clip-path: inset(30% 0 40% 0);
    transform: translate(-2px, 2px);
  }
  40% {
    clip-path: inset(60% 0 20% 0);
    transform: translate(2px, -2px);
  }
  60% {
    clip-path: inset(10% 0 80% 0);
    transform: translate(-1px, 1px);
  }
  80% {
    clip-path: inset(70% 0 10% 0);
    transform: translate(1px, -1px);
  }
}

@keyframes glitch-2 {
  0%, 100% {
    clip-path: inset(0 0 0 0);
    transform: translate(0);
  }
  20% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(2px, -2px);
  }
  40% {
    clip-path: inset(20% 0 60% 0);
    transform: translate(-2px, 2px);
  }
  60% {
    clip-path: inset(80% 0 10% 0);
    transform: translate(1px, -1px);
  }
  80% {
    clip-path: inset(10% 0 70% 0);
    transform: translate(-1px, 1px);
  }
}

/* ========================================
   Typewriter Effect
   ======================================== */

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--spectrum-primary-400);
  animation: 
    typewriter 3s steps(40, end),
    blink-caret 0.75s step-end infinite;
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--spectrum-primary-400); }
}

/* ========================================
   Magnetic Cursor Effect Styles
   ======================================== */

.magnetic-area {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cursor-trail {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--spectrum-primary-400);
  pointer-events: none;
  opacity: 0;
  transform: scale(0);
  z-index: 9999;
}

/* ========================================
   Neumorphic Components
   ======================================== */

.neumorphic-card {
  background: var(--spectrum-bg-elevated);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 
    20px 20px 60px rgba(0, 0, 0, 0.5),
    -20px -20px 60px rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.neumorphic-card:hover {
  box-shadow: 
    10px 10px 30px rgba(0, 0, 0, 0.5),
    -10px -10px 30px rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.neumorphic-button {
  background: var(--spectrum-bg-elevated);
  border: none;
  border-radius: 15px;
  padding: 1rem 2rem;
  color: var(--text);
  font-weight: 600;
  box-shadow: 
    8px 8px 20px rgba(0, 0, 0, 0.4),
    -8px -8px 20px rgba(255, 255, 255, 0.05),
    inset 0 0 0 rgba(0, 0, 0, 0),
    inset 0 0 0 rgba(255, 255, 255, 0);
  transition: all 0.3s ease;
  cursor: pointer;
}

.neumorphic-button:hover {
  box-shadow: 
    12px 12px 30px rgba(0, 0, 0, 0.4),
    -12px -12px 30px rgba(255, 255, 255, 0.05),
    inset 0 0 0 rgba(0, 0, 0, 0),
    inset 0 0 0 rgba(255, 255, 255, 0);
}

.neumorphic-button:active {
  box-shadow: 
    0 0 0 rgba(0, 0, 0, 0.4),
    0 0 0 rgba(255, 255, 255, 0.05),
    inset 8px 8px 20px rgba(0, 0, 0, 0.4),
    inset -8px -8px 20px rgba(255, 255, 255, 0.05);
}

/* ========================================
   Liquid Motion Buttons
   ======================================== */

.liquid-button {
  position: relative;
  padding: 1rem 2rem;
  border: none;
  background: var(--spectrum-primary-500);
  color: white;
  font-weight: 600;
  border-radius: 50px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.liquid-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.liquid-button:hover::before {
  width: 300px;
  height: 300px;
}

.liquid-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 48%, rgba(255, 255, 255, 0.03) 50%, transparent 52%);
  transform: rotate(45deg);
  transition: all 0.5s;
}

.liquid-button:hover::after {
  animation: liquid-shine 0.5s ease-in-out;
}

@keyframes liquid-shine {
  0% { transform: rotate(45deg) translateY(0); }
  100% { transform: rotate(45deg) translateY(200%); }
}

/* ========================================
   Advanced Loading Animations
   ======================================== */

.loader-dna {
  width: 60px;
  height: 60px;
  position: relative;
  display: inline-block;
}

.loader-dna::before,
.loader-dna::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--spectrum-primary-400);
  animation: dna-rotate 2s linear infinite;
}

.loader-dna::after {
  border-top-color: var(--spectrum-health-teal);
  animation-delay: 0.5s;
}

@keyframes dna-rotate {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(0.8); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Pulse loader */
.loader-pulse {
  display: inline-block;
  width: 40px;
  height: 40px;
  position: relative;
}

.loader-pulse span {
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--spectrum-primary-400);
  opacity: 0.6;
  animation: pulse-expand 2s ease-out infinite;
}

.loader-pulse span:nth-child(2) {
  animation-delay: 0.5s;
}

.loader-pulse span:nth-child(3) {
  animation-delay: 1s;
}

@keyframes pulse-expand {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* ========================================
   Skeleton Screens with Shimmer
   ======================================== */

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--spectrum-bg-elevated);
  border-radius: 8px;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  animation: skeleton-shimmer 2s infinite;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-title {
  height: 32px;
  width: 60%;
  margin-bottom: 16px;
  border-radius: 4px;
}

.skeleton-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

/* ========================================
   Ripple Effect
   ======================================== */

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ========================================
   Custom Scrollbar
   ======================================== */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--spectrum-bg-dark);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--spectrum-primary-400), var(--spectrum-health-teal));
  border-radius: 6px;
  border: 2px solid var(--spectrum-bg-dark);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--spectrum-primary-500), var(--spectrum-health-emerald));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--spectrum-primary-400) var(--spectrum-bg-dark);
}

/* ========================================
   Page Transitions
   ======================================== */

.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--spectrum-bg-deep);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-transition.active {
  opacity: 1;
  pointer-events: all;
}

/* ========================================
   Floating Action Button
   ======================================== */

.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--spectrum-gradient-health);
  background-size: 200% 200%;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  animation: fab-float 3s ease-in-out infinite;
  z-index: 100;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
  animation-play-state: paused;
}

@keyframes fab-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ========================================
   Data Visualization Effects
   ======================================== */

.data-wave {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--spectrum-bg-elevated);
  border-radius: 16px;
}

.data-wave svg {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.wave-path {
  fill: url(#wave-gradient);
  animation: wave-motion 10s ease-in-out infinite;
}

@keyframes wave-motion {
  0%, 100% { d: path('M0,100 C150,120 350,80 500,100 L500,200 L0,200 Z'); }
  50% { d: path('M0,100 C150,80 350,120 500,100 L500,200 L0,200 Z'); }
}

/* ========================================
   Parallax Depth Layers
   ======================================== */

.parallax-container {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.parallax-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.parallax-layer-1 {
  transform: translateZ(-1px) scale(2);
}

.parallax-layer-2 {
  transform: translateZ(-2px) scale(3);
}

.parallax-layer-3 {
  transform: translateZ(-3px) scale(4);
}

/* ========================================
   Ultra Mode Toggle
   ======================================== */

.ultra-mode-toggle {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1000;
  background: var(--spectrum-bg-elevated);
  border-radius: 50px;
  padding: 0.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ultra-mode-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

.ultra-mode-toggle input[type="checkbox"] {
  display: none;
}

.ultra-indicator {
  width: 50px;
  height: 24px;
  background: var(--spectrum-bg-surface);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s ease;
}

.ultra-indicator::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.ultra-mode-toggle input:checked + .ultra-mode-label .ultra-indicator {
  background: var(--spectrum-gradient-health);
}

.ultra-mode-toggle input:checked + .ultra-mode-label .ultra-indicator::after {
  transform: translateX(26px);
}

/* ========================================
   Performance Classes
   ======================================== */

.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

.gpu-accelerate {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ========================================
   Custom Cursor
   ======================================== */

.custom-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  mix-blend-mode: difference;
}

/* Disable mix-blend-mode when feedback modal is open */
body.feedback-modal-open .custom-cursor {
  mix-blend-mode: normal !important;
}

.cursor-dot {
  position: absolute;
  top: -5px;
  left: -5px;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.cursor-ring {
  position: absolute;
  top: -20px;
  left: -20px;
  width: 40px;
  height: 40px;
  border: 2px solid white;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.custom-cursor.click .cursor-dot {
  transform: scale(0.5);
}

.custom-cursor.click .cursor-ring {
  transform: scale(1.5);
  opacity: 0;
}

/* ========================================
   Data Animate Styles
   ======================================== */

[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate].animate-in {
  opacity: 1;
  transform: translateY(0);
}

[data-animate-child] {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-animate-child].animate-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Fade animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Ultra Mode Specific Styles */
body.ultra-mode:not(.modal-open):not(.feedback-modal-open) {
  cursor: none;
}

/* Don't hide cursor on interactive elements when modal is open */
body.ultra-mode:not(.modal-open):not(.feedback-modal-open) a,
body.ultra-mode:not(.modal-open):not(.feedback-modal-open) button {
  cursor: none !important;
}

body.ultra-mode:not(.modal-open):not(.feedback-modal-open) input,
body.ultra-mode:not(.modal-open):not(.feedback-modal-open) textarea,
body.ultra-mode:not(.modal-open):not(.feedback-modal-open) select {
  cursor: none !important;
}

/* Always show proper cursor in modals */
body.ultra-mode.modal-open,
body.ultra-mode.feedback-modal-open,
body.ultra-mode .modal,
body.ultra-mode .modal *,
body.ultra-mode .feedback-modal,
body.ultra-mode .feedback-modal * {
  cursor: auto !important;
}

body.ultra-mode .modal button,
body.ultra-mode .modal a,
body.ultra-mode .modal .btn,
body.ultra-mode .feedback-modal button,
body.ultra-mode .feedback-modal a {
  cursor: pointer !important;
}

body.ultra-mode .modal input[type="text"],
body.ultra-mode .modal textarea,
body.ultra-mode .feedback-modal input,
body.ultra-mode .feedback-modal textarea {
  cursor: text !important;
}

/* Hide custom cursor when feedback modal is open */
body.feedback-modal-open .custom-cursor {
  display: none !important;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 768px) {
  .aurora,
  .blob-container,
  .particle-network {
    display: none; /* Disable heavy effects on mobile */
  }
  
  .text-holographic {
    animation: none;
    background: var(--spectrum-primary-400);
    -webkit-text-fill-color: var(--spectrum-primary-400);
  }
}

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