/* Reset & Variables */
:root {
    --bg-dark: #090a0f;
    --bg-card: rgba(20, 21, 30, 0.8);
    --border-glass: rgba(255, 255, 255, 0.08);
    
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-purple-glow: rgba(139, 92, 246, 0.4);
    
    --text-primary: #f3f4f6;
    --text-muted: #9ca3af;
    
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-main);
    color: var(--text-primary);
}

/* Pantalla de Bienvenida */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: radial-gradient(circle at center, #1e1b4b 0%, #090a0f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s;
}

.welcome-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

.welcome-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    padding: 40px 30px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 40px rgba(139, 92, 246, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.welcome-card.wide {
    max-width: 580px;
    padding: 42px 30px 30px 30px;
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.brand {
    margin-bottom: 12px;
}

.logo-icon {
    position: relative;
    width: 52px;
    height: 52px;
    background: rgba(139, 92, 246, 0.1);
    border: 1.5px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px auto;
}

.logo-icon svg {
    width: 26px;
    height: 26px;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--accent-purple);
    animation: welcomePulse 2.5s infinite;
}

@keyframes welcomePulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.welcome-card h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2px;
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.setup-controls {
    width: 100%;
    text-align: left;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

select {
    width: 100%;
    background: #14151e; /* Fondo oscuro sólido para evitar que el navegador use blanco */
    border: 1.5px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px 14px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
}

select:focus {
    border-color: var(--accent-purple);
    background: #1c1d29;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
}

select option {
    background-color: #14151e; /* Fondo oscuro para las opciones */
    color: var(--text-primary); /* Texto claro para legibilidad */
}

/* Sección de Selección de Rutas */
.routes-selection-section {
    width: 100%;
    text-align: left;
    margin-top: 15px;
}

.section-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.routes-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Tarjeta de Ruta */
.route-card {
    display: flex;
    gap: 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1.5px solid var(--border-glass);
    border-radius: 16px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    align-items: center;
}

.route-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}

.route-card.selected {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.route-thumbnail {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.route-info {
    flex-grow: 1;
}

.route-info h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.route-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-bottom: 6px;
}

.route-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.badge.cat {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.1);
}

.badge.difficulty {
    color: #c084fc;
    background: rgba(167, 139, 250, 0.1);
}

.badge.duration {
    color: #34d399;
    background: rgba(16, 185, 129, 0.1);
}

.cta-button {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: 16px;
    padding: 14px 24px;
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 10px 20px -5px var(--accent-purple-glow);
    transition: all 0.3s;
}

.cta-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px var(--accent-purple-glow);
}

.cta-button:active:not(:disabled) {
    transform: translateY(1px);
}

.cta-button:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    border: 1px dashed var(--border-glass);
}

.cta-button svg {
    width: 16px;
    height: 16px;
}

/* Mapa */
#map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.leaflet-container {
    background: var(--bg-dark);
}

.leaflet-top.leaflet-left {
    top: 15px;
    left: 15px;
}

.leaflet-bar {
    border: 1px solid var(--border-glass) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.leaflet-bar a {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-glass) !important;
}

.leaflet-bar a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dashboard Panel */
.dashboard-panel {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: 90%;
    max-width: 480px;
    z-index: 999;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), 
                inset 0 1px 0 rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 900px;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.4s, 
                max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.dashboard-panel.hidden {
    transform: translateX(-50%) translateY(120%);
    opacity: 0;
}

.dashboard-panel.collapsed {
    max-height: 155px; /* Altura perfecta para mostrar handle, header y barra de progreso */
    gap: 10px;
}

.drag-handle {
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    align-self: center;
    margin-bottom: -5px;
    cursor: pointer;
    transition: background 0.3s;
}

.drag-handle:hover {
    background: rgba(255, 255, 255, 0.35);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.gps-status-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-indicator.live {
    background-color: var(--accent-blue);
    box-shadow: 0 0 8px var(--accent-blue);
    animation: gpsPulse 2s infinite;
}

.status-indicator.simulating {
    background-color: var(--accent-purple);
    box-shadow: 0 0 8px var(--accent-purple);
}

.status-indicator.error {
    background-color: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

@keyframes gpsPulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.simulation-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sim-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

.sim-badge.active {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border-color: rgba(139, 92, 246, 0.3);
}

/* Interruptor Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border: 1px solid var(--border-glass);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--accent-purple);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Tarjeta de Progreso de la Ruta */
.route-progress-card {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 12px;
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s;
}

.route-progress-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.route-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.route-active-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.route-active-steps {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-blue);
}

.route-progress-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

/* Reproductor de Audio Card */
.audio-player-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.poi-info h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}

.poi-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.audio-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    height: 50px;
}

/* Ondas de Audio */
.audio-waves {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.audio-waves span {
    display: block;
    width: 3px;
    height: 4px;
    background: linear-gradient(to top, var(--accent-blue), var(--accent-purple));
    border-radius: 2px;
    transition: height 0.2s ease;
}

.audio-waves.playing span {
    animation: waveMotion 1.2s ease infinite;
}

.audio-waves.playing span:nth-child(1) { animation-delay: 0.1s; }
.audio-waves.playing span:nth-child(2) { animation-delay: 0.4s; }
.audio-waves.playing span:nth-child(3) { animation-delay: 0.2s; }
.audio-waves.playing span:nth-child(4) { animation-delay: 0.5s; }
.audio-waves.playing span:nth-child(5) { animation-delay: 0.3s; }

@keyframes waveMotion {
    0%, 100% { height: 4px; }
    50% { height: 24px; }
}

.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn.play {
    background: white;
    color: black;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.action-btn.play:hover:not(:disabled) {
    transform: scale(1.08);
}

.action-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    cursor: not-allowed;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

.hidden {
    display: none !important;
}

/* Caja de Narración Colapsable */
.narration-box {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    margin-top: 4px;
}

.narration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.narration-header svg {
    transition: transform 0.3s;
}

.narration-header.open svg {
    transform: rotate(180deg);
}

.narration-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #d1d5db;
    margin-top: 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.narration-header.open + .narration-content {
    max-height: 150px;
    overflow-y: auto;
}

/* Footer del Dashboard */
.dashboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.mini-control {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mini-control select {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    width: auto;
}

.premium-switch {
    display: flex;
    align-items: center;
    gap: 8px;
}

.premium-switch span {
    font-weight: 500;
}

/* Switch Pequeño */
.switch-small {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border: 1px solid var(--border-glass);
}

.slider-small:before {
    position: absolute;
    content: "";
    height: 10px;
    width: 10px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider-small {
    background-color: var(--accent-emerald);
}

input:checked + .slider-small:before {
    transform: translateX(14px);
}

.slider-small.round {
    border-radius: 18px;
}

.slider-small.round:before {
    border-radius: 50%;
}

.btn-text-link {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.3s;
}

.btn-text-link:hover {
    color: var(--accent-purple);
}

/* Banner de Simulación */
.sim-banner {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 998;
    background: rgba(139, 92, 246, 0.9);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 8px 16px;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    pointer-events: none;
    text-align: center;
    backdrop-filter: blur(8px);
    animation: fadeInDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Marcadores personalizados */
.user-marker {
    background: radial-gradient(circle, #3b82f6 30%, rgba(59, 130, 246, 0.2) 70%);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.user-marker.simulating {
    background: radial-gradient(circle, #8b5cf6 30%, rgba(139, 92, 246, 0.2) 70%);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.8);
}

/* Enlace al Panel Admin */
#admin-panel-link {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 997;
    background: rgba(20, 21, 30, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s;
}

#admin-panel-link:hover {
    color: var(--text-primary);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

/* Ajustes responsivos */
@media (max-width: 480px) {
    .welcome-card {
        padding: 25px 20px;
    }
    .welcome-card.wide {
        padding: 20px;
    }
    .dashboard-panel {
        bottom: 15px;
        width: 92%;
    }
    .dashboard-footer {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px 8px !important;
        align-items: center;
    }
    .dashboard-footer .mini-control {
        width: 100%;
        justify-content: flex-start;
    }
    .dashboard-footer #btn-change-route {
        text-align: right;
        display: block;
        margin-left: auto;
    }
    .routes-grid {
        max-height: 260px;
    }
    .route-card {
        padding: 8px;
        gap: 10px;
    }
    .route-thumbnail {
        width: 50px;
        height: 50px;
    }
}

/* Chips de Filtro de Rutas */
.filter-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--border-glass);
    border-radius: 20px;
    padding: 5px 14px;
    font-family: var(--font-main);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: rgba(139, 92, 246, 0.5);
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.08);
}

.filter-chip.active {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-purple);
    color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
}

/* Galería de imágenes del POI */
.poi-gallery {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
    max-height: 160px;
}

.poi-gallery.hidden {
    display: none !important;
}

.gallery-track {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 2px;
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-track img {
    width: 100%;
    min-width: 100%;
    height: 155px;
    object-fit: cover;
    border-radius: 10px;
    scroll-snap-align: start;
    flex-shrink: 0;
    display: block;
}

.gallery-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    position: absolute;
    top: 8px;
    left: 0;
    right: 0;
    z-index: 10;
}

.gallery-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: background 0.3s, transform 0.2s;
    cursor: pointer;
}

.gallery-dot:hover {
    background: rgba(255,255,255,0.8);
    transform: scale(1.3);
}

.gallery-dot.active {
    background: white;
    transform: scale(1.1);
}

/* Botones de navegación del slideshow (Desktop) */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 0.75rem;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s, transform 0.2s, opacity 0.2s;
    outline: none;
    padding: 0;
    opacity: 0;
}

.poi-gallery:hover .gallery-nav-btn {
    opacity: 1;
}

.gallery-nav-btn:hover {
    background: var(--accent-purple);
    transform: translateY(-50%) scale(1.1);
    color: white;
}

.gallery-nav-btn.prev {
    left: 8px;
}

.gallery-nav-btn.next {
    right: 8px;
}

/* Soporte Drag-and-drop en administración */
.preview-thumb {
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.preview-thumb.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    border: 1px dashed var(--accent-purple) !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

/* Estilos de audio embebido */
.audio-slide audio::-webkit-media-controls-panel {
    background-color: rgba(255, 255, 255, 0.85);
}

.audio-slide audio {
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Tarjeta de Bienvenida al POI */
.poi-welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.4s, visibility 0.4s;
}

.poi-welcome-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.poi-welcome-card {
    background: #14151e;
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    overflow: hidden;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(139,92,246,0.2);
    animation: slideUpCard 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpCard {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.welcome-poi-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.welcome-card-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: rgba(139, 92, 246, 0.15);
}

.welcome-card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: linear-gradient(to top, #14151e, transparent);
}

.welcome-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: background 0.3s;
}

.welcome-close-btn:hover {
    background: rgba(0,0,0,0.8);
}

.welcome-card-body {
    padding: 16px 20px 22px;
}

.welcome-card-badge {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-purple);
    margin-bottom: 6px;
}

.welcome-card-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.welcome-card-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.welcome-card-cta {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 13px 20px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.35);
}

.welcome-card-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

/* Botón de Chat en Controles de Audio */
.action-btn.chat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    color: var(--accent-purple);
    box-shadow: none;
}

.action-btn.chat:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    transform: scale(1.05);
}

/* Ventana de Chat Flotante (Chat Drawer) */
.poi-chat-window {
    position: absolute;
    inset: 0;
    z-index: 1100;
    background: #101118;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(105%);
}

.poi-chat-window.open {
    transform: translateY(0);
}

/* Cabecera del Chat */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    font-size: 1.4rem;
    width: 38px;
    height: 38px;
    background: rgba(139, 92, 246, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.chat-header-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.chat-status {
    font-size: 0.72rem;
    color: var(--accent-emerald);
    margin: 2px 0 0 0;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.chat-status::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--accent-emerald);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent-emerald);
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* Contenedor de Mensajes */
.chat-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar para el Chat */
.chat-messages-container::-webkit-scrollbar {
    width: 4px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

/* Burbujas de Chat */
.chat-bubble {
    max-width: 82%;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-bubble.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-radius: 16px 16px 16px 4px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #7c3aed 100%);
    color: white;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

/* Área de Entrada del Chat */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.01);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input-area input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.88rem;
    transition: all 0.3s;
}

.chat-input-area input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(255, 255, 255, 0.06);
}

.chat-input-area button {
    background: var(--accent-purple);
    color: white;
    border: none;
    border-radius: 14px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
}

.chat-input-area button:hover {
    background: #7c3aed;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.35);
}

/* Indicador de Escritura de la IA */
.chat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 18px 10px;
    color: var(--text-muted);
}

.chat-typing-indicator p {
    font-size: 0.72rem;
    margin: 0 0 0 6px;
    font-weight: 500;
}

.chat-typing-indicator span {
    display: block;
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.chat-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ==========================================================================
   Nuevas Funcionalidades: Favoritos, Logros, Mini-Mapa y Estadísticas Admin
   ========================================================================== */

/* Botón de Logros */
#btn-open-achievements:hover {
    transform: scale(1.1) rotate(5deg);
    background: rgba(245, 158, 11, 0.25) !important;
}

/* Botón de Favoritos en Ruta */
.fav-route-btn:hover {
    transform: scale(1.15) !important;
    background: rgba(0, 0, 0, 0.6) !important;
    color: #fbbf24 !important;
}

.fav-route-btn.active {
    animation: favPulse 0.3s ease-out;
}

@keyframes favPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Contenedor del Mini-Mapa Activo */
#active-minimap-container:not(.hidden) {
    animation: slideDownFade 0.3s ease-out;
}

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

/* Marcadores del Mini-Mapa Activo */
.active-poi-marker {
    transition: transform 0.2s;
}

/* Grid de Estadísticas Admin */
.stats-grid {
    margin-bottom: 20px;
}

.stats-card {
    transition: transform 0.2s, border-color 0.2s;
}

.stats-card:hover {
    transform: translateY(-3px);
    border-color: rgba(139, 92, 246, 0.3) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}


