* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body, html {
    height: 100%;
    overflow: hidden;
}

/* Contenedor del Mapa */
#map {
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Barra Superior (Navbar) */
header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: #007bff;
}

.menu-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.menu-btn:hover {
    background: #0056b3;
}

/* Menú Lateral Desplegable (Derecha a Izquierda) */
.sidebar {
    position: absolute;
    top: 0;
    right: -320px; /* Escondido por defecto */
    width: 320px;
    height: 100%;
    background-color: #ffffff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.15);
    z-index: 20;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 20px;
    padding-top: 80px;
}

.sidebar.open {
    right: 0;
}

.close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #333;
}

/* Buscador */
.search-container {
    margin-bottom: 20px;
}

.search-box {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* Contenedor de Rutas */
.routes-container {
    overflow-y: auto;
    flex-grow: 1;
}

.category-title {
    font-size: 16px;
    font-weight: 700;
    color: #555;
    margin: 15px 0 8px 0;
    padding-bottom: 5px;
    border-bottom: 2px solid #f0f0f0;
}

.route-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #333;
}

.route-item input {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.route-item label {
    cursor: pointer;
    user-select: none;
}

/* Ocultar elementos filtrados */
.hidden {
    display: none !important;
}

/* BOTÓN DE UBICACIÓN FLOTANTE */
.location-btn {
    position: absolute;
    bottom: 90px;
    right: 10px;
    z-index: 10;
    background-color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.location-btn:hover {
    background-color: #f4f4f4;
}

.location-btn svg {
    width: 24px;
    height: 24px;
    fill: #007bff;
}

/* --- NUEVOS ESTILOS PARA USUARIO Y CIERRE DE SESIÓN --- */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logout-btn {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #dc3545;
    color: white;
}

.user-status-container {
    background-color: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    border: 1px solid #e9ecef;
}

#userDisplay {
    font-size: 14px;
    font-weight: 700;
    color: #495057;
    word-break: break-all;
}

/* --- ESTILOS COMPLEMENTARIOS PARA EL PANEL DE ADMINISTRADOR --- */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-toggle-btn {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

/* Menú Lateral Izquierdo Admin */
.sidebar-admin {
    position: fixed;
    top: 60px;
    left: -320px; /* Fuera de la pantalla */
    width: 300px;
    height: calc(100vh - 60px);
    background-color: #ffffff;
    box-shadow: 4px 0 15px rgba(0,0,0,0.15);
    z-index: 1050; /* Mayor que el mapa para que no se quede atrás */
    transition: left 0.3s ease; /* Efecto deslizante */
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ESTA CLASE ES LA QUE ACTIVA EL BOTÓN. Si dice 'right: 0' o no existe, no abrirá */
.sidebar-admin.open {
    left: 0 !important; /* Lo regresa al frente */
}

.sidebar-admin h3 {
    color: #007bff;
    font-size: 20px;
    margin-bottom: 2px;
}

.admin-note {
    font-size: 12px;
    color: #666;
    margin-bottom: 20px;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-admin-act {
    width: 100%;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    text-align: left;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-admin-act:hover {
    background-color: #0056b3;
}

.btn-danger-outline {
    background-color: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-danger-outline:hover {
    background-color: #dc3545;
    color: white;
}

.admin-hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 20px 0;
}

.geofences-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.geofence-list-item {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    border-left: 4px solid #007bff;
}

/* Botones modo edición */
.btn-save { background: #28a745; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; margin-right: 5px;}
.btn-cancel { background: #6c757d; color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }

/* --- COMPONENTES DEL FORMULARIO INTEGRADO DE ADMIN --- */
.dynamic-form-panel {
    background-color: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}
.dynamic-form-panel h4 {
    margin-bottom: 12px;
    color: #495057;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}
.form-group-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.form-group-block label {
    font-size: 12px;
    font-weight: bold;
    color: #495057;
}
.form-group-block input, .form-group-block select {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}
.form-group-block input:focus { border-color: #007bff; }

/* Botonera de acciones internas */
.btn-save-action { width: 100%; background: #007bff; color: white; border: none; padding: 10px; border-radius: 4px; font-weight: bold; cursor: pointer; margin-top: 5px; }
.btn-save-action:hover { background: #0056b3; }
.btn-cancel-action { width: 100%; background: #6c757d; color: white; border: none; padding: 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-danger-act { width: 100%; background: #dc3545; color: white; border: none; padding: 10px; border-radius: 4px; font-weight: bold; cursor: pointer; }
.btn-danger-outline-block { width: 100%; background: transparent; color: #dc3545; border: 1px solid #dc3545; padding: 8px; border-radius: 4px; cursor: pointer; font-weight: bold; }

/* Subcategorías de Geocercas en Lista */
.geofence-sub-cat {
    font-size: 12px;
    font-weight: bold;
    color: #007bff;
    border-bottom: 1px solid #e3fafc;
    padding-bottom: 4px;
    margin-bottom: 6px;
}
.geofence-list-item-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    border-left: 3px solid #228be6;
}
.geofence-info-side { font-size: 13px; color: #212529; }
.geofence-info-side span { display: block; font-size: 10px; color: #868e96; }

/* Esto oculta el espacio desde que carga la página */
.ad-space {
    display: none !important;
}

/* Asegura que esto sea lo más fuerte posible */
.ad-hidden {
    display: none !important;
}

/* Ajuste necesario para que el mapa no se quede oculto detrás del anuncio */
#map {
    height: calc(100vh - 60px) !important; /* Reduce el mapa 60px para dejarle espacio limpio al anuncio */
}

/* Ajuste para el botón flotante de ubicación del mapa */
.location-btn {
    bottom: 80px !important; /* Lo subimos un poco para que no choque con el banner */
}

/* MODAL DE DONACIÓN RESPONSIVO */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    animation: fadeIn 0.3s ease;
}
.close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}
.close-modal-btn:hover { color: #333; }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* --- ESTILOS DE BOTONES DONAR --- */
.donation-btn-header {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s;
}
.donation-btn-header:hover { background-color: #218838; }

.btn-pay-real {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s;
}
.btn-pay-real:hover { filter: brightness(90%); }

.mp-color { background-color: #FFF159; color: #333; }
.pp-color { background-color: #0070ba; color: #ffffff; }

/* Forzamos que los grupos de botones en los formularios sean verticales */
.admin-button-group { 
    display: flex; 
    flex-direction: column; /* Esto pone un botón arriba del otro */
    gap: 8px; 
    margin-top: 15px; 
    width: 100%; 
}

/* Ajuste para que los botones dentro del grupo ocupen el ancho completo sin espacios extra */
.btn-action { 
    width: 100%; 
    padding: 10px; 
    border: none; 
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold; 
}

.admin-button-group { display: flex; gap: 10px; margin-top: 15px; }
.btn-action { flex: 1; padding: 10px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; }
.admin-select { width: 100%; padding: 8px; margin: 5px 0 15px 0; border: 1px solid #ccc; border-radius: 4px; }
.btn-blue { background-color: #007bff; color: white; }
.btn-grey { background-color: #6c757d; color: white; }
.btn-danger { background-color: #dc3545; color: white; }
.btn-danger-outline { border: 1px solid #dc3545; color: #dc3545; background: none; }

/* Corregir el bloque de borrar */
#deleteConfirmBlock { 
    background: #f8d7da; 
    padding: 10px; 
    border-radius: 6px; 
    margin-top: 10px; 
    width: 100%; 
    text-align: center; 
    display: flex; 
    flex-direction: column; /* Asegura que el texto y el botón de sí/no se centren */
    align-items: center;
}