/**
 * NCode Events Calendar - Timeline Widget Styles
 * Timeline Vertical de Eventos con Infinite Scroll
 */

/* =============================================
   Widget Container
   ============================================= */
.ncode-events-timeline-widget {
    padding: 20px 0;
    max-width: 900px;
    margin: 0 auto;
}

.ncode-timeline-section-title {
    font-size: 28px;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 40px;
    text-align: center;
}

.ncode-no-events-msg {
    text-align: center;
    color: #646970;
    font-style: italic;
    padding: 40px;
    background: #f6f7f7;
    border-radius: 8px;
}

/* =============================================
   Timeline Container
   ============================================= */
.ncode-timeline-container {
    position: relative;
    padding-left: 30px;
}

/* Línea vertical del timeline */
.ncode-timeline-line {
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e5e7eb 0%, #e5e7eb 90%, transparent 100%);
}

/* =============================================
   Timeline Items
   ============================================= */
.ncode-timeline-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ncode-timeline-item {
    position: relative;
    padding-bottom: 30px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Animación de entrada para nuevos items */
.ncode-timeline-item-new {
    animation: ncode-timeline-fade-in 0.5s ease forwards;
}

@keyframes ncode-timeline-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Punto del timeline */
.ncode-timeline-dot {
    position: absolute;
    left: -24px;
    top: 20px;
    width: 14px;
    height: 14px;
    background: #2563eb;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #2563eb;
    z-index: 2;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ncode-timeline-item:hover .ncode-timeline-dot {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.3);
}

/* Contenido del item */
.ncode-timeline-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* =============================================
   Fecha Lateral
   ============================================= */
.ncode-timeline-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding-top: 12px;
    flex-shrink: 0;
}

.ncode-timeline-date .ncode-date-day {
    font-size: 28px;
    font-weight: 700;
    color: #2563eb;
    line-height: 1;
}

.ncode-timeline-date .ncode-date-month {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* =============================================
   Timeline Card
   ============================================= */
.ncode-timeline-card {
    display: flex;
    flex: 1;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 120px;
}

.ncode-timeline-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.ncode-timeline-card.ncode-card-expired {
    opacity: 0.8;
}

/* Card Image */
.ncode-timeline-image {
    position: relative;
    width: 150px;
    min-width: 150px;
    height: 120px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}

.ncode-timeline-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ncode-timeline-card:hover .ncode-timeline-image img {
    transform: scale(1.05);
}

.ncode-timeline-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0e7ff 0%, #f0f6fc 100%);
}

.ncode-timeline-placeholder span {
    font-size: 36px;
    opacity: 0.5;
}

.ncode-timeline-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #d63638;
    color: #fff;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Card Info */
.ncode-timeline-info {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.ncode-timeline-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ncode-timeline-location {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.ncode-timeline-icon {
    font-size: 14px;
}

.ncode-timeline-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================
   Year Separator
   ============================================= */
.ncode-timeline-year-separator {
    position: relative;
    padding: 20px 0 30px;
    margin-left: -30px;
}

.ncode-timeline-year {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #374151;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 20px;
    position: relative;
    left: 0;
    z-index: 3;
    letter-spacing: 1px;
}

/* =============================================
   Loading Indicator
   ============================================= */
.ncode-timeline-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ncode-timeline-loader.active {
    opacity: 1;
}

.ncode-timeline-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ncode-spin 0.8s linear infinite;
}

@keyframes ncode-spin {
    to {
        transform: rotate(360deg);
    }
}

.ncode-timeline-loading-text {
    font-size: 14px;
    color: #6b7280;
}

/* End indicator */
.ncode-timeline-end {
    text-align: center;
    padding: 30px 20px;
    color: #9ca3af;
    font-size: 14px;
    font-style: italic;
}

.ncode-timeline-end span {
    display: inline-block;
    padding: 8px 20px;
    background: #f3f4f6;
    border-radius: 20px;
}

/* =============================================
   Responsive - Tablet
   ============================================= */
@media (max-width: 768px) {
    .ncode-events-timeline-widget {
        padding: 15px;
    }
    
    .ncode-timeline-section-title {
        font-size: 22px;
        margin-bottom: 30px;
    }
    
    .ncode-timeline-container {
        padding-left: 25px;
    }
    
    .ncode-timeline-line {
        left: 5px;
    }
    
    .ncode-timeline-dot {
        left: -20px;
        width: 12px;
        height: 12px;
    }
    
    .ncode-timeline-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .ncode-timeline-date {
        flex-direction: row;
        gap: 8px;
        padding-top: 0;
        min-width: auto;
    }
    
    .ncode-timeline-date .ncode-date-day {
        font-size: 20px;
    }
    
    .ncode-timeline-date .ncode-date-month {
        font-size: 14px;
        margin-top: 0;
    }
    
    .ncode-timeline-card {
        flex-direction: column;
    }
    
    .ncode-timeline-image {
        width: 100%;
        height: 160px;
    }
    
    .ncode-timeline-info {
        padding: 15px;
    }
    
    .ncode-timeline-year-separator {
        margin-left: -25px;
    }
}

/* =============================================
   Responsive - Mobile
   ============================================= */
@media (max-width: 480px) {
    .ncode-events-timeline-widget {
        padding: 10px;
    }
    
    .ncode-timeline-section-title {
        font-size: 20px;
        margin-bottom: 25px;
    }
    
    .ncode-timeline-container {
        padding-left: 20px;
    }
    
    .ncode-timeline-line {
        left: 4px;
        width: 2px;
    }
    
    .ncode-timeline-dot {
        left: -16px;
        width: 10px;
        height: 10px;
        border-width: 2px;
    }
    
    .ncode-timeline-item {
        padding-bottom: 20px;
    }
    
    .ncode-timeline-image {
        height: 140px;
    }
    
    .ncode-timeline-title {
        font-size: 15px;
    }
    
    .ncode-timeline-excerpt {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }
    
    .ncode-timeline-year-separator {
        margin-left: -20px;
        padding: 15px 0 20px;
    }
    
    .ncode-timeline-year {
        font-size: 13px;
        padding: 6px 16px;
    }
}

/* =============================================
   Print Styles
   ============================================= */
@media print {
    .ncode-timeline-loader,
    .ncode-timeline-end {
        display: none;
    }
    
    .ncode-timeline-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}

/* =============================================
   Reduced Motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
    .ncode-timeline-item,
    .ncode-timeline-item-new,
    .ncode-timeline-card,
    .ncode-timeline-dot,
    .ncode-timeline-image img {
        transition: none;
        animation: none;
    }
    
    .ncode-timeline-spinner {
        animation: none;
        border-top-color: transparent;
    }
}
