/* ===== ESTILOS BASE (style_oficial.css) ===== */

/* RESET BASE */
body {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

/* Navbar */
.navbar {
    flex-shrink: 0;
}

.bg-totem {
    background-color: #173F8A !important;
}

/* Contenedor de búsqueda */
.search-container {
    width: 100%;
    margin: 0 auto;
    background: white;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 10;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.search-input {
    flex: 1;
    border: none;
    border-bottom: 2px solid #007bff;
    padding: 8px 0;
    font-size: 16px;
    outline: none;
    background: transparent;
}

.clear-btn.visible {
    opacity: 1;
}

.search-icon {
    color: #666;
    font-size: 1.2rem;
}

/* Contenedor principal */
#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Mapa */
#map {
    width: 100%;
    flex: 1;
    min-height: 100px;
    position: relative;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

/* ===== SISTEMA DE PANEL DESLIZABLE ===== */

.panel-system {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.results-list {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30vh;
    background: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.panel-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid #eaeaea;
    background: white;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.panel-header:active {
    cursor: grabbing;
}

.handle-bar {
    width: 40px;
    height: 5px;
    background: #ddd;
    border-radius: 3px;
    margin: 0 auto 10px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.results-count {
    background: #173F8A;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}

.results-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

/* Scrollbar personalizado */
.results-content::-webkit-scrollbar {
    width: 8px;
}

.results-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.results-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.results-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Estados del panel */
.results-list.collapsed {
    height: 70px;
}

.results-list.person {
    height: 20vh;
}

.results-list.detail {
    height: 20vh;
}

.results-list.expanded {
    height: 85vh;
}

.results-list.half {
    height: 40vh;
}

/* ===== ITEMS DE RESULTADOS ===== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

.empty-state h4 {
    margin-bottom: 10px;
    color: #666;
}

.empty-state p {
    color: #999;
    font-size: 14px;
}

.result-item {
    padding: 16px;
    margin: 12px 0;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #173F8A;
    transition: all 0.2s;
    cursor: pointer;
}

.result-item:hover {
    background: #e9f3ff;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-item.active {
    background: #e3f2fd;
    border-left-color: #2196f3;
    box-shadow: 0 3px 10px rgba(33, 150, 243, 0.2);
}

.result-item h6 {
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 16px;
}

.result-item p {
    margin-bottom: 5px;
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-item p i {
    width: 16px;
}

.person-name {
    font-weight: 600;
    color: #333;
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.person-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.status-online {
    background: #4caf50;
    color: white;
}

.status-offline {
    background: #9e9e9e;
    color: white;
}

.person-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

.person-location {
    color: #173F8A;
    font-weight: 500;
    margin-top: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.person-distance {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

/* ===== ESTILOS ADICIONALES NECESARIOS ===== */

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay p {
    margin-top: 15px;
    color: #666;
    font-weight: 500;
}

/* Elevar z-index del popup de Leaflet para que no quede tapado por el panel de resultados */
.leaflet-popup {
    z-index: 1500 !important;
}

.leaflet-popup-pane {
    z-index: 1500 !important;
}

/* Popup personalizado del mapa */
.custom-popup {
    min-width: 200px;
}

.custom-popup h6 {
    color: #173F8A;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-popup p {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-popup .btn {
    margin-top: 8px;
    width: 100%;
}

/* Marcadores personalizados */
.custom-marker {
    background-color: #0176DE;
    border: 3px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.custom-marker i {
    font-size: 14px;
    line-height: 1;
    transform: translate(2px);
}

.custom-marker.selected {
    background-color: #dc3545;
    transform: scale(1.33);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Marcador "Usted está aquí" */
.you-are-here-marker {
    background: none;
    border: none;
}

.you-are-here-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.you-are-here-icon i {
    font-size: 40px;
    color: #dc3545;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    animation: pulse-you 2s infinite;
}

@keyframes pulse-you {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.you-are-here-popup {
    text-align: center;
    min-width: 150px;
}

.you-are-here-popup h6 {
    color: #dc3545;
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.you-are-here-popup p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Etiqueta de distancia en la ruta */
.distance-label {
    background: none;
    border: none;
}

.distance-badge {
    background-color: #dc3545;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    white-space: nowrap;
    text-align: center;
}

/* Detalles de persona en modal */
#personDetails {
    line-height: 1.8;
}

#personDetails .detail-row {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

#personDetails .detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

#personDetails .detail-label {
    font-weight: 600;
    color: #495057;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#personDetails .detail-value {
    color: #6c757d;
    flex: 1;
}

#personDetails .person-image {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}


/* Estilos para clusters de marcadores */
.marker-cluster-small {
    background-color: #0177dea4;
}

.marker-cluster-small div {
    background-color: #0176DE;
}

.marker-cluster-medium {
    background-color: rgba(255, 193, 7, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(255, 193, 7, 0.8);
}

.marker-cluster-large {
    background-color: rgba(220, 53, 69, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(220, 53, 69, 0.8);
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .search-container {
        width: 100%;
        padding: 1rem;
        border-radius: 0;
    }
    
    .results-list {
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
    }
    
    .results-list.half {
        height: 50vh;
    }
    
    .results-list.expanded {
        height: 90vh;
    }
    
    .results-content {
        padding: 0 15px 15px;
    }
    
    #map {
        height: 50vh;
    }
}

/* ===== CONTENEDOR DE FILTROS ===== */

.filter-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow-x: auto;
    flex-wrap: nowrap;
}

/* Scrollbar horizontal si hay muchos filtros */
.filter-container::-webkit-scrollbar {
    height: 6px;
}

.filter-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filter-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #173F8A;
    background-color: #173F8A;
    color: white;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    outline: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    background-color: #0f2d63;
    border-color: #0f2d63;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 63, 138, 0.3);
}

.filter-btn.active {
    background-color: white;
    color: #173F8A;
    border-color: #173F8A;
    box-shadow: 0 2px 8px rgba(23, 63, 138, 0.15);
}

.filter-btn.active:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
}

/* Icono dentro del botón */
.filter-btn i {
    font-size: 16px;
}

/* ===== ESTADOS ADICIONALES ===== */

/* Botón deshabilitado */
.filter-btn:disabled,
.filter-chip:disabled,
.filter-icon-btn:disabled,
.filter-minimal:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Animación al hacer click */
.filter-btn:active,
.filter-chip:active,
.filter-icon-btn:active {
    transform: scale(0.95);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .filter-container {
        gap: 8px;
        padding: 12px 15px;
    }
    
    .filter-btn,
    .filter-chip {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .filter-icon-btn {
        min-width: 70px;
        padding: 10px 12px;
    }
    
    .filter-icon-btn i {
        font-size: 20px;
    }
}

.hidden {
    display: none !important;
}

#inactivity-video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    cursor: pointer;
}

#inactivity-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.floating-panel {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6000;
    
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.floating-panel:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}
/* ===== TECLADO VIRTUAL ===== */

.virtual-keyboard {
    position: fixed;
    bottom: 0;
    width: 100%;
    margin-top: 10px;
    z-index: 6500;
    padding: 10px 8px 8px;
    background: #f0f4fb;
    border-radius: 14px 14px 0 0;
    border: 1px solid #d1dff5;
    box-shadow: inset 0 2px 6px rgba(23, 63, 138, 0.07);
}

.keyboard-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.key-btn {
    min-width: 60px;
    height: 60px;
    padding: 0 8px;
    border: 1.5px solid #c5d3ec;
    border-radius: 8px;
    background: white;
    color: #173F8A;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(23, 63, 138, 0.1), 0 1px 0 #b0c4e8;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    font-family: inherit;
}

.key-btn:hover {
    background: #e8f0fd;
    border-color: #173F8A;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(23, 63, 138, 0.18), 0 1px 0 #173F8A;
}

.key-btn:active,
.key-btn.key-pressed {
    background: #173F8A;
    color: white;
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(23, 63, 138, 0.2);
    border-color: #0f2d63;
}

.key-backspace {
    background: #fff0f0;
    border-color: #f0b8b8;
    color: #c0392b;
    min-width: 52px;
}

.key-backspace:hover {
    background: #ffe0e0;
    border-color: #c0392b;
    box-shadow: 0 4px 8px rgba(192, 57, 43, 0.18), 0 1px 0 #c0392b;
}

.key-backspace:active,
.key-backspace.key-pressed {
    background: #c0392b;
    color: white;
    border-color: #922b21;
}

.key-btn[data-char="@"],
.key-btn[data-char="."] {
    background: #eef3fd;
    border-color: #173F8A;
    color: #173F8A;
    font-size: 16px;
}

.key-btn[data-char="@"]:hover,
.key-btn[data-char="."]:hover {
    background: #173F8A;
    color: white;
}

.key-space {
    flex: 1;
    max-width: 300px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: #555;
    border-color: #c5d3ec;
}

.key-space:hover {
    background: #e8f0fd;
    border-color: #173F8A;
    color: #173F8A;
}

.key-space:active,
.key-space.key-pressed {
    background: #173F8A;
    color: white;
}

@media (max-width: 500px) {
    .key-btn {
        min-width: 30px;
        height: 38px;
        font-size: 13px;
        padding: 0 4px;
    }
    .keyboard-row { gap: 10px; }
    .keyboard-rows { gap: 4px; }
}

@media (max-width: 380px) {
    .key-btn {
        min-width: 26px;
        height: 36px;
        font-size: 12px;
    }
}

/* Override search-container to column layout for keyboard */
.search-container {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
}

/* ===== TECLADO: MOSTRAR / OCULTAR ===== */

.keyboard-hidden {
    display: none !important;
}

.keyboard-visible {
    display: block !important;
    animation: keyboardSlideDown 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes keyboardSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Barra superior del teclado */
.keyboard-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 2px;
}

.keyboard-label {
    font-size: 12px;
    font-weight: 600;
    color: #173F8A;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.7;
}

.keyboard-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #c5d3ec;
    background: white;
    color: #173F8A;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    outline: none;
    line-height: 1;
}

.keyboard-close-btn:hover {
    background: #173F8A;
    color: white;
    border-color: #173F8A;
    transform: scale(1.1);
}

.fas{
    margin-right: 5px;
}