/* =============================================
    ELEGANT THEME TRANSITION - LOGO CIRCLE EXPAND
    ============================================= */

/* Overlay container */
.elegant-theme-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.elegant-theme-overlay.active {
  opacity: 1;
}

/* Expanding circle effect */
.expanding-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1;
}

.expanding-circle.expand {
  width: 300vmax;
  height: 300vmax;
}

/* Light theme circle */
.expanding-circle.to-light {
  background: radial-gradient(circle at center, 
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.9) 40%,
    rgba(241, 245, 249, 0.85) 70%,
    rgba(255, 255, 255, 0.8) 100%);
  box-shadow: 
    0 0 100px rgba(255, 255, 255, 0.5),
    inset 0 0 100px rgba(255, 255, 255, 0.3);
}

/* Dark theme circle */
.expanding-circle.to-dark {
  background: radial-gradient(circle at center, 
    rgba(15, 15, 15, 0.95) 0%,
    rgba(26, 26, 26, 0.9) 40%,
    rgba(20, 20, 20, 0.85) 70%,
    rgba(10, 10, 10, 0.8) 100%);
  box-shadow: 
    0 0 100px rgba(0, 0, 0, 0.7),
    inset 0 0 100px rgba(255, 255, 255, 0.1);
}

/* Logo container in center */
.center-logo-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 2;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
}

.center-logo-container.animate-in {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.center-logo-container.animate-out {
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Logo styles */
.center-logo {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  position: relative;
  backdrop-filter: blur(20px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  animation: logoFloat 3s ease-in-out infinite;
}

/* Light theme logo */
.center-logo.light {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Dark theme logo */
.center-logo.dark {
  background: rgba(0, 0, 0, 0.1);
  box-shadow: 
    0 8px 32px rgba(255, 255, 255, 0.1),
    inset 0 0 20px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Logo favicon image */
.logo-favicon {
  width: 40px;
  height: 40px;
  display: block;
  border-radius: 8px;
  object-fit: contain;
}

/* Logo text fallback */
.logo-text {
  font-size: 24px;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  display: none; /* Hidden by default, shown if favicon fails */
}

/* Light theme text */
.center-logo.light .logo-text {
  color: #1f2937;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Dark theme text */
.center-logo.dark .logo-text {
  color: #f9fafb;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

/* Floating animation */
@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-5px) rotate(2deg);
  }
  50% {
    transform: translateY(0px) rotate(0deg);
  }
  75% {
    transform: translateY(-3px) rotate(-1deg);
  }
}

/* Logo glow effect */
.center-logo::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.center-logo.light::before {
  background: conic-gradient(from 0deg, 
    transparent, 
    rgba(59, 130, 246, 0.3), 
    transparent, 
    rgba(16, 185, 129, 0.3), 
    transparent);
  animation: logoGlowLight 3s linear infinite;
}

.center-logo.dark::before {
  background: conic-gradient(from 0deg, 
    transparent, 
    rgba(139, 92, 246, 0.4), 
    transparent, 
    rgba(236, 72, 153, 0.4), 
    transparent);
  animation: logoGlowDark 3s linear infinite;
}

.center-logo-container.animate-in .center-logo::before {
  opacity: 1;
}

@keyframes logoGlowLight {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes logoGlowDark {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Enhanced theme button */
.theme-toggle {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.theme-toggle:hover::before {
  width: 60px;
  height: 60px;
}

.theme-toggle.transitioning {
  animation: elegantButtonPulse 1.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes elegantButtonPulse {
  0%, 100% { 
    transform: scale(1);
    filter: brightness(1);
  }
  20% { 
    transform: scale(1.1);
    filter: brightness(1.2);
  }
  50% { 
    transform: scale(1.05);
    filter: brightness(1.1);
  }
  80% { 
    transform: scale(1.1);
    filter: brightness(1.2);
  }
}

/* Icon transition enhancement */
.theme-toggle i {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.theme-toggle.icon-changing i {
  transform: scale(0) rotate(90deg);
  opacity: 0;
}

/* Smooth theme transitions for all elements */
:root {
  --elegant-theme-transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  transition: var(--elegant-theme-transition);
}

/* Prevent transition on initial load */
.preload * {
  transition: none !important;
}

/* Theme-specific button styles */
[data-theme="light"] .theme-toggle i {
  color: #f59e0b;
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .theme-toggle i {
  color: #60a5fa;
  text-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

/* Performance optimizations */
.elegant-theme-overlay {
  will-change: opacity;
  contain: strict;
}

.expanding-circle {
  will-change: transform;
  contain: layout style;
}

.center-logo-container {
  will-change: transform, opacity;
  contain: layout style;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .center-logo {
    width: 60px;
    height: 60px;
  }
  
  .logo-favicon {
    width: 30px;
    height: 30px;
  }
  
  .logo-text {
    font-size: 18px;
  }
  
  .expanding-circle.expand {
    width: 250vmax;
    height: 250vmax;
  }
}

@media screen and (max-width: 480px) {
  .center-logo {
    width: 50px;
    height: 50px;
  }
  
  .logo-favicon {
    width: 25px;
    height: 25px;
  }
  
  .logo-text {
    font-size: 16px;
  }
  
  .expanding-circle.expand {
    width: 200vmax;
    height: 200vmax;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .center-logo {
    border-width: 3px;
  }
  
  .center-logo.light {
    border-color: #000;
    background: rgba(255, 255, 255, 0.9);
  }
  
  .center-logo.dark {
    border-color: #fff;
    background: rgba(0, 0, 0, 0.9);
  }
}

/* Accessibility - Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .expanding-circle,
  .center-logo-container,
  .theme-toggle {
    animation: none !important;
    transition: opacity 0.3s ease !important;
  }
  
  .center-logo::before {
    animation: none !important;
  }
  
  @keyframes logoFloat {
    0%, 100% { transform: none; }
  }
}