/* styles.css */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f5f5;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.5rem 1rem;
    background: linear-gradient(to right, #0D3B93, #E71E73);
    min-height: 100px;
}

.title {
    order: 1;
    font-family: var(--font-family);
    font-size: 3.0rem;
    color: var(--text-color);
    margin-right: auto;
}

.header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 110px;
    width: auto;
}

.header h1 {
    font-size: 32px;
    font-weight: 600;
    color: #ffffff;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    z-index: 999;
}

.map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.panel-header {
    background: #34495e;
    color: white;
    padding: 15px;
    font-weight: 500;
    font-size: 16px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
}

.layer-section {
    border-bottom: 1px solid #eee;
    background-color: #f5f5f5;
    border: 1px solid #ffffff;
    border-radius: 4px;
    margin-bottom: 12px;
    overflow: hidden;
}

.section-title {
    background: #2c3e50;
    color: #ffffff;
    padding: 12px 15px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title:hover {
    background: #d5dbdb;
}

.section-content {
    padding: 10px 15px;
    display: none;
}

.section-content.active {
    display: block;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
    margin-bottom: 6px;
}

.layer-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.layer-checkbox {
    margin-right: 10px;
    transform: scale(1.2);
}

.layer-label {
    flex: 1;
    cursor: pointer;
    color: #2c3e50;
}

.layer-opacity {
    width: 60px;
    margin-left: 10px;
}

.search-box {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
    display: inline-block;
}

.toggle-icon.rotated {
    transform: rotate(90deg);
}

.control-buttons {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
}

.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-size: 14px;
}

.btn:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.info-panel {
    position: absolute;
    top: 60px;
    right: 0;
    width: 300px;
    max-height: calc(100% - 60px);
    background: #fff;
    box-shadow: -2px 0 6px rgba(0,0,0,0.3);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.info-panel.open {
    transform: translateX(0);
}

.info-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    float: right;
    margin: 0.5rem;
    cursor: pointer;
}

.info-content {
    padding: 1rem;
    font-family: sans-serif;
}

.info-content h2 {
    margin-top: 0;
}

.info-content table {
    width: 100%;
    border-collapse: collapse;
}

.info-content th, .info-content td {
    padding: 0.25rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.leyenda-capa {
    font-family: Arial, sans-serif;
    font-size: 12px;
    max-width: 200px;
}

.leyenda-capa h4 {
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.leyenda-capa ul li {
    padding: 3px 0;
    display: flex;
    align-items: center;
}

.leaflet-control-geocoder {
    width: 300px !important;
    border: 1px solid #ddd !important;
    font-family: 'Arial', sans-serif;
}

.leaflet-control-geocoder-form input {
    padding: 10px 15px !important;
}

.leaflet-control-geocoder-alternatives li {
    border-bottom: 1px solid #eee;
    padding: 8px;
}

.leaflet-control-geocoder-selected {
    background-color: #f0f8ff !important;
}

@media (max-width: 768px) {
    .left-panel {
        position: absolute;
        left: -300px;
        top: 0;
        bottom: 0;
        transition: left 0.3s;
        z-index: 1001;
    }
    
    .left-panel.mobile-open {
        left: 0;
    }
}
/* Estilos para el buscador */
.leaflet-control-geocoder {
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  background: white;
  width: 250px;
}

.leaflet-control-geocoder a {
  border-bottom: none;
}

.leaflet-control-geocoder .leaflet-control-geocoder-form input {
  width: 100%;
}

/* Estilos para las leyendas */
.map-legend {
  background: white;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
  max-height: 300px;
  overflow-y: auto;
}

.map-legend h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #333;
}

.legend-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legend-items li {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  font-size: 13px;
}

.legend-color {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 8px;
  border: 1px solid #999;
}

.bus-line {
  border-radius: 50%;
}

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 999;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  }

  #map {
    height: 100vh;
    width: 100%;
    position: absolute;
    top: 100px;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    height: auto;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .leaflet-control {
    transform: scale(0.9);
  }

  .layer-section {
    font-size: 0.9rem;
  }
}

#toggle-panel-btn {
    display: none;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1002;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    background: #0D3B93;
    color: white;
    border: none;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    #toggle-panel-btn {
        display: block;
    }

    .left-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        left: -100%;
        width: 80%;
        background: white;
        z-index: 1001;
        transition: left 0.3s ease-in-out;
    }

    .left-panel.show {
        left: 0;
    }
}


@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: center !important;
    justify-content: center;
    text-align: center;
    padding: 1rem 0.5rem;
  }

  .title {
    font-size: 1.4rem !important;
    margin: 0.5rem 0 !important;
  }

  .header-logo {
    position: static !important;
    transform: none !important;
    height: 80px !important;
    margin-bottom: 0.5rem;
  }
}

.vm-custom-svg-icon {
  background: transparent !important;
  border: none !important;
}

.vm-custom-svg-icon svg {
  filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.4));
}

/* Estilos mejorados para el botón de capas (toggle-panel-btn) */
#toggle-panel-btn {
    display: none;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1002;
    padding: 0.8rem 1.2rem;
    font-size: 1.1rem;
    font-weight: bold;
    background: #0D3B93;
    color: white;
    border: 3px solid white; /* Marco blanco añadido */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), 
                0 0 0 2px rgba(255, 255, 255, 0.7); /* Efecto de resaltado */
    cursor: pointer;
    transition: all 0.3s ease;
}

#toggle-panel-btn:hover {
    background: #0a2a6e;
    box-shadow: 0 6px 12px rgba(0,0,0,0.4), 
                0 0 0 3px rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

#toggle-panel-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), 
                0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Para que el botón sea más visible en móviles */
@media (max-width: 768px) {
    #toggle-panel-btn {
        display: block;
        font-size: 1rem;
        padding: 0.7rem 1.1rem;
    }
    
    /* Asegurar que el botón tenga buen contraste en diferentes fondos */
    #toggle-panel-btn {
        text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    }
}