/* ===== SORTEIO ALUNOS - CUSTOM STYLES ===== */

/* Sections - always visible */
.sorteio-section {
  display: block;
  margin-bottom: 32px;
}

.sorteio-section + .sorteio-section {
  margin-top: 16px;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: rgba(102, 126, 234, 0.02);
  position: relative;
  overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.08);
  transform: translateY(-2px);
}

.upload-zone.dragover {
  animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

.upload-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 0.9rem;
  color: var(--muted);
}

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.format-hint {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(102, 126, 234, 0.05);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.format-hint code {
  background: rgba(102, 126, 234, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: monospace;
  color: var(--primary);
}

.hint-example {
  display: block;
  margin-top: 4px;
  font-style: italic;
}

.upload-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  color: #065f46;
  font-weight: 500;
}

[data-theme="dark"] .upload-status {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-icon {
  font-size: 1.2rem;
}

/* Stats Row */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-box {
  flex: 1;
  min-width: 120px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-available {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.stat-drawn {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.1) 100%);
}

.stat-total {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(102, 126, 234, 0.1) 100%);
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-available .stat-number {
  color: #10b981;
}

.stat-drawn .stat-number {
  color: #f59e0b;
}

.stat-total .stat-number {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Search Filter */
.search-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
}

#clearSearch {
  padding: 12px 16px;
  min-width: auto;
}

/* Students Table */
.students-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.students-table {
  width: 100%;
  border-collapse: collapse;
}

.students-table th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.students-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.students-table tbody tr {
  transition: all var(--transition);
}

.students-table tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

.students-table tbody tr.available {
  background: transparent;
}

.students-table tbody tr.drawn {
  background: rgba(245, 158, 11, 0.08);
  opacity: 0.6;
}

.students-table tbody tr.drawn td {
  text-decoration: line-through;
  color: var(--muted);
}

.students-table tbody tr.highlight {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.available {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.status-badge.drawn {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.empty-message {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

/* Draw Section */
.draw-container {
  text-align: center;
  padding: 32px 24px;
}

.draw-button-wrapper {
  margin-bottom: 24px;
}

.btn-draw {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 48px;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
  overflow: hidden;
}

.btn-draw::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s ease;
}

.btn-draw:hover:not(:disabled)::before {
  left: 100%;
}

.btn-draw:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.4);
}

.btn-draw:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-draw:active:not(:disabled) {
  transform: scale(0.98);
}

.draw-icon {
  font-size: 1.8rem;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-4px) rotate(-10deg); }
  75% { transform: translateY(-4px) rotate(10deg); }
}

.btn-draw:disabled .draw-icon {
  animation: none;
}

.draw-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.options-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

.sound-toggle input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.btn-reset {
  font-size: 0.9rem;
}

/* Roulette Animation */
.roulette-container {
  text-align: center;
  padding: 32px 24px;
  animation: fadeIn 0.3s ease;
}

.roulette-display {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 32px 48px;
  border-radius: var(--radius);
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 16px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-hover);
  perspective: 1000px;
}

.roulette-text {
  animation: roulette-spin 0.1s linear infinite;
  display: inline-block;
}

@keyframes roulette-spin {
  0% { transform: translateY(-10px); opacity: 0.3; }
  50% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(10px); opacity: 0.3; }
}

.roulette-hint {
  color: var(--muted);
  font-size: 1rem;
}

/* Winner Card */
.winner-card {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

[data-theme="dark"] .winner-card {
  background: rgba(0, 0, 0, 0.95);
}

.winner-card.hidden {
  display: none;
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1001;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.winner-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #fff;
  padding: 8px 24px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.winner-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce-in {
  0% { transform: scale(0) rotate(-180deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.winner-name {
  color: #fff;
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  animation: slide-up 0.5s ease 0.2s both;
}

@keyframes slide-up {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.winner-matricula {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.2rem;
  margin-bottom: 32px;
  animation: slide-up 0.5s ease 0.3s both;
}

.winner-actions {
  animation: slide-up 0.5s ease 0.4s both;
}

.winner-actions .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}

.winner-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: #fff;
}

/* History Section */
.history-list {
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.history-item:hover {
  background: rgba(102, 126, 234, 0.05);
}

.history-item:last-child {
  border-bottom: none;
}

.history-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.history-info {
  flex: 1;
}

.history-name {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.history-matricula {
  font-size: 0.85rem;
  color: var(--muted);
}

.history-time {
  font-size: 0.8rem;
  color: var(--muted);
}

.empty-history {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

/* Animations */
.hidden {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .stats-row {
    flex-direction: column;
  }
  
  .stat-box {
    min-width: 100%;
  }
  
  .btn-draw {
    padding: 16px 32px;
    font-size: 1.2rem;
  }
  
  .winner-name {
    font-size: 2rem;
  }
  
  .winner-icon {
    font-size: 3.5rem;
  }
  
  .students-table th,
  .students-table td {
    padding: 10px 12px;
  }
  
  .options-row {
    flex-direction: column;
    gap: 12px;
  }
}