/* Variables CSS personalizadas */
:root {
    --primary-color: #2196F3;
    --secondary-color: #FFC107;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --dark-color: #212121;
    --light-color: #FAFAFA;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estilos globales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark-color);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Header mejorado */
#info-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    box-shadow: var(--shadow);
    z-index: 1000;
    border-bottom: 3px solid var(--primary-color);
    transition: var(--transition);
}

#info-panel h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

#info-panel p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Modal de instrucciones mejorado */
#instructions {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.instructions-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    animation: scaleIn 0.3s ease-out forwards;
}

#marker-display, #qr-display {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%; /* Ocupar todo el ancho del contenedor padre */
}

#marker-display img, #qr-display img {
    max-width: 100%;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}



.back-button {
    background: linear-gradient(45deg, var(--secondary-color), #FF8F00);
    width: 100%;
}

.instructions-content h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.6rem;
    text-align: center;
}

.instructions-content h4 {
    color: var(--dark-color);
    margin-top: 15px; /* Reducido el margen superior */
    margin-bottom: 10px;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
}

.instructions-content ol {
    margin: 20px 0;
    padding-left: 20px;
}

.instructions-content li {
    margin: 10px 0;
    line-height: 1.6;
}

/* Controles de navegación mejorados */
#navigation-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 15px;
    z-index: 1000;
    align-items: center;
}

/* Botones mejorados */
.nav-button, .close-button, .instructions-button, .marker-button {
    background: linear-gradient(45deg, var(--primary-color), #1976D2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.nav-button:hover, .close-button:hover, .nav-button:hover, .close-button:hover, .instructions-button:hover, .marker-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, #1976D2, var(--primary-color));
}

.nav-button:active, .close-button:active, .instructions-button:active, .marker-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.close-button {
    background: linear-gradient(45deg, var(--danger-color), #D32F2F);
    margin-top: 20px;
    width: 100%;
}

a.marker-button {
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.marker-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 15px; /* Añadido para separar de la línea hr */
    justify-content: center; /* Centrar botones */
    flex-wrap: wrap; /* Permitir que los botones se envuelvan en pantallas pequeñas */
    width: 100%;
}

.marker-button {
    background: linear-gradient(45deg, var(--success-color), #388E3C);
    flex-grow: 1;
    min-width: 150px; /* Ancho mínimo para evitar que se encojan demasiado */
}

.instructions-button {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(45deg, var(--secondary-color), #FF8F00);
    z-index: 1000;
    min-width: auto;
    padding: 10px 15px;
}

/* Panel de información ODS mejorado */
#ods-info {
    position: fixed;
    top: 120px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 200px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: none;
    z-index: 1000;
    overflow-y: auto;
    border: 2px solid var(--primary-color);
}

#ods-info h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #E3F2FD;
}

#ods-info::-webkit-scrollbar {
    width: 8px;
}

#ods-info::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#ods-info::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

#ods-info::-webkit-scrollbar-thumb:hover {
    background: #1976D2;
}

/* Estilos para las secciones enriquecidas de ODS */
.ods-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(33, 150, 243, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.ods-section h4 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ods-section p {
    line-height: 1.6;
    color: #444;
    margin-bottom: 8px;
}

.ods-list {
    line-height: 1.7;
    color: #555;
}

.ods-impact {
    font-style: italic;
    color: var(--primary-color);
    font-weight: 500;
    background: rgba(33, 150, 243, 0.1);
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

/* Spinner de carga mejorado */
#loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 1500;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(33, 150, 243, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Diseño responsivo */
@media (max-width: 768px) {
    #info-panel {
        padding: 10px 15px;
    }
    
    #info-panel h1 {
        font-size: 1.4rem;
    }
    
    #ods-info {
        width: calc(100% - 20px);
        right: 10px;
        left: 10px;
        max-height: 40vh;
        top: auto;
        bottom: 80px;
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .instructions-content {
        padding: 20px;
        margin: 20px;
    }
    
    #navigation-controls {
        bottom: 15px;
        gap: 10px;
    }
    
    .nav-button {
        padding: 10px 15px;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .instructions-button {
        top: 70px;
        right: 15px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    #ods-info h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
}