/* 
 * 臺灣彩票號碼球 3D 效果樣式
 * 現代化設計，配合紫紅漸變主題
 */

/* ===== 基礎球體樣式 ===== */
.ball-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  margin: 0 0.25rem 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
}

/* 3D 高光效果 */
.ball-3d::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 20%;
  width: 30%;
  height: 30%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  border-radius: 50%;
  pointer-events: none;
}

/* 懸停效果 */
.ball-3d:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== 臺灣彩票號碼顏色系統 ===== */

/* 威力彩和大樂透 - 紅色號碼 */
.ball-3d.red,
.ball-3d[data-color="red"] {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* 威力彩和大樂透 - 藍色號碼 */
.ball-3d.blue,
.ball-3d[data-color="blue"] {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* 威力彩和大樂透 - 綠色號碼 */
.ball-3d.green,
.ball-3d[data-color="green"] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* 威力彩和大樂透 - 紫色號碼 */
.ball-3d.purple,
.ball-3d[data-color="purple"] {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* 威力彩和大樂透 - 橙色號碼 */
.ball-3d.orange,
.ball-3d[data-color="orange"] {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

/* 威力彩和大樂透 - 粉色號碼 */
.ball-3d.pink,
.ball-3d[data-color="pink"] {
  background: linear-gradient(135deg, #ec4899, #db2777);
}

/* ===== 特別號碼球 ===== */
.ball-3d.special {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  font-weight: 800;
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.ball-3d.special::before {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
}

/* 特別號碼加號 */
.special-number-plus {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0.5rem;
  color: #f59e0b;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.special-number-container {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* ===== 動畫效果 ===== */
@keyframes ballPop {
  0% { 
    transform: scale(0.3);
    opacity: 0;
  }
  50% { 
    transform: scale(1.1);
    opacity: 0.8;
  }
  100% { 
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes ballBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes ballGlow {
  0%, 100% {
    box-shadow: 
      0 4px 8px rgba(0, 0, 0, 0.2),
      inset 0 2px 4px rgba(255, 255, 255, 0.3),
      inset 0 -2px 4px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 
      0 8px 16px rgba(0, 0, 0, 0.3),
      inset 0 2px 4px rgba(255, 255, 255, 0.4),
      inset 0 -2px 4px rgba(0, 0, 0, 0.3),
      0 0 20px rgba(139, 92, 246, 0.5);
  }
}

/* 動畫類 */
.ball-3d.new {
  animation: ballPop 0.6s ease-out forwards;
}

.ball-3d.bounce {
  animation: ballBounce 1s ease-in-out;
}

.ball-3d.glow {
  animation: ballGlow 2s ease-in-out infinite;
}

/* ===== 號碼球容器 ===== */
.number-balls-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.number-balls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

/* ===== 響應式設計 ===== */
@media (max-width: 768px) {
  .ball-3d {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.9rem;
    margin: 0 0.2rem 0.4rem;
  }

  .ball-3d.special {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1rem;
  }

  .special-number-plus {
    font-size: 1.3rem;
    margin: 0 0.4rem;
  }

  .number-balls-container {
    gap: 0.3rem;
  }
}

@media (max-width: 480px) {
  .ball-3d {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.8rem;
    margin: 0 0.15rem 0.3rem;
  }

  .ball-3d.special {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.9rem;
  }

  .special-number-plus {
    font-size: 1.1rem;
    margin: 0 0.3rem;
  }

  .number-balls-container {
    gap: 0.2rem;
  }
}

/* ===== 特殊效果 ===== */
.ball-3d.highlighted {
  animation: ballGlow 1.5s ease-in-out infinite;
  transform: scale(1.1);
}

.ball-3d.selected {
  border: 3px solid #fbbf24;
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(251, 191, 36, 0.6);
}

/* 確保所有模式下字體顏色一致 */
.ball-3d {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== 載入動畫 ===== */
@keyframes ballLoading {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.ball-3d.loading {
  animation: ballLoading 1.4s ease-in-out infinite;
}

.ball-3d.loading:nth-child(1) { animation-delay: 0s; }
.ball-3d.loading:nth-child(2) { animation-delay: 0.2s; }
.ball-3d.loading:nth-child(3) { animation-delay: 0.4s; }
.ball-3d.loading:nth-child(4) { animation-delay: 0.6s; }
.ball-3d.loading:nth-child(5) { animation-delay: 0.8s; }
.ball-3d.loading:nth-child(6) { animation-delay: 1s; }
.ball-3d.loading:nth-child(7) { animation-delay: 1.2s; }
