/**
 * Nombre: timeline-mejoras.css
 * Proposito: Estilos para seccion de timeline de mejoras y evoluciones del sistema
 * Fecha: 2025-10-23
 * Version: 2.0 - Compacta con scroll interno y elementos expandibles
 */

/* ========================================
   SECCION TIMELINE - Contenedor Principal
   ======================================== */
.timeline-section {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    position: relative;
    overflow: hidden;
    padding: 60px 0;
}

.timeline-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" xmlns="http://www.w3.org/2000/svg"><circle cx="30" cy="30" r="1.5" fill="white" opacity="0.05"/></svg>');
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
}

.timeline-section .section-container {
    position: relative;
    z-index: 10;
}

.timeline-section .section-title {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
}

.timeline-section .section-subtitle {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

/* ========================================
   ESTADISTICAS COMPACTAS
   ======================================== */
.timeline-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
}

.stat-box .stat-icon {
    font-size: 24px;
    color: #3498db;
    margin-bottom: 8px;
}

.stat-box .stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin: 5px 0;
    line-height: 1;
}

.stat-box .stat-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   CONTENEDOR CON SCROLL INTERNO
   ======================================== */
.timeline-wrapper {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Estilo personalizado del scrollbar */
.timeline-wrapper::-webkit-scrollbar {
    width: 8px;
}

.timeline-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.timeline-wrapper::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.6);
    border-radius: 10px;
}

.timeline-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.8);
}

/* ========================================
   TIMELINE COMPACTO
   ======================================== */
.timeline-container {
    position: relative;
    padding: 20px 0 20px 40px;
}

/* Linea vertical izquierda */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(52, 152, 219, 0.6) 5%, 
        rgba(52, 152, 219, 0.6) 95%, 
        transparent 100%
    );
}

/* ========================================
   ITEMS COMPACTOS DEL TIMELINE
   ======================================== */
.timeline-item {
    position: relative;
    margin-bottom: 25px;
    opacity: 0;
    animation: fadeInTimeline 0.6s ease forwards;
}

.timeline-item:nth-child(n) {
    animation-delay: calc(0.1s * var(--item-index, 1));
}

@keyframes fadeInTimeline {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Punto en la linea */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 8px;
    width: 12px;
    height: 12px;
    background: #3498db;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-item:hover::before {
    transform: scale(1.3);
    box-shadow: 0 0 0 6px rgba(52, 152, 219, 0.3);
}

/* ========================================
   HEADER COLAPSABLE
   ======================================== */
.timeline-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.timeline-header:hover {
    background: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateX(3px);
}

.timeline-header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.timeline-date-compact {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
}

.timeline-title-compact {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    flex: 1;
}

.timeline-icon {
    font-size: 18px;
    color: #3498db;
    transition: transform 0.3s ease;
}

.timeline-item.expanded .timeline-icon {
    transform: rotate(90deg);
}

/* Badge contador de mejoras */
.mejoras-count {
    background: rgba(52, 152, 219, 0.2);
    color: #2980b9;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

/* ========================================
   CONTENIDO EXPANDIBLE
   ======================================== */
.timeline-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.timeline-item.expanded .timeline-details {
    max-height: 1000px;
}

.timeline-content-inner {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 10px 10px;
    padding: 15px;
    margin-top: -5px;
}

/* ========================================
   LISTA COMPACTA DE MEJORAS
   ======================================== */
.mejoras-lista-compact {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.mejoras-lista-compact li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(52, 152, 219, 0.05);
    border-left: 2px solid #3498db;
    border-radius: 4px;
    font-size: 13px;
    color: #2c3e50;
    line-height: 1.4;
}

.mejoras-lista-compact li i {
    color: #3498db;
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* ========================================
   BADGES COMPACTOS
   ======================================== */
.badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.categoria-badge-compact {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-ux { 
    background: rgba(46, 204, 113, 0.2); 
    color: #27ae60; 
}

.badge-performance { 
    background: rgba(241, 196, 15, 0.2); 
    color: #f39c12; 
}

.badge-features { 
    background: rgba(52, 152, 219, 0.2); 
    color: #2980b9; 
}

.badge-security { 
    background: rgba(231, 76, 60, 0.2); 
    color: #c0392b; 
}

.badge-infrastructure { 
    background: rgba(155, 89, 182, 0.2); 
    color: #8e44ad; 
}

.badge-fix { 
    background: rgba(230, 126, 34, 0.2); 
    color: #d35400; 
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .timeline-wrapper {
        max-height: 500px;
        padding: 15px;
    }
    
    .timeline-container {
        padding-left: 30px;
    }
    
    .timeline-item::before {
        left: -27px;
    }
    
    .timeline-header {
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timeline-header-left {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .timeline-title-compact {
        font-size: 14px;
    }
    
    .timeline-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-box .stat-number {
        font-size: 28px;
    }
    
    .timeline-wrapper {
        max-height: 400px;
    }
    
    .mejoras-lista-compact li {
        font-size: 12px;
    }
}

.timeline-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" xmlns="http://www.w3.org/2000/svg"><circle cx="30" cy="30" r="1.5" fill="white" opacity="0.05"/></svg>');
    opacity: 0.4;
    pointer-events: none;
}

.timeline-section .section-container {
    position: relative;
    z-index: 1;
}

.timeline-section .section-title {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
}

.timeline-section .section-subtitle {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: 50px;
}

/* ========================================
   ESTADISTICAS GENERALES
   ======================================== */
.timeline-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.stat-box .stat-icon {
    font-size: 36px;
    color: #3498db;
    margin-bottom: 10px;
}

.stat-box .stat-number {
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    margin: 10px 0 5px;
    line-height: 1;
}

.stat-box .stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   LINEA DE TIEMPO
   ======================================== */
.timeline-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 0;
}

/* Linea vertical central */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, 
        transparent 0%, 
        rgba(52, 152, 219, 0.8) 10%, 
        rgba(52, 152, 219, 0.8) 90%, 
        transparent 100%
    );
    transform: translateX(-50%);
}

/* ========================================
   ITEMS DEL TIMELINE
   ======================================== */
.timeline-item {
    position: relative;
    margin-bottom: 60px;
    opacity: 0;
    animation: fadeInTimeline 0.8s ease forwards;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }
.timeline-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInTimeline {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Items a la izquierda */
.timeline-item.left .timeline-content {
    margin-right: 55%;
    text-align: right;
}

/* Items a la derecha */
.timeline-item.right .timeline-content {
    margin-left: 55%;
    text-align: left;
}

/* ========================================
   FECHA DEL TIMELINE
   ======================================== */
.timeline-date {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    white-space: nowrap;
    z-index: 2;
}

/* Punto en la linea */
.timeline-date::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: #fff;
    border: 4px solid #3498db;
    border-radius: 50%;
    z-index: -1;
}

/* ========================================
   CONTENIDO DEL TIMELINE
   ======================================== */
.timeline-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-top: 50px;
    transition: all 0.3s ease;
}

.timeline-content:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    transform: translateY(-3px);
}

.timeline-month {
    display: inline-block;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.timeline-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    margin: 10px 0 15px;
}

.timeline-description {
    font-size: 14px;
    color: #7f8c8d;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ========================================
   LISTA DE MEJORAS
   ======================================== */
.mejoras-lista {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mejoras-lista li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(52, 152, 219, 0.05);
    border-left: 3px solid #3498db;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.mejoras-lista li:hover {
    background: rgba(52, 152, 219, 0.1);
    transform: translateX(5px);
}

.mejoras-lista li i {
    color: #3498db;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.mejoras-lista li span {
    font-size: 14px;
    color: #2c3e50;
    line-height: 1.5;
}

/* ========================================
   BADGES DE CATEGORIAS
   ======================================== */
.categoria-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin: 5px 5px 5px 0;
    letter-spacing: 0.5px;
}

.badge-ux { 
    background: rgba(46, 204, 113, 0.2); 
    color: #27ae60; 
}

.badge-performance { 
    background: rgba(241, 196, 15, 0.2); 
    color: #f39c12; 
}

.badge-features { 
    background: rgba(52, 152, 219, 0.2); 
    color: #2980b9; 
}

.badge-security { 
    background: rgba(231, 76, 60, 0.2); 
    color: #c0392b; 
}

.badge-infrastructure { 
    background: rgba(155, 89, 182, 0.2); 
    color: #8e44ad; 
}

/* ========================================
   METRICAS DE IMPACTO
   ======================================== */
.impacto-metricas {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(0, 0, 0, 0.05);
}

.metrica-item {
    text-align: center;
}

.metrica-valor {
    font-size: 28px;
    font-weight: 700;
    color: #3498db;
    line-height: 1;
}

.metrica-label {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 5px;
    text-transform: uppercase;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    /* Linea a la izquierda en mobile */
    .timeline-container::before {
        left: 20px;
    }
    
    /* Todos los items alineados a la derecha */
    .timeline-item.left .timeline-content,
    .timeline-item.right .timeline-content {
        margin-left: 50px;
        margin-right: 0;
        text-align: left;
    }
    
    /* Fecha a la izquierda */
    .timeline-date {
        left: 20px;
        transform: none;
    }
    
    .timeline-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-box .stat-number {
        font-size: 36px;
    }
    
    .timeline-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .timeline-content {
        padding: 20px;
    }
    
    .mejoras-lista li {
        font-size: 13px;
    }
    
    .impacto-metricas {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   ANIMACIONES ADICIONALES
   ======================================== */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(52, 152, 219, 0);
    }
}

.timeline-date::before {
    animation: pulse-glow 2s infinite;
}

/* ========================================
   ESTADOS DE CARGA Y ERROR
   ======================================== */
.timeline-loading,
.timeline-error {
    text-align: center;
    padding: 60px 20px;
    color: white;
}

.timeline-loading i,
.timeline-error i {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.timeline-loading i {
    color: #3498db;
}

.timeline-error i {
    color: #e74c3c;
}

.timeline-loading p,
.timeline-error p {
    font-size: 18px;
    margin: 10px 0;
}

.error-details {
    font-size: 14px;
    opacity: 0.7;
    font-family: monospace;
}

/* ========================================
   ESTILOS ADICIONALES PARA RENDERIZADO DINAMICO
   ======================================== */
.timeline-description-compact {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.metrica-valor-compact {
    font-size: 24px;
    font-weight: 700;
    color: #3498db;
    margin-bottom: 5px;
}

.metrica-label-compact {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tecnologias-usadas {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
    font-size: 13px;
    color: #7f8c8d;
}

.tecnologias-usadas strong {
    color: #2c3e50;
    margin-right: 5px;
}

/* ========================================
   FORZAR VISIBILIDAD - Contenido Dinamico
   ======================================== */
#timeline-dynamic-content {
    position: relative !important;
    z-index: 10 !important;
    min-height: 100px !important;
}

#timeline-dynamic-content .timeline-stats {
    opacity: 1 !important;
    visibility: visible !important;
    display: grid !important;
}

#timeline-dynamic-content .timeline-wrapper {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    position: relative !important;
    z-index: 5 !important;
}

#timeline-dynamic-content .timeline-container {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

#timeline-dynamic-content .timeline-item {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    animation: none !important;
}

#timeline-dynamic-content .stat-box {
    opacity: 1 !important;
    visibility: visible !important;
}

