/* ==========================================================================
   1. FONTS & ICONOS
   ========================================================================== */
@font-face {
    font-family: 'iconos';
    src: url('icons/fuenteiconos.woff2') format('woff2'),
         url('icons/fuenteiconos.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

:root {
    --font-primary: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --color-primary: #0e1563;
    --color-primary-hover: #1a237e;
    --color-primary-dark: #020b3d;
}

/* ==========================================================================
   2. RESET & GENERAL
   ========================================================================== */
html, body { 
    height: 100%; 
    margin: 0; 
    padding: 0; 
}
body, #sidePanel {
    color: #1a1a1a;
}
body, button, input, textarea, select, label, #sidePanel * {
    font-family: var(--font-primary);
}
body {
    line-height: 1.5;
    letter-spacing: -0.2px;
    font-size: 15px;
}
label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    font-size: 14px;
}
textarea, select, input {
    width: 100%;
    box-sizing: border-box;
}
button, a.action {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    display: block;
    text-align: center;
    text-decoration: none;
}
button {
    letter-spacing: 0.3px;
}

/* Pesos de fuente */
body, p, span {
    font-weight: 400;
}
label, .panel-actions button, .photo-split-btn {
    font-weight: 600;
}
h1, h2, h3, #userDisplay {
    font-weight: 700;
}

/* Iconos */
.icono { 
    font-family: 'iconos', serif; 
    font-size: 16px; 
}
.azul { color: #1A9DDB; }
.verde { color: #729C43; }
.marron { color: #966D49; }
.naranja { color: #FF9933; }
.gris { color: #666666; }
.rojo { color: #D92433; }
.azul2 { color: #003399; }
.blanco { color: #FFFFFF; }
.icono.morado { color: #6a1b9a; }

.marker-nuevo {
    background-color: #ffc107;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.5);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}
.marker-nuevo-estilo img {
    filter: drop-shadow(0 0 0 3px rgba(255, 193, 7, 0.8)) drop-shadow(0 0 0 6px rgba(255, 193, 7, 0.4));
    animation: pulse-nuevo 1.5s infinite;
}

@keyframes pulse-nuevo {
    0% {
        filter: drop-shadow(0 0 0 3px rgba(255, 193, 7, 0.8)) drop-shadow(0 0 0 6px rgba(255, 193, 7, 0));
    }
    100% {
        filter: drop-shadow(0 0 0 6px rgba(255, 193, 7, 0)) drop-shadow(0 0 0 12px rgba(255, 193, 7, 0));
    }
}

/* ==========================================================================
   3. BARRA SUPERIOR (#topBar)
   ========================================================================== */
    #topBar{
        top: 0;
        left: 0;
        background: var(--color-primary);
        color: white;
        box-sizing: border-box;
        justify-content: space-between;
        padding: 0 5px;
        z-index: 2000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4);
        align-items: center;
        position: fixed;
        display:inline-block;
        height: 60px;
        margin: auto;
	    text-align: left;
        width:100%
    }
    .left-section{
        width: 50%;
        display: inline;
        position: absolute;
        left: 0;
        text-align: end;
        margin-top: 1em;
    }
    #menuBtn{
        width: 50px;
        float: left;
        background: none;
        border: none;
        color: white;
        font-size: 28px;
        cursor: pointer;
        margin-top: -0.4em;
    }
    .logo-container{
        width: 100%;
        object-fit: contain;
        max-height: 54px;
        float: left;
        max-width: 50%;
    }
    .logo-container img{
        width:100%;
        object-fit: contain;
        max-height: 40px;
        margin-top: 0em;
    }
        
    .right-section{
        position: absolute;
        right: 0;
        width:70%;
        text-align: end;
        display:inline;
    }
    #userDisplay{
        font-family: var(--font-primary);
        width: 30%;
        /*font-size: 1em;*/
        font-size: clamp(0.7rem, 1vw + 0.1rem, 1rem);
        float:left;
        margin-top: 1.25rem;
        margin-left: 0.5rem;
    }
    #premiumBadge{
      width: 20%;
      align-items: end;
      float: right;
      margin-top: 0.5em;
      max-height: 60px;
      height: 60px;
    }
    #premiumBadge img{
      width: auto;
      height: auto;
      object-fit: scale-down;
      text-align: left;
      max-height: 80%;
      max-width: 100%;
    }
    #idiomas{
        width: 20%;
        float:right;
        margin-top: 1.5em;
        margin-right: 10px;
        margin-left: 3%;
    }
    #idiomas img{
        width:100%;
        max-height: 20px;
        object-fit: contain;
        cursor:pointer;
    }
    #ayudaBtn{
        float: right;
        width:10%;
        margin-right: 10px;
        font-size: 30px;
        margin-top: 0.3em;
        cursor:pointer;
    }
    @media (max-width: 450px) {
        #premiumBadge img{
            margin-top: 0.5em;
        }
    }

/* Mensaje de usuario desactivado */
#disabled-message {
    position: absolute;
    left: 70px;
    top: 0;
    height: 60px;
    display: flex;
    align-items: center;
    background: #c62828;
    color: white;
    padding: 0 20px;
    font-size: 22px;
    font-weight: bold;
    z-index: 2001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border-radius: 0 0 12px 12px;
}
#disabled-message .main-text {
    font-size: 24px;
    margin-right: 20px;
}
#disabled-message .sub-text {
    font-size: 14px;
    font-weight: normal;
    opacity: 0.9;
}
#topBar.disabled .left-section, 
#topBar.disabled #menuBtn {
    opacity: 0.4;
    pointer-events: none;
}

/* ==========================================================================
   4. MENÚ DESPLEGABLE
   ========================================================================== */
#menul {
    display: none;
    position: fixed;
    top: 52px;
    left: 16px;
    width: 240px;
    background: #ddd;
    backdrop-filter: blur(10px);
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    z-index: 1999;
    list-style: none;
    padding: 8px 0;
    margin: 0;
}
#menul li a {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    color: #333;
    font-size: 15px;
}
#menul li a:hover {
    background: #e3f2fd;
    color: var(--color-primary);
    font-weight: bold;
}

/* ==========================================================================
   5. MAPA
   ========================================================================== */
#map {
    width: 100%;
    height: calc(100vh - 60px);
    margin-top: 60px;
}
#myLocationBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--color-primary);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
}
.my-location-marker {
    filter: drop-shadow(0 0 3px rgba(33, 150, 243, 0.7));
    animation: pulse-gentle 3s infinite ease-in-out;
}

/* ==========================================================================
   6. PANEL LATERAL (#sidePanel)
   ========================================================================== */
#sidePanel {
    position: fixed;
    top: 60px;
    right: -350px;
    width: 350px;
    height: calc(100% - 60px);
    background: #fff;
    z-index: 2000;
    padding: 12px;
    box-sizing: border-box;
    box-shadow: -2px 0 8px rgba(0,0,0,.3);
    transition: right .3s ease;
    overflow-y: auto;
    background-color: #ebebf5;
}
#sidePanel.open {
    right: 0;
}
#sidePanel select, #sidePanel textarea {
    font-size: 12px;
}
#dateDisplay { 
    font-size: 12px; 
    color: #666; 
    margin-top: 10px; 
    margin-bottom: 10px; 
    font-weight: bold;
}

/* Características en dos columnas */
.features-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px 16px !important;
}
.features-checkboxes label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}
.features-checkboxes input[type="checkbox"] {
    margin-right: 10px;
    width: auto;
}

/* Panel actions (botones) */
.panel-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 24px 0 16px;
    width: 100%;
}
.panel-actions button {
    flex: 1;
    width: auto;
    margin-top: 0;
}

/* Botones Guardar/Eliminar */
#saveBtn,
#deleteBtn {
    flex: 1;
    max-width: 180px;
    height: 36px;
    border: none;
    border-radius: 28px;
    background-color: var(--color-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
    transition: all 0.18s ease;
    overflow: hidden;
    font-size: 15px;
}
#copiarGrupoBtn, #copiarAMisPuntosBtn {
    flex: 1;
    max-width: 180px;
    height: 40px;
    border: none;
    border-radius: 28px;
    background-color: var(--color-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
    transition: all 0.18s ease;
    overflow: hidden;
    font-size: 12px;
    margin-top:5px;
    line-height: 1.1;
}
#saveBtn:hover,
#deleteBtn:hover,
#shareBtn:hover,
#navBtn:hover,
.photo-split-btn:hover,
#saveFeatures:hover,
#parseBtn:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 21, 99, 0.45);
}
#saveBtn:active,
#deleteBtn:active,
#shareBtn:active,
#navBtn:active,
.photo-split-btn:active {
    transform: translateY(0);
    background-color: var(--color-primary-dark);
    box-shadow: 0 2px 8px rgba(14, 21, 99, 0.3);
}
#saveBtn span,
#deleteBtn span,
#saveBtn::before,
#deleteBtn::before {
    font-size: 28px;
    color: #ffffff !important;
    line-height: 1;
}

/* Botones WhatsApp y Google */
.share-nav-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 16px 0 24px;
    width: 100%;
}
#shareBtn,
#navBtn {
    flex: 1;
    max-width: 180px;
    height: 36px;
    border: none;
    border-radius: 28px;
    background-color: var(--color-primary);
    color: #ffffff;
    font-size: 0;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 16px;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
    transition: all 0.18s ease;
}
#shareBtn img, #navBtn img {
    width: 20%;
    height: auto;
    display: block;
}
#shareBtn .label, #navBtn .label {
    font-size: 15px;
    font-weight: 500;
    color: #ffffff;
    margin: 0;
    line-height: 1;
}
#shareBtn .icon, #navBtn .icon {
    width: 24px;
    height: 24px;
    fill: #ffffff;
    stroke: #ffffff;
}

/* Botones de fotos */
.photo-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin: 5px auto;
    width: fit-content;
    padding: 0 16px;
}
.photo-split-btn {
    flex: 1;
    height: 39px;
    border: none;
    border-radius: 32px;
    background-color: var(--color-primary);
    color: #ffffff;
    font-size: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
    transition: all 0.18s ease;
    padding-left: 28px;
    padding-right: 28px;
}
.photo-split-btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.photo-split-btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}
.photo-split-btn .icon {
    width: 32px;
    height: 32px;
    stroke: #ffffff;
    fill: none;
    font-size: 32px;
}
.photo-actions .icon {
    width: 28px;
    height: 28px;
    stroke: #ffffff;
    fill: none;
}

/* Input file ocultos */
#cameraInput, #galleryInput {
    display: none !important;
    visibility: hidden !important;
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
    left: -9999px;
}

/* Slider de fotos */
.photo-slider {
    position: relative;
    width: 100%;
    height: 220px;
    margin: 0 0 16px;
    background: #f8f8f8;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.slider-container {
    display: flex;
    height: 100%;
    transition: transform 0.4s ease;
}
.slider-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0;
}
.slider-container > div {
    position: relative;
    width: 100%;
    height: 100%;
    flex-shrink: 0;
}
.slider-prev, .slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    padding-top: 3px;
}
.slider-prev { left: 10px; }
.slider-next { right: 10px; }
.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}
.slider-dot {
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
    cursor: pointer;
}
.slider-dot.active {
    background: white;
    transform: scale(1.2);
}
.slider-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px !important;
    height: 28px !important;
    font-size: 20px;
    line-height: 28px;
    cursor: pointer;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding-bottom: 10px;
}
.slider-container > div:hover .slider-close {
    display: flex !important;
}
.slider-close.always-visible {
    display: flex !important;
}

/* Fila valoración + favorito */
.row-group {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 8px 0 20px;
}
.row-group .field {
    flex: 1;
}
.row-group .field.half {
    margin-top: 0 !important;
    margin-bottom: 6px;
}
.row-group .field.half:first-child {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.favorite-field .favorite-label {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
}
.favorite-label span {
    margin: 0;
    line-height: 1;
    font-size: 16px;
    margin-top: 26px;
    color: #FF9933;
    font-weight: bold;
}
.favorite-label input[type="checkbox"] {
    margin: 30px 8px 0 0;
    width: 16px;
    height: 16px;
}
textarea {
    background-color: #ebebf5;
}

/* Descripción */
.description-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 16px 0 8px;
}
.description-header label {
    margin: 0;
    font-weight: bold;
}
#descMoreLink {
    color: #1976d2;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
#descMoreLink:hover {
    color: #0d47a1;
}
#desc {
    background-color: #ebebf5;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 12px;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    height: 72px;
    overflow-y: hidden;
    overflow-x: hidden;
}
#desc:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 21, 99, 0.15);
}
#desc::-webkit-scrollbar {
    display: none;
}
#desc {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Características display */
.features-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
    min-height: 20px;
    margin-bottom: 0;
}
.features-display span.icono {
    font-size: 24px;
    line-height: 1;
    font-family: iconos !important;
}
.features-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 12px 0 8px;
}
.features-header label {
    margin: 0;
    font-weight: bold;
}
.modify-link {
    color: #1976d2;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.modify-link:hover {
    color: #0d47a1;
}

.web-header {
    margin: 8px 0 8px;
    margin-bottom: 0px;
}
.web-header label {
    margin: 0;
    font-weight: bold;
}
.web-input {
    background-color: #ebebf5;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 2px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 2px;
    flex: 1; /* ESTO ES LO IMPORTANTE: el input ocupa todo el espacio disponible */
    min-width: 0; /* Permite que se encoja si es necesario */
}
.web-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(14, 21, 99, 0.15);
}
/* NUEVO: contenedor flex para input + botón */
.web-input-group {
    display: flex;
    gap: 4px;
    align-items: center;
    width: 100%;
}
/* NUEVO: botón pequeño a la derecha */
.web-go-btn {
    background-color: #0e1563;
    color: white;
    border: none;
    border-radius: 2px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    height: 22px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    width: auto;       /* Ancho automático según contenido */
    flex-shrink: 0;    /* Evita que se encoja */
    align-self: center;
    margin-top:0px;
}
.web-go-btn:hover {
    background-color: #1a237e;
}

/* ==========================================================================
   7. MODALES
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    top:150px;
}
#featuresModal[style*="display: flex"],
#featuresModal[style*="display: block"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.modal-content {
    background-color: #ebebf5;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 24px 20px;
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    font-family: var(--font-primary);
    position: relative;
}
.modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
}
.close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 32px;
    color: var(--color-primary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.close-modal:hover {
    color: var(--color-primary-hover);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 28px;
}
.modal-actions button {
    padding: 12px 28px;
    border: none;
    border-radius: 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
}
#cancelFeatures, #cancelDesc, #cancelCreators {
    background-color: #e0e0e0;
    color: #333;
}
#cancelFeatures:hover, #cancelDesc:hover, #cancelCreators:hover {
    background-color: #d0d0d0;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 21, 99, 0.45) !important;
}
#saveFeatures, #saveDesc, #applyCreators, #parseBtn {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
}
#saveDesc, #cancelDesc {
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35) !important;
}

/* Modal características */
.features-checkboxes-modal {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}
.features-checkboxes-modal label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    padding: 0 12px;
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
    margin: 0 !important;
}
.features-checkboxes-modal label:hover {
    background: rgba(14, 21, 99, 0.08);
}
.features-checkboxes-modal input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--color-primary);
}
.features-checkboxes-modal .icono {
    font-size: 26px;
}

/* Modal descripción */
#descModal {
    left: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}
#descModal .modal-content {
    max-width: calc(100% - 40px);
    margin: 0 auto;
    margin-left: 35px;
    margin-right: env(safe-area-inset-right, 20px);
    box-sizing: border-box;
}
#descFull {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: var(--font-primary);
    font-size: 14px;
    resize: vertical;
}

/* Modal tipos personalizados */
.tipo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    cursor: pointer;
}
.tipo-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}
.tipo-item .icono {
    display: inline-block;
    width: 24px;
    text-align: center;
    font-size: 28px;
}

/* Modal creadores */
#creatorModal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}
#creatorModalContent {
    background: #ebebf5;
    width: 90%;
    max-width: 320px;
    max-height: 70vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
#creatorModalHeader {
    padding: 12px;
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    font-size: 15px;
    text-align: center;
}
#creatorModalBody {
    padding: 12px;
    max-height: 50vh;
    overflow-y: auto;
}
#creatorModalBody input {
    width: 10%;
}
#creatorModalBody label {
    display: block;
    margin: 0;
    font-size: 14px;
}
#creatorModalFooter {
    padding: 10px;
    border-top: 1px solid #ddd;
    text-align: right;
}
#creatorModalFooter button {
    padding: 8px 16px;
    margin-left: 0;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
    transition: all 0.18s ease;
}

/* Modal ayuda */
#ayudaModal h3 {
    color: white;
    margin: 0;
    font-size: 18px;
}
.ayuda-opcion {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.ayuda-opcion:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}
.ayuda-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 14px;
    padding: 3px 0;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}
.ayuda-link:hover {
    border-bottom-color: var(--color-primary);
    color: #1a237e;
}
#inputpregunta {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 10px;
}
#ayudaPregunta {
    flex: 3;
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    height: 48px;
    box-sizing: border-box;
}
#enviarPreguntaBtn {
    flex: 1;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
}

/* Modal idiomas */
.language-modal {
    max-width: 380px;
    padding: 20px;
    text-align: left;
}
.language-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
    max-height: 50vh;
    overflow-y: auto;
}
.language-link {
    display: block;
    padding: 14px 16px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 16px;
    border-radius: 8px;
    transition: all 0.2s;
}
.language-link:hover {
    background: rgba(14, 21, 99, 0.08);
    color: #1a237e;
    padding-left: 20px;
}
.language-link.current {
    background: rgba(14, 21, 99, 0.15);
    font-weight: bold;
}
.badge {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
}

/* ==========================================================================
   8. LEYENDAS, FILTROS E IMPORTACIÓN
   ========================================================================== */
#searchControl, #filterControl, #legendControl {
    background: #ebebf5;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
    font-size: 13px;
    margin: 10px;
    font-family: var(--font-primary);
}
#searchControl {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 70%;
}
#searchControl input {
    flex: 1;
    min-width: 130px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
#searchControl button {
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
}
#searchControl button:hover {
    background: #005a87;
}
#filterControl {
    width: 208px;
    text-align: left;
    display: none;
}
#filterControl strong {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: bold;
}
#filterControl label {
    display: block;
    margin: 4px 0;
    font-size: 15px;
    white-space: nowrap;
    font-weight: bold !important;
}
#filterControl input[type="checkbox"] {
    margin: 0 10px 0 0;
    width: 20px;
}
#filterByCreatorText {
    font-weight: bold !important;
}
.filter-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    font-size: 15px;
}
.filter-status label {
    font-weight: 500;
    color: #333;
}
.filter-status select {
    border: 1px solid #888;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    min-width: 130px;
}
#filterval {
    margin-bottom: 16px;
}
#filterval select {
    border-radius: 4px;
    border: 1px solid #888;
}
#filterFavorite {
    font-weight: bold;
}
#legendControl {
    width: 190px;
    line-height: 1.5;
    text-align: left;
    display: none;
    background-color: #ebebf5;
    font-weight: bold;
    bottom: 5px;
    position: absolute;
}
#leyendatit, #leyendatit-leyenda {
    font-size: 18px;
    font-weight: bold;
}

.grande {
    font-size: 24px;
    line-height: 1;
}
.legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.legend-content {
    max-height: 200px;
    overflow-y: auto;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    font-size: 13px;
}
.legend-item .icono {
    font-size: 24px;
    line-height: 1;
    display: inline-block;
    width: 32px;
    text-align: center;
}
.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}
.legend-color.visited {
    background-color: #4caf50;
}
.legend-color.pending {
    background-color: #2c7be5;
}
.legend-empty {
    color: #999;
    font-style: italic;
    padding: 8px;
    text-align: center;
}

/* Panel importación */
#importPanel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    background-color: #ebebf5;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 24px 20px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
    transform: translate(-50%, -50%);
    z-index: 4000;
    height: auto;
}
#importPanel.open {
    display: block;
}
#importPanel textarea {
    width: 100%;
    min-height: 140px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 12px;
    font-size: 15px;
    resize: vertical;
    background: white;
    margin: 16px 0;
}
#importPanel button {
    padding: 12px 24px;
    border: none;
    border-radius: 28px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin: 0 10px;
}
#cancelImportBtn {
    background-color: #e0e0e0;
    color: #333;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35) !important;
}
#cancelImportBtn:hover {
    background-color: #d0d0d0;
}
.import-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background: #ebebf5;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    z-index: 4000;
    overflow: hidden;
}
.import-panel.open {
    display: block;
}
.import-tabs {
    display: flex;
    background: var(--color-primary);
    position: relative;
}
.tab-btn {
    flex: 1;
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    padding: 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}
.tab-btn.active {
    color: white;
    background: rgba(255,255,255,0.2);
}
.close-import {
    position: absolute;
    right: 10px;
    top: 10px;
    background: transparent;
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.close-import:hover {
    background: rgba(255,255,255,0.2);
}
.import-content {
    padding: 20px;
}
.import-content h3 {
    margin: 0 0 10px 0;
    color: var(--color-primary);
}
.import-content textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin: 10px 0;
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
}
.import-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.import-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 28px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-cancel {
    background: #e0e0e0;
    color: #333;
}
.btn-cancel:hover {
    background: #d0d0d0;
}
.btn-primary {
    background: var(--color-primary);
    color: white;
}

/* ==========================================================================
   9. VISOR DE IMÁGENES
   ========================================================================== */
#imageViewer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
#imageViewer img {
    max-width: 90vw;
    max-height: 90vh;
}

/* ==========================================================================
   10. BOTONES DE CIERRE (X)
   ========================================================================== */
.close-btn, .close-panel-btn {
    position: absolute;
    top: 0;
    right: 10px;
    left: auto;
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    z-index: 100;
    display: inline-block;
}
.close-btn:hover, .close-panel-btn:hover {
    color: #c62828;
}
.danger { 
    background: #c62828; 
    color: #fff; 
}

/* ==========================================================================
   11. RESPONSIVE
   ========================================================================== */
@media (max-width: 420px) {
    .features-checkboxes {
        grid-template-columns: 1fr;
        gap: 2px 12px !important;
    }
    .row-group {
        gap: 16px;
        margin-bottom: 0;
    }
    .favorite-label {
        margin-top: 12px;
        justify-content: flex-start;
    }
    .photo-buttons {
        flex-direction: column;
        gap: 10px;
    }
    .photo-buttons button {
        font-size: 15px;
        padding: 5px 30px;
    }
    .panel-actions {
        flex-direction: row;
        gap: 10px;
        margin-top: 14px;
    }
    .panel-actions button {
        padding: 5px 30px;
    }
    #importPanel,
    #importPanel.open {
        background-color: #ebebf5 !important;
        backdrop-filter: none !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.35) !important;
        border: none !important;
    }
    .features-header {
        margin: 10px 0 8px;
    }
}

@media (max-width: 480px) {
}

@media (min-width: 421px) and (max-width: 768px) {
    .features-checkboxes {
        grid-template-columns: repeat(2, 1fr);
    }
    .row-group,
    .photo-buttons,
    .panel-actions {
        flex-direction: row;
    }
}

@media (min-width: 769px) {
    #searchBtn2 {
        display: none !important;
    }
    #searchInput, #searchBtn {
        display: inline-block !important;
    }
    #filterbyCreatorText {
        font-weight: bold !important;
    }
}

@media (max-width: 768px) {
    #searchBtn2 {
        display: flex !important;
    }
    #searchControl {
        width: auto !important;
    }
    #searchInput, #searchBtn {
        display: none !important;
        right: 1%;
    }
    #searchControl.open-search #searchInput,
    #searchControl.open-search #searchBtn {
        display: inline-block !important;
    }
    #searchControl.open-search #searchBtn2 {
        display: none !important;
    }

}

/* ==========================================================================
   12. AJUSTES PARA MÓVIL (AYUDA)
   ========================================================================== */
@media only screen and (max-width: 768px) {
}

@media only screen and (max-width: 500px) {
    #ayudaModal .modal-content {
        width: 95%;
        padding: 15px;
    }
    .ayuda-opcion {
        padding: 8px;
        font-size: 12px;
    }
    #ayudaPregunta {
        font-size: 14px;
    }
}

/* ==========================================================================
   13. AJUSTES ESPECÍFICOS PARA IPHONE
   ========================================================================== */
@media only screen and (max-width: 500px) and (-webkit-min-device-pixel-ratio: 2) {
    #menul {
        top: calc(60px + env(safe-area-inset-top, 0));
    }
    #ayudaBtn {
        font-size: 24px;
    }
}

/* iPhone con notch (altura >= 800px) */
@media only screen and (max-width: 500px) and (min-height: 800px) and (-webkit-min-device-pixel-ratio: 2) {
    #topBar {
        height: 85px;
        padding-top: 25px;
        align-items: flex-end;
    }
    #menul {
        top: 75px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    #searchControl {
        top: 5px !important;
        z-index: 1000;
    }
    #searchBtn2 {
        margin-top: 0;
        position: relative;
        z-index: 1001;
    }
    #searchControl.open-search {
        top: 20px !important;
        background: #ebebf5;
        width: 90% !important;
        right: 0;
    }
    #sidePanel {
        top: 80px !important;
    }
}

/* iPhone SE (sin notch) */
@media only screen and (device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) {
    #menul {
        top: 52px;
    }
    #searchControl {
        top: 55px !important;
    }
}

/* iPhone X, XS, 11 Pro */
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    #topBar {
        height: 80px;
        padding-top: 20px;
        align-items: flex-end;
        padding-bottom: 10px;
    }
    #menuBtn {
        width: 60px;
        height: 60px;
        font-size: 32px;
        margin-bottom: 5px;
    }
    #idiomas {
        padding: 15px;
        font-size: 18px;
    }
    #idiomas img {
        width: 35px;
        margin-right: 8px;
    }
}

/* iPhone XS Max, 11 Pro Max */
@media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) {
    #topBar {
        height: 85px;
        padding-top: 25px;
        align-items: flex-end;
        padding-bottom: 12px;
    }
    #menuBtn {
        width: 65px;
        height: 65px;
        font-size: 34px;
    }
}

/* iPhone 12, 13, 14 */
@media only screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) {
    #topBar {
        height: 85px;
        padding-top: 25px;
        align-items: flex-end;
    }
}

/* iPhone 12 Pro Max, 13 Pro Max, 14 Plus */
@media only screen and (device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) {
    #topBar {
        height: 90px;
        padding-top: 30px;
        align-items: flex-end;
    }
}

/* iPhone 14 Pro */
@media only screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) {
    #topBar {
        height: 90px;
        padding-top: 30px;
        align-items: flex-end;
    }
}

/* iPhone 14 Pro Max */
@media only screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) {
    #topBar {
        height: 95px;
        padding-top: 35px;
        align-items: flex-end;
    }
}

/* ==========================================================================
   14. AJUSTE ESPECÍFICO PARA ESCRITORIO
   ========================================================================== */
@media screen and (min-width: 769px) {
    html, body {
        height: 100%;
        overflow: hidden; /* Elimina scroll doble */
    }
    
    #map {
        height: calc(100vh - 60px) !important;
        width: 100vw !important;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
    }
    
    /* Asegurar que el contenedor del mapa no tenga márgenes */
    .leaflet-container {
        width: 100% !important;
        height: 100% !important;
    }
}

/* ==========================================================================
   AJUSTE TECLADO IOS PARA MODAL DE AYUDA
   ========================================================================== */

/* Solo para iOS */
@supports (-webkit-touch-callout: none) {
    #ayudaModal {
        align-items: center; /* Por defecto centrado */
    }
    
    /* Cuando el input está enfocado, forzar alineación superior */
    #ayudaPregunta:focus {
        font-size: 16px !important; /* Evita zoom automático en iOS */
    }
}

/* ==========================================================================
   AJUSTE MANUAL PARA IPHONE (valor fijo 90px)
   ========================================================================== */
@supports (-webkit-touch-callout: none) {
    
    /* MAPA */
    #map {
        height: calc(100vh - 0px - 85px) !important;
        margin-top: 60px;
    }
    
    /* PANEL LATERAL */
    #sidePanel {
        top: calc(60px + 30px) !important; /* = 145px */
    }
    
    /* 🟢 BOTÓN DE BÚSQUEDA - SUBIR 30px */
    #searchControl {
        top: calc(60px + 5px - 30px) !important;
    }
    #searchBtn2 {
        top: calc(60px + 85px - 30px) !important;
    }
    
    /* 🔵 BOTÓN DE GPS - BAJAR 10px (respecto a la última posición) */
    #myLocationBtn {
        bottom: calc(20px + 55px - 20px) !important;
        /*        base   + mapa  - 20px = baja 10px respecto al ajuste anterior */
    }
    
    /* FILTROS - alineados con búsqueda */
    #filterControl {
        top: calc(60px + 5px - 30px) !important;
    }
}

/* ==========================================================================
   15. PANEL DE RUTAS
   ========================================================================== */
#rutasControl {
    background: #ebebf5;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90vw;
    font-family: var(--font-primary);
    position: absolute;
    top: 80px;
    right: auto;
    left:10px;
    z-index: 1000;
    overflow: hidden;
}
.rutas-header {
    background: #0e1563;
    color: white;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}
.rutas-header span {
    font-weight: 600;
    font-size: 16px;
}
.rutas-header button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.rutas-header button:hover {
    background: rgba(255,255,255,0.2);
}
.rutas-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Lista de rutas */
.rutas-lista {
    margin-bottom: 15px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    overflow-x: hidden;
}
.ruta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}
.ruta-item:hover {
    background: #f0f7ff;
}
.ruta-item:last-child {
    border-bottom: none;
}
.ruta-item input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.ruta-nombre {
    flex: 1;
    font-weight: 600;
    font-size: 12px;
    overflow: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 50; /* Importante para que el text-overflow funcione */
    /*margin-right: 8px;*/
}
.ruta-info {
    font-size: 11px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 10px;
    flex-shrink: 0;
    margin-right: 4px;
    white-space: nowrap;     /* Evita que "X puntos" se parta */
    margin-left: auto; 
}

/* Botón nueva ruta */
.btn-nueva-ruta {
    width: 100%;
    padding: 10px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
}
.btn-nueva-ruta:hover {
    background: #45a049;
}

/* Modo creación */
#modoCreacionRuta {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid #ddd;
}
#nuevaRutaNombre {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.rutas-instrucciones {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    background: #e3f2fd;
    padding: 8px;
    border-radius: 4px;
}
.rutas-instrucciones p {
    margin: 5px 0;
}
#contadorPuntosRuta {
    font-weight: 600;
    color: #0e1563;
}
.rutas-acciones {
    display: flex;
    gap: 10px;
}
.rutas-acciones button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
#guardarRutaBtn {
    background: #4caf50;
    color: white;
}
#guardarRutaBtn:hover {
    background: #45a049;
}
#cancelarRutaBtn {
    background: #f44336;
    color: white;
}
#cancelarRutaBtn:hover {
    background: #d32f2f;
}

/* Minimizado */
#rutasControl.minimizado .rutas-content {
    display: none;
}
.ruta-selector-marker {
    background: #f44336;  /* Rojo */
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.2s;
}
.ruta-selector-marker:hover {
    transform: scale(1.1);
    background: #b71c1c;  /* Rojo más oscuro al pasar el ratón */
}
.ruta-eliminar {
    background: none;
    border: none;
    color: #f44336;
    cursor: pointer;
    font-size: 16px;
    padding: 0 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
    margin-left: auto;
    width:auto;
        display: flex;              /* Para controlar alineación */
    align-items: center;        /* Centrar verticalmente */
    justify-content: center;    /* Centrar horizontalmente */
    height: 100%;               /* Misma altura que el contenedor */
    line-height: 1;             /* Ajustar línea base */
    transform: translateY(-5px); /* Ajuste fino de 1px (prueba valores) */
    
}
.ruta-eliminar:hover {
    opacity: 1;
    color: #d32f2f;
}
.ruta-editar {
    background: none;
    border: none;
    color: #ff9800;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: auto;  /* Se alinea con la papelera */
    flex-shrink: 0;
    width:20px;
    transform: translateY(-5px); /* Ajuste fino de 1px (prueba valores) */
}
.ruta-editar:hover {
    opacity: 1;
    color: #f57c00;
}
.ruta-compartir {
    background: none;
    border: none;
    color: #ff9800;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: auto;  /* Se alinea con la papelera */
    flex-shrink: 0;
    width:20px;
    transform: translateY(-5px); /* Ajuste fino de 1px (prueba valores) */
}
.ruta-compartir:hover {
    opacity: 1;
    color: #f57c00;
}
.ruta-selector-marker.seleccionado {
    background: #4caf50;  /* Verde para indicar seleccionado */
}
.rutas-header .minimize-btn {
    background: none;
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    right: -4px;
    position: relative;
}
.rutas-header .minimize-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ==========================================================================
   16. Pueblos friendly
   ========================================================================== */

/* Modal de pueblos - mismo estilo que los dems modales */
#pueblosPanel .modal-content {
    background-color: #ebebf5;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 24px 20px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    font-family: var(--font-primary);
    position: relative;
}
#pueblosPanel h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
}
#pueblosPanel h4 {
    margin: 15px 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary);
}
#pueblosPanel .close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 32px;
    color: var(--color-primary);
    cursor: pointer;
    line-height: 1;
}
#pueblosPanel .close-modal:hover {
    color: var(--color-primary-hover);
}

/* Inputs y selects */
#pueblosPanel input,
#pueblosPanel select,
#pueblosPanel textarea {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-family: var(--font-primary);
    box-sizing: border-box;
}

#pueblosPanel input:focus,
#pueblosPanel select:focus,
#pueblosPanel textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(14,21,99,0.1);
}

/* Botones */
#pueblosPanel .btn-small {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    margin-top:0px;
}
#pueblosPanel .btn-small:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,21,99,0.3);
}
#pueblosPanel .btn-primary {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.18s ease;
}
#pueblosPanel .btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,21,99,0.3);
}

/* Lista de pueblos */
#pueblosLista {
    border: 1px solid #ddd;
    border-radius: 12px;
    background: white;
    overflow: hidden;
}
.pueblo-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}
.pueblo-item:hover {
    background: #f0f7ff;
}
.pueblo-friendly { border-left: 4px solid #4caf50; }
.pueblo-normal { border-left: 4px solid #ff9800; }
.pueblo-no-visitar { border-left: 4px solid #f44336; }

/* Info de coordenadas */
#coordenadasInfo {
    background: #e3f2fd;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    color: #0e1563;
    margin: 8px 0;
}

/* Nota */
#pueblosPanel .nota {
    font-size: 12px;
    color: #666;
    margin-top: 15px;
    text-align: center;
}

/* ==========================================================================
   17. Grupos
   ========================================================================== */

/* --- Estilos del modal de lista (modal 1) --- */
#gruposListaModal .modal-content {
    max-width: 500px;
}

#listaGrupos {
    margin-bottom: 20px;
}

/* Cada grupo en la lista */
.grupo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: white;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #eee;
    cursor: pointer;
}

.grupo-item:hover {
    background: #f0f7ff;
}

/* Bloque de texto (nombre, rol, miembros) */
.grupo-info {
    flex: 1;
    min-width: 0;          /* Permite recortar texto largo */
}

.grupo-nombre {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grupo-detalle {
    font-size: 12px;
    color: #666;
}

/* Botn "Salir" pequeo y a la derecha */
.btn-salir-grupo {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    width: auto;
    display: inline-block;
}

.btn-salir-grupo:hover {
    background-color: #d32f2f;
}

/* --- Estilos del modal de creacin (modal 2) --- */
#crearGrupoModal .modal-content {
    max-width: 500px;
}

#crearGrupoModal input[type="text"],
#crearGrupoModal select {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

/* Checkboxes alineados a la izquierda (sin centrado) */
#crearGrupoModal label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-weight: normal;
    text-align: left;
    justify-content: flex-start;
}

#crearGrupoModal input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

#crearGrupoModal label span {
    flex: 1;
    text-align: left;
}

/* Miembro item: email en la misma lnea */
.miembro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    gap: 8px;
    flex-wrap: wrap;
}

.miembro-info {
    flex: 1;
    min-width: 0;
}

.miembro-nombre {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.miembro-email {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 500px) {
    .miembro-email {
        display: inline;
        margin-left: 8px;
        font-size: 13px;
    }
    .miembro-nombre {
        display: inline;
    }
}

/* Miembro item: email en la misma lnea */
.miembro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    gap: 8px;
    flex-wrap: wrap;
}

.miembro-info {
    flex: 1;
    min-width: 0;
}

.miembro-nombre {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.miembro-email {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 500px) {
    .miembro-email {
        display: inline;
        margin-left: 8px;
        font-size: 13px;
    }
    .miembro-nombre {
        display: inline;
    }
}
/* El modal 3 usa las mismas clases que los dems modales */
#grupoDetalleModal .modal-content {
    /* Si ya existe .modal-content global, no necesitas esto */
    /* Solo si quieres un ancho especfico para este modal */
    max-width: 600px;
}

/* Los botones deben usar .btn-primary (no .btn-small) */
#grupoDetalleModal .btn-primary {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    width: 100%;
}

#grupoDetalleModal .btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,21,99,0.3);
}

/* Botn eliminar (rojo) */
#grupoDetalleModal .btn-danger {
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 28px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
}

#grupoDetalleModal .btn-danger:hover {
    background-color: #d32f2f;
}

/* Checkboxes alineados a la izquierda */
#grupoDetalleModal label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-weight: normal;
    justify-content: flex-start;
}

#grupoDetalleModal input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Lista de miembros */
.miembro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
    gap: 8px;
    flex-wrap: wrap;
}

.miembro-info {
    flex: 1;
    min-width: 0;
}

.miembro-nombre {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.miembro-email {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 500px) {
    .miembro-email {
        display: inline;
        margin-left: 8px;
        font-size: 13px;
    }
    .miembro-nombre {
        display: inline;
    }
}
/* Estilos especficos para el modal 3 (coherentes con el resto) */
#grupoDetalleModal .modal-content {
    max-width: 600px;
}

#grupoDetalleModal .btn-primary {
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 3px 10px rgba(14, 21, 99, 0.35);
}

#grupoDetalleModal .btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(14, 21, 99, 0.45);
}

/* Estilo de los miembros (como lista de rutas) */
#grupoDetalleModal .miembro-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

#grupoDetalleModal .miembro-item:last-child {
    border-bottom: none;
}

#grupoDetalleModal .miembro-info {
    flex: 1;
}

#grupoDetalleModal .miembro-nombre {
    font-weight: 600;
    font-size: 14px;
}

#grupoDetalleModal .miembro-email {
    font-size: 12px;
    color: #666;
    margin-left: 8px;
}

@media (max-width: 500px) {
    #grupoDetalleModal .miembro-email {
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
}
/* Alinear el campo email y el botn Invitar en la misma lnea */
#invitarUsuarioContainer {
    display: flex;
    gap: 8px;
    align-items: center;
}
#invitarUsuarioContainer input {
    flex: 1;
}
#invitarUsuarioContainer button {
    width: auto;
    white-space: nowrap;
}

/* Alinear los botones Guardar y Eliminar en la misma lnea */
#grupoDetalleModal .botonera {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
#grupoDetalleModal .botonera button {
    flex: 1;
}

/* El botn Eliminar grupo debe usar el mismo color que otros botones de la app (no rojo) */
#btnEliminarGrupo {
    background-color: var(--color-primary);
}
#btnEliminarGrupo:hover {
    background-color: var(--color-primary-hover);
}
#btnGuardarPermisos{
    display:inline-block;
    width:45% !important;
}
#btnEliminarGrupo{
    display:inline-block;
    width:45% !important;
    margin-left:5%;
}
#btnInvitarUsuario{
    margin-bottom:8px;
}
#grupoSelector {
    background: #ebebf5 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-family: var(--font-primary);
}
#grupoSelect {
    cursor: pointer;
    outline: none;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}
.btn-cancelar {
    background-color: #666;
    color: white;
    border: none;
    border-radius: 28px;
    padding: 8px 16px;
    cursor: pointer;
}
