/* ============================================
   SORTEADOR DE AFAZERES - ESTILOS
   Sem emojis - Icones SVG
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* TEMA PADRAO */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #ec4899;
  --accent: #8b5cf6;
  --dark: #0f172a;
  --darker: #020617;
  --card: #1e293b;
  --surface: #334155;
  --surface-light: #475569;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --transition: all 0.2s ease;
}

/* TEMA ESCURO PURO */
[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --secondary: #a78bfa;
  --accent: #c084fc;
  --dark: #000000;
  --darker: #0a0a0a;
  --card: #111111;
  --surface: #1a1a1a;
  --surface-light: #262626;
  --text: #fafafa;
  --text-muted: #737373;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
}

/* TEMA CLARO */
[data-theme="light"] {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --secondary: #db2777;
  --accent: #7c3aed;
  --dark: #f8fafc;
  --darker: #f1f5f9;
  --card: #ffffff;
  --surface: #e2e8f0;
  --surface-light: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

/* TEMA CYBERPUNK */
[data-theme="cyberpunk"] {
  --primary: #00ff9f;
  --primary-dark: #00cc7a;
  --secondary: #ff00ff;
  --accent: #00ffff;
  --dark: #0d0221;
  --darker: #070214;
  --card: #1a0b2e;
  --surface: #2d1b4e;
  --surface-light: #432874;
  --text: #ffffff;
  --text-muted: #a855f7;
  --success: #00ff9f;
  --warning: #ffff00;
  --danger: #ff006e;
  --shadow: 0 0 10px rgba(0, 255, 159, 0.3);
  --shadow-lg: 0 0 20px rgba(0, 255, 159, 0.5);
}

[data-theme="cyberpunk"] .result-box {
  border: 2px solid var(--primary);
  box-shadow: 0 0 20px rgba(0, 255, 159, 0.2);
}

[data-theme="cyberpunk"] .btn-draw {
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 2px solid var(--primary);
  box-shadow: 0 0 15px rgba(0, 255, 159, 0.4);
}

[data-theme="cyberpunk"] .tag {
  border: 1px solid var(--surface-light);
}

[data-theme="cyberpunk"] .tag:hover {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 255, 159, 0.3);
}

[data-theme="cyberpunk"] .task-item {
  border: 1px solid var(--surface-light);
}

[data-theme="cyberpunk"] .task-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 255, 159, 0.2);
}

[data-theme="cyberpunk"] .result-text.winner {
  text-shadow: 0 0 20px var(--warning);
  -webkit-text-fill-color: var(--warning);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--dark);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.header-title {
  flex: 1;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-header {
  width: 24px;
  height: 24px;
}

.header p {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

.btn-theme {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-theme svg {
  width: 20px;
  height: 20px;
}

.btn-theme:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(15deg) scale(1.1);
}

/* Layout */
.main-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.left-column {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: var(--darker);
  border-top: 1px solid var(--surface);
}

/* Resultado */
.result-section {
  background: var(--card);
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--surface);
}

.result-box {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1),
    rgba(236, 72, 153, 0.1)
  );
  border: 2px solid var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1rem;
  text-align: center;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.result-box.spinning {
  animation: border-pulse 0.5s infinite;
}

@keyframes border-pulse {
  0%,
  100% {
    border-color: var(--surface);
  }
  50% {
    border-color: var(--primary);
  }
}

.result-text {
  font-size: 1.25rem;
  font-weight: 700;
  word-break: break-word;
  z-index: 1;
  transition: var(--transition);
}

.result-text.winner {
  background: linear-gradient(135deg, var(--warning), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: winner-scale 0.5s ease;
}

@keyframes winner-scale {
  0% {
    transform: scale(0.8);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.btn-draw {
  width: 100%;
  margin-top: 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border: none;
  color: white;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  touch-action: manipulation;
}

.icon-btn {
  width: 20px;
  height: 20px;
}

.btn-draw:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-draw:active:not(:disabled) {
  transform: translateY(0);
}

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

/* Input */
.input-section {
  padding: 1rem;
  background: var(--dark);
}

.input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.input-field {
  flex: 1;
  background: var(--card);
  border: 2px solid var(--surface);
  color: var(--text);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  min-width: 0;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.input-field::placeholder {
  color: var(--text-muted);
}

.btn-add {
  background: var(--surface);
  border: none;
  color: white;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-add svg {
  width: 24px;
  height: 24px;
}

.btn-add:hover {
  background: var(--primary);
}

.btn-add:active {
  transform: scale(0.95);
}

.quick-tags {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.quick-tags::-webkit-scrollbar {
  display: none;
}

.tag {
  background: var(--card);
  border: 1px solid var(--surface);
  color: var(--text-muted);
  padding: 0.5rem 0.875rem;
  border-radius: 20px;
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.icon-tag {
  width: 16px;
  height: 16px;
}

.tag:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--primary);
}

.tag:active {
  transform: scale(0.95);
}

/* Tarefas */
.tasks-section {
  flex: 1;
  padding: 0 1rem 1rem;
  overflow-y: auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.section-title {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-text {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-text:hover {
  background: rgba(239, 68, 68, 0.1);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-item {
  background: var(--card);
  border: 1px solid var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slide-in 0.3s ease;
  transition: var(--transition);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.task-item:hover {
  border-color: var(--surface-light);
  transform: translateX(4px);
}

.task-number {
  background: var(--surface);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}

.task-text {
  flex: 1;
  font-size: 0.9375rem;
  word-break: break-word;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-icon.delete {
  color: var(--danger);
}

.btn-icon.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Sidebar */
.stats-card,
.history-card {
  background: var(--card);
  border: 1px solid var(--surface);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: var(--transition);
}

.stats-card h3,
.history-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-title {
  width: 18px;
  height: 18px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--surface);
}

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

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.btn-icon-small {
  background: none;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-small svg {
  width: 18px;
  height: 18px;
}

.btn-icon-small:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.history-list-container {
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--surface);
  gap: 0.5rem;
}

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

.history-info {
  flex: 1;
  min-width: 0;
}

.history-task {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn-reuse {
  background: var(--surface);
  border: none;
  color: var(--text);
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-reuse:hover {
  background: var(--primary);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.5rem;
  opacity: 0.5;
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-text {
  font-size: 0.9375rem;
}

.empty-state-small {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  color: var(--text);
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 320px;
  text-align: center;
  border: 1px solid var(--surface);
  animation: modal-in 0.3s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.modal-text {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-modal {
  flex: 1;
  padding: 0.875rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-modal.cancel {
  background: var(--surface);
  color: var(--text);
}

.btn-modal.cancel:hover {
  background: var(--surface-light);
}

.btn-modal.confirm {
  background: var(--danger);
  color: white;
}

.btn-modal.confirm:hover {
  background: #dc2626;
}

/* Modal Tema */
.modal-theme {
  max-width: 360px;
}

.theme-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.theme-btn {
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.theme-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.theme-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.theme-preview {
  width: 60px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--surface-light);
}

.theme-preview.default {
  background: linear-gradient(135deg, #6366f1, #ec4899);
}

.theme-preview.dark {
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
}

.theme-preview.light {
  background: linear-gradient(135deg, #4f46e5, #db2777);
}

.theme-preview.cyberpunk {
  background: linear-gradient(135deg, #00ff9f, #ff00ff);
  box-shadow: 0 0 10px rgba(0, 255, 159, 0.5);
}

.theme-name {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}

/* Confetti */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 999;
}

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

/* DESKTOP */
@media (min-width: 900px) {
  body {
    background: var(--darker);
  }

  .app {
    max-width: 1400px;
    margin: 0 auto;
  }

  .header {
    padding: 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    margin: 0 1rem;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .icon-header {
    width: 28px;
    height: 28px;
  }

  .header p {
    font-size: 1rem;
  }

  .main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    padding: 1.5rem;
    align-items: start;
  }

  .left-column {
    gap: 1rem;
  }

  .right-column {
    position: sticky;
    top: 100px;
    padding: 0;
    background: transparent;
    border: none;
    gap: 1.5rem;
  }

  .result-section,
  .input-section,
  .tasks-section,
  .stats-card,
  .history-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface);
  }

  .result-section {
    padding: 2rem;
  }

  .result-box {
    min-height: 140px;
    padding: 3rem;
  }

  .result-text {
    font-size: 1.75rem;
  }

  .result-text.winner {
    font-size: 2.25rem;
  }

  .btn-draw {
    padding: 1.25rem;
    font-size: 1.125rem;
  }

  .icon-btn {
    width: 24px;
    height: 24px;
  }

  .input-section {
    padding: 1.5rem;
    background: var(--card);
  }

  .quick-tags {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .tasks-section {
    padding: 1.5rem;
    max-height: 400px;
  }

  .stats-card,
  .history-card {
    padding: 1.5rem;
  }

  .stats-card h3,
  .history-card h3 {
    font-size: 1.125rem;
  }

  .icon-title {
    width: 20px;
    height: 20px;
  }

  .history-list-container {
    max-height: 300px;
  }

  .toast {
    bottom: 40px;
  }

  .theme-options {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1200px) {
  .main-layout {
    grid-template-columns: 1fr 420px;
  }
}
