/* Reset Global */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

/* Variáveis */
:root {
  --primary-color: #1a2559;
  --environmental-color: #27ae60;
  --social-color: #2c3e87;
  --governance-color: #5a6bc7;
  --energy-color: #f39c12;
  --electric-color: #e67e22;
  --text-color: #2c3e50;
  --card-bg-glass: #1a2559;
  --card-bg-hover: #2c3e87;
  --blur-strength: 12px;
  --transition-speed: 0.3s;
  --border-radius: 16px;
  --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.25);
  --shadow-heavy: 0 12px 35px rgba(0, 0, 0, 0.4);
}

/* Skip Links para Acessibilidade */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: var(--text-color);
  padding: 8px;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  z-index: 10000;
  transition: top var(--transition-speed);
}

.skip-link:focus {
  top: 0;
}

/* Fundo */
body {
  font-family: 'Poppins', sans-serif;
  background: #f8f9fa;
  color: #2c3e50;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  scroll-behavior: smooth;
}

/* Container */
.main-container {
  width: 100%;
  max-width: 1200px;
  text-align: center;
  padding: 2rem;
  position: relative;
}

/* Botão Voltar ao Topo */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #5a6bc7, #2c3e87);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: var(--shadow-light);
  transition: all var(--transition-speed) ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  z-index: 1000;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--shadow-heavy);
}

/* Hero */
.hero {
  margin-bottom: 3rem;
}

.logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: brightness(1.1) contrast(1.1);
  transition: filter var(--transition-speed);
  background: transparent;
  mix-blend-mode: multiply;
}

.logo:hover {
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4)) brightness(1.1);
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, #5a6bc7, #2c3e87);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.2rem;
  font-weight: 300;
  color: rgba(44, 62, 80, 0.8);
}

/* Cards */
.map-selection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  justify-content: center;
  max-width: 1000px;
  margin: 0 auto;
}

.map-card {
  background: var(--card-bg-glass);
  backdrop-filter: blur(var(--blur-strength));
  border-radius: var(--border-radius);
  padding: 2.5rem 2rem;
  text-decoration: none;
  color: var(--text-color);
  border-top: 5px solid transparent;
  transition: all var(--transition-speed) ease;
  box-shadow: var(--shadow-light);
  cursor: pointer;
  animation: fadeInUp 0.8s ease forwards;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
}

.map-card.animate-in {
  opacity: 1;
  transform: translateY(0);
}

.map-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  transition: left 0.5s ease;
}

.map-card:hover::before {
  left: 100%;
}

.map-card:hover {
  background: var(--card-bg-hover);
  box-shadow: var(--shadow-heavy);
}

.map-card:focus {
  outline: 3px solid var(--environmental-color);
  outline-offset: 2px;
}

.environmental-card {
  border-top-color: var(--environmental-color);
}

.social-card {
  border-top-color: var(--social-color);
}

.energy-card {
  border-top-color: var(--energy-color);
}

.electric-card {
  border-top-color: var(--electric-color);
}

.governance-card {
  border-top-color: var(--governance-color);
}

/* Card Loading State */
.card-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  color: var(--text-color);
  font-weight: 600;
  border-radius: var(--border-radius);
}

/* Card Footer */
.card-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.card-action {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: color var(--transition-speed);
}

.map-card:hover .card-action {
  color: #ffffff;
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1.2rem;
  transition: transform 0.3s ease;
}

  .map-card:hover .card-icon {
    transform: scale(1.2) rotate(5deg);
  }
  
  .map-card:active {
    transform: scale(0.98);
  }.environmental-card .card-icon {
  color: var(--environmental-color);
}

.social-card .card-icon {
  color: var(--social-color);
}

.energy-card .card-icon {
  color: var(--energy-color);
}

.electric-card .card-icon {
  color: var(--electric-color);
}

.governance-card .card-icon {
  color: var(--governance-color);
}

.map-card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #ffffff;
}

.card-description {
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

/* Rodapé */
.page-footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(236, 240, 241, 0.5);
}

/* Modal */
.modal-container {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(44, 62, 80, 0.95);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: var(--primary-color);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1.5rem;
  background: #283c7c;
  border-bottom: 2px solid #3d4f9a;
  min-height: 45px;
}

.modal-header h3 {
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
  color: #e8eaff;
}

.close-button {
  background: none;
  border: none;
  color: #ddd;
  font-size: 1rem;
  font-weight: 300;
  cursor: pointer;
  transition: all var(--transition-speed);
  padding: 4px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-button:hover {
  color: #fff;
  background: none;
  opacity: 0.8;
}

.close-button:focus {
  outline: none;
  color: #fff;
}

/* Iframe */
.iframe-wrapper {
  flex: 1;
  position: relative;
}

#map-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Spinner */
.spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
}

.spinner::before {
  content: '';
  display: block;
  width: 50px;
  height: 50px;
  margin: 0 auto 1rem;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top: 5px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-text {
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Error Message */
.error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-color);
  background: rgba(44, 62, 80, 0.95);
  padding: 2rem;
  border-radius: var(--border-radius);
  max-width: 400px;
  z-index: 10;
}

.error-message i {
  font-size: 3rem;
  color: #e74c3c;
  margin-bottom: 1rem;
}

.error-message h4 {
  margin: 0 0 1rem 0;
  font-size: 1.2rem;
}

.error-message p {
  margin: 0 0 1.5rem 0;
  opacity: 0.8;
}

.retry-button {
  background: var(--environmental-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition-speed);
}

.retry-button:hover {
  background: #219a52;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(44, 62, 80, 0.95);
  color: var(--text-color);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-speed) ease;
  max-width: 300px;
  backdrop-filter: blur(10px);
}

.toast.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-info {
  border-left: 4px solid var(--social-color);
}

.toast-error {
  border-left: 4px solid #e74c3c;
}

.toast i {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-info i {
  color: var(--social-color);
}

.toast-error i {
  color: #e74c3c;
}

/* Animações */
@keyframes spin {
  100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
  from { 
    opacity: 0; 
    transform: translateY(30px) scale(0.95); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Smooth focus transitions */
*:focus {
  transition: outline var(--transition-speed) ease;
}

/* Responsividade */
@media (max-width: 1024px) {
  .main-container {
    max-width: 900px;
    padding: 1.5rem;
  }
  
  .map-selection {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .main-container {
    padding: 1rem;
  }

  .map-selection {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .map-card {
    padding: 2rem 1.5rem;
  }
  
  .modal-header {
    padding: 0.4rem 1rem;
    min-height: 40px;
  }
  
  .modal-header h3 {
    font-size: 0.85rem;
  }
  
  .error-message {
    padding: 1.5rem;
    margin: 0 1rem;
  }
  
  .toast {
    max-width: 280px;
    margin: 0 10px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  
  .hero p {
    font-size: 0.9rem;
  }
  
  .map-card {
    padding: 1.5rem 1rem;
  }
  
  .card-icon {
    font-size: 2.5rem;
  }
  
  .back-to-top {
    width: 45px;
    height: 45px;
    font-size: 1rem;
    bottom: 15px;
    right: 15px;
  }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .map-card::before {
    display: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --card-bg-glass: #1a2559;
    --card-bg-hover: #2c3e87;
  }
  
  .map-card:focus {
    outline: 4px solid var(--environmental-color);
  }
}

/* Dark mode preference */
@media (prefers-color-scheme: light) {
  /* Mantém o esquema escuro como padrão */
}
