/* ================================ */
/* ESTILOS GERAIS                   */
/* ================================ */
html, body {
  height: 100%;
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.layer-bloqueado {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ================================ */
/* HEADER                           */
/* ================================ */
header.header {
  background-color: white;
  color: black;
  padding: 20px 16px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  position: fixed;
  top: 3%;
  width: 80vw;
  height: 5vh;
  z-index: 1001;
  left: 50%;
  transform: translateX(-50%);
}

header.header .logo {
  max-height: 250%;
  margin-right: 20px;
  flex-shrink: 0;
}

header.header h1 {
  font-size: 24px;
  margin: 0;
}

header.header h2 {
  font-size: 16px;
  margin: 5px 0 0 0;
}

/* ================================ */
/* NAVBAR                            */
/* ================================ */
.navbar {
  background-color: #2e7d32;
  color: white;
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 80px;
  width: 80vw;
  z-index: 1000;
  left: 50%;
  transform: translateX(-50%);
}

.navbar h1 {
  font-size: 16px;
  margin: 0;
}

/* ================================ */
/* MAPA                              */
/* ================================ */
#map {
  position: relative;
  width: 80vw;
  height: 80vh;
  margin-top: 8%;
  background-color: #f4f4f4;
  border-radius: 8px;
}

/* ================================ */
/* COORDENADAS E ALERTAS             */
/* ================================ */
#coords {
  position: fixed;
  bottom: 12px;
  left: 12px;
  background: rgba(46,125,50,0.92);
  color: white;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#loading-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255,255,255,0.9);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  font-size: 16px;
  text-align: center;
  z-index: 2000;
}

/* ================================ */
/* LOGIN                             */
/* ================================ */
#login-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(255,255,255,0.9);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
  text-align: center;
  width: 300px;
  display: none;
  z-index: 2000;
}

#login-container h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 24px;
  font-weight: bold;
}

#login-container input,
#login-container button {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
}

#login-container input {
  border: 1px solid #ccc;
}

#login-container button {
  background-color: #4CAF50;
  color: white;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s;
}

#login-container button:hover {
  background-color: #45a049;
}

#login-error {
  color: red;
  font-size: 14px;
  margin-top: 10px;
  display: none;
}

/* ================================ */
/* PROGRESSO                         */
/* ================================ */
#progress-container {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  max-width: 600px;
  background-color: #f3f3f3;
  border-radius: 10px;
  overflow: hidden;
  z-index: 1500;
  display: none;
}

#progress-bar {
  width: 0%;
  height: 12px;
  background-color: #2196F3;
  transition: width 0.2s ease-out;
}

/* ================================ */
/* LEGENDAS E CHECKBOXES             */
/* ================================ */
.legend-control,
.camadas-content {
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  max-width: 230px;
  max-height: 300px;
  overflow: hidden;
  padding: 4px 0;
}

.legend-header,
.layer-header {
  font-size: 14px;
  font-weight: bold;
  padding: 6px 8px;
  cursor: pointer;
}

.legend-header:hover,
.layer-header:hover {
  background: #f0f0f0;
}

.legend-body,
.layer-body {
  padding: 4px 6px;
  overflow-y: auto;
  max-height: 250px;
  display: none;
}

.legend-body.expanded,
.layer-body.expanded {
  display: block;
}

.legend-item-flex {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.legend-icon-flex {
  width: 22px;
  height: 22px;
  margin-right: 8px;
}

.legend-check-item {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  margin-bottom: 4px;
  font-size: 13px;
  cursor: pointer;
}

.legend-check-item input {
  margin: 0;
  flex-shrink: 0;
}

.legend-check-svg {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legend-check-text {
  white-space: nowrap;
}

/* ================================ */
/* CONTROLE DE CAMADAS               */
/* ================================ */
.camadas-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 75px;
  height: 36px;
  cursor: pointer;
  font-size: 13px;
}

.camadas-content-inner {
  padding: 4px 6px;
  overflow-y: auto;
  max-height: 250px;
}

.camadas-content-inner hr {
  margin: 6px 0;
}

/* ================================ */
/* CLUSTERS LEAFLET                  */
/* ================================ */
.marker-cluster {
  background-color: rgba(0,128,0,0.2) !important;
  border: 2px solid transparent !important;
  color: white !important;
  font-weight: bold;
}

.marker-cluster div {
  line-height: 40px !important;
}

/* ================================ */
/* MAP SWITCHER                      */
/* ================================ */
.map-switcher {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 8px;
  background: rgba(255,255,255,0.9);
  border: 2px solid white;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,0,0,0.25);
}

.map-btn {
  width: 60px;
  height: 60px;
  display: block;
  overflow: hidden;
  background: white;
  transition: 0.15s;
}

.map-btn img {
  width: 100%;
  height: 100%;
}

.map-btn:hover {
  transform: scale(1.08);
}

.map-btn.active {
  border-color: #3a86ff;
  box-shadow: 0 0 10px rgba(58,134,255,0.6);
}

/* ================================ */
/* CONTROLES AUXILIARES              */
/* ================================ */
.leaflet-top.leaflet-left .north-control {
  margin-top: 5px;
  margin-left: 5px;
  display: block;
  pointer-events: none;
}

/* ================================ */
/* TIMELINE CONTROL                  */
/* ================================ */
.leaflet-control.timeline-control {
  font-family: Arial, sans-serif;
  line-height: 1.4;
  min-width: 140px;
  text-align: left;
}

.leaflet-control.timeline-control select {
  width: 100%;
  margin-top: 4px;
  padding: 2px 4px;
  font-size: 13px;
}

/* ================================ */
/* MOBILE RESPONSIVO                 */
/* ================================ */
@media (max-width: 768px) {
  html, body {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    overflow-y: auto !important;
    background: white !important;
  }

  header.header {
    position: static !important;
    width: 100% !important;
    padding: 10px !important;
    flex-direction: column !important;
    text-align: center !important;
    height: auto !important;
    transform: none !important;
  }

  header.header .logo {
    max-height: 45px !important;
    margin: 0 0 6px 0 !important;
  }

  header.header h1 { font-size: 18px !important; }
  header.header h2 { font-size: 13px !important; }

  .navbar {
    position: static !important;
    width: 100% !important;
    padding: 6px !important;
    transform: none !important;
  }

  #map {
    width: 80vw !important;
    height: 80vh !important;
    margin: 20px auto !important;
    border-radius: 10px !important;
  }

  #progress-container {
    width: 90% !important;
    bottom: 20px !important;
    max-width: none !important;
  }
}
