/**
 * Unscarred UI Enhancements
 * Smooth, professional animations and transitions
 * Maintains the existing dark theme with added polish
 * 
 * @version 1.0.0
 */

/* ===========================================
   SMOOTH SCROLL & BASE ANIMATIONS
   =========================================== */

html {
  scroll-behavior: smooth;
}

/* Reduced motion support */
@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;
  }
}

/* ===========================================
   PAGE TRANSITIONS
   =========================================== */

/* Fade in on page load */
body {
  animation: fadeInPage 0.5s ease-out;
}

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

/* Staggered content reveal */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ===========================================
   ENHANCED BUTTONS
   =========================================== */

/* Smooth button states */
.btn,
.package-btn,
.cta-btn,
.submit-btn,
.global-nav-cta,
button[type="submit"] {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect on click */
.btn::after,
.package-btn::after,
.cta-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 0 0;
}

.btn:active::after,
.package-btn:active::after,
.cta-btn:active::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0) translate(-50%, -50%);
    opacity: 1;
  }
  100% {
    transform: scale(100, 100) translate(-50%, -50%);
    opacity: 0;
  }
}

/* Magnetic hover effect */
.btn-magnetic {
  transition: transform 0.2s ease;
}

/* Glow pulse on hover */
.btn-primary:hover,
.global-nav-cta:hover {
  animation: glowPulse 1.5s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 8px 30px rgba(163, 59, 92, 0.4);
  }
  50% {
    box-shadow: 0 8px 40px rgba(163, 59, 92, 0.6);
  }
}

/* ===========================================
   CARD ENHANCEMENTS
   =========================================== */

/* Smooth card hover with 3D effect */
.quiz-card,
.program-card,
.package-card,
.neurotype-card,
.service-card,
.review-card {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  will-change: transform;
}

.quiz-card:hover,
.program-card:hover,
.package-card:hover {
  transform: translateY(-8px) scale(1.02);
}

/* Subtle 3D tilt on hover */
.card-3d-hover {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.card-3d-hover:hover {
  transform: rotateX(-5deg) rotateY(5deg) translateY(-8px);
}

/* Gradient border animation */
.gradient-border {
  position: relative;
  background: linear-gradient(165deg, rgba(20, 18, 25, 0.9), rgba(12, 11, 16, 0.95));
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(163, 59, 92, 0.5),
    rgba(124, 92, 191, 0.5),
    rgba(201, 118, 61, 0.5),
    rgba(163, 59, 92, 0.5)
  );
  background-size: 300% 300%;
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: gradientMove 3s ease infinite;
}

.gradient-border:hover::before {
  opacity: 1;
}

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

/* ===========================================
   NAVIGATION ENHANCEMENTS
   =========================================== */

/* Smooth header transition on scroll */
.global-header {
  transition: all 0.3s ease;
}

.global-header.scrolled {
  padding: 12px 0;
  background: rgba(5, 5, 7, 0.98);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Enhanced dropdown animations */
.global-dropdown-menu {
  transform: translateX(-50%) translateY(10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-nav-dropdown:hover .global-dropdown-menu {
  transform: translateX(-50%) translateY(0);
}

/* Menu item stagger animation */
.global-dropdown-menu a {
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.global-nav-dropdown:hover .global-dropdown-menu a {
  opacity: 1;
  transform: translateY(0);
}

.global-nav-dropdown:hover .global-dropdown-menu a:nth-child(1) { transition-delay: 0.05s; }
.global-nav-dropdown:hover .global-dropdown-menu a:nth-child(2) { transition-delay: 0.1s; }
.global-nav-dropdown:hover .global-dropdown-menu a:nth-child(3) { transition-delay: 0.15s; }
.global-nav-dropdown:hover .global-dropdown-menu a:nth-child(4) { transition-delay: 0.2s; }
.global-nav-dropdown:hover .global-dropdown-menu a:nth-child(5) { transition-delay: 0.25s; }
.global-nav-dropdown:hover .global-dropdown-menu a:nth-child(6) { transition-delay: 0.3s; }

/* Nav link underline animation */
.global-header nav > a:not(.global-nav-cta),
.global-nav-dropdown > a {
  position: relative;
}

.global-header nav > a:not(.global-nav-cta)::after,
.global-nav-dropdown > a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary, #a33b5c), transparent);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.global-header nav > a:not(.global-nav-cta):hover::after,
.global-nav-dropdown:hover > a::after {
  width: 100%;
}

/* ===========================================
   FORM ENHANCEMENTS
   =========================================== */

/* Floating label effect */
.form-group.floating {
  position: relative;
}

.form-group.floating label {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  pointer-events: none;
  color: var(--text-dim, #5c5955);
}

.form-group.floating input:focus + label,
.form-group.floating input:not(:placeholder-shown) + label {
  top: 8px;
  font-size: 0.7rem;
  color: var(--primary, #a33b5c);
}

/* Input focus effects */
input, textarea, select {
  transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary, #a33b5c);
  box-shadow: 
    0 0 0 3px rgba(163, 59, 92, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Input shake on error */
.input-error {
  animation: inputShake 0.5s ease;
}

@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Success checkmark animation */
.input-success::after {
  content: '✓';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  color: #7d9a8c;
  font-weight: bold;
  animation: checkPop 0.3s ease forwards;
}

@keyframes checkPop {
  0% { transform: translateY(-50%) scale(0); }
  50% { transform: translateY(-50%) scale(1.3); }
  100% { transform: translateY(-50%) scale(1); }
}

/* ===========================================
   HERO & SECTION ANIMATIONS
   =========================================== */

/* Hero content stagger */
.hero h1,
.hero-badge,
.hero-sub,
.hero-buttons {
  animation: slideUp 0.6s ease-out backwards;
}

.hero-badge { animation-delay: 0.1s; }
.hero h1 { animation-delay: 0.2s; }
.hero-sub { animation-delay: 0.3s; }
.hero-buttons { animation-delay: 0.4s; }

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

/* Section fade-in on scroll */
section {
  opacity: 0;
  animation: sectionReveal 0.6s ease-out forwards;
}

@keyframes sectionReveal {
  to {
    opacity: 1;
  }
}

/* ===========================================
   LOADING STATES
   =========================================== */

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(163, 59, 92, 0.2);
  border-top-color: var(--primary, #a33b5c);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button loading state */
.btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===========================================
   QUIZ & PROGRESS ANIMATIONS
   =========================================== */

/* Progress bar animation */
.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary, #a33b5c), var(--secondary, #7c5cbf));
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Question transition */
.quiz-question {
  animation: questionSlide 0.4s ease-out;
}

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

/* ===========================================
   MODAL & OVERLAY ANIMATIONS
   =========================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 7, 0.9);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9999;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ===========================================
   TOAST NOTIFICATIONS
   =========================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  background: linear-gradient(165deg, rgba(20, 18, 25, 0.98), rgba(12, 11, 16, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  color: var(--text-main, #ece8e1);
  transform: translateX(120%);
  animation: toastSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast.success {
  border-left: 3px solid #7d9a8c;
}

.toast.error {
  border-left: 3px solid #e74c3c;
}

.toast.info {
  border-left: 3px solid var(--secondary, #7c5cbf);
}

.toast.closing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  to { transform: translateX(0); }
}

@keyframes toastSlideOut {
  to { 
    transform: translateX(120%); 
    opacity: 0;
  }
}

/* ===========================================
   SCROLL INDICATOR
   =========================================== */

.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary, #a33b5c), var(--secondary, #7c5cbf));
  transform-origin: left;
  transform: scaleX(0);
  z-index: 9999;
  transition: transform 0.1s linear;
}

/* ===========================================
   CURSOR EFFECTS (OPTIONAL)
   =========================================== */

.cursor-glow {
  position: fixed;
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(163, 59, 92, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body:hover .cursor-glow {
  opacity: 1;
}

/* ===========================================
   TESTIMONIAL CAROUSEL
   =========================================== */

.testimonial-carousel {
  overflow: hidden;
}

.testimonial-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.testimonial-slide {
  flex: 0 0 100%;
  padding: 0 24px;
}

/* ===========================================
   MOBILE ENHANCEMENTS
   =========================================== */

@media (max-width: 768px) {
  /* Smooth mobile menu */
  .mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
  }
  
  .mobile-menu.open {
    right: 0;
  }
  
  /* Hamburger animation */
  .hamburger {
    width: 28px;
    height: 20px;
    position: relative;
    cursor: pointer;
  }
  
  .hamburger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-main, #ece8e1);
    border-radius: 1px;
    transition: all 0.3s ease;
  }
  
  .hamburger span:nth-child(1) { top: 0; }
  .hamburger span:nth-child(2) { top: 9px; }
  .hamburger span:nth-child(3) { bottom: 0; }
  
  .hamburger.open span:nth-child(1) {
    top: 9px;
    transform: rotate(45deg);
  }
  
  .hamburger.open span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger.open span:nth-child(3) {
    bottom: 9px;
    transform: rotate(-45deg);
  }
  
  /* Reduce animations on mobile */
  .quiz-card:hover,
  .program-card:hover,
  .package-card:hover {
    transform: translateY(-4px);
  }
}

/* ===========================================
   ACCESSIBILITY FOCUS STATES
   =========================================== */

*:focus-visible {
  outline: 2px solid var(--primary, #a33b5c);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--primary, #a33b5c);
  color: white;
  border-radius: 0 0 8px 8px;
  z-index: 10000;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
}
