/* ComparePesca - Main Stylesheet */

/* ==================== VARIABLES ==================== */
:root {
  /* Colors */
  --primary-color: #0077be;
  --primary-dark: #005a8f;
  --secondary-color: #00a86b;
  --accent-color: #ff6b35;

  --bg-color: #f5f7fa;
  --surface-color: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #0077be 0%, #00a86b 100%);
  --gradient-hero: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.7));

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Poppins', sans-serif;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
}

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  color: var(--text-primary);
  background-color: var(--bg-color);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: 135px; /* Espaço para header fixo (91px) + nav fixo (~44px) */
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

ul, ol {
  list-style: none;
}

/* ==================== UTILITY CLASSES ==================== */
.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  box-sizing: border-box;
  overflow-x: hidden;
}

.card {
  background: var(--surface-color);
  border-radius: 12px;
  padding: var(--spacing-md);
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-base);
  text-align: center;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  text-decoration: none;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-icon {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  position: relative;
  padding: 0.5rem;
  color: var(--text-secondary);
  transition: var(--transition-fast);
}

.btn-icon:hover {
  color: var(--primary-color);
}

#profile-btn {
  font-size: 1.5rem;
}

#profile-btn:hover {
  color: var(--secondary-color);
  transform: scale(1.05);
}

.badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== HEADER ==================== */
.main-header {
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  gap: var(--spacing-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.logo:hover {
  opacity: 0.8;
}

.logo-image {
  height: 75px;
  width: auto;
  object-fit: contain;
}

.logo i {
  font-size: 2rem;
}

.search-container {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-container input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.search-container input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-container i {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* ==================== NAVIGATION ==================== */
.main-nav {
  background: var(--gradient-primary);
  color: white;
  position: fixed;
  top: 106px; /* Altura do header (logo 75px + padding-top 1rem) */
  left: 0;
  right: 0;
  width: 100%;
  z-index: 999;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.nav-menu {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  color: white;
  border-radius: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255, 255, 255, 0.2);
}

.favorites-badge {
  background: #ff6b6b;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 12px;
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ==================== PAGES ==================== */
.page {
  display: none;
  padding: var(--spacing-xl) 0;
  min-height: calc(100vh - 400px);
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.page-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
}

.page-header-content > div {
  flex: 1;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
}

.page-header p {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* ==================== HERO SLIDESHOW ==================== */
.hero-slideshow {
  position: relative;
  height: 500px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: var(--spacing-xl);
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.slide.active {
  opacity: 1;
}

.slide::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-hero);
}

.slide-content {
  position: relative;
  z-index: 1;
  color: white;
  text-align: center;
  padding: var(--spacing-xl);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.slide-content h1 {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  font-family: var(--font-display);
}

.slide-content p {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-lg);
}

.slide-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.3);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  transition: var(--transition-fast);
}

.slide-nav:hover {
  background: rgba(255, 255, 255, 0.5);
}

.slide-nav.prev {
  left: 20px;
}

.slide-nav.next {
  right: 20px;
}

.slide-indicators {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 2;
}

/* ==================== IQP WIDGET ==================== */
.iqp-widget {
  margin-bottom: var(--spacing-xl);
}

.iqp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.iqp-header h3 {
  margin: 0;
}

.iqp-location {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.iqp-location i {
  color: var(--primary-color);
}

.iqp-content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--spacing-lg);
  align-items: center;
}

.iqp-score {
  text-align: center;
}

.score-circle {
  position: relative;
  width: 150px;
  height: 150px;
}

.score-circle svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-circle circle {
  fill: none;
  stroke-width: 8;
  stroke: #e0e0e0;
}

.score-circle circle.progress {
  stroke: var(--secondary-color);
  stroke-dasharray: 283;
  stroke-dashoffset: 70;
  transition: stroke-dashoffset 1s ease;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
}

.score-label {
  margin-top: var(--spacing-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.iqp-details {
  display: grid;
  gap: var(--spacing-sm);
}

.iqp-factor {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.iqp-factor i {
  color: var(--primary-color);
  width: 24px;
}

/* ==================== GRIDS ==================== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

.news-card {
  background: var(--surface-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: var(--transition-base);
  cursor: pointer;
}

.news-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.news-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.news-content {
  padding: var(--spacing-md);
}

.news-category {
  display: inline-block;
  background: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.news-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.news-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.news-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.quick-card {
  background: var(--surface-color);
  padding: var(--spacing-lg);
  border-radius: 12px;
  text-align: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: var(--transition-base);
}

.quick-card:hover {
  background: var(--gradient-primary);
  color: white;
  transform: scale(1.05);
}

.quick-card i {
  font-size: 3rem;
  margin-bottom: var(--spacing-sm);
  color: var(--primary-color);
}

.quick-card:hover i {
  color: white;
}

.quick-card h3 {
  margin-bottom: 0.5rem;
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  /* Removido min-height - deixa o label ocupar o espaço natural */
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  align-items: end; /* Alinha os inputs (último elemento de cada form-group) */
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.required {
  color: #ef4444;
  font-weight: 700;
}

/* ==================== TABLES ==================== */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.comparison-table th,
.comparison-table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
}

.comparison-table tr:hover {
  background: rgba(0, 119, 190, 0.05);
}

/* ==================== MAP ==================== */
/* Container do mapa */
.map-container {
  position: relative;
  width: 100%;
  margin-bottom: var(--spacing-lg);
  isolation: isolate; /* Criar novo contexto de empilhamento */
}

.map-container.card {
  padding: 0 !important;
  overflow: visible !important; /* Mudado de hidden para visible */
  position: relative;
  z-index: 1;
}

#fishing-map {
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 600px !important;
  position: relative;
  z-index: 1;
}

/* Fix crítico para tiles do Leaflet carregarem completamente */
.leaflet-container {
  width: 100% !important;
  height: 100% !important;
  background: #dfe3e8 !important; /* Cor de fundo enquanto carrega */
  position: relative !important;
  z-index: auto !important; /* Importante: não forçar z-index alto */
}

.leaflet-map-pane {
  z-index: 1 !important;
}

.leaflet-tile-pane {
  z-index: 2 !important;
}

.leaflet-overlay-pane {
  z-index: 4 !important;
}

.leaflet-shadow-pane {
  z-index: 5 !important;
}

.leaflet-marker-pane {
  z-index: 6 !important;
}

.leaflet-tooltip-pane {
  z-index: 7 !important;
}

.leaflet-popup-pane {
  z-index: 8 !important;
}

.leaflet-tile-container {
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  user-select: none !important;
}

/* Corrigir controles de zoom - z-index baixo para não sobrepor */
.leaflet-control-container {
  position: absolute;
  z-index: 100 !important; /* Baixo o suficiente para não sobrepor outros elementos */
  pointer-events: none;
}

.leaflet-control-container > * {
  pointer-events: auto;
}

.leaflet-control-zoom {
  border: 2px solid rgba(0,0,0,0.2) !important;
  border-radius: 4px !important;
  box-shadow: 0 1px 5px rgba(0,0,0,0.15) !important;
  z-index: inherit !important;
  position: relative !important;
}

.leaflet-control-zoom a {
  background-color: #fff !important;
  color: #333 !important;
  border: none !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  text-align: center !important;
  display: block !important;
  text-decoration: none !important;
}

.leaflet-control-zoom a:hover {
  background-color: #f4f4f4 !important;
  color: #000 !important;
}

.leaflet-control-zoom-in {
  border-bottom: 1px solid #ccc !important;
}

/* Corrigir attribution */
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.8) !important;
  padding: 0 5px !important;
  margin: 0 !important;
}

/* Corrigir popup */
.leaflet-popup-content-wrapper {
  border-radius: 8px !important;
  padding: 0 !important;
  box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-content {
  margin: 15px !important;
  font-family: var(--font-primary) !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  background: white !important;
}

/* Fix para loading de tiles */
.leaflet-tile-loaded {
  opacity: 1 !important;
}

.leaflet-tile-loading {
  opacity: 0.3 !important;
}

/* Marcador de localização do usuário */
.user-location-marker {
  z-index: 1000 !important;
}

.user-location-marker div {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(66, 133, 244, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
  }
}

/* Botão de localização customizado */
.leaflet-control-custom {
  background: white;
  border-radius: 4px;
  margin-top: 10px !important;
  box-shadow: 0 1px 5px rgba(0,0,0,0.15) !important;
}

.location-button {
  width: 30px;
  height: 30px;
  background: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: all 0.2s ease;
  padding: 0;
}

.location-button:hover {
  background: #f4f4f4;
  color: #4285f4;
}

.location-button:active {
  background: #e8e8e8;
  transform: scale(0.95);
}

.location-button svg {
  pointer-events: none;
}

/* ==================== FOOTER ==================== */
.main-footer {
  background: var(--text-primary);
  color: white;
  padding: var(--spacing-xl) 0 var(--spacing-md);
  margin-top: var(--spacing-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.footer-col h4 {
  margin-bottom: var(--spacing-sm);
  color: var(--secondary-color);
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col a:hover {
  color: var(--secondary-color);
}

.social-links {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.social-links a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transition: var(--transition-fast);
}

.social-links a:hover {
  background: var(--secondary-color);
  transform: scale(1.1);
}

.footer-bottom {
  text-align: center;
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
  }

  .search-container {
    order: 3;
    flex-basis: 100%;
  }

  .nav-menu {
    flex-direction: column;
    align-items: stretch;
  }

  .slide-content h1 {
    font-size: 2rem;
  }

  .iqp-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .mobile-menu-toggle {
    display: block;
  }
}
