/* ═══════════════════════════════════════════════════════════
   VOTEMAISVINDI — Design System (inspirado shadcn/ui)
   ═══════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ─────────────────────────────────────── */
:root {
  /* Cores base */
  --background: #09090b;
  --foreground: #fafafa;
  --card: #09090b;
  --card-foreground: #fafafa;
  --popover: #09090b;
  --popover-foreground: #fafafa;

  /* Cores primárias (Dourado = brand) */
  --primary: #d4af37;
  --primary-foreground: #000000;
  --primary-hover: #e6c44a;
  --primary-muted: rgba(212, 175, 55, 0.12);

  /* Cores secundárias */
  --secondary: #1c1c1e;
  --secondary-foreground: #fafafa;

  /* Cores de destaque */
  --accent: #1c1c1e;
  --accent-foreground: #fafafa;

  /* Bordas e inputs */
  --border: rgba(255, 255, 255, 0.08);
  --input: rgba(255, 255, 255, 0.08);
  --ring: #d4af37;

  /* Cores de estado */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --success-border: rgba(34, 197, 94, 0.3);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.3);

  /* Texto */
  --text-muted: #a1a1aa;

  /* Raio */
  --radius: 0.5rem;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-bg: #0a0a0a;
  --sidebar-border: rgba(255, 255, 255, 0.06);
}

/* ── RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── TYPOGRAPHY ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--foreground);
}
h1 { font-size: 1.875rem; line-height: 1.2; }
h2 { font-size: 1.5rem; line-height: 1.3; }
h3 { font-size: 1.25rem; line-height: 1.4; }
h4 { font-size: 1rem; line-height: 1.5; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-gold { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }

/* ── LAYOUT ────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── SPACING ───────────────────────────────────────────── */
.p-0 { padding: 0; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.m-0 { margin: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-auto { margin-top: auto; }
.ml-auto { margin-left: auto; }

/* ── CARD ──────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.card-content {
  padding: 1.5rem;
}
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

/* ── BUTTON ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  line-height: 1.25rem;
  text-decoration: none;
}
.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: #2a2a2c;
}
.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-ghost {
  background: transparent;
  color: var(--foreground);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover {
  background: #16a34a;
}
.btn-sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}
.btn-lg {
  height: 2.75rem;
  padding: 0 2rem;
  font-size: 1rem;
}
.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 2rem;
  height: 2rem;
}

/* ── BADGE ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-default {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.badge-primary {
  background: var(--primary-muted);
  color: var(--primary);
  border-color: rgba(212, 175, 55, 0.3);
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: var(--info-border);
}
.badge-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

/* ── INPUT / SELECT / TEXTAREA ─────────────────────────── */
.input {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #52525b; }
.input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}
.input:disabled { opacity: 0.5; cursor: not-allowed; }

.select {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: transparent;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}
.select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}
.select option { background: #18181b; }

.textarea {
  display: flex;
  width: 100%;
  min-height: 5rem;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  resize: vertical;
  font-family: inherit;
}
.textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

/* ── LABEL ─────────────────────────────────────────────── */
.label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  display: block;
  margin-bottom: 0.375rem;
}
.label-muted {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── FORM GROUP ────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── TABLE ─────────────────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.table thead {
  border-bottom: 1px solid var(--border);
}
.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255,255,255,0.02);
}
.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* ── AVATAR ────────────────────────────────────────────── */
.avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.75rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1.25rem; }

/* ── SEPARATOR ─────────────────────────────────────────── */
.separator {
  height: 1px;
  background: var(--border);
  width: 100%;
}
.separator-v {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

/* ── ALERT / TOAST ─────────────────────────────────────── */
.alert {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.alert-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}
.alert-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}
.alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}
.alert-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info);
}
.alert-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin-top: 0.125rem;
}

/* ── MODAL / DIALOG ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  pointer-events: none;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.125rem; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── SKELETON ──────────────────────────────────────────── */
.skeleton {
  background: var(--secondary);
  border-radius: var(--radius);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── TABS ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
}
.tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--foreground); }
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── DROPDOWN ──────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 10rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.1s;
  color: var(--foreground);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: var(--accent); }
.dropdown-separator {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* ── STAT CARD ─────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.375rem;
}

/* ── PAGE HEADER ───────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  opacity: 0.5;
}
.empty-state-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

/* ── UTILITIES ─────────────────────────────────────────── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.overflow-hidden { overflow: hidden; }
