/**
 * Prize Wheel Spinner Styles - v2.0
 */

/* ─── CSS Custom Properties ─────────────────────────────────── */
:root {
  --pw-primary:       #6366f1;
  --pw-primary-dark:  #4f46e5;
  --pw-secondary:     #8b5cf6;
  --pw-success:       #10b981;
  --pw-success-dark:  #059669;
  --pw-danger:        #ef4444;
  --pw-danger-dark:   #dc2626;
  --pw-warning:       #f59e0b;
  --pw-text:          #1e293b;
  --pw-text-muted:    #64748b;
  --pw-border:        #e2e8f0;
  --pw-bg:            #f8fafc;
  --pw-white:         #ffffff;
  --pw-radius:        12px;
  --pw-radius-sm:     8px;
  --pw-shadow:        0 4px 20px rgba(0, 0, 0, 0.08);
  --pw-shadow-lg:     0 12px 40px rgba(0, 0, 0, 0.15);
  --pw-font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --pw-transition:    0.2s ease;
}

/* ─── Base ──────────────────────────────────────────────────── */
.prize-wheel-container {
  font-family: var(--pw-font);
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: var(--pw-text);
}

.prize-wheel-container *,
.prize-wheel-container *::before,
.prize-wheel-container *::after {
  box-sizing: border-box;
}

/* ─── Toolbar ───────────────────────────────────────────────── */
.prize-wheel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--pw-white);
  border-bottom: 1px solid var(--pw-border);
  gap: 12px;
  flex-wrap: wrap;
}

.prize-wheel-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prize-wheel-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prize-wheel-name-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ede9fe;
  color: var(--pw-primary-dark);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  transition: all var(--pw-transition);
}

/* ─── Mute Button ───────────────────────────────────────────── */
.prize-wheel-mute-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--pw-border);
  border-radius: 50%;
  background: var(--pw-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--pw-transition);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.prize-wheel-mute-btn:hover {
  border-color: var(--pw-primary);
  background: #ede9fe;
  transform: scale(1.05);
}

.prize-wheel-mute-btn.muted {
  border-color: var(--pw-danger);
  background: #fee2e2;
}

/* ─── Main Layout ───────────────────────────────────────────── */
.prize-wheel-content {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 24px;
}

.prize-wheel-canvas-section {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.prize-wheel-controls-section {
  flex: 0 0 300px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Canvas Container ──────────────────────────────────────── */
.prize-wheel-canvas-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* ─── Pointer ───────────────────────────────────────────────── */
.prize-wheel-pointer {
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 38px solid #ef4444;
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  filter: drop-shadow(0 4px 8px rgba(239, 68, 68, 0.5));
}

/* ─── Canvas ────────────────────────────────────────────────── */
.prize-wheel-canvas {
  display: block;
  margin: 0 auto;
  touch-action: none;
  border-radius: 50%;
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.8),
    0 8px 40px rgba(0, 0, 0, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ─── Full-Screen Winner Screen ─────────────────────────────── */
.prize-wheel-winner-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.prize-wheel-winner-screen.show {
  opacity: 1;
  pointer-events: all;
}

.prize-wheel-winner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 35, 0.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}

.prize-wheel-winner-card {
  position: relative;
  background: linear-gradient(145deg, #1e1b4b 0%, #0f172a 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 24px;
  padding: clamp(32px, 5vw, 60px) clamp(24px, 7vw, 72px);
  text-align: center;
  max-width: min(620px, 92vw);
  width: 100%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 80px rgba(99, 102, 241, 0.25),
    0 30px 70px rgba(0, 0, 0, 0.6);
  animation: winnerCardIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes winnerCardIn {
  from {
    transform: scale(0.65) translateY(40px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.winner-trophy {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1;
  margin-bottom: 10px;
  display: block;
  animation: trophyBounce 1.6s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-14px) scale(1.08); }
}

.winner-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--pw-warning);
  margin-bottom: 14px;
}

.winner-name-display {
  font-size: clamp(2.2rem, 7vw, 4.5rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 10px;
  word-break: break-word;
  animation: nameGlow 2.5s ease-in-out infinite alternate;
}

@keyframes nameGlow {
  from {
    text-shadow:
      0 0 20px rgba(139, 92, 246, 0.9),
      0 0 60px rgba(99, 102, 241, 0.6);
  }
  to {
    text-shadow:
      0 0 30px rgba(245, 158, 11, 0.9),
      0 0 80px rgba(239, 68, 68, 0.5);
  }
}

.winner-remaining {
  font-size: 0.875rem;
  color: #94a3b8;
  margin-bottom: 28px;
  min-height: 20px;
}

.winner-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.prize-wheel-btn-spin-again {
  background: linear-gradient(135deg, var(--pw-primary) 0%, var(--pw-secondary) 100%);
  color: white;
  border: none;
  padding: 13px 28px;
  border-radius: var(--pw-radius-sm);
  font-family: var(--pw-font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--pw-transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
}

.prize-wheel-btn-spin-again:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(99, 102, 241, 0.6);
}

.prize-wheel-btn-spin-again:active {
  transform: translateY(0);
}

.prize-wheel-btn-dismiss {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 13px 28px;
  border-radius: var(--pw-radius-sm);
  font-family: var(--pw-font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--pw-transition);
}

.prize-wheel-btn-dismiss:hover {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

/* ─── Controls: Input Groups ────────────────────────────────── */
.prize-wheel-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prize-wheel-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.prize-wheel-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--pw-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.prize-wheel-count-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pw-primary-dark);
  background: #ede9fe;
  padding: 2px 9px;
  border-radius: 10px;
  white-space: nowrap;
  transition: all var(--pw-transition);
}

.prize-wheel-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--pw-border);
  border-radius: var(--pw-radius-sm);
  font-family: var(--pw-font);
  font-size: 0.9rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 180px;
  transition: border-color var(--pw-transition), box-shadow var(--pw-transition);
  color: var(--pw-text);
  background: var(--pw-white);
}

.prize-wheel-textarea:focus {
  outline: none;
  border-color: var(--pw-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.prize-wheel-input {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--pw-border);
  border-radius: var(--pw-radius-sm);
  font-family: var(--pw-font);
  font-size: 0.9rem;
  transition: border-color var(--pw-transition), box-shadow var(--pw-transition);
  color: var(--pw-text);
  background: var(--pw-white);
  appearance: none;
  -webkit-appearance: none;
}

.prize-wheel-input:focus {
  outline: none;
  border-color: var(--pw-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

select.prize-wheel-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.prize-wheel-error {
  min-height: 18px;
  color: var(--pw-danger);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.prize-wheel-button {
  padding: 10px 18px;
  border: none;
  border-radius: var(--pw-radius-sm);
  font-family: var(--pw-font);
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--pw-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1;
}

.prize-wheel-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.prize-wheel-button:active:not(:disabled) {
  transform: translateY(0);
}

.prize-wheel-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Spin button – large, prominent */
.prize-wheel-button-primary {
  background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
  flex: 1;
  font-size: 1.05rem;
  padding: 13px 20px;
  letter-spacing: 0.01em;
}

.prize-wheel-button-primary:hover:not(:disabled) {
  box-shadow: 0 6px 22px rgba(59, 130, 246, 0.5);
}

/* Save button */
.prize-wheel-button-secondary {
  background: linear-gradient(135deg, var(--pw-primary) 0%, var(--pw-secondary) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.prize-wheel-button-secondary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

/* New Wheel button */
.prize-wheel-button-new {
  background: transparent;
  border: 2px solid var(--pw-primary);
  color: var(--pw-primary);
  font-size: 0.875rem;
  padding: 7px 14px;
}

.prize-wheel-button-new:hover:not(:disabled) {
  background: var(--pw-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

/* Success/green button */
.prize-wheel-button-success {
  background: linear-gradient(135deg, var(--pw-success-dark) 0%, var(--pw-success) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.prize-wheel-button-small {
  padding: 7px 14px;
  font-size: 0.8125rem;
}

/* Button group */
.prize-wheel-button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.45s ease-in-out;
}

/* ─── Messages ──────────────────────────────────────────────── */
.prize-wheel-message {
  padding: 10px 14px;
  border-radius: var(--pw-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
}

.prize-wheel-message-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.prize-wheel-message-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.prize-wheel-message-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* ─── Loading Spinner ───────────────────────────────────────── */
.prize-wheel-loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: white;
  animation: pw-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes pw-spin {
  to { transform: rotate(360deg); }
}

/* ─── My Saved Wheels (admin template) ──────────────────────── */
.prize-wheel-saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.prize-wheel-saved-item {
  background: var(--pw-white);
  border: 2px solid var(--pw-border);
  border-radius: var(--pw-radius);
  padding: 20px;
  transition: all var(--pw-transition);
}

.prize-wheel-saved-item:hover {
  border-color: var(--pw-primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.12);
  transform: translateY(-2px);
}

.prize-wheel-saved-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--pw-text);
  margin: 0 0 10px 0;
}

.prize-wheel-saved-meta {
  color: var(--pw-text-muted);
  font-size: 0.875rem;
  margin-bottom: 14px;
}

.prize-wheel-saved-url {
  background: var(--pw-bg);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-family: 'Courier New', monospace;
  color: #475569;
  margin-bottom: 14px;
  word-break: break-all;
}

.prize-wheel-saved-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.prize-wheel-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--pw-text-muted);
}

.prize-wheel-empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.25;
}

.prize-wheel-empty-text {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* ─── Modal ─────────────────────────────────────────────────── */
.prize-wheel-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.prize-wheel-modal.show {
  display: flex;
}

.prize-wheel-modal-content {
  background: var(--pw-white);
  border-radius: var(--pw-radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--pw-shadow-lg);
}

.prize-wheel-modal-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--pw-text);
}

.prize-wheel-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 960px) {
  .prize-wheel-controls-section {
    flex: 0 0 260px;
    width: 260px;
  }

  .prize-wheel-content {
    gap: 20px;
    padding: 18px;
  }
}

@media (max-width: 700px) {
  .prize-wheel-content {
    flex-direction: column;
    padding: 12px;
    gap: 16px;
  }

  .prize-wheel-controls-section {
    flex: unset;
    width: 100%;
  }

  .prize-wheel-textarea {
    min-height: 140px;
  }

  .prize-wheel-toolbar {
    padding: 8px 12px;
  }

  .prize-wheel-saved-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .prize-wheel-winner-card {
    padding: 28px 20px;
  }

  .winner-actions {
    flex-direction: column;
    gap: 10px;
  }

  .prize-wheel-btn-spin-again,
  .prize-wheel-btn-dismiss {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .prize-wheel-button-group {
    flex-direction: column;
  }

  .prize-wheel-button-primary {
    width: 100%;
  }
}
