/* 自定义加载动画 */

/* 全屏加载遮罩 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--background-color);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease-in-out;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* 可爱的绘图工具动画 */
.loading-container {
  position: relative;
  width: 200px;
  height: 200px;
}

.loading-icon {
  position: absolute;
  width: 60px;
  height: 60px;
  animation: floating 3s ease-in-out infinite;
}

.loading-icon:nth-child(1) {
  top: 20px;
  left: 20px;
  transform: rotate(-15deg);
  animation-delay: 0s;
}

.loading-icon:nth-child(2) {
  top: 20px;
  right: 20px;
  transform: rotate(15deg);
  animation-delay: 0.5s;
}

.loading-icon:nth-child(3) {
  bottom: 20px;
  left: 20px;
  transform: rotate(15deg);
  animation-delay: 1s;
}

.loading-icon:nth-child(4) {
  bottom: 20px;
  right: 20px;
  transform: rotate(-15deg);
  animation-delay: 1.5s;
}

@keyframes floating {
  0% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-15px) rotate(5deg);
  }
  100% {
    transform: translateY(0) rotate(0);
  }
}

.loading-progress {
  margin-top: 30px;
  width: 200px;
  height: 4px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--active-button-color), var(--button-hover-background));
  border-radius: 2px;
  animation: progress 2s ease-in-out infinite;
  width: 0;
}

@keyframes progress {
  0% {
    width: 0;
    left: 0;
  }
  50% {
    width: 100%;
    left: 0;
  }
  100% {
    width: 0;
    left: 100%;
  }
}

.loading-text {
  margin-top: 20px;
  font-size: 18px;
  color: var(--text-color);
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  text-align: center;
}

.loading-text span {
  display: inline-block;
  animation: bounce 1.5s ease infinite;
}

.loading-text span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-text span:nth-child(3) {
  animation-delay: 0.4s;
}

.loading-text span:nth-child(4) {
  animation-delay: 0.6s;
}

.loading-text span:nth-child(5) {
  animation-delay: 0.8s;
}

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

/* 画笔图标 */
.loading-brush {
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"><path d="M45,15c-5.5,0-10,4.5-10,10c0,1.1,0.2,2.1,0.5,3.1L15,48.6c-1.2,1.2-1.2,3.2,0,4.4c0.6,0.6,1.4,0.9,2.2,0.9s1.6-0.3,2.2-0.9l20.5-20.5c1,0.3,2,0.5,3.1,0.5c5.5,0,10-4.5,10-10S50.5,15,45,15z" fill="%23cf93e6"/></svg>');
  background-repeat: no-repeat;
}

/* 铅笔图标 */
.loading-pencil {
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"><path d="M45,15L15,45v15h15L60,30L45,15z M18,55l-3-3l27-27l3,3L18,55z" fill="%23f7a4e3"/></svg>');
  background-repeat: no-repeat;
}

/* 调色板图标 */
.loading-palette {
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"><path d="M30,10C16.75,10,6,20.75,6,34c0,11.05,7.5,20.35,17.65,23.15c0.6,0.15,1.2-0.3,1.2-0.9v-4.5c0-2.5,2-4.5,4.5-4.5s4.5,2,4.5,4.5c0,2.5,2,4.5,4.5,4.5c8.3,0,15-6.7,15-15C53.35,23.75,43.25,10,30,10z M15,35c-2.75,0-5-2.25-5-5s2.25-5,5-5s5,2.25,5,5S17.75,35,15,35z M25,25c-2.75,0-5-2.25-5-5s2.25-5,5-5s5,2.25,5,5S27.75,25,25,25z M35,25c-2.75,0-5-2.25-5-5s2.25-5,5-5s5,2.25,5,5S37.75,25,35,25z M45,35c-2.75,0-5-2.25-5-5s2.25-5,5-5s5,2.25,5,5S47.75,35,45,35z" fill="%239e66b3"/></svg>');
  background-repeat: no-repeat;
}

/* 橡皮擦图标 */
.loading-eraser {
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60"><path d="M54.65,25.3L34.7,5.35c-1.6-1.6-4.2-1.6-5.8,0L5.35,28.9c-1.6,1.6-1.6,4.2,0,5.8l13.5,13.5h-8.8v6h38v-6h-14.5l21.1-21.1C56.25,29.5,56.25,26.9,54.65,25.3z M26.75,42.2L11.15,26.6L28.9,8.85L44.5,24.45L26.75,42.2z" fill="%23a96fd4"/></svg>');
  background-repeat: no-repeat;
}