/* ===================================
   PALETA DE COLORES Y FUENTES
=================================== */
:root {
    --font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --primary-color: #34495e; /* Azul oscuro */
    --secondary-color: #e74c3c; /* Rojo-Naranja */
    --accent-color: #2ecc71; /* Verde */
    --text-dark: #2c3e50;
    --text-light: #ecf0f1;
    --background-light: #f4f7f9;
    --background-dark: #2c3e50;
    --gradient-bg: linear-gradient(135deg, #3498db 0%, #8e44ad 100%);
}

/* ===================================
   ESTILOS GLOBALES Y TIPOGRAFÍA
=================================== */
body {
    font-family: var(--font-family);
    background-color: var(--background-light);
    color: var(--text-dark);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 700;
}

/* Clases de utilidad */
.bg-primary-dark { background-color: var(--background-dark) !important; }
.text-primary-dark { color: var(--text-dark) !important; }
.text-secondary-dark { color: var(--primary-color) !important; }
.text-accent { color: var(--accent-color) !important; }

/* ===================================
   NAVEGACIÓN
=================================== */
.navbar {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar-brand {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
}

.nav-link:hover {
    color: var(--secondary-color) !important;
    transform: translateY(-2px);
}

/* ===================================
   BOTÓN FLOTANTE DE REGRESO
=================================== */
.back-btn-floating {
    position: fixed;
    bottom: 25px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    
    background-color: var(--secondary-color);
    color: white;
    border-radius: 50px;
    padding: 12px 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    
    /* Nueva propiedad: opacidad reducida por defecto */
    opacity: 0.3; 
}

.back-btn-floating:hover {
    background-color: #c0392b;
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    
    /* Nueva propiedad: opacidad completa al pasar el cursor */
    opacity: 1; 
}

.back-btn-floating:active {
    /* Nueva pseudo-clase: estilo al presionar el botón */
    transform: translateX(-50%) scale(0.95);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.back-btn-floating i {
    font-size: 1rem;
}

/* Ocultar el botón flotante en la sección de inicio */
#home-section.active-section ~ .back-btn-floating {
    display: none;
}
/* ===================================
   ANIMACIÓN DE IMAGEN FLOTANTE
=================================== */
.floating-image {
    position: fixed; /* Para que la imagen flote sobre el contenido */
    width: 100px; /* Tamaño de la imagen */
    height: auto;
    z-index: 2000; /* Asegura que esté por encima de todos los elementos */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Posición inicial */
    opacity: 0; /* Empieza transparente */
}

/* Define la animación con @keyframes */
@keyframes floating-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1.2);
        opacity: 1;
    }
    80% {
        transform: translate(200px, -300px) rotate(1080deg) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(400px, 400px) rotate(1440deg) scale(0.5);
        opacity: 0;
    }
}

/* Clase que activa la animación */
.is-animating {
    animation: floating-spin 4s ease-in-out forwards;
}

/* ===================================
   HEADER SECTION
=================================== */
.header-section {
    background: var(--gradient-bg);
    color: white;
    padding: 6rem 0;
    text-align: center;
    border-bottom-left-radius: 50% 20%;
    border-bottom-right-radius: 50% 20%;
    animation: slideInUp 0.8s ease-out;
}

.header-section h1 {
    font-size: 3.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: white; /* Asegura el color blanco en el encabezado */
}

.header-section p {
    font-size: 1.5rem;
    font-weight: 300;
    opacity: 0.9;
}

/* ===================================
   CARDS DE ALGORITMOS
=================================== */
.algorithm-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e0e0e0;
    border-radius: 1rem;
    cursor: pointer;
    margin-top: 2rem; /* Separación superior entre tarjetas */
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); /* Sombra suave */
}

.algorithm-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.card-title {
    color: var(--primary-color);
    font-weight: 600;
}

.algorithm-type-badge {
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.supervised { background-color: #d1f1e7; color: #1e8449; }
.unsupervised { background-color: #d4e6f1; color: #2e86c1; }
.ensemble { background-color: #f9e79f; color: #d68910; }


/* ===================================
   SECCIÓN DE DETALLES
=================================== */
.algorithm-detail {
    display: none;
    animation: fadeIn 0.8s ease-out;
}

.detail-header {
    text-align: center;
    padding: 2rem 0;
}

.detail-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 2rem;
}

.section-title {
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    color: var(--text-dark);
}

.code-container {
    background: #2d3748;
    color: #e0e0e0;
    border-radius: 10px;
    padding: 1.5rem;
    overflow-x: auto;
}

.chart-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    text-align: center;
}

.back-btn {
    background: var(--secondary-color);
    border: none;
    border-radius: 25px;
    padding: 0.75rem 2rem;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* ===================================
   ANIMACIONES
=================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===================================
   RESPONSIVE DESIGN
=================================== */
@media (max-width: 768px) {
    .header-section {
        padding: 4rem 0;
    }
    .header-section h1 {
        font-size: 2.5rem;
    }
    .detail-content {
        padding: 1rem;
    }
    .code-container {
        padding: 1rem;
    }
}