:root {
  --primary-color: #FFA412;
  --primary-dark: #e89400;
  --secondary-color: #0067FF;
  --secondary-dark: #0052cc;
  --background-color: #f0f7ff;
  --card-background: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --border-color: #cce0ff;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --shadow: 0 2px 10px rgba(0, 103, 255, 0.1);
  --shadow-lg: 0 4px 20px rgba(0, 103, 255, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Header */
.header {
  background: var(--secondary-color);
  color: white;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  font-size: 0.9rem;
  opacity: 0.9;
}

.btn-icon {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Main Content */
.main-content {
  min-height: calc(100vh - 70px);
  padding: 2rem;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* Telas */
.tela {
  display: none;
}

.tela.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.login-box {
  background: var(--card-background);
  padding: 3rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-box h2 {
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
}

.login-box p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(247, 206, 0, 0.2);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--secondary-color);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #2a2a4e;
  transform: translateY(-2px);
}

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

.btn-danger:hover {
  background: #c82333;
}

.btn-full {
  width: 100%;
}

.btn-back {
  margin-bottom: 2rem;
}

.btn-enviar {
  margin-top: 2rem;
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* Error message */
.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 1rem;
  min-height: 1.25rem;
}

/* Princípios Grid */
.principios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.principio-card {
  background: var(--card-background);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.principio-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.principio-card.votado {
  opacity: 0.7;
  cursor: not-allowed;
}

.principio-card.votado::after {
  content: '✓ Votado';
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--success-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.principio-card.bloqueado {
  opacity: 0.5;
  cursor: not-allowed;
}

.principio-card.bloqueado::after {
  content: '🔒 Bloqueado';
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--text-muted);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.principio-card .numero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  color: var(--secondary-color);
  border-radius: 50%;
  font-weight: 700;
  margin-bottom: 1rem;
}

.principio-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.principio-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Votação */
.votacao-header {
  background: linear-gradient(135deg, var(--secondary-color), #2a2a4e);
  color: white;
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.votacao-header h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.votacao-descricao {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.7;
}

.votacao-secao {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.votacao-secao h3 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.secao-icon {
  font-size: 1.5rem;
}

.secao-descricao {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Autocomplete */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  box-shadow: var(--shadow);
}

.autocomplete-list.active {
  display: block;
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-color);
}

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

.autocomplete-item:hover {
  background: var(--primary-color);
  color: var(--secondary-color);
}

.autocomplete-item .nome {
  font-weight: 500;
}

.autocomplete-item .info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.autocomplete-item:hover .info {
  color: var(--secondary-color);
  opacity: 0.7;
}

/* Configurações */
.subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.config-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--border-color);
  background: var(--card-background);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.tab-btn:hover {
  border-color: var(--primary-color);
}

.tab-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--secondary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.config-section {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.config-section h3 {
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.config-section > p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #f0f0f0;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-family: monospace;
}

.config-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.file-upload {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.file-upload input[type="file"] {
  max-width: 200px;
}

.data-preview {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.data-preview h4 {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--background-color);
  font-weight: 600;
  color: var(--secondary-color);
}

.data-table tr:hover {
  background: #f9f9f9;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-background);
  padding: 2rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  text-align: center;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content h3 {
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.modal-content > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateX(150%);
  transition: transform 0.3s ease;
  z-index: 300;
}

.toast.active {
  transform: translateX(0);
}

.toast.success {
  background: var(--success-color);
}

.toast.error {
  background: var(--danger-color);
}

.toast.warning {
  background: var(--warning-color);
  color: var(--secondary-color);
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .login-box {
    padding: 2rem;
  }

  .principios-grid {
    grid-template-columns: 1fr;
  }

  .votacao-secao {
    padding: 1.5rem;
  }

  .config-tabs {
    flex-direction: column;
  }

  .tab-btn {
    width: 100%;
    text-align: center;
  }

  .config-actions {
    flex-direction: column;
  }

  .file-upload {
    flex-direction: column;
    align-items: stretch;
  }

  .file-upload input[type="file"] {
    max-width: 100%;
  }

  .modal-content {
    margin: 1rem;
  }
}

/* Ranking Section */
.ranking-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.ranking-section h4 {
  margin-bottom: 1.5rem;
  color: var(--secondary-color);
  font-size: 1.25rem;
}

.ranking-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.filter-group select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  min-width: 200px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.grupos-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.grupo-btn {
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--secondary-color);
  background: transparent;
  color: var(--secondary-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.grupo-btn:hover {
  background: var(--secondary-color);
  color: white;
}

.grupo-btn.active {
  background: var(--secondary-color);
  color: white;
}

.ranking-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.ranking-box {
  background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
  border-radius: var(--radius);
  padding: 1.5rem;
  color: white;
}

.ranking-box h5 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
}

.ranking-position {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
}

.ranking-position.pos-1 {
  background: #FFD700;
  color: #333;
}

.ranking-position.pos-2 {
  background: #C0C0C0;
  color: #333;
}

.ranking-position.pos-3 {
  background: #CD7F32;
  color: white;
}

.ranking-info {
  flex: 1;
}

.ranking-name {
  font-weight: 600;
  font-size: 1rem;
}

.ranking-group {
  font-size: 0.8rem;
  opacity: 0.8;
}

.ranking-votes {
  background: var(--primary-color);
  color: var(--secondary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

.ranking-empty {
  text-align: center;
  padding: 1.5rem;
  opacity: 0.7;
  font-style: italic;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--background-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
