/* TED Latest Videos Styles */
.ted-latest-videos {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: var(--ted-space-2xl) 0;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.ted-latest-videos::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ted-primary), transparent);
}

.ted-latest-grid {
    display: grid;
    gap: var(--ted-space-lg);
    margin-bottom: var(--ted-space-xl);
    width: 100%;
}

/* Responsive grid based on data attributes */
.ted-latest-grid[data-columns="2"] { 
    grid-template-columns: repeat(2, 1fr); 
}
.ted-latest-grid[data-columns="3"] { 
    grid-template-columns: repeat(3, 1fr); 
}
.ted-latest-grid[data-columns="4"] { 
    grid-template-columns: repeat(4, 1fr); 
}
.ted-latest-grid[data-columns="5"] { 
    grid-template-columns: repeat(5, 1fr); 
}
.ted-latest-grid[data-columns="6"] { 
    grid-template-columns: repeat(6, 1fr); 
}

.ted-latest-item {
    background: var(--ted-white);
    border-radius: var(--ted-radius-xl);
    overflow: hidden;
    box-shadow: var(--ted-shadow-lg);
    transition: all 0.6s var(--ted-ease);
    position: relative;
    opacity: 0;
    transform: translateY(30px);
}

.ted-latest-item.ted-animated {
    opacity: 1;
    transform: translateY(0);
}

/* Animation types */
.ted-latest-grid[data-animation="fade"] .ted-latest-item.ted-animated {
    animation: tedFadeIn 0.8s var(--ted-ease);
}

.ted-latest-grid[data-animation="slide"] .ted-latest-item.ted-animated {
    animation: tedSlideIn 0.8s var(--ted-ease);
}

.ted-latest-grid[data-animation="zoom"] .ted-latest-item.ted-animated {
    animation: tedZoomIn 0.8s var(--ted-ease);
}

.ted-latest-grid[data-animation="bounce"] .ted-latest-item.ted-animated {
    animation: tedBounceIn 0.8s var(--ted-ease);
}

.ted-latest-grid[data-animation="flip"] .ted-latest-item.ted-animated {
    animation: tedFlipIn 0.8s var(--ted-ease);
}

.ted-latest-grid[data-animation="all"] .ted-latest-item.ted-animated {
    animation: tedMixedIn 1s var(--ted-ease);
}

.ted-latest-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--ted-shadow-xl);
}

.ted-latest-thumb {
    position: relative;
    overflow: hidden;
}

.ted-thumb-container {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.ted-thumb-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ted-ease);
}

.ted-latest-item:hover .ted-thumb-image {
    transform: scale(1.1);
}

.ted-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--ted-primary-light) 0%, var(--ted-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ted-placeholder-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.ted-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s var(--ted-ease);
}

.ted-latest-item:hover .ted-video-overlay {
    opacity: 1;
}

.ted-play-button {
    width: 50px;
    height: 50px;
    background: var(--ted-primary);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ted-ease);
    transform: scale(0.9);
}

.ted-latest-item:hover .ted-play-button {
    transform: scale(1);
}

.ted-play-button:hover {
    background: var(--ted-primary-dark);
    transform: scale(1.1);
}

.ted-video-duration {
    position: absolute;
    bottom: var(--ted-space-sm);
    left: var(--ted-space-sm);
    background: rgba(0, 0, 0, 0.8);
    color: var(--ted-white);
    padding: 0.25rem 0.5rem;
    border-radius: var(--ted-radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.ted-new-badge {
    position: absolute;
    top: var(--ted-space-sm);
    right: var(--ted-space-sm);
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: var(--ted-white);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: tedPulse 2s infinite;
}

.ted-latest-info {
    padding: var(--ted-space-lg);
}

.ted-video-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ted-gray-900);
    margin: 0 0 var(--ted-space-sm);
    line-height: 1.4;
}

.ted-video-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s var(--ted-ease);
}

.ted-video-title a:hover {
    color: var(--ted-primary);
}

.ted-video-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--ted-space-sm);
    gap: var(--ted-space-sm);
}

.ted-speaker-info {
    flex: 1;
}

.ted-speaker-name {
    display: block;
    font-weight: 600;
    color: var(--ted-primary);
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.ted-video-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--ted-gray-600);
}

.ted-views-count,
.ted-publish-date {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.ted-video-category {
    margin-bottom: var(--ted-space-sm);
}

.ted-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--ted-gray-100);
    color: var(--ted-gray-700);
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s var(--ted-ease);
}

.ted-category-tag:hover {
    background: var(--ted-primary-light);
    color: var(--ted-white);
}

.ted-video-actions {
    display: flex;
    gap: var(--ted-space-xs);
    border-top: 1px solid var(--ted-gray-100);
    padding-top: var(--ted-space-md);
}

.ted-action-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    color: var(--ted-gray-600);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--ted-radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s var(--ted-ease);
    flex: 1;
    justify-content: center;
}

.ted-action-btn:hover {
    background: var(--ted-gray-50);
    color: var(--ted-primary);
    transform: translateY(-1px);
}

.ted-action-btn.ted-liked {
    color: var(--ted-primary);
}

.ted-action-btn.ted-saved {
    color: var(--ted-primary);
}

.ted-action-text {
    font-size: 0.7rem;
}

.ted-section-footer {
    text-align: center;
    margin-top: var(--ted-space-xl);
}

.ted-no-videos {
    text-align: center;
    padding: var(--ted-space-2xl);
    color: var(--ted-gray-600);
    grid-column: 1 / -1;
}

.ted-empty-icon {
    font-size: 3rem;
    margin-bottom: var(--ted-space-md);
    opacity: 0.5;
}

.ted-no-videos h3 {
    color: var(--ted-gray-700);
    margin-bottom: var(--ted-space-sm);
}

/* Animation Keyframes */
@keyframes tedFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tedSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tedZoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes tedBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes tedFlipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateY(0deg);
    }
}

@keyframes tedMixedIn {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.8) rotate(-5deg);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-10px) scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

@keyframes tedPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Staggered animation delays */
.ted-latest-item:nth-child(1) { animation-delay: 0.1s; }
.ted-latest-item:nth-child(2) { animation-delay: 0.2s; }
.ted-latest-item:nth-child(3) { animation-delay: 0.3s; }
.ted-latest-item:nth-child(4) { animation-delay: 0.4s; }
.ted-latest-item:nth-child(5) { animation-delay: 0.5s; }
.ted-latest-item:nth-child(6) { animation-delay: 0.6s; }
.ted-latest-item:nth-child(7) { animation-delay: 0.7s; }
.ted-latest-item:nth-child(8) { animation-delay: 0.8s; }
.ted-latest-item:nth-child(9) { animation-delay: 0.9s; }
.ted-latest-item:nth-child(10) { animation-delay: 1s; }
.ted-latest-item:nth-child(11) { animation-delay: 1.1s; }
.ted-latest-item:nth-child(12) { animation-delay: 1.2s; }

/* Responsive Design */
@media (max-width: 1200px) {
    .ted-latest-grid[data-columns="6"] { grid-template-columns: repeat(5, 1fr); }
    .ted-latest-grid[data-columns="5"] { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
    .ted-latest-grid[data-columns="6"],
    .ted-latest-grid[data-columns="5"],
    .ted-latest-grid[data-columns="4"] { 
        grid-template-columns: repeat(3, 1fr); 
    }
}

@media (max-width: 768px) {
    .ted-latest-videos {
        padding: var(--ted-space-xl) 0;
    }
    
    .ted-latest-grid {
        gap: var(--ted-space-md);
    }
    
    .ted-latest-grid[data-columns="6"],
    .ted-latest-grid[data-columns="5"],
    .ted-latest-grid[data-columns="4"],
    .ted-latest-grid[data-columns="3"] { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .ted-latest-info {
        padding: var(--ted-space-md);
    }
    
    .ted-video-meta {
        flex-direction: column;
        gap: var(--ted-space-xs);
    }
    
    .ted-video-stats {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .ted-latest-grid[data-columns="6"],
    .ted-latest-grid[data-columns="5"],
    .ted-latest-grid[data-columns="4"],
    .ted-latest-grid[data-columns="3"],
    .ted-latest-grid[data-columns="2"] { 
        grid-template-columns: 1fr; 
    }
    
    .ted-video-actions {
        flex-direction: column;
        gap: var(--ted-space-xs);
    }
}