/* 7B2抽奖插件动画样式 - v1.1.0 */

/* CSS变量定义 */
:root {
  --primary-color: #007bff;
  --secondary-color: #6c757d;
  --accent-color: #28a745;
  --highlight-color: #ffc107;
  --danger-color: #dc3545;
  --success-color: #28a745;
  --info-color: #17a2b8;
  --warning-color: #ffc107;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
}

/* 基础动画容器 */
.lottery-animation-container {
  position: relative;
  overflow: hidden;
}

/* 弹跳动画 */
@keyframes bounce-keyframes {
  0% {
    transform: scale(1);
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  25% {
    transform: scale(1.1);
    background-color: var(--highlight-color);
    box-shadow: 0 4px 8px rgba(255,193,7,0.3);
  }
  50% {
    transform: scale(1.2);
    background-color: var(--accent-color);
    box-shadow: 0 6px 12px rgba(40,167,69,0.4);
  }
  75% {
    transform: scale(1.1);
    background-color: var(--highlight-color);
    box-shadow: 0 4px 8px rgba(255,193,7,0.3);
  }
  100% {
    transform: scale(1);
    background-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
}

.lottery-animation-bounce {
  animation-name: bounce-keyframes;
  animation-duration: 3000ms;
  animation-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

/* 翻转动画 */
@keyframes flip-keyframes {
  0% {
    transform: rotateY(0deg);
    background-color: var(--primary-color);
  }
  50% {
    transform: rotateY(180deg);
    background-color: var(--secondary-color);
  }
  100% {
    transform: rotateY(360deg);
    background-color: var(--primary-color);
  }
}

.lottery-animation-flip {
  animation-name: flip-keyframes;
  animation-duration: 2500ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  transform-style: preserve-3d;
}

/* 缩放动画 */
@keyframes zoom-keyframes {
  0% {
    transform: scale(1);
    opacity: 1;
    border: 2px solid transparent;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
    border: 2px solid var(--highlight-color);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    border: 2px solid transparent;
  }
}

.lottery-animation-zoom {
  animation-name: zoom-keyframes;
  animation-duration: 2000ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

/* 滑动动画 */
@keyframes slide-keyframes {
  0% {
    transform: translateX(0);
    background-color: var(--primary-color);
  }
  25% {
    transform: translateX(10px);
    background-color: var(--secondary-color);
  }
  50% {
    transform: translateX(0);
    background-color: var(--accent-color);
  }
  75% {
    transform: translateX(-10px);
    background-color: var(--secondary-color);
  }
  100% {
    transform: translateX(0);
    background-color: var(--primary-color);
  }
}

.lottery-animation-slide {
  animation-name: slide-keyframes;
  animation-duration: 3500ms;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

/* 3D旋转动画 */
@keyframes rotate3d-keyframes {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
  }
  25% {
    transform: rotateX(90deg) rotateY(90deg);
    box-shadow: 0 0 20px rgba(255,0,0,0.5);
  }
  50% {
    transform: rotateX(180deg) rotateY(180deg);
    box-shadow: 0 0 30px rgba(0,255,0,0.5);
  }
  75% {
    transform: rotateX(270deg) rotateY(270deg);
    box-shadow: 0 0 20px rgba(0,0,255,0.5);
  }
  100% {
    transform: rotateX(360deg) rotateY(360deg);
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
  }
}

.lottery-animation-rotate3d {
  animation-name: rotate3d-keyframes;
  animation-duration: 4000ms;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  transform-style: preserve-3d;
}

/* 粒子效果基础样式 */
.lottery-particle {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
}

.lottery-particle.circle {
  border-radius: 50%;
}

.lottery-particle.square {
  border-radius: 2px;
}

.lottery-particle.triangle {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 10px solid currentColor;
}

/* 粒子容器 */
.lottery-particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* 中奖高亮效果 */
@keyframes winning-highlight {
  0% {
    background-color: var(--success-color);
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
  }
  50% {
    background-color: var(--highlight-color);
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
  }
  100% {
    background-color: var(--success-color);
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
  }
}

.lottery-item.winning-item {
  animation: winning-highlight 1s ease-in-out 3;
  z-index: 10;
}

/* 抽奖控制按钮样式 */
.lottery-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.sound-toggle {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.sound-toggle:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sound-toggle:active {
  transform: scale(0.95);
}

/* 消息提示样式 */
.lottery-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: 500;
  text-align: center;
  z-index: 1000;
  min-width: 200px;
  animation: messageSlideIn 0.3s ease-out;
  backdrop-filter: blur(10px);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.lottery-message-success {
  background: rgba(40, 167, 69, 0.95);
  color: white;
  border: 1px solid var(--success-color);
}

.lottery-message-info {
  background: rgba(23, 162, 184, 0.95);
  color: white;
  border: 1px solid var(--info-color);
}

.lottery-message-error {
  background: rgba(220, 53, 69, 0.95);
  color: white;
  border: 1px solid var(--danger-color);
}

.lottery-message-warning {
  background: rgba(255, 193, 7, 0.95);
  color: #212529;
  border: 1px solid var(--warning-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .lottery-controls {
    top: 5px;
    right: 5px;
  }
  
  .sound-toggle {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .lottery-message {
    min-width: 150px;
    padding: 10px 20px;
    font-size: 14px;
  }
  
  /* 移动端动画优化 */
  .lottery-animation-bounce,
  .lottery-animation-flip,
  .lottery-animation-zoom,
  .lottery-animation-slide,
  .lottery-animation-rotate3d {
    animation-duration: 2000ms; /* 缩短动画时间 */
  }
}

/* 无障碍访问支持 */
@media (prefers-reduced-motion: reduce) {
  .lottery-animation-bounce,
  .lottery-animation-flip,
  .lottery-animation-zoom,
  .lottery-animation-slide,
  .lottery-animation-rotate3d,
  .winning-item {
    animation: none !important;
  }
  
  .lottery-item {
    transition: background-color 0.3s ease;
  }
  
  .lottery-item.winning-item {
    background-color: var(--success-color) !important;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0056b3;
    --secondary-color: #495057;
    --accent-color: #155724;
    --highlight-color: #856404;
    --danger-color: #721c24;
  }
  
  .lottery-message {
    border-width: 2px;
  }
  
  .sound-toggle {
    border-width: 2px;
    border-color: #000;
  }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --accent-color: #198754;
    --highlight-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #343a40;
    --dark-color: #f8f9fa;
  }
  
  .sound-toggle {
    background: rgba(52, 58, 64, 0.9);
    border-color: #495057;
    color: #f8f9fa;
  }
  
  .sound-toggle:hover {
    background: rgba(52, 58, 64, 1);
  }
}

/* 加载状态动画 */
@keyframes loading-pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

.lottery-loading {
  animation: loading-pulse 1.5s ease-in-out infinite;
}

/* 禁用状态样式 */
.lottery-disabled {
  opacity: 0.6;
  pointer-events: none;
  filter: grayscale(50%);
}

/* 自定义滚动条（如果需要） */
.lottery-container::-webkit-scrollbar {
  width: 6px;
}

.lottery-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

.lottery-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.lottery-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* 打印样式 */
@media print {
  .lottery-controls,
  .lottery-message,
  .lottery-particle-container {
    display: none !important;
  }
  
  .lottery-animation-bounce,
  .lottery-animation-flip,
  .lottery-animation-zoom,
  .lottery-animation-slide,
  .lottery-animation-rotate3d {
    animation: none !important;
  }
}