/* ==============================================
   Spinning Wheel – Custom CSS
   Only for things Tailwind CDN can't handle:
   canvas, complex animations, pseudo-elements,
   modal transitions, and component-specific styles.
   ============================================== */

/* ── Background glow blobs ──────────────────── */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: #6c5ce7;
  top: -120px;
  left: -100px;
  opacity: 0.35;
}
.blob-2 {
  width: 400px;
  height: 400px;
  background: #00cec9;
  bottom: -100px;
  right: -80px;
  opacity: 0.35;
}
.blob-3 {
  width: 300px;
  height: 300px;
  background: #e84393;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.15;
}

/* Light mode: softer blobs */
html:not(.dark) .bg-blob {
  opacity: 0.12;
}
html:not(.dark) .blob-3 {
  opacity: 0.06;
}

/* ── Panels (glassmorphism) ─────────────────── */
.panel {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

html:not(.dark) .panel {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ── Wheel ──────────────────────────────────── */
.wheel-container {
  position: relative;
}

#wheelCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08),
    0 0 60px rgba(108, 92, 231, 0.25), 0 20px 60px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.3s;
}

html:not(.dark) #wheelCanvas {
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.06), 0 0 40px rgba(108, 92, 231, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.1);
}

.wheel-center-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  background: radial-gradient(circle, #fff, #ddd);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  z-index: 3;
  pointer-events: none;
}

/* Pointer / Arrow – right side */
.pointer {
  position: absolute;
  top: 50%;
  right: -10px;
  transform: translateY(-50%) rotate(90deg);
  z-index: 5;
  filter: drop-shadow(0 4px 10px rgba(255, 45, 85, 0.5));
  transition: transform 0.08s;
}

/* ── Buttons ────────────────────────────────── */
.btn-ghost {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  background: transparent;
  color: #8888aa;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

html:not(.dark) .btn-ghost {
  color: #888;
  border-color: rgba(0, 0, 0, 0.12);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f0f0f5;
  border-color: rgba(255, 255, 255, 0.15);
}

html:not(.dark) .btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #333;
  border-color: rgba(0, 0, 0, 0.2);
}

.btn-spin {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 2px;
  padding: 10px 24px;
  width: 100%;
  color: #fff;
  background: linear-gradient(135deg, #6c5ce7, #a855f7);
  border: none;
  border-radius: 60px;
  cursor: pointer;
  outline: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: all 0.2s;
}

.btn-spin::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 30%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 0.5s;
}

.btn-spin:hover:not(:disabled)::before {
  transform: translateX(100%);
}
.btn-spin:hover:not(:disabled) {
  box-shadow: 0 6px 30px rgba(108, 92, 231, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}
.btn-spin:active {
  transform: scale(0.96);
}
.btn-spin:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-remove {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 24px;
  color: #ff7675;
  background: rgba(255, 118, 117, 0.1);
  border: 1px solid rgba(255, 118, 117, 0.25);
  border-radius: 60px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-remove:hover {
  background: rgba(255, 118, 117, 0.2);
  border-color: rgba(255, 118, 117, 0.5);
  transform: translateY(-1px);
}

/* ── Winner Modal ───────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: linear-gradient(
    160deg,
    rgba(40, 30, 80, 0.95),
    rgba(20, 15, 50, 0.98)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 48px 56px;
  text-align: center;
  transform: scale(0.85) translateY(30px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  position: relative;
}

html:not(.dark) .modal {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.97),
    rgba(245, 240, 255, 0.99)
  );
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

/* ── Medal Badge ────────────────────────────── */
.medal-badge {
  position: absolute;
  top: -18px;
  left: -18px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.3);
  animation: medal-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.medal-badge[data-tier="gold"] {
  background: linear-gradient(135deg, #ffd700, #f0b200, #ffdf50);
}

.medal-badge[data-tier="silver"] {
  background: linear-gradient(135deg, #c0c0c0, #a8a8a8, #d8d8d8);
}

.medal-badge[data-tier="bronze"] {
  background: linear-gradient(135deg, #cd7f32, #b5651d, #e09050);
}

@keyframes medal-pop {
  0% {
    transform: scale(0) rotate(-30deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.winner-name {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffd700, #ffaa00, #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 28px;
  animation: winner-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes winner-pulse {
  from {
    transform: scale(1);
    filter: brightness(1);
  }
  to {
    transform: scale(1.04);
    filter: brightness(1.15);
  }
}

/* ── Confetti ───────────────────────────────── */
.confetti-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall 1.8s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0.3);
  }
}

/* ── Winners Table ──────────────────────────── */
.winners-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 14px;
  user-select: none;
  color: #8888aa;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: color 0.2s;
}

html:not(.dark) .winners-table th {
  color: #999;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.winners-table th.sortable {
  cursor: pointer;
}
.winners-table th.sortable:hover {
  color: #f0f0f5;
}
html:not(.dark) .winners-table th.sortable:hover {
  color: #333;
}
.winners-table th.active-sort {
  color: #6c5ce7;
}

.sort-arrow {
  font-size: 0.7rem;
  margin-left: 2px;
}

.winners-table td {
  padding: 10px 14px;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

html:not(.dark) .winners-table td {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}

.winners-table tbody tr {
  transition: background 0.15s;
}
.winners-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}
html:not(.dark) .winners-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

.winners-table td:first-child {
  color: #8888aa;
  font-weight: 700;
  width: 50px;
}

html:not(.dark) .winners-table td:first-child {
  color: #999;
}

.winner-row-enter {
  animation: row-enter 0.35s ease-out;
}

@keyframes row-enter {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ── App Grid Layout ────────────────────────── */
.area-sidebar {
  grid-area: sidebar;
}
.area-wheel {
  grid-area: wheel;
}

/* Desktop (>900px): 2 columns – Sidebar (Input + Winners) | Wheel */
.app-grid {
  display: grid;
  grid-template-areas: "sidebar wheel";
  grid-template-columns: 380px 1fr;
  gap: 32px;
  align-items: start;
}

.area-sidebar {
  max-height: calc(100vh - 100px);
}

.area-wheel {
  align-self: center;
  justify-self: center;
}

.wheel-container {
  width: 560px;
  height: 560px;
}

/* Tablet (600px–900px): narrower sidebar */
@media (max-width: 900px) {
  .app-grid {
    grid-template-columns: 300px 1fr;
    gap: 20px;
  }

  .wheel-container {
    width: 400px;
    height: 400px;
  }
}

/* Mobile (<600px): single column – Wheel → Input → Winners */
@media (max-width: 600px) {
  .app-grid {
    grid-template-areas:
      "wheel"
      "sidebar";
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: auto;
  }

  .area-sidebar {
    width: 100%;
    max-height: none;
  }

  .area-wheel {
    justify-self: center;
  }

  .wheel-container {
    width: min(400px, 100%);
    height: auto;
    aspect-ratio: 1;
  }
}

@media (max-width: 400px) {
  .wheel-container {
    width: 300px;
    height: 300px;
  }
}
