/* Estilos generales */
:root {
  --sidebar-width: 40%;
  --map-width: 60%;
  --header-height: 70px;

  /* Color palette based on #9f2241 */
  --primary-color: #9f2241;
  --primary-light: #c12e5a;
  --primary-dark: #7a1b32;
  --primary-bg: #fdf2f5;
  --secondary-color: #d9a6b3;
  --accent-color: #e6c3cf;
  --text-color: #2d3748;
  --text-light: #4a5568;
  --light-gray: #f8f9fa;
  --border-color: #e2c8d0;
  --shadow-sm: 0 2px 8px rgba(159, 34, 65, 0.08);
  --shadow-md: 0 4px 12px rgba(159, 34, 65, 0.1);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-color);
  line-height: 1.6;
  background-color: #f1f5f9;
}

header {
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-color)
  );
  color: white;
  padding: 0 2rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 100;
}

header h1 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

main {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Estilos del panel de información */
#info-panel {
  width: var(--sidebar-width);
  background: var(--primary-bg);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex: 0 0 auto;
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(37, 99, 235, 0.6) rgba(0, 0, 0, 0.05);
  padding-right: 0.75rem;
  margin-right: -0.75rem;
}

#info-panel h1 {
  color: var(--primary-dark);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  position: relative;
  padding-bottom: 0.5rem;
  text-align: center;
}

/* Webkit Scrollbar Styling */
#info-panel::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#info-panel::-webkit-scrollbar-track {
  background: var(--primary-bg);
  border-radius: 10px;
  margin: 4px 0;
}

#info-panel::-webkit-scrollbar-thumb {
  background-color: var(--secondary-color);
  border-radius: 10px;
  border: 2px solid var(--primary-bg);
  background-clip: padding-box;
  transition: all 0.3s ease;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

#info-panel::-webkit-scrollbar-thumb:hover {
  background-color: rgba(29, 78, 216, 0.8);
}

#info-panel::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox Scrollbar Styling */
@supports (scrollbar-color: auto) {
  * {
    scrollbar-color: rgba(37, 99, 235, 0.6) rgba(0, 0, 0, 0.05);
    scrollbar-width: thin;
  }
}

/* Tree Details Styles */
#tree-details {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

#tree-details h3 {
  color: black;
  font-size: 1.2rem;
  margin: 0 0 1rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.tree-details-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-right: 1rem;
  flex-shrink: 0;
}

.detail-value {
  text-align: right;
  color: var(--primary-dark);
  font-weight: 500;
  font-size: 0.95rem;
  word-break: break-word;
  flex: 1;
}

.info-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.5rem;
  overflow: visible;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  box-sizing: border-box;
  min-height: min-content;
  position: relative;
}

.info-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.info-stats {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1 1 auto;
  max-width: 100%;
  box-sizing: border-box;
  min-height: min-content;
  overflow: visible;
}

.stat-item {
  text-align: center;
  padding: 1.5rem 1.25rem;
  background: #fff;
  border-radius: var(--border-radius);
  margin: 0 0 1rem 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100px;
}

.stat-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.stat-item:active {
  transform: translateY(0);
}

.stat-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    var(--primary-color),
    var(--secondary-color)
  );
}

.stat-item h3 {
  color: var(--primary-color);
  font-size: 1rem;
  margin: 0 0 0.75rem 0;
  font-weight: 600;
  position: relative;
  padding: 0 0 0.75rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
}

/* Estilos para los valores de las estadísticas */
.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  margin: 0.3rem 0 0.5rem;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Estilos específicos para las primeras dos tarjetas */
#tree-count,
#species-count {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #9f2241, #d62b5e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin: 0.5rem 0 1rem;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
}

.stat-label {
  color: var(--text-light);
  font-size: 1rem; /* Increased from 0.85rem */
  line-height: 1.5;
  display: block;
  margin-top: 0.5rem;
  font-weight: 400;
}

.legend {
  margin: 0 0 1rem 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  border-left: none;
  position: relative;
  overflow: visible;
}

.legend h3 {
  font-size: 2rem;
  font-weight: bold;
  margin: 0 0 0.75rem 0;
  color: var(--primary-color);
  position: relative;
  z-index: 1;
}

.legend p {
  color: var(--text-light);
  line-height: 1.6;
  margin: 0;
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
}

/* Estilos del contenedor del mapa */
#map-container {
  width: var(--map-width);
  position: relative;
  height: calc(100vh - var(--header-height));
  background: #e9ecef;
  flex: 0 0 auto;
}

/* Estilos del mapa */
#map {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: var(--transition);
}

/* Estilos específicos para la sección de altura total */
#total-height {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin: 0.5rem 0 1rem;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
}

#total-height::after {
  content: "km";
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 3px;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

/* Estilos para la sección de alcaldía */
#top-borough {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  margin: 0.5rem 0 1rem;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
  text-align: center;
  width: 100%;
  word-break: break-word;
  padding: 0 0.5rem;
}

/* Estilos para la sección de edad total */
#total-age {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #e67e22, #f39c12);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin: 0.5rem 0 1rem;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
}

#total-age::after {
  content: "años";
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 3px;
  background: linear-gradient(135deg, #e67e22, #f39c12);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

/* Basic Information Table */
.basic-info-section {
  margin: 1.5rem 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.3s ease;
}

.basic-info-title {
  padding: 1rem 1.25rem;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  background-color: var(--primary-bg);
  border-bottom: 1px solid var(--border-color);
}

.basic-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.basic-info-table .section-header th {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary-dark);
  background-color: #f8f0f3;
  border-bottom: 1px solid var(--border-color);
}

.basic-info-table .info-label {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-weight: 500;
  color: var(--text-light);
  width: 40%;
  vertical-align: top;
  border-bottom: 1px solid #f0f0f0;
}

.basic-info-table .info-value {
  padding: 0.75rem 1.25rem 0.75rem 0;
  color: var(--text-color);
  border-bottom: 1px solid #f0f0f0;
}

.basic-info-table tr:last-child .info-label,
.basic-info-table tr:last-child .info-value {
  border-bottom: none;
}

/* Environmental Benefits Section */
.environmental-benefits-section {
  margin: 2rem 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.3s ease;
}

.environmental-benefits-title {
  padding: 1rem 1.25rem;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  background-color: var(--primary-bg);
  border-bottom: 1px solid var(--border-color);
}

.environmental-benefits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.environmental-benefits-table .benefit-section-header th {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary-dark);
  background-color: #f8f0f3;
  border-bottom: 1px solid var(--border-color);
}

.environmental-benefits-table .benefit-label {
  padding: 0.75rem 1.25rem;
  text-align: left;
  font-weight: 500;
  color: var(--text-light);
  width: 60%;
  vertical-align: top;
  border-bottom: 1px solid #f0f0f0;
}

.environmental-benefits-table .benefit-value {
  padding: 0.75rem 1.25rem 0.75rem 0;
  color: var(--text-color);
  font-family: monospace;
  text-align: right;
  border-bottom: 1px solid #f0f0f0;
}

.environmental-benefits-table tr:last-child .benefit-label,
.environmental-benefits-table tr:last-child .benefit-value {
  border-bottom: none;
}

.environmental-benefits-disclaimer {
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-light);
  background-color: #f9f9f9;
  border-top: 1px solid #f0f0f0;
}

.environmental-benefits-disclaimer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.environmental-benefits-disclaimer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.environmental-benefits-disclaimer p {
  margin: 0.5rem 0 0 0;
  line-height: 1.5;
}

/* Tree details section */
#tree-details {
  margin-bottom: 1.5rem;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 0;
  border-left: 4px solid var(--primary-color);
  overflow: hidden;
}

.tree-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
}

.tree-details-header h3 {
  margin: 0;
  color: black !important;
  font-size: 1.1rem;
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  color: white;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.close-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.tree-details-content {
  padding: 1.5rem;
}

#tree-details h3 {
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.tree-details-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--light-gray);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  font-weight: 600;
  color: var(--primary-dark);
  min-width: 140px;
  flex-shrink: 0;
}

.detail-value {
  color: var(--text-color);
  flex-grow: 1;
  word-break: break-word;
}

/* Street View section */
.street-view-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.street-view-title {
  color: var(--primary-dark);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.street-view-title::before {
  content: "🌐";
  font-size: 1.2em;
}

.street-view-container {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #f5f5f5;
  aspect-ratio: 16/9;
}

.street-view-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Assigned name section */
.assigned-name-section {
  margin: 2rem -1.5rem 0;
  padding: 1.5rem 1.5rem 1.75rem;
  background: linear-gradient(
    135deg,
    rgba(159, 34, 65, 0.03) 0%,
    rgba(255, 255, 255, 0.5) 100%
  );
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.assigned-name-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--primary-light)
  );
}

.assigned-name-title {
  font-weight: 600;
  color: var(--primary-dark);
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.assigned-name-title::before {
  content: "🌳";
  font-size: 1.2em;
}

.assigned-name-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary-dark);
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin: 0.5rem 0 0;
  border-left: 3px solid var(--primary-color);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.assigned-name-value::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  pointer-events: none;
}

.assigned-name-value:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.assigned-name-value.no-name {
  font-style: italic;
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Image Gallery Styles */
.tree-gallery {
  margin: 2rem -1.5rem 0;
  padding: 1.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.gallery-title {
  margin: 0 0 1rem 0;
  color: var(--primary-dark);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-title::before {
  content: "🖼️";
  font-size: 1.2em;
}

.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* Lightbox styles */
#lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 2rem;
  box-sizing: border-box;
}

#lightbox.show {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-img-container {
  position: relative;
  max-width: 100%;
  max-height: 80vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.lightbox-img.loading {
  opacity: 0.5;
}

.lightbox-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 1rem;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.close-lightbox {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 3rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
}

.lightbox-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 1.1rem;
}

/* Carousel styles */
.carousel-container {
  position: relative;
  width: 100%;
  margin: 20px 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  aspect-ratio: 16/9; /* Maintain aspect ratio */
  max-height: 70vh; /* Limit maximum height */
}

.carousel-slides {
  display: flex;
  transition: transform 0.5s ease-in-out;
  height: 100%;
  width: 100%;
}

.carousel-slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.7);
  color: var(--primary-color);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.carousel-btn:hover {
  background-color: var(--primary-color);
  color: white;
}

.carousel-btn.prev {
  left: 15px;
}

.carousel-btn.next {
  right: 15px;
}

.carousel-indicators {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.carousel-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-indicator.active {
  background-color: white;
  transform: scale(1.2);
}

.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  padding: 15px 20px;
  text-align: center;
  font-size: 0.9rem;
}

/* Hide the gallery styles since we're using a carousel */
.gallery-container {
  display: none;
}

/* Lightbox Styles */
#lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.lightbox-content {
  position: relative;
  width: 100%;
  max-width: 1200px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.close-lightbox {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  background: rgba(0, 0, 0, 0.5);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.3);
  z-index: 10;
}

.close-lightbox:hover {
  color: var(--primary-color);
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.7);
}

.lightbox-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  margin: 0;
  padding: 2rem;
  box-sizing: border-box;
}

.lightbox-img-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}

.lightbox-img.loading {
  opacity: 0.5;
}

/* Ensure lightbox takes full viewport */
#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.lightbox-content {
  width: 100%;
  height: 100%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 1.8rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: all 0.2s;
  z-index: 5;
}

.nav-btn.prev-btn {
  left: 1rem;
}

.nav-btn.next-btn {
  right: 1rem;
}

.nav-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.lightbox-caption {
  color: white;
  text-align: center;
  margin-top: 1rem;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  max-width: 90%;
  backdrop-filter: blur(5px);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .carousel-container {
    max-height: 50vh;
  }

  .nav-btn {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }

  .close-lightbox {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  #map {
    height: 50vh;
    width: 100%;
  }

  #info-panel {
    width: 100%;
    max-height: 50vh;
  }

  .tree-details {
    padding: 0.8rem;
  }

  .tree-name,
  .tree-scientific,
  .tree-id,
  .assigned-name {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }

  .lightbox-content {
    padding: 0.5rem;
  }

  .lightbox-caption {
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
  }
}

/* Mobile styles */
@media (max-width: 480px) {
  .carousel-container {
    border-radius: 8px;
    margin: 10px 0;
  }

  .nav-btn {
    width: 2rem;
    height: 2rem;
    font-size: 1.2rem;
  }

  .close-lightbox {
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    font-size: 1.5rem;
  }

  .tree-details h2 {
    font-size: 1.2rem;
    margin: 0.5rem 0;
  }

  .tree-name,
  .tree-scientific,
  .tree-id,
  .assigned-name {
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
    margin: 0.2rem 0;
  }
}

/* Animation for when a name is present */
.assigned-name-value:not(.no-name) {
  animation: fadeInUp 0.5s ease-out forwards;
}

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

/* Estilos para la sección de lluvia interceptada */
#total-rainfall,
#total-runoff-reduction {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3498db, #2980b9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin: 0.5rem 0 1rem;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
}

#total-rainfall::after {
  content: "Litros/año";
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 3px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

/* Estilos para la sección de reducción de escurrimientos */
#total-runoff-reduction {
  background: linear-gradient(135deg, #1abc9c, #16a085);
  -webkit-background-clip: text;
  background-clip: text;
}

#total-runoff-reduction::after {
  content: "Litros/año";
  font-size: 1.1rem;
  font-weight: 600;
  margin-left: 3px;
  background: linear-gradient(135deg, #1abc9c, #16a085);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

/* Estilos para la sección de carbono secuestrado */
#total-carbon,
#total-co2 {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #27ae60, #219653);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin: 0.5rem 0 1rem;
  letter-spacing: -1px;
  position: relative;
  z-index: 1;
  display: inline-block;
  transition: var(--transition);
}

#total-carbon::after {
  content: " kg";
  font-size: 1.5rem;
  font-weight: 600;
  margin-left: 4px;
  background: linear-gradient(135deg, #27ae60, #219653);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

/* Estilos para la sección de absorción de CO₂ */
#total-co2 {
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
}

#total-co2::after {
  content: " kg/año";
  font-size: 1.5rem;
  font-weight: 600;
  margin-left: 4px;
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

#total-age::after {
  content: "años";
  font-size: 1.5rem;
  font-weight: 600;
  margin-left: 4px;
  background: linear-gradient(135deg, #e67e22, #f39c12);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

#age-value {
  font-weight: 600;
  color: #e67e22;
  transition: var(--transition);
}

#total-height::after {
  content: "km";
  font-size: 1.5rem;
  font-weight: 600;
  margin-left: 4px;
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  vertical-align: super;
  line-height: 1;
  opacity: 0.8;
}

#height-value {
  font-weight: 600;
  color: #27ae60;
  transition: var(--transition);
}

/* Mejoras para dispositivos móviles */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 100%;
    --map-width: 100%;
    --header-height: 60px;
  }

  main {
    flex-direction: column;
  }

  #info-panel {
    max-height: 50vh;
    overflow-y: auto;
    width: 100%;
    padding: 1rem;
  }

  #map-container {
    height: 50vh;
    width: 100%;
  }

  .stat-item {
    padding: 1.25rem 0.75rem;
    margin-bottom: 1rem;
  }

  .stat-value {
    font-size: 2.5rem;
  }

  #total-height {
    font-size: 2.8rem;
  }

  #top-borough {
    font-size: 2.2rem;
  }

  #total-age,
  #total-rainfall,
  #total-runoff-reduction,
  #total-carbon,
  #total-co2 {
    font-size: 2.8rem;
  }

  #total-height::after {
    font-size: 1.2rem;
  }

  .stat-label,
  .legend p {
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

/* Ajustes para pantallas pequeñas */
@media (max-width: 480px) {
  .stat-item {
    padding: 1rem 0.5rem;
  }

  .stat-value {
    font-size: 2.2rem;
  }

  #total-height {
    font-size: 2.4rem;
  }

  #top-borough {
    font-size: 2rem;
    line-height: 1.1;
  }

  #total-age,
  #total-rainfall,
  #total-runoff-reduction,
  #total-carbon,
  #total-co2,
  #total-co2-equivalent {
    font-size: 2.4rem;
  }

  #total-age::after {
    font-size: 1.2rem;
  }

  .stat-label,
  .legend p {
    font-size: 0.85rem;
  }
}

/* Estilos del botón de ubicación */
#locate-me {
  position: absolute;
  top: 20%;
  left: 30px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  border: none;
  border-radius: 50px;
  padding: 12px 18px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-weight: 500;
  color: var(--primary-color);
  gap: 8px;
}

#locate-me:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

#locate-me:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#locate-me .location-icon-svg {
  fill: var(--primary-color);
  transition: var(--transition);
}

#locate-me:hover .location-icon-svg {
  transform: scale(1.1);
  fill: var(--secondary-color);
}

#locate-me .button-text {
  color: var(--primary-color);
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

#locate-me:hover .button-text {
  color: var(--secondary-color);
}

.button-text {
  display: block;
  font-size: 12px;
  margin-top: 6px;
  color: #333;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.location-icon-svg {
  width: 22px;
  height: 22px;
  fill: #4285f4;
  transition: all 0.2s ease;
  transform: translateZ(0);
}

#locate-me:hover {
  background: #f8f9fa;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

#locate-me:hover .location-icon-svg {
  fill: #3367d6;
  transform: scale(1.05) translateZ(0);
}

#locate-me:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#locate-me.active {
  background: #4caf50;
  border-color: #45a049;
}

#locate-me.active .location-icon-svg,
#locate-me.active .button-text {
  color: white;
  fill: white;
}

#locate-me:hover.active {
  background: #43a047;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#locate-me:active.active {
  background: #3d8b40;
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.2);
}

/* Estilos para el marcador de ubicación */
.location-icon {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background-color: #4285f4;
}

/* Estilos para el tooltip de alcaldías */
.alcaldia-tooltip {
  background-color: rgba(44, 62, 80, 0.9);
  color: white;
  border: 1px solid #2c3e50;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}

/* Prevenir selección y resaltado en las alcaldías */
.alcaldia-layer {
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Eliminar el resaltado al hacer clic */
.alcaldia-layer:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Estilo para cuando está seleccionado */
.alcaldia-layer.leaflet-interactive:focus {
  outline: none !important;
}

/* Triángulo del tooltip */
.alcaldia-tooltip::before {
  border-top-color: #2c3e50;
}

/* Efecto de transición suave para el hover */
.alcaldia-layer {
  transition: fill-opacity 0.2s, opacity 0.2s;
}

/* Ajustes para pantallas pequeñas */
@media (max-width: 600px) {
  #locate-me {
    padding: 8px 16px;
    font-size: 13px;
    bottom: 15px;
    right: 15px;
  }
}
