/**
 * ESTILOS PRINCIPAIS DA APLICAÇÃO
 * Sistema de Gestão de Eleitores
 */

/* ========== RESET E BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: #1f2937;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: var(--space-6) var(--space-4);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
  color: var(--color-text-inverse);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }

a {
  color: var(--color-primary-2);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-gold);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========== MENU DE NAVEGAÇÃO ========== */
.main-nav {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
}

.nav-brand i {
  font-size: 1.5rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger {
  width: 25px;
  height: 3px;
  background: white;
  margin: 3px 0;
  transition: all 0.3s;
  border-radius: 3px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-user-mobile {
  display: none;
}

.nav-links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.5rem;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: white;
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.3s;
  white-space: nowrap;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.15);
}

.nav-links a i {
  font-size: 0.9rem;
}

.nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 0.5rem;
}

.nav-section {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.5rem 1rem;
}

.nav-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
}

.nav-user-info i {
  font-size: 1.25rem;
}

.user-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-avatar-small img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-small i {
  font-size: 1.25rem;
  color: white;
}

.user-badge {
  background: #ffc107;
  color: #000;
  padding: 0.125rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  text-decoration: none;
  border-radius: 0.375rem;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: #dc3545;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* ========== BANNER TOP 3 ========== */
.top3-banner {
  background: var(--color-primary-gradient);
  padding: var(--space-8) var(--space-4);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-md);
}

.top3-title {
  text-align: center;
  color: white;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.top3-title i {
  color: #FFD700;
  font-size: var(--font-size-3xl);
}

.top3-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: var(--space-6);
  align-items: end;
}

.top3-card {
  background: transparent;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  position: relative;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  animation: zoomIn 0.6s ease-out backwards;
  overflow: hidden;
}

.top3-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shine 3s infinite;
  pointer-events: none;
}

.top3-second {
  animation-delay: 0.1s;
}

.top3-first {
  animation-delay: 0.2s;
}

.top3-third {
  animation-delay: 0.3s;
}

.top3-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.top3-first {
  transform: scale(1.1);
  z-index: 2;
}

.top3-first:hover {
  transform: scale(1.1) translateY(-4px);
}

.top3-second, .top3-third {
  opacity: 0.95;
}

/* Keyframes para animações */
@keyframes zoomIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(30deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(30deg);
  }
}

/* Molduras Decorativas com Imagens */
.podium-frame {
  position: relative;
  width: 220px;
  height: 240px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.top3-first .podium-frame {
  width: 280px;
  height: 300px;
}

.avatar-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.top3-first .avatar-circle {
  width: 135px;
  height: 135px;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #E8EAF6 0%, #C5CAE9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-3xl);
  color: #7986CB;
}

.top3-first .avatar-placeholder {
  font-size: var(--font-size-4xl);
  color: #5C6BC0;
}

.frame-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  object-fit: contain;
}

.stars {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  color: #FFD700;
  font-size: var(--font-size-lg);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.user-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: #ffffff;
  margin-bottom: var(--space-2);
}

.user-score {
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.9);
  font-weight: var(--font-weight-medium);
}

/* ========== FORMULÁRIOS ========== */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-2);
  color: var(--color-text);
  font-size: var(--font-size-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-neutral-300);
  border-radius: var(--radius-base);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--color-bg);
  color: var(--color-text-light);
}

/* Placeholder com contraste adequado */
.form-input::placeholder,
.form-select::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}

/* Firefox placeholder */
.form-input::-webkit-input-placeholder,
.form-select::-webkit-input-placeholder,
.form-textarea::-webkit-input-placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}

/* Mozilla placeholder */
.form-input::-moz-placeholder,
.form-select::-moz-placeholder,
.form-textarea::-moz-placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-2);
  box-shadow: 0 0 0 3px rgba(24, 75, 138, 0.1);
}

/* Alias para form-control (utilizado nos formulários) */
.form-control,
.form-control:focus {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-neutral-300);
  border-radius: var(--radius-base);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  background: var(--color-bg);
  color: var(--color-text-light);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary-2);
  box-shadow: 0 0 0 3px rgba(24, 75, 138, 0.1);
}

.form-control::placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}

.form-control::-webkit-input-placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}

.form-control::-moz-placeholder {
  color: var(--color-text-light);
  opacity: 0.8;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--color-error);
}

.form-error {
  color: var(--color-error);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
  display: block;
}

.form-help {
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}

/* ========== BOTÕES ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  border: none;
  border-radius: var(--radius-base);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary-gradient);
  color: var(--color-text-inverse);
}

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

.btn-accent {
  background: var(--color-accent-gold);
  color: var(--color-text);
}

.btn-accent:hover:not(:disabled) {
  background: var(--color-accent-gold-dark);
  transform: translateY(-2px);
}

.btn-success {
  background: var(--color-success);
  color: var(--color-text-inverse);
}

.btn-danger {
  background: var(--color-error);
  color: var(--color-text-inverse);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary-2);
  color: var(--color-primary-2);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary-2);
  color: var(--color-text-inverse);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

/* ========== CARDS ========== */
.card {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}

.card-header {
  border-bottom: 1px solid var(--color-neutral-200);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--font-size-2xl);
  margin-bottom: 0;
}

/* ========== TABELAS ========== */
.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg);
  border-radius: var(--radius-base);
  overflow: hidden;
}

.table thead {
  background: var(--color-neutral-100);
}

.table th,
.table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-neutral-200);
  color: var(--color-text-light);
}

.table th {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr:nth-child(even) {
  background: var(--color-neutral-100);
}

.table tbody tr:hover {
  background: var(--color-neutral-200);
  cursor: pointer;
}

/* ========== MODAL ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-modal);
  display: none;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
}

.modal-content {
  position: relative;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  animation: modalSlideIn var(--transition-base);
}

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

.modal-content.small { width: 400px; max-width: 95%; }
.modal-content.medium { width: 600px; max-width: 95%; }
.modal-content.large { width: 900px; max-width: 95%; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid var(--color-neutral-200);
}

.modal-title {
  margin: 0;
  font-size: var(--font-size-2xl);
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-size-2xl);
  color: var(--color-text-light);
  cursor: pointer;
  padding: var(--space-2);
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-6);
  border-top: 1px solid var(--color-neutral-200);
}

/* ========== ALERTAS/TOASTS ========== */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-base);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.alert-success {
  background: var(--color-success-light);
  color: #065F46;
  border-left: 4px solid var(--color-success);
}

.alert-error {
  background: var(--color-error-light);
  color: #991B1B;
  border-left: 4px solid var(--color-error);
}

.alert-warning {
  background: var(--color-warning-light);
  color: #92400E;
  border-left: 4px solid var(--color-warning);
}

.alert-info {
  background: var(--color-info-light);
  color: #1E40AF;
  border-left: 4px solid var(--color-info);
}

/* ========== FOOTER ========== */
.main-footer {
  background: var(--color-primary-1);
  color: var(--color-text-inverse);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  margin-top: var(--space-3);
}

.footer-links a {
  color: var(--color-text-inverse);
  margin: 0 var(--space-3);
}

.footer-links a:hover {
  color: var(--color-accent-gold);
}

/* ========== UTILITÁRIOS ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.hidden { display: none !important; }

/* ========== RESPONSIVO ========== */
@media (max-width: 968px) {
  .nav-toggle {
    display: flex;
  }
  
  .nav-toggle.active .hamburger:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
  }
  
  .nav-toggle.active .hamburger:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active .hamburger:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
  
  .nav-menu {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 300px;
    height: calc(100vh - 60px);
    background: white;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem 0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .nav-user-mobile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    margin-bottom: 1rem;
  }
  
  .nav-user-mobile i {
    font-size: 1.5rem;
  }
  
  .nav-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }
  
  .nav-links a {
    color: #333;
    padding: 1rem 1.5rem;
    border-radius: 0;
    border-left: 3px solid transparent;
  }
  
  .nav-links a:hover {
    background: #f8f9fa;
    border-left-color: #667eea;
  }
  
  .nav-divider {
    width: 100%;
    height: 1px;
    background: #e0e0e0;
    margin: 0.5rem 0;
  }
  
  .nav-section {
    color: #666;
    padding: 0.75rem 1.5rem;
    background: #f8f9fa;
  }
  
  .nav-footer {
    margin-top: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
  }
  
  .nav-user-info {
    display: none;
  }
  
  .btn-logout {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-2xl) !important;
  }
  
  h2 {
    font-size: var(--font-size-xl) !important;
  }
  
  .top3-title {
    font-size: var(--font-size-lg);
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding: 0 var(--space-2);
  }
  
  .top3-title i {
    font-size: var(--font-size-2xl);
  }
  
  .top3-banner {
    padding: var(--space-4) 0;
    margin-bottom: var(--space-6);
  }
  
  .top3-container {
    /* Mantém o layout original em dispositivos móveis */
    max-width: 100%;
    grid-template-columns: 0.9fr 1.2fr 0.9fr;
    gap: var(--space-1);
    align-items: end;
    padding: 0 var(--space-1);
  }
  
  .top3-first {
    /* Mantém o destaque do 1º lugar */
    transform: scale(1);
  }
  
  .top3-card {
    padding: var(--space-2) 0;
  }
  
  .podium-frame {
    width: 110px;
    height: 125px;
  }
  
  .top3-first .podium-frame {
    width: 140px;
    height: 160px;
  }
  
  .avatar-circle {
    width: 55px;
    height: 55px;
  }
  
  .top3-first .avatar-circle {
    width: 70px;
    height: 70px;
  }
  
  .avatar-placeholder {
    font-size: var(--font-size-lg);
  }
  
  .top3-first .avatar-placeholder {
    font-size: var(--font-size-xl);
  }
  
  .user-name {
    font-size: var(--font-size-xs);
    margin-bottom: var(--space-1);
  }
  
  .user-score {
    font-size: 0.65rem;
  }
  
  .stars {
    font-size: var(--font-size-xs);
    margin-bottom: var(--space-1);
  }
  
  .table-responsive {
    font-size: var(--font-size-sm);
  }
  
  .modal-content {
    width: 95% !important;
  }
  .btn-logout {
    margin-bottom: 100px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: var(--font-size-xl) !important;
  }
  
  h2 {
    font-size: var(--font-size-lg) !important;
  }
  
  .nav-brand span {
    font-size: 1rem;
  }
  
  .nav-menu {
    width: 100%;
  }
}
