/* =========================================
   1. VARIABLES & GLOBAL
   ========================================= */
:root {
    --uaem-verde: #1B5E20;
    --uaem-dorado: #9E8B39;
    --uaem-negro: #1a1a1a;
    --blanco: #ffffff;
    --gris-fondo: #f0f2f5;
    --gris-claro: #f8f9fa;
    --sombra-suave: 0 4px 15px rgba(0,0,0,0.08);
    --sombra-fuerte: 0 10px 30px rgba(0,0,0,0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', system-ui, sans-serif; }

body { 
    display: flex; flex-direction: column; min-height: 100vh;
    background-color: var(--gris-fondo);
    color: #333;
    /* SEGURIDAD: Evita selección de texto e imágenes */
    user-select: none; 
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* =========================================
   2. HEADER
   ========================================= */
header {
    background-color: var(--uaem-verde); color: var(--blanco);
    padding: 0.8rem 1.5rem; 
    border-bottom: 4px solid var(--uaem-dorado);
    display: flex; justify-content: space-between; align-items: center;
    z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.logo-area { display: flex; align-items: center; gap: 12px; }
.uaem-logo { height: 45px; width: auto; }
.logo-secundario { height: 35px; width: auto; }
.logo-dark-fix { filter: invert(1) brightness(1.5); }
.separador-vertical { width: 1px; height: 30px; background: rgba(255,255,255,0.3); margin: 0 10px; }

.titulo-mapa { 
    font-size: 1.1rem; margin: 0; font-weight: 700; 
    text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; flex-direction: column; line-height: 1.1;
}
.detalle-2d { color: var(--uaem-dorado); font-weight: 400; font-size: 0.85em; }

.btn-home-simple {
    background: rgba(255,255,255,0.15); color: white; padding: 8px 18px; 
    border-radius: 25px; text-decoration: none; font-size: 0.9rem; 
    display: flex; align-items: center; gap: 8px; transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
}
.btn-home-simple:hover { 
    background: var(--uaem-dorado); border-color: white; 
    transform: translateY(-2px);
}

@media (max-width: 600px) {
    header { padding: 0.5rem 1rem; }
    .logo-area { gap: 8px; }
    .uaem-logo { height: 35px; }
    .logo-secundario { height: 28px; }
    .titulo-mapa { display: none; } 
    .separador-vertical { display: none; }
    .btn-home-simple span { display: none; } 
}

/* =========================================
   3. INTRODUCCIÓN (OPTIMIZADA MÓVIL)
   ========================================= */
.intro-section {
    background-color: var(--gris-fondo);
    padding: 2rem 1rem;
    display: flex; justify-content: center;
}

.intro-card {
    background: white; max-width: 900px; width: 100%;
    border-radius: 15px; box-shadow: var(--sombra-suave);
    display: flex; align-items: center;
    padding: 2rem; gap: 2rem;
    border-left: 6px solid var(--uaem-dorado);
    transition: transform 0.3s;
}
.intro-card:hover { transform: translateY(-3px); }

.card-icon {
    background: var(--uaem-verde); color: white;
    width: 60px; height: 60px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.6rem; flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(27, 94, 32, 0.2);
}

.card-content h2 { color: var(--uaem-verde); font-size: 1.5rem; margin-bottom: 0.5rem; }
.card-content p { color: #555; line-height: 1.5; font-size: 1rem; }

/* Flecha animada (Scroll Indicator) */
.scroll-indicator {
    color: var(--uaem-dorado); font-size: 1.5rem;
    margin-top: 15px; display: none; /* Oculto en PC */
    text-align: center;
}
.animate-bounce { animation: bounce 2s infinite; }

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

@media (max-width: 768px) {
    .intro-section { padding: 1rem 0.5rem; }
    .intro-card { flex-direction: column; text-align: center; padding: 1.2rem; gap: 1rem; }
    .card-icon { width: 50px; height: 50px; font-size: 1.3rem; }
    .card-content h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
    .card-content p { font-size: 0.9rem; line-height: 1.4; margin-bottom: 0; }
    .scroll-indicator { display: block; }
}

/* =========================================
   4. MAPA 2D & FULLSCREEN
   ========================================= */
.contenedor-mapa {
    position: relative; 
    height: 65vh; min-height: 400px;
    background: #e0e0e0; overflow: hidden;
    border-top: 1px solid #ddd;
    border-bottom: 5px solid var(--uaem-dorado);
    transition: all 0.3s ease;
}

.contenedor-mapa.fullscreen-mode {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw !important; height: 100vh !important;
    z-index: 9999;
    border: none;
    background: #111;
}

@media (max-width: 768px) {
    .contenedor-mapa { height: 55vh; min-height: 350px; }
}

.map-viewport { 
    width: 100%; height: 100%; overflow: hidden; position: relative; cursor: grab; 
    display: flex; justify-content: center; align-items: center;
}
.map-viewport:active { cursor: grabbing; }

/* =========================================
   5. EDIFICIOS E ICONOS (ANIMACIONES)
   ========================================= */
.map-wrapper { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
#base-map { width: 1600px; height: auto; display: block; pointer-events: none; }

/* Animación de "Latido de Luz" (Respiración) */
@keyframes brilloSuave {
    0% { filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5)); transform: translate(-50%, -50%) scale(1); }
    50% { filter: drop-shadow(0 0 6px rgba(158, 139, 57, 0.6)); transform: translate(-50%, -50%) scale(1.02); }
    100% { filter: drop-shadow(0 4px 4px rgba(0,0,0,0.5)); transform: translate(-50%, -50%) scale(1); }
}

.map-overlay {
    position: absolute; z-index: 10; cursor: pointer;
    width: var(--w, 50px); 
    transform: translate(-50%, -50%);
    
    /* Animación Infinita (Respiración) */
    animation: brilloSuave 3s infinite ease-in-out;
    transition: all 0.2s ease-out;
    
    -webkit-tap-highlight-color: transparent; 
}

/* --- INTERACCIÓN (Hover/Active) --- */
.map-overlay:hover, .map-overlay:active {
    animation: none; /* Pausar latido */
    z-index: 100;
    
    /* Zoom + Brillo Intenso Dorado */
    transform: translate(-50%, -50%) scale(1.2);
    filter: drop-shadow(0 0 15px var(--uaem-dorado)) drop-shadow(0 0 5px #fff) brightness(1.1);
}

/* --- TOOLTIPS (SOLO PC) --- */
.map-overlay::after {
    content: attr(data-title);
    position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%) translateY(10px);
    
    background: rgba(27, 94, 32, 0.95); color: white;
    padding: 6px 12px; border-radius: 8px;
    font-size: 0.85rem; font-weight: bold; white-space: nowrap;
    border: 1px solid var(--uaem-dorado);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4); pointer-events: none;
    
    opacity: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27);
}

/* Mostrar tooltip solo si hay mouse (PC) */
@media (hover: hover) {
    .map-overlay:hover::after {
        opacity: 1; transform: translateX(-50%) translateY(-15px);
    }
}

/* --- AJUSTES MÓVILES --- */
@media (max-width: 768px) {
    #base-map { width: 1000px; }
    
    /* Reducción tamaño base */
    .map-overlay { zoom: 0.65; }
    
    /* Zoom táctil un poco más grande al presionar */
    .map-overlay:active { transform: translate(-50%, -50%) scale(1.25); }
    
    /* Ocultar tooltips en móvil */
    .map-overlay::after { display: none; }
}

.gesture-hint {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(27, 94, 32, 0.9); color: white; padding: 10px 20px;
    border-radius: 30px; font-weight: 600; pointer-events: none; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); transition: opacity 0.5s; z-index: 50;
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}

/* =========================================
   6. BOTÓN PANTALLA COMPLETA (DINÁMICO)
   ========================================= */
.btn-fullscreen {
    position: absolute; z-index: 1500;
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(5px);
    color: var(--uaem-verde); border: 2px solid white;
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.27);
}

/* PC: Arriba Derecha */
@media (min-width: 769px) {
    .btn-fullscreen { top: 20px; right: 20px; }
    .btn-fullscreen:hover {
        transform: scale(1.15) rotate(90deg); background: var(--uaem-verde); color: white;
        box-shadow: 0 8px 25px rgba(27, 94, 32, 0.5);
    }
}

/* MÓVIL: Abajo Derecha */
@media (max-width: 768px) {
    .btn-fullscreen {
        top: auto; bottom: 25px; right: 20px;
        width: 60px; height: 60px; font-size: 1.6rem;
        background: #ffffff; animation: pulseButton 3s infinite;
    }
    .btn-fullscreen:active { transform: scale(0.9); background: var(--uaem-verde); color: white; }
}

@keyframes pulseButton {
    0% { box-shadow: 0 0 0 0 rgba(27, 94, 32, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(27, 94, 32, 0); }
    100% { box-shadow: 0 0 0 0 rgba(27, 94, 32, 0); }
}

.contenedor-mapa.fullscreen-mode .btn-fullscreen {
    background: rgba(0, 0, 0, 0.7); color: white; border-color: #555;
}

/* =========================================
   7. SECCIÓN MAPA REAL (GRID)
   ========================================= */
.seccion-mapa-real { background: white; padding: 3rem 1.5rem; }
.contenedor-real-grid {
    max-width: 1100px; margin: 0 auto;
    display: grid; grid-template-columns: 1.5fr 1fr;
    gap: 2.5rem; align-items: start;
}
.columna-mapa {
    height: 400px; width: 100%;
    border-radius: 15px; overflow: hidden;
    border: 3px solid var(--uaem-dorado);
    box-shadow: var(--sombra-fuerte);
}
#map-osm { width: 100%; height: 100%; z-index: 1; }

.columna-info h3 { 
    color: var(--uaem-verde); font-size: 1.6rem; margin-bottom: 1rem; 
    border-bottom: 2px solid #eee; padding-bottom: 10px;
}
.direccion-principal { font-size: 1.05rem; color: #555; margin-bottom: 1.5rem; line-height: 1.6; }
.datos-contacto-real { list-style: none; padding: 0; margin-bottom: 2rem; }
.datos-contacto-real li { 
    margin-bottom: 12px; font-size: 0.95rem; color: #444; 
    display: flex; align-items: flex-start; gap: 12px; 
}
.datos-contacto-real li i { color: var(--uaem-dorado); margin-top: 4px; }

.btn-ruta-google {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--uaem-verde); color: white;
    padding: 12px 25px; border-radius: 8px; text-decoration: none;
    font-weight: bold; transition: 0.3s;
    box-shadow: 0 4px 10px rgba(27, 94, 32, 0.3);
}
.btn-ruta-google:hover { background: #144a19; transform: translateY(-2px); }

@media (max-width: 850px) {
    .contenedor-real-grid { grid-template-columns: 1fr; gap: 2rem; }
    .columna-mapa { height: 300px; }
    .columna-info { text-align: center; }
    .datos-contacto-real li { justify-content: center; }
    .btn-ruta-google { justify-content: center; width: 100%; }
}

/* =========================================
   8. MODAL PROFESIONAL (SMART IMAGES)
   ========================================= */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 3000;
    backdrop-filter: blur(5px); justify-content: center; align-items: center;
    padding: 15px;
}
.modal-overlay.active { display: flex; animation: zoomIn 0.3s ease-out; }
@keyframes zoomIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-content {
    background: white; width: 100%; max-width: 650px;
    border-radius: 15px; overflow: hidden; position: relative;
    box-shadow: var(--sombra-fuerte);
}
.modal-header-visual { background: var(--uaem-verde); padding: 1.2rem; text-align: center; color: white; }
.modal-header-visual h2 { margin: 0; font-size: 1.3rem; text-transform: uppercase; letter-spacing: 1px; }

.close-btn {
    position: absolute; top: 12px; right: 15px;
    background: rgba(0,0,0,0.2); color: white;
    border: none; width: 32px; height: 32px; border-radius: 50%;
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    z-index: 10; transition: 0.3s; display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { background: var(--uaem-dorado); transform: rotate(90deg); }

.modal-body { padding: 20px; max-height: 80vh; overflow-y: auto; }

/* Grid de Imágenes Adaptable */
.modal-images-grid {
    display: flex; gap: 15px; margin-bottom: 15px;
    justify-content: center; align-items: stretch;
}
.img-card {
    background: #f9f9f9; padding: 8px; border-radius: 10px; border: 1px solid #eee;
    text-align: center; flex: 1; display: flex; flex-direction: column;
    justify-content: center; align-items: center; transition: all 0.3s;
}
.img-card img {
    max-width: 100%; border-radius: 5px; transition: transform 0.3s;
}

/* Indicador de que se puede hacer clic en la real */
.img-card.zoomable { cursor: pointer; border: 2px solid transparent; }
.img-card.zoomable:hover { border-color: var(--uaem-dorado); background: #fffbe6; }

/* Clases dinámicas */
.img-card.vertical img { max-height: 250px; width: auto; object-fit: contain; }
.img-card.horizontal img { width: 100%; height: auto; object-fit: cover; }
.img-card:hover img { transform: scale(1.05); }

.label-img {
    display: block; margin-top: 8px; font-size: 0.75rem; 
    font-weight: bold; color: var(--uaem-verde); text-transform: uppercase;
}

/* Descripción con Scroll y Listas */
.desc-text-scroll {
    max-height: 300px; overflow-y: auto;
    background: #f4f4f4; padding: 15px; border-radius: 10px;
    border-left: 5px solid var(--uaem-dorado);
    font-size: 0.95rem; color: #333; line-height: 1.6;
}
.desc-text-scroll ul { margin: 5px 0 10px 20px; padding: 0; }
.desc-text-scroll li { margin-bottom: 5px; }
.info-piso { margin-bottom: 15px; border-bottom: 1px solid #e0e0e0; padding-bottom: 10px; }
.info-piso:last-child { border-bottom: none; }
.info-piso strong { color: var(--uaem-verde); display: block; margin-bottom: 5px; font-size: 1rem; }

@media (max-width: 600px) {
    .modal-images-grid { flex-direction: column; }
    .img-card.vertical img { max-height: 200px; }
}

/* =========================================
   9. VISOR PANTALLA COMPLETA (LIGHTBOX)
   ========================================= */
.lightbox-overlay {
    display: none; position: fixed; z-index: 5000;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s ease;
}

.lightbox-overlay.active { display: flex; opacity: 1; animation: fadeIn 0.3s forwards; }

.lightbox-overlay img {
    max-width: 90%; max-height: 90%; object-fit: contain;
    border: 2px solid white; border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    transform: scale(0.9); transition: transform 0.3s;
}

.lightbox-overlay.active img { transform: scale(1); }

.lightbox-close {
    position: absolute; top: 20px; right: 30px;
    color: white; font-size: 3rem; font-weight: bold;
    cursor: pointer; z-index: 5001; line-height: 1; transition: 0.3s;
}
.lightbox-close:hover { color: var(--uaem-dorado); transform: scale(1.1); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }


/* =========================================
   10. CHATBOT FLOTANTE
   ========================================= */
.chatbot-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; }
.chat-toggle-btn { 
    width: 55px; height: 55px; background: var(--uaem-verde); color: white;
    border-radius: 50%; border: none; font-size: 1.5rem; cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); transition: transform 0.2s;
}
.chat-toggle-btn:hover { transform: scale(1.1); }

.chat-window {
    position: absolute; bottom: 70px; right: 0; width: 300px; height: 400px;
    background: white; border-radius: 15px; display: none; flex-direction: column;
    box-shadow: var(--sombra-fuerte); border: 1px solid #ddd; overflow: hidden;
}
.chat-window.active { display: flex; animation: slideUp 0.3s; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.chat-header { background: var(--uaem-verde); color: white; padding: 10px 15px; display: flex; align-items: center; gap: 10px; }
.chat-avatar img { width: 30px; height: 30px; border-radius: 50%; background: white; padding: 2px; }
.chat-body { flex: 1; padding: 15px; background: #f5f5f5; overflow-y: auto; }
.message { margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; max-width: 85%; font-size: 0.85rem; }
.bot-message { background: white; align-self: flex-start; border-bottom-left-radius: 2px; }
.user-message { background: #dcedc8; align-self: flex-end; border-bottom-right-radius: 2px; margin-left: auto; }
.chat-footer { padding: 10px; border-top: 1px solid #eee; display: flex; gap: 5px; background: white; }
.chat-footer input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 20px; outline: none; font-size: 0.9rem; }
.chat-footer button { background: var(--uaem-verde); color: white; border: none; width: 32px; border-radius: 50%; cursor: pointer; }

/* =========================================
   11. PRELOADER (CENTRADO)
   ========================================= */
#preloader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: white; z-index: 9999;
    display: flex; flex-direction: column; 
    justify-content: center; align-items: center;
    transition: opacity 0.5s ease-out;
}
#preloader.hidden { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-logo { width: 90px; margin-bottom: 20px; animation: pulse 1.5s infinite; }
.loader-circle {
    width: 35px; height: 35px; margin: 0 auto 15px auto;
    border: 3px solid #f3f3f3; border-top: 3px solid var(--uaem-dorado);
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* =========================================
   12. FOOTER MINIMALISTA (DARK)
   ========================================= */
footer {
    background-color: #1a1a1a; color: #e0e0e0;
    border-top: 5px solid var(--uaem-dorado);
    padding-top: 3rem; margin-top: auto; font-size: 0.95rem;
}
.footer-container {
    max-width: 1000px; margin: 0 auto;
    display: flex; flex-wrap: wrap; 
    justify-content: center; gap: 4rem;
    padding: 0 1rem 2rem 1rem;
}
.footer-col { min-width: 250px; }
.footer-col h4 {
    color: var(--uaem-dorado); font-size: 1.1rem;
    margin-bottom: 1.2rem; position: relative; display: inline-block;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.footer-col h4::after {
    content: ''; display: block; width: 40px; height: 2px;
    background: var(--uaem-verde); margin-top: 5px;
}
.footer-link {
    display: flex; align-items: center; gap: 12px;
    color: #bbb; text-decoration: none; margin-bottom: 12px;
    transition: all 0.3s ease;
}
.footer-link:hover { color: var(--uaem-dorado); transform: translateX(5px); }
.footer-link i { font-size: 1.1rem; color: var(--uaem-verde); }
.footer-text {
    display: flex; align-items: flex-start; gap: 12px;
    color: #bbb; margin-bottom: 15px; line-height: 1.5;
}
.footer-copyright {
    background: #111; text-align: center; padding: 1.5rem;
    border-top: 1px solid #333; color: #666; font-size: 0.85rem;
}

@media (max-width: 600px) {
    .footer-container { flex-direction: column; gap: 2rem; }
    .footer-col { width: 100%; min-width: auto; }
}