html, body {
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    display: flex;
    justify-content: center; /* centra el contenido horizontal */
    align-items: center;
    position: relative;
    padding: 10px 20px;
    background-color: #202220;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

.header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

header h1 {
    color: #f2f2f2;
    margin: 0;
    font-family: "Gotham bold";
}

header img {
    width: 8%;
    margin-left: auto;
}

main {
    display: flex;
    flex-grow: 1;
    height: calc(100vh - 60px);
}

.sidebar {
    width: 30%;
    padding: 5px;
    background-color: #f4f4f4;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.sidebar p{
    text-align: justify;
    font-family: "Gotham Regular";
    margin: 20px;
}

.sidebar h2 {
    margin-bottom: 1px;
    text-align: center;
    font-family: "Gotham bold";
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
}

.sidebar ul li {
    margin-bottom: 10px;
}

.sidebar label {
    margin-left: 5px;
}

.sidebar-footer {
    margin-top: auto; /* empuja al fondo */
    padding: 10px;
    font-size: 0.9em;
    background-color: #f2f2f2;
    color: #333;
    border-top: 1px solid #ccc;
    font-family: "Gotham Regular";
}

.sidebar-footer a {
    color: #0077cc;
    text-decoration: none;
}

.sidebar-footer a:hover {
    text-decoration: underline;
}


.simbologia-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
}

.simbologia-table th,
.simbologia-table td {
    padding: 12px 15px;
    border: 1px solid black;
    text-align: center;
}

.simbologia-table th {
    background-color: #f4f4f4;
    font-weight: bold;
}

.simbologia-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.simbologia-table tbody tr:hover {
    background-color: #f1f1f1;
}

.simbologia-table td input[type="checkbox"] {
    margin-left: 10px;
    transform: scale(1.2);
}

.map-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e0e0e0;
}

#map {
    width: 100%;
    height: 100%;
    background-color: white;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 1.5rem;
    border-radius: 16px;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    overflow: hidden;
    height: fit-content;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.close:hover {
    color: #e74c3c;
}

.modal-body {
    overflow-y: visible;
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.modal-body th,
.modal-body td {
    border: 1px solid #dddddd;
    padding: 0.6rem;
    text-align: left;
}

.modal-body th {
    background-color: #00b5d9; /* contraste mejorado */
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: 10px;
        box-shadow: none;
        height: auto;
        max-height: 400px;
        overflow-y: auto;
    }

    .map-container {
        width: 100%;
        height: 600px;
        margin-top: 20px;
    }

    .accordion {
        width: 100%;
        font-size: 1rem;
        
    }

    .accordion-header {
        height: auto;
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
    }

    .accordion-content div {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 8px 12px;
    }

    .accordion-content.open {
        max-height: 1000px; /* permitir expansión */
        transition: max-height 0.4s ease-out;
    }

    #map {
        width: 100%;
        height: 100%;
    }

    header img {
        width: 100px;
    }
}


/* Acordeón */
.accordion {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 20px;
    margin-top: 10px;
    
}

.accordion-header {
    background-color: #f1f1f1;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.3s ease;
    background-color: #fff;
}
/* Para checkbox y labels: */
.accordion-content label {
    flex-grow: 1;
    font-size: 1rem; /* tamaño legible */
    user-select: none;
}

.accordion-content.open {
    border-top: 1px solid #ccc;
}

.accordion-content div {
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px; /* separa checkbox de label */
}

.accordion-header i {
    transition: transform 0.3s ease;
}

.accordion-header.open i {
    transform: rotate(180deg);
}

/* Checkbox con tamaño más grande */
.accordion-content input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}


/* Sidebar scroll y botones fijos en móvil */


/*Cuadro del mapa*/

.legend-custom {
  background: white;
  padding: 15px 20px;
  border-radius: 6px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4em;
  color: #333;
  position: relative;
  bottom: 40px;
  right: 40px;
  width: 180px;
  max-width: 90vw;
}

.legend-custom h4 {
  margin: 0 0 8px 0;
  font-weight: bold;
}

.legend-box {
  display: inline-block;
  width: 25px;
  height: 25px;
  margin-right: 12px;
  vertical-align: middle;
  border-radius: 4px;
}

.legend-box.no-cumple {
  background: #f52121;
}

.legend-box.al-limite {
  background: #f4ff12;
}

.legend-box.cumple {
  background: #48b117;
}

/* --- Versión responsiva para pantallas menores a 600px --- */
@media (max-width: 600px) {
  .legend-custom {
    font-size: 14px;
    padding: 10px 12px;
    width: auto;
    position: static; /* para que se ubique naturalmente en pantallas chicas */
    margin: 10px;
  }

  .legend-box {
    width: 20px;
    height: 20px;
    margin-right: 8px;
  }
}
