body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#map {
    width: 100%;
    height: calc(100vh - 42px); /* Full height minus compact navbar height */
    z-index: 1;
}

#map-container {
    position: relative;
}

.navbar {
    z-index: 2;
}

/* --- Estilos para los marcadores personalizados y la tabla --- */

/* Contenedor del icono de Leaflet. No necesita estilos. */
.custom-marker-icon {
    background: none;
    border: none;
}

.marker-inner-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* La chincheta usa una variable CSS '--marker-color' definida en el HTML */
.marker-pin {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--marker-color);
    border: 2px solid #fff;
    box-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.marker-pin::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 26px; /* Posiciona la punta justo debajo del círculo */
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--marker-color);
}

/* Punto de color en la tabla de marcadores */
.color-dot {
    height: 15px;
    width: 15px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid #6c757d;
}

.marker-row {
    cursor: pointer;
}

.marker-row-clickable {
    cursor: pointer;
}

.leaflet-custom-div-icon {
    background: transparent;
    border: none;
}

.marker-svg {
    width: 32px;
    height: 32px;
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.5));
}

/* Legend Styles */
.legend-container {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 5px;
    border: 1px solid #ddd;
}

.legend {
    padding: 8px 12px;
    font: 16px/1.5 Arial, Helvetica, sans-serif;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 5px;
    line-height: 24px;
    color: #333;
}
.legend h4 {
    margin: 0 0 8px;
    color: #000;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
}
.legend-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.legend-item:hover {
    background-color: #f4f4f4;
}
.legend-item-inactive {
    opacity: 0.6;
    text-decoration: line-through;
    background-color: #e9ecef;
}

/* --- Action Icons in Tables --- */
.actions-cell a.icon-action {
    color: #6c757d; /* secondary */
    text-decoration: none;
    margin: 0 4px;
    font-size: 1.1rem;
    transition: transform 0.1s ease-in-out, color 0.1s ease-in-out;
    display: inline-block; /* Allows transform */
}

.actions-cell a.icon-action:hover {
    transform: scale(1.2);
    color: #212529; /* dark */
}

.actions-cell a.icon-action.text-danger:hover {
    color: #dc3545 !important; /* Ensure hover on delete is red */
}

.map-search-control {
    background: #fff;
    border-radius: 6px;
    padding: 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    transition: width 0.25s ease, padding 0.25s ease;
    overflow: hidden;
}

.map-search-control.map-search-collapsed .map-search-inner {
    display: none;
}

.map-search-control.map-search-collapsed {
    padding: 0;
}

.map-search-toggle-btn {
    border: none;
    background: transparent;
    padding: 7px 9px;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-search-toggle-btn:hover {
    color: #000;
}

.map-search-control:not(.map-search-collapsed) .map-search-toggle-btn {
    display: none;
}

.map-search-inner {
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-search-inner input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 8px;
    min-width: 220px;
    font-size: 14px;
}

.map-search-inner button {
    border: 1px solid #ced4da;
    background: #ffffff;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
}

.layer-opacity-slider {
    width: 110px;
    margin-left: 8px;
    vertical-align: middle;
}

.shadow-date-control {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 6px;
    padding: 6px 10px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    font-size: 13px;
    color: #212529;
}

#point-details-modal .modal-header .icon-action {
    background: transparent;
    border: 0;
    color: #6c757d;
}

#point-details-modal .modal-header .icon-action:hover {
    color: #212529;
}

.shadow-date-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shadow-date-label {
    font-weight: 600;
    margin: 0;
}

.shadow-date-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    padding: 4px 8px;
    font-size: 13px;
}

.shadow-date-refresh-btn {
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    padding: 3px 8px;
    line-height: 1;
}

.shadow-date-refresh-btn:hover {
    color: #212529;
    background: #f8f9fa;
}

.map-download-control {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
}

.map-download-control button {
    border: 0;
    background: transparent;
    padding: 8px 10px;
    cursor: pointer;
}

.download-overlay-list {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    max-height: 220px;
    overflow-y: auto;
}

.download-overlay-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.concejo-style-control {
    background: rgba(255, 255, 255, 0.94);
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    padding: 8px 10px;
    min-width: 190px;
}

.concejo-style-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.concejo-style-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.concejo-style-color {
    width: 34px;
    height: 30px;
    padding: 0;
}

.concejo-style-width {
    flex: 1;
}


.concejo-advanced-style-btn {
    margin-left: 8px;
    padding: 1px 6px;
    line-height: 1.1;
}

/* --- Project selector with edit button --- */
#project-selector-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

#project-selector-container label {
    margin-bottom: 4px;
    font-weight: bold;
    display: block;
}

#project-selector-container .d-flex select {
    min-width: 180px;
}

/* --- Project edit modal --- */
.pe-hoja-card {
    border-color: #dee2e6;
}

.pe-hoja-card .card-body {
    background: #f8f9fa;
}

.pe-hoja-card .form-text {
    font-size: 0.72rem;
    line-height: 1.2;
}

.pe-sheet-chevron {
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.pe-cat-colors-list {
    max-height: 180px;
    overflow-y: auto;
    padding: 2px 0;
}

.pe-cat-color-row {
    padding: 2px 4px;
    border-radius: 4px;
}

.pe-cat-color-row:hover {
    background: #e9ecef;
}

/* --- Loading overlay --- */
#map-loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 900;
    background: rgba(13, 17, 23, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
#map-loading-overlay.active {
    display: flex;
}
.map-loading-content {
    text-align: center;
}
.map-loading-text {
    color: rgba(255,255,255,0.8);
    margin-top: .8rem;
    font-size: .95rem;
    font-weight: 500;
    letter-spacing: .3px;
}

/* --- Marker controls in layer panel --- */
.markers-layer-separator {
    border: 0;
    border-top: 1px solid #ddd;
    margin: 6px 0;
}

.markers-layer-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 0;
}

.markers-layer-label input[type="checkbox"] {
    margin: 0;
}

.marker-size-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0 0 0;
    font-size: 12px;
    color: #555;
}

.marker-size-slider {
    flex: 1;
    height: 4px;
    cursor: pointer;
    accent-color: #0d6efd;
}

.marker-size-value {
    min-width: 22px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
