/* LOADING MODULE */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    #faf8f3 0%,
    #f0ebfa 50%,
    #faf8f3 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999998;
  backdrop-filter: blur(20px);
  overflow: hidden;
  visibility: visible;
}

.loading.hidden {
  display: none;
  visibility: hidden;
}

.loading-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: 
    0 8px 32px rgba(138, 92, 175, 0.1),
    0 2px 8px rgba(138, 92, 175, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
  min-width: 320px;
  animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.loading-spinner {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary-purple);
  animation: spinRing 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.spinner-ring:nth-child(1) {
  width: 100px;
  height: 100px;
  border-top-color: var(--primary-purple);
  animation-duration: 1.5s;
}

.spinner-ring:nth-child(2) {
  width: 80px;
  height: 80px;
  border-top-color: var(--accent-lavender);
  animation-duration: 1.2s;
  animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
  width: 60px;
  height: 60px;
  border-top-color: var(--accent-violet);
  animation-duration: 1s;
}

.spinner-center {
  position: relative;
  z-index: 5;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--light-purple), var(--accent-lavender));
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(138, 92, 175, 0.3);
  animation: pulseCenter 2s ease-in-out infinite;
}

.flower-icon {
  font-size: 1.8rem;
  animation: flowerFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(138, 92, 175, 0.3));
}

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

@keyframes pulseCenter {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(138, 92, 175, 0.3);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(138, 92, 175, 0.5);
  }
}

@keyframes flowerFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-8px) rotate(10deg);
  }
}

.loading-text {
  text-align: center;
}

.loading-text h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark-purple);
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, var(--primary-purple), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 3s ease-in-out infinite;
}

.loading-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
  opacity: 0.8;
  animation: fadeInOut 2s ease-in-out infinite;
}

@keyframes textShimmer {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.85;
  }
}

@keyframes fadeInOut {
  0%, 100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.5;
  }
}

.loading-progress {
  width: 100%;
  max-width: 240px;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(138, 92, 175, 0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-purple), var(--accent-violet));
  border-radius: 2px;
  animation: progressLoad 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(138, 92, 175, 0.5);
}

@keyframes progressLoad {
  0% {
    width: 0%;
    transform: translateX(0);
  }
  50% {
    width: 70%;
  }
  100% {
    width: 100%;
    transform: translateX(0);
  }
}

.loading-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
}

.bg-circle {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(138, 92, 175, 0.1), rgba(177, 156, 217, 0.15));
  filter: blur(40px);
  animation: float 20s ease-in-out infinite;
}

.bg-circle-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation-duration: 20s;
}

.bg-circle-2 {
  width: 250px;
  height: 250px;
  bottom: -80px;
  right: -80px;
  animation-duration: 25s;
  animation-delay: -5s;
}

.bg-circle-3 {
  width: 200px;
  height: 200px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 30s;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -30px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--light-purple);
  border-top-color: var(--dark-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading-calendar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.loading-calendar .spinner {
  width: 80px;
  height: 80px;
  border-width: 8px;
}

/* Flower Loading Animation - ENHANCED */
.flower-loader {
  width: 60px;
  height: 60px;
  position: relative;
  animation: bloom 1s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flower-loader::before,
.flower-loader::after {
  content: "🌸";
  position: absolute;
  font-size: 2.5rem;
  animation: spin 2s linear infinite, pulse 1s ease-in-out infinite;
}

.flower-loader::after {
  animation: spin 2s linear infinite reverse, pulse 1s ease-in-out infinite;
  opacity: 0.6;
  filter: hue-rotate(45deg);
}

@keyframes bloom {
  0%, 100% {
    transform: scale(1);
    filter: hue-rotate(0deg) brightness(1);
  }
  50% {
    transform: scale(1.3);
    filter: hue-rotate(45deg) brightness(1.2);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Image Placeholder - PROFESSIONAL DESIGN */
.image-placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: linear-gradient(
    135deg,
    rgba(240, 235, 250, 0.8) 0%,
    rgba(230, 220, 245, 0.9) 50%,
    rgba(240, 235, 250, 0.8) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.5),
    0 2px 8px rgba(138, 92, 175, 0.1);
}

.image-placeholder::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(138, 92, 175, 0.05) 0%,
    rgba(177, 156, 217, 0.08) 50%,
    rgba(138, 92, 175, 0.05) 100%
  );
  animation: gradientShift 4s ease-in-out infinite;
  z-index: 1;
}

.image-placeholder::after {
  content: "";
  position: absolute;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 30%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.4) 70%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
  z-index: 2;
}

.image-placeholder .flower-icon {
  position: relative;
  z-index: 3;
  font-size: 2.5rem;
  animation: flowerGentle 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 8px rgba(138, 92, 175, 0.3));
  background: linear-gradient(135deg, var(--primary-purple), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes gradientShift {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

@keyframes flowerGentle {
  0%, 100% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  25% {
    transform: translateY(-4px) rotate(-5deg) scale(1.05);
    opacity: 0.9;
  }
  50% {
    transform: translateY(-8px) rotate(0deg) scale(1.1);
    opacity: 1;
  }
  75% {
    transform: translateY(-4px) rotate(5deg) scale(1.05);
    opacity: 0.9;
  }
}

/* Loading dots animation - PROFESSIONAL */
.image-placeholder .loading-dots {
  color: var(--primary-purple);
  font-size: 0.95rem;
  font-weight: 600;
  position: relative;
  z-index: 3;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
  background: linear-gradient(135deg, var(--primary-purple), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.image-placeholder .loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

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

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

@keyframes progressPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(138, 92, 175, 0.4);
  }
  50% {
    box-shadow: 0 0 12px rgba(138, 92, 175, 0.6);
  }
}

/* Skeleton Loading Animation */
.skeleton-loader {
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: linear-gradient(
    135deg,
    rgba(147, 112, 219, 0.1) 0%,
    rgba(177, 156, 217, 0.15) 100%
  );
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}

.skeleton-loader::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.6) 50%,
    transparent 100%
  );
  animation: skeletonShimmer 2s ease-in-out infinite;
  transform: translateX(-100%);
}

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

/* Progressive Image Loading (Blur-up) */
.progressive-image {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
}

.progressive-image-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px);
  transform: scale(1.1);
  transition: opacity 0.5s ease, filter 0.5s ease;
}

.progressive-image-full {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.progressive-image-full.loaded {
  opacity: 1;
}

.progressive-image-thumb.hide {
  opacity: 0;
  filter: blur(0px);
}

/* Smooth Fade In for Images */
@keyframes smoothFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.gallery-item img.fade-in,
.highlight-item img.fade-in {
  animation: smoothFadeIn 0.5s ease-out forwards;
}

/* Loading Spinner for Images */
.image-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(147, 112, 219, 0.2);
  border-top-color: var(--primary-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 3;
}

/* Loading Progress Bar */
.image-loading-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(147, 112, 219, 0.2);
  overflow: hidden;
  z-index: 4;
}

.image-loading-progress::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60%;
  background: linear-gradient(
    90deg,
    var(--primary-purple),
    var(--accent-violet)
  );
  animation: progressSlide 1.5s ease-in-out infinite;
}

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

.loading p {
  font-size: 1.2rem;
  color: var(--dark-purple);
  font-weight: 600;
}

/* Hide all background content when loading */
body.app-loading .container,
body.app-loading .flower-decoration,
body.app-loading .calendar-section,
body.app-loading .gallery-section,
body.app-loading .highlights-bar,
body.app-loading .on-this-day,
body.app-loading header,
body.app-loading .media-modal,
body.app-loading .date-picker-modal,
body.app-loading .growth-modal,
body.app-loading .upload-modal {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

/* Mobile-specific loading screen */
@media (max-width: 768px) {
  .loading {
    z-index: 9999998 !important;
    background: #faf8f3 !important;
  }
  
  .loading-content {
    max-width: 90% !important;
    padding: 2rem 1.5rem !important;
  }
  
  body.app-loading .container,
  body.app-loading .flower-decoration,
  body.app-loading .calendar-section,
  body.app-loading .gallery-section,
  body.app-loading .highlights-bar,
  body.app-loading .on-this-day,
  body.app-loading header,
  body.app-loading .media-modal,
  body.app-loading .date-picker-modal,
  body.app-loading .growth-modal,
  body.app-loading .upload-modal {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none !important;
  }
}

/* Media Modal */
