/* ===== VARIABLES Y FUNDAMENTOS ===== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --transition-duration: 0.3s;

    /* VARIABLES PARA EL GRADIENTE ANIMADO (Modo Claro/Default) */
    --banner-gradient-start: #0d6efd; /* Azul Bootstrap */
    --banner-gradient-mid: #6610f2;   /* Indigo */
    --banner-gradient-end: #0dcaf0;   /* Cian */
}

/* ===== BODY Y TEMAS ===== */
body {
    font-family: 'Inter', sans-serif;
    transition: background-color var(--transition-duration), color var(--transition-duration);
}

/* Tema claro (default) */
html[data-bs-theme="light"] {
    --bs-body-bg: #ffffff;
    --bs-body-color: #212529;
    --bs-emphasis-color: #000;
}

/* Tema oscuro */
html[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #e9ecef;
    --bs-emphasis-color: #fff;
    --bs-tertiary-bg: #2d2d2d;
    --bs-tertiary-color: #b0b0b0;

    /* VARIABLES PARA EL GRADIENTE ANIMADO (Modo Oscuro - Tonos más profundos) */
    --banner-gradient-start: #06357a; 
    --banner-gradient-mid: #2d0a75;
    --banner-gradient-end: #055160;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in {
    animation: fadeInUp 0.8s ease-out;
}

/* ===== NAVBAR ===== */
.navbar {
    transition: background-color var(--transition-duration), box-shadow var(--transition-duration);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.navbar-scrolled {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.9) !important;
}

html[data-bs-theme="dark"] .navbar-scrolled {
    background-color: rgba(26, 26, 26, 0.9) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#themeToggle {
    cursor: pointer;
    transition: transform var(--transition-duration), background-color var(--transition-duration);
}

#themeToggle:hover {
    transform: rotate(20deg);
}

/* ===== HERO SECTION ===== */
#inicio {
    position: relative;
    color: white;
    overflow: hidden;
    min-height: 600px;
    display: flex;
    align-items: center;
}

.hero-section {
    background: #000;
}

.hero-video-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden; /* IMPORTANTE: Oculta el excedente del video */
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Asegura que cubra todo */
    object-position: center;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    background-color: rgba(0, 0, 0, 0.5);
    
    /* RECORTE: Zoom al video para ocultar marcas de agua superior/inferior */
    transform: scale(1.15); 
}

.hero-video.fade-out {
    opacity: 0;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.65) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.65) 100%
    );
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
    z-index: 1;
    transition: background 0.3s ease-in-out;
}

/* Tema dark: overlay más oscuro */
html[data-bs-theme="dark"] .hero-overlay {
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
}

/* Tema light: overlay blanco/claro */
html[data-bs-theme="light"] .hero-overlay {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.7) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0.7) 100%
    );
}

html[data-bs-theme="light"] #inicio h1,
html[data-bs-theme="light"] #inicio h2,
html[data-bs-theme="light"] #inicio p {
    color: #212529;
    text-shadow: none;
}

#inicio .container-xl {
    z-index: 2;
}

.z-1 {
    position: relative;
    z-index: 2;
}

/* ===== HERO RESPONSIVE ===== */
@media (max-width: 768px) {
    #inicio {
        min-height: 500px;
    }
}

/* ===== CARDS INTERACTIVAS ===== */
.hover-card {
    transition: transform var(--transition-duration), box-shadow var(--transition-duration), background-color var(--transition-duration);
}

.hover-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}

.hover-item {
    transition: background-color var(--transition-duration), padding-left var(--transition-duration);
    border-radius: 0.5rem;
}

html[data-bs-theme="light"] .hover-item:hover {
    background-color: #f0f8ff;
}

html[data-bs-theme="dark"] .hover-item:hover {
    background-color: #2d3748;
}

/* ===== GRÁFICOS ===== */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    height: 400px;
    max-height: 450px;
}

@media (max-width: 640px) {
    .chart-container {
        height: 350px;
        max-height: 400px;
    }
}

/* ===== BOTONES DE GRÁFICOS ===== */
.active-chart-btn {
    background-color: var(--primary-color);
    color: white;
    transition: all var(--transition-duration);
}

.active-chart-btn:hover {
    background-color: #0056b3;
}

.inactive-chart-btn {
    background-color: #e9ecef;
    color: #212529;
    transition: all var(--transition-duration);
}

.inactive-chart-btn:hover {
    background-color: #dee2e6;
}

html[data-bs-theme="dark"] .inactive-chart-btn {
    background-color: #2d3748;
    color: #e9ecef;
}

html[data-bs-theme="dark"] .inactive-chart-btn:hover {
    background-color: #404854;
}

/* ===== TIMELINE ===== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -17px;
    top: 0;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border: 4px solid var(--bs-body-bg);
    border-radius: 50%;
    transition: all var(--transition-duration);
}

.timeline-item:hover .timeline-marker {
    width: 24px;
    height: 24px;
    left: -20px;
    box-shadow: 0 0 0 8px rgba(13, 110, 253, 0.1);
}

.timeline-content {
    transition: all var(--transition-duration);
}

/* ===== LOGOS DE EMPRESAS ===== */
.company-logo {
    max-width: 60px;
    height: auto;
    border-radius: 8px;
    transition: transform var(--transition-duration), filter var(--transition-duration);
}

.company-logo:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

html[data-bs-theme="dark"] .company-logo {
    filter: brightness(0.9);
}

html[data-bs-theme="dark"] .company-logo:hover {
    filter: brightness(1.1);
}

/* ===== BOOTSTRAP CAROUSEL (LINKEDIN & REVIEWS) ===== */
#linkedinCarousel, #reviewsCarousel {
    padding: 1rem 0;
}

.carousel-inner {
    border-radius: 8px;
    overflow: visible; /* Permitir sombras fuera */
    padding: 10px 50px; /* Padding lateral para las flechas */
}

.carousel-item {
    padding: 1rem 0;
    transition: transform 1.5s ease-in-out, opacity 1.5s ease-in-out; /* Transición más lenta */
}

/* Estilos de controles (flechas) */
.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(13, 110, 253, 0.7);
    border-radius: 50%;
    padding: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    background-color: rgba(13, 110, 253, 1);
}

html[data-bs-theme="dark"] .carousel-control-prev-icon,
html[data-bs-theme="dark"] .carousel-control-next-icon {
    background-color: rgba(13, 110, 253, 0.8);
}

/* CARRUSEL RESPONSIVE */
@media (max-width: 992px) {
    .carousel-inner {
        padding: 0 40px;
    }
}

@media (max-width: 768px) {
    .carousel-inner {
        padding: 0 20px;
    }
    .carousel-control-prev,
    .carousel-control-next {
        width: 30px;
    }
}

/* ===== CERTIFICADOS ===== */
.certificate-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    transition: all var(--transition-duration);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-bs-theme="dark"] .certificate-thumbnail {
    background: linear-gradient(135deg, #3a4556 0%, #2d354a 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
}

.certificate-thumbnail:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

html[data-bs-theme="dark"] .certificate-thumbnail:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.certificate-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    padding: 0;
}

.certificate-link {
    text-decoration: none !important;
    color: inherit;
    display: block;
}

.certificate-title {
    font-weight: 600;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--bs-body-color);
    transition: color var(--transition-duration);
}

.certificate-link:hover .certificate-title {
    color: var(--primary-color);
}

/* ===== BADGES ===== */
.badge {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    transition: all var(--transition-duration);
}

.badge:hover {
    transform: scale(1.05);
}

html[data-bs-theme="dark"] .badge {
    filter: brightness(0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

html[data-bs-theme="dark"] .badge:hover {
    filter: brightness(1);
    border-color: rgba(255, 255, 255, 0.25);
}

.bg-orange {
    background-color: #FD7E14 !important;
    color: #ffffff !important;
}

/* ===== SECCIONES ===== */
section {
    transition: background-color var(--transition-duration);
}

html[data-bs-theme="light"] section {
    background-color: transparent;
}

html[data-bs-theme="light"] .bg-body-secondary {
    background-color: #f8f9fa !important;
}

html[data-bs-theme="dark"] section {
    background-color: transparent;
}

html[data-bs-theme="dark"] .bg-body-secondary {
    background-color: #2d2d2d !important;
}

/* ===== CARDS ===== */
.card {
    transition: all var(--transition-duration);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-bs-theme="dark"] .card {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: #2d3748;
}

/* ===== SMOOTH SCROLL ===== */
html {
    scroll-behavior: smooth;
}

/* ===== FOOTER ===== */
footer {
    transition: background-color var(--transition-duration);
}

/* ===== RESPONSIVOS ===== */
@media (max-width: 768px) {
    .timeline {
        padding-left: 1rem;
    }
    .timeline::before {
        left: -4px;
    }
    .timeline-marker {
        left: -12px;
    }
    .timeline-item:hover .timeline-marker {
        left: -15px;
    }
}

/* ===== UTILIDADES ===== */
.space-y-2 > * + * {
    margin-top: 0.5rem;
}

.text-light {
    color: #f8f9fa;
}

html[data-bs-theme="dark"] .text-light {
    color: #e9ecef;
}

.d-none {
    display: none !important;
}

.contact-footer-max-width {
    max-width: 700px;
    margin: auto;
}

.max-width-700 {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== INFINITE SLIDER (TESTIMONIOS) ===== */
.infinite-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 20px 0;
    /* Efecto de desvanecimiento en los bordes para suavidad */
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.infinite-slider-track {
    display: flex;
    gap: 30px; /* Espacio entre tarjetas */
    width: max-content; /* El ancho se ajusta al contenido */
    animation: scroll 40s linear infinite; /* 40s es la velocidad, ajústalo a tu gusto */
}

/* Pausar animación al pasar el mouse */
.infinite-slider-track:hover {
    animation-play-state: paused;
}

/* La tarjeta individual dentro del slider */
.review-card {
    width: 400px; /* Ancho fijo para cada tarjeta */
    flex-shrink: 0; /* Evita que se encojan */
    white-space: normal; /* Permite que el texto salte de línea */
}

/* Ajuste para móviles */
@media (max-width: 768px) {
    .review-card {
        width: 300px;
    }
}

/* La animación clave */
@keyframes scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* Se mueve el 50% porque duplicaremos el contenido */
    }
}

/* ===== INFINITE SLIDER (COMÚN) ===== */
.infinite-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 20px 0;
    /* Efecto fade en los bordes */
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.infinite-slider-track {
    display: flex;
    gap: 30px;
    width: max-content;
    /* CAMBIO DE VELOCIDAD AQUÍ: De 40s a 80s */
    animation: scroll 80s linear infinite; 
}

.infinite-slider-track:hover {
    animation-play-state: paused;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ESTILOS ESPECÍFICOS: Reviews */
.review-card {
    width: 400px;
    flex-shrink: 0;
    white-space: normal;
}

/* ESTILOS ESPECÍFICOS: Certificados */
.cert-slide-item {
    width: 280px; /* Ancho ideal para miniaturas verticales */
    flex-shrink: 0;
}

/* Ajustes Responsive */
@media (max-width: 768px) {
    .review-card { width: 300px; }
    .cert-slide-item { width: 220px; }
}

/* =========================================================
/* NUEVA SECCIÓN: CARRUSEL 3D (SKILLS)
/* ========================================================= */

.carousel-3d-scene {
    position: relative;
    width: 210px;
    height: 140px;
    margin: 80px auto;
    perspective: 1000px;
}

.carousel-3d {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    animation: rotateCarousel 30s linear infinite;
    cursor: grab;
}

.carousel-3d:hover {
    animation-play-state: paused;
}

@keyframes rotateCarousel {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

.carousel-3d-item {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 190px;
    height: 120px;
    background: var(--bs-body-bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    backface-visibility: hidden; /* Oculta la cara trasera */
    transition: background-color var(--transition-duration), border-color var(--transition-duration);
}

html[data-bs-theme="dark"] .carousel-3d-item {
    background: var(--bs-tertiary-bg);
    border-color: rgba(255, 255, 255, 0.15);
}

.carousel-3d-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    transition: filter var(--transition-duration);
}

.carousel-3d-item p {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bs-secondary-color);
    margin: 0;
}

/* Manejo del Dark Mode para los Logos (INVERSIÓN) */
html[data-bs-theme="dark"] .carousel-3d-item img {
    filter: invert(0.8) hue-rotate(180deg) brightness(1.2) contrast(1.1);
}

/* Excluir logos que ya son claros o se ven mal invertidos */
html[data-bs-theme="dark"] .carousel-3d-item img[alt*="Bootstrap"],
html[data-bs-theme="dark"] .carousel-3d-item img[alt*="BigQuery"],
html[data-bs-theme="dark"] .carousel-3d-item img[alt*="JavaScript"] {
    filter: none;
}

/* =========================================================
/* NUEVA SECCIÓN: BANNER ANIMADO & EXTRAS
/* ========================================================= */

/* Animación del Gradiente */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Banner Gradiente Animado (LiveOps) */
.banner-container {
    padding: 4rem 1rem; /* Ajustado para que tenga buen alto como Hero */
    text-align: center;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    /* Usa las variables del banner */
    background: linear-gradient(90deg, var(--banner-gradient-start), var(--banner-gradient-mid), var(--banner-gradient-end));
    background-size: 300% 300%; /* Aumentado para que el movimiento sea fluido */
    animation: gradientShift 12s ease infinite alternate;
    position: relative;
    overflow: hidden;
}

/* Switch de Bootstrap personalizado (según tu snippet) */
.form-check-input {
    width: 3em; 
    height: 1.5em;
    cursor: pointer;
}

/* ===== SISTEMA DE PESTAÑAS (PROJECT PILLS) ===== */
.project-nav-pills {
    position: sticky;
    top: 56px;
    z-index: 99;
}

.project-pills {
    margin-bottom: 0;
}

.project-pills .nav-link {
    background-color: #f0f0f0;
    color: #212529;
    border: none;
    font-weight: 500;
    transition: all var(--transition-duration) ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

html[data-bs-theme="dark"] .project-pills .nav-link {
    background-color: #3a3f47;
    color: #e9ecef;
}

.project-pills .nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: #e0e0e0;
}

html[data-bs-theme="dark"] .project-pills .nav-link:hover {
    background-color: #4a505a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-pills .nav-link.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.project-pills .nav-link.active:hover {
    background-color: #0056b3;
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.4);
}

/* ===== MONITOR FRAME (Diseño de Pantalla de PC) ===== */
.monitor-frame {
    position: relative;
    background: var(--bs-body-bg);
    border: 16px solid #1a1a1a;
    border-bottom-width: 50px;
    border-radius: 12px;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
    transition: all var(--transition-duration);
}

html[data-bs-theme="dark"] .monitor-frame {
    border-color: #0a0a0a;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Pie del monitor (mentón) */
.monitor-frame::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 20px;
    background: linear-gradient(to bottom, #1a1a1a, #0d0d0d);
    border-radius: 0 0 20px 20px;
}

html[data-bs-theme="dark"] .monitor-frame::after {
    background: linear-gradient(to bottom, #0a0a0a, #000);
}

.monitor-frame img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform var(--transition-duration) ease;
}

/* Efecto Hover: Elevación del Monitor y Zoom de Imagen */
.row:has(.monitor-frame):hover .monitor-frame {
    transform: translateY(-8px);
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.1),
        0 30px 80px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .row:has(.monitor-frame):hover .monitor-frame {
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 30px 80px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.row:has(.monitor-frame):hover .monitor-frame img {
    transform: scale(1.03);
}

/* ===== CHART CONTAINER ===== */
.chart-container-custom {
    position: relative;
    height: 300px;
}

@media (max-width: 640px) {
    .chart-container-custom {
        height: 250px;
    }
}

/* ===== BANNER GRADIENTS ===== */
.banner-gradient-laboral {
    background: linear-gradient(45deg, #0d6efd, #6610f2);
}

.banner-gradient-academico {
    background: linear-gradient(45deg, #6610f2, #0dcaf0);
}

/* ===== TABS RESPONSIVA ===== */
@media (max-width: 768px) {
    .project-pills {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }

    .project-pills .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 1rem !important;
    }

    .monitor-frame {
        border-width: 12px;
        border-bottom-width: 40px;
    }

    .monitor-frame::after {
        width: 80px;
        height: 16px;
    }
}