/* ========================================
   织网 (WebWeave) - 加载状态和错误提示优化
   ======================================== */

/* === 加载器样式 === */
.holy-loader {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(184, 134, 11, 0.3);
  border-top-color: var(--divine-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  will-change: transform;
  transform: translateZ(0);
}

@keyframes spin {
  to {
    transform: rotate(360deg) translateZ(0);
  }
}

/* === 骨架屏加载 === */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(184, 134, 11, 0.1) 0%,
    rgba(255, 215, 0, 0.2) 50%,
    rgba(184, 134, 11, 0.1) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
  will-change: background-position;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5em;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 1em;
}

.skeleton-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

.skeleton-card {
  padding: 20px;
  margin-bottom: 20px;
}

/* === 加载遮罩 === */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.loading-overlay .holy-loader {
  width: 60px;
  height: 60px;
  border-width: 5px;
  margin-bottom: 20px;
}

.loading-overlay .loading-text {
  color: var(--divine-gold);
  font-family: var(--font-display);
  font-size: 1.2rem;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* === 内联加载器 === */
.inline-loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--divine-gold);
}

.inline-loader .holy-loader {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* === 按钮加载状态 === */
.holy-button.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
  /* 确保按钮本身不旋转 */
  transform: none !important;
  animation: none !important;
}

.holy-button.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.6s linear infinite;
  z-index: 1;
}

/* 按钮内的加载器（不替换按钮内容时使用） */
.holy-button .holy-loader {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
}

/* 确保按钮文本在加载时仍然可见 */
.holy-button.loading span:not(.holy-loader) {
  opacity: 0.5;
}

/* === 错误提示样式 === */
.error-message {
  background: linear-gradient(145deg, rgba(139, 0, 0, 0.2), rgba(139, 0, 0, 0.1));
  border: 2px solid var(--error-red);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  margin: 15px 0;
  color: var(--holy-white);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 15px rgba(139, 0, 0, 0.3);
}

.error-message::before {
  content: '⚠';
  font-size: 1.5rem;
  color: var(--error-red);
}

.error-message .error-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(139, 0, 0, 0.3);
  font-size: 0.9rem;
  opacity: 0.8;
}

/* === 成功提示样式 === */
.success-message {
  background: linear-gradient(145deg, rgba(46, 204, 113, 0.2), rgba(46, 204, 113, 0.1));
  border: 2px solid var(--success-green);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  margin: 15px 0;
  color: var(--holy-white);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.3);
}

.success-message::before {
  content: '✓';
  font-size: 1.5rem;
  color: var(--success-green);
}

/* === 警告提示样式 === */
.warning-message {
  background: linear-gradient(145deg, rgba(255, 140, 0, 0.2), rgba(255, 140, 0, 0.1));
  border: 2px solid var(--warning-orange);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  margin: 15px 0;
  color: var(--holy-white);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 15px rgba(255, 140, 0, 0.3);
}

.warning-message::before {
  content: '⚠';
  font-size: 1.5rem;
  color: var(--warning-orange);
}

/* === 信息提示样式 === */
.info-message {
  background: linear-gradient(145deg, rgba(30, 58, 138, 0.2), rgba(30, 58, 138, 0.1));
  border: 2px solid var(--info-blue);
  border-radius: var(--radius-md);
  padding: 15px 20px;
  margin: 15px 0;
  color: var(--holy-white);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 0 15px rgba(30, 58, 138, 0.3);
}

.info-message::before {
  content: 'ℹ';
  font-size: 1.5rem;
  color: var(--info-blue);
}

/* === 通知提示（Toast） === */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  padding: 15px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--holy-glow-medium);
  animation: toastSlideIn 0.3s ease;
  will-change: transform, opacity;
  transform: translateZ(0);
  backdrop-filter: blur(10px);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%) translateZ(0);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateZ(0);
  }
}

.toast.success {
  background: linear-gradient(145deg, rgba(46, 204, 113, 0.9), rgba(46, 204, 113, 0.7));
  border: 2px solid var(--success-green);
  color: var(--holy-white);
}

.toast.error {
  background: linear-gradient(145deg, rgba(139, 0, 0, 0.9), rgba(139, 0, 0, 0.7));
  border: 2px solid var(--error-red);
  color: var(--holy-white);
}

.toast.warning {
  background: linear-gradient(145deg, rgba(255, 140, 0, 0.9), rgba(255, 140, 0, 0.7));
  border: 2px solid var(--warning-orange);
  color: var(--holy-white);
}

.toast.info {
  background: linear-gradient(145deg, rgba(30, 58, 138, 0.9), rgba(30, 58, 138, 0.7));
  border: 2px solid var(--info-blue);
  color: var(--holy-white);
}

.toast.fade-out {
  animation: toastFadeOut 0.3s ease forwards;
}

@keyframes toastFadeOut {
  to {
    opacity: 0;
    transform: translateX(100%) translateZ(0);
  }
}

/* === 响应式优化 === */
@media (max-width: 640px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: 100%;
  }
  
  .toast {
    padding: 12px 15px;
    font-size: 0.9rem;
  }
  
  .error-message,
  .success-message,
  .warning-message,
  .info-message {
    padding: 12px 15px;
    font-size: 0.9rem;
  }
}
