/* ============================================================
   ROLETA DE SORTEIO — ESTILO PREMIUM GAME-SHOW
   ============================================================ */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Cores principais */
  --bg-dark:       #0b0e1a;
  --bg-card:       #141829;
  --bg-sidebar:    #111525;
  --accent:        #f5a623;
  --accent-hover:  #ffc857;
  --accent-glow:   rgba(245, 166, 35, .45);
  --primary:       #4a90d9;
  --primary-hover: #6fb1ff;
  --danger:        #e74c3c;
  --danger-hover:  #ff6b5a;
  --text:          #eaf0ff;
  --text-muted:    #8892b0;
  --border:        rgba(255,255,255,.07);
  --glass:         rgba(255,255,255,.04);

  /* Layout */
  --sidebar-w: 340px;
  --topbar-h:  60px;
  --radius:    14px;
  --radius-sm: 8px;

  /* Tipografia */
  --ff: 'Poppins', sans-serif;
  --ff-display: 'Orbitron', sans-serif;
}

html { font-size: 16px; }
@media (min-width: 2560px) { html { font-size: 20px; } }  /* 4K */

body {
  font-family: var(--ff);
  background: var(--bg-dark);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- CONFETTI CANVAS ---------- */
#confettiCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9000;
}

/* ---------- APP LAYOUT ---------- */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 500;
  transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .3s;
  overflow: hidden;
}
.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-w)));
  opacity: 0;
  pointer-events: none;
  min-width: 0;
  width: 0;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 10px;
}
.sidebar-header h2 {
  font-size: 1.1rem; font-weight: 700;
}

/* Form add */
.form-add {
  padding: 10px 20px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.form-add input[type="text"] {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s;
}
.form-add input[type="text"]:focus {
  border-color: var(--accent);
}

.file-label {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  font-size: .85rem; color: var(--text-muted);
  padding: 6px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .2s;
}
.file-label:hover { border-color: var(--accent); color: var(--accent); }
.file-label input { display: none; }
.photo-file-name { font-size: .75rem; color: var(--accent); padding: 0 2px; min-height: 1em; }

/* Bulk actions */
.bulk-actions {
  display: flex; gap: 6px;
  padding: 0 20px 10px;
  flex-wrap: wrap;
}

/* Participant count */
.participant-count {
  padding: 4px 20px 6px;
  font-size: .8rem; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Participant list */
.participant-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 20px;
}
.participant-list::-webkit-scrollbar { width: 5px; }
.participant-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.participant-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
  animation: fadeSlideIn .3s ease both;
}
.participant-item:hover { background: var(--glass); }
.participant-item .p-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: contain;
  border: none;
  flex-shrink: 0;
  background: transparent;
}
.participant-item .p-name {
  flex: 1;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.participant-item .p-remove {
  background: none; border: none; color: var(--danger);
  cursor: pointer; font-size: 1.1rem;
  opacity: .5; transition: opacity .2s;
  padding: 4px;
}
.participant-item .p-remove:hover { opacity: 1; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- STAGE ---------- */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(74,144,217,.12) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 90%, rgba(245,166,35,.08) 0%, transparent 50%),
    var(--bg-dark);
}

/* Top bar */
.top-bar {
  width: 100%;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(0,0,0,.25);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  flex-shrink: 0;
}

.brand {
  display: flex; align-items: center; gap: 10px;
}
.brand-icon { font-size: 1.6rem; }
.brand-text {
  font-family: var(--ff-display);
  font-size: 1.05rem;
  letter-spacing: 2px;
  color: var(--text);
}
.brand-text strong { color: var(--accent); }

.top-actions { display: flex; gap: 8px; }

.sidebar-toggle-open { display: none; }
.sidebar.collapsed ~ .stage .sidebar-toggle-open { display: inline-flex; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ff); font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn-sm {
  font-size: .78rem; padding: 6px 12px;
}
.btn-lg {
  font-size: 1.1rem; padding: 14px 36px;
}
.btn-block { width: 100%; justify-content: center; }
.btn-ghost {
  background: var(--glass); color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,.08); color: var(--text); }
.btn-primary {
  background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent {
  background: var(--accent); color: #111;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-danger {
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-icon-only {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.1rem;
  padding: 4px 8px;
  transition: color .2s;
}
.btn-icon-only:hover { color: var(--text); }

/* Spin button */
.btn-spin {
  margin-top: 14px;
  padding: 18px 56px;
  font-size: 1.5rem;
  font-family: var(--ff-display);
  font-weight: 900;
  letter-spacing: 3px;
  border-radius: 60px;
  background: linear-gradient(135deg, var(--accent), #ff6a00);
  color: #111;
  box-shadow:
    0 0 30px var(--accent-glow),
    0 6px 20px rgba(0,0,0,.5);
  position: relative;
  overflow: hidden;
  z-index: 10;
  transition: transform .2s, box-shadow .2s, opacity .3s;
  flex-shrink: 0;
}
.btn-spin::before {
  content: '';
  position: absolute; inset: -50%;
  background: conic-gradient(transparent 0deg, rgba(255,255,255,.25) 90deg, transparent 180deg);
  animation: spinShine 3s linear infinite;
}
@keyframes spinShine {
  to { transform: rotate(360deg); }
}
.btn-spin:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow:
    0 0 50px var(--accent-glow),
    0 8px 30px rgba(0,0,0,.6);
}
.btn-spin:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.btn-spin:disabled::before { animation: none; }
.spin-icon, .spin-text { position: relative; z-index: 1; }

/* ---------- ROULETTE AREA ---------- */
.roulette-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  min-height: 0;
  padding: 10px 20px;
}

.canvas-wrap {
  position: relative;
  width: min(62vh, 70vw, 700px);
  height: min(62vh, 70vw, 700px);
  flex-shrink: 0;
}
@media (min-width: 2560px) {
  .canvas-wrap { width: min(65vh, 55vw, 1100px); height: min(65vh, 55vw, 1100px); }
}

#rouletteCanvas {
  width: 100%; height: 100%;
  display: block;
  filter: drop-shadow(0 0 40px rgba(74,144,217,.2));
}

/* Center hub */
.center-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1f36, #252b47);
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px var(--accent-glow), inset 0 0 14px rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-display);
  font-size: .65rem;
  letter-spacing: 2px;
  color: var(--accent);
  pointer-events: none;
  z-index: 5;
}

/* Pointer (arrow) — posicionado no TOPO (12h), apontando para baixo */
.pointer-wrap {
  position: absolute;
  top: calc(50% - min(31vh, 35vw, 350px) - 18px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.5));
}
@media (min-width: 2560px) {
  .pointer-wrap { top: calc(50% - min(32.5vh, 27.5vw, 550px) - 22px); }
}
.pointer {
  width: 0; height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 38px solid var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

/* ---------- LAST WINNER BAR ---------- */
.last-winner-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  background: rgba(0,0,0,.3);
  border-radius: 40px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  animation: fadeUp .5s ease;
}
.last-winner-bar.hidden { display: none; }
.lw-label { font-size: .8rem; color: var(--text-muted); }
.lw-photo {
  width: 40px; height: 40px;
  border-radius: 8px; object-fit: contain;
  border: none;
  background: transparent;
}
.lw-name { font-weight: 700; font-size: 1rem; color: var(--accent); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- WINNER OVERLAY ---------- */
.winner-overlay {
  position: fixed; inset: 0;
  background: rgba(5,7,18,.88);
  backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  z-index: 8000;
  animation: fadeIn .4s ease;
}
.winner-overlay.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.winner-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  animation: popIn .5s cubic-bezier(.17,.67,.35,1.4);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1); }
}

.winner-badge {
  font-family: var(--ff-display);
  font-size: 2.2rem;
  letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(245,166,35,.25);
  animation: pulseBadge 1.5s ease infinite;
}
@keyframes pulseBadge {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .85; transform: scale(1.04); }
}

.winner-photo-wrap {
  position: relative;
  width: 340px; height: 340px;
}
@media (min-width: 2560px) { .winner-photo-wrap { width: 480px; height: 480px; } }

.winner-photo-wrap img {
  width: 100%; height: 100%;
  border-radius: 18px;
  object-fit: contain;
  border: none;
  box-shadow: none;
  position: relative; z-index: 2;
  background: transparent;
}
.winner-photo-glow {
  display: none;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: .7; }
  50%      { transform: scale(1.15); opacity: 1; }
}

.winner-name {
  font-family: var(--ff-display);
  font-size: 3.8rem;
  font-weight: 900;
  color: #fff;
  text-shadow:
    0 0 30px var(--accent-glow),
    0 0 60px rgba(245,166,35,.3),
    0 4px 12px rgba(0,0,0,.6);
  text-align: center;
  max-width: 90vw;
  word-break: break-word;
  line-height: 1.15;
}
@media (min-width: 2560px) { .winner-name { font-size: 5.5rem; } }

/* Winner action buttons */
.winner-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}
.btn-md {
  font-size: .92rem; padding: 11px 22px;
}
.winner-actions .btn:disabled {
  opacity: .3;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-danger-fill {
  background: var(--danger); color: #fff; border: none;
}
.btn-danger-fill:hover { background: var(--danger-hover); }

/* ---------- DEFAULT AVATAR SVG (inline data URI) ---------- */
.default-avatar {
  /* Will be set via JS */
}

/* ---------- SOUND MUTED INDICATOR ---------- */
.sound-off .btn-sound-label::after {
  content: ' (off)';
}

/* ---------- RESPONSIVE / MOBILE ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    box-shadow: 6px 0 30px rgba(0,0,0,.6);
  }
  .sidebar.collapsed { transform: translateX(-100%); }
  .sidebar-toggle-open { display: inline-flex !important; }

  .stage { overflow-y: auto; min-height: 100vh; height: auto; }

  .roulette-area {
    flex: 0 0 auto;
    padding: 8px 10px;
  }
  .canvas-wrap { width: min(48vh, 82vw, 400px); height: min(48vh, 82vw, 400px); }
  .pointer-wrap { top: calc(50% - min(24vh, 41vw, 200px) - 16px); left: 50%; transform: translateX(-50%); }

  .btn-spin {
    padding: 14px 38px; font-size: 1.2rem;
    margin-top: 10px;
    margin-bottom: 14px;
    flex-shrink: 0;
  }

  .winner-name { font-size: 2rem; }
  .winner-badge { font-size: 1.3rem; letter-spacing: 3px; }
  .winner-photo-wrap { width: 200px; height: 200px; }
  .winner-actions { gap: 8px; }
  .btn-md { font-size: .82rem; padding: 9px 16px; }

  .last-winner-bar { margin-bottom: 14px; }
}

/* ---------- UTILITY ---------- */
.hidden { display: none !important; }

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Animations for spinning state */
.spinning .center-hub span {
  animation: none;
}
