/**
 * 13Node Post Carousel - Frontend Styles
 * Author: 13Node
 * URL: https://13node.com
 */

/* ============================================
   Carousel Wrapper & Container
   ============================================ */

.tnpc-carousel-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 3rem;
}

.tnpc-carousel-container {
    position: relative;
    overflow: hidden;
    /* Asegurar que no se vean elementos parciales */
    width: 100%;
}

/* ============================================
   Carousel Track (contenedor de items)
   ============================================ */

.tnpc-carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 1.5rem;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    will-change: transform;
}

.tnpc-carousel-track.tnpc-dragging {
    cursor: grabbing;
    transition: none;
}

.tnpc-carousel-track.tnpc-dragging * {
    pointer-events: none;
}

/* Prevenir selección de texto durante el drag */
.tnpc-carousel-track * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ============================================
   Carousel Items (tarjetas de posts)
   ============================================ */

.tnpc-carousel-item {
    flex: 0 0 calc(33.333% - 1rem);
    min-width: 0;
    max-width: calc(33.333% - 1rem);
    transition: transform 0.3s ease;
}

.tnpc-carousel-item:hover {
    transform: translateY(-5px);
}

.tnpc-carousel-track.tnpc-dragging .tnpc-carousel-item {
    transform: scale(0.98);
}

.tnpc-carousel-track.tnpc-dragging .tnpc-carousel-item:hover {
    transform: scale(0.98);
}

.tnpc-item-inner {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.tnpc-carousel-item:hover .tnpc-item-inner {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Item Image
   ============================================ */

.tnpc-item-image {
    position: relative;
    width: 100%;
    padding-top: 60%;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tnpc-item-image a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.tnpc-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.tnpc-carousel-item:hover .tnpc-item-image img {
    transform: scale(1.08);
}

/* ============================================
   Item Content
   ============================================ */

.tnpc-item-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tnpc-item-category {
    margin-bottom: 0.75rem;
}

.tnpc-item-category a {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tnpc-item-category a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tnpc-item-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
}

.tnpc-item-title a {
    color: #1a202c;
    text-decoration: none;
    transition: color 0.2s ease;
}

.tnpc-item-title a:hover {
    color: #667eea;
}

.tnpc-item-date {
    font-size: 0.875rem;
    color: #718096;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.tnpc-item-date::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 0.5rem;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23718096" stroke-width="2"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
}

.tnpc-item-excerpt {
    color: #4a5568;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    flex: 1;
}

.tnpc-item-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: gap 0.3s ease, color 0.2s ease;
    margin-top: auto;
}

.tnpc-item-link:hover {
    color: #764ba2;
    gap: 0.75rem;
}

.tnpc-item-link svg {
    transition: transform 0.3s ease;
}

.tnpc-item-link:hover svg {
    transform: translateX(3px);
}

/* ============================================
   Navigation Buttons
   ============================================ */

.tnpc-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #1a202c;
}

.tnpc-nav:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.tnpc-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.tnpc-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.tnpc-nav-prev {
    left: 0;
}

.tnpc-nav-next {
    right: 0;
}

/* ============================================
   Dots Navigation
   ============================================ */

.tnpc-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.tnpc-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #cbd5e0;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.tnpc-dot:hover {
    background: #cbd5e0;
    transform: scale(1.2);
}

.tnpc-dot.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    transform: scale(1.3);
}

/* ============================================
   Sin flechas (cuando se ocultan)
   ============================================ */

.tnpc-carousel-wrapper.tnpc-no-arrows {
    padding: 0 !important;
}

.tnpc-carousel-wrapper.tnpc-no-arrows .tnpc-nav {
    display: none !important;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
    .tnpc-carousel-item {
        flex: 0 0 calc(50% - 0.75rem);
        max-width: calc(50% - 0.75rem);
    }
    
    .tnpc-carousel-wrapper {
        padding: 0 2.5rem;
    }
    
    .tnpc-carousel-wrapper.tnpc-no-arrows {
        padding: 0 !important;
    }
}

@media (max-width: 768px) {
    .tnpc-carousel-item {
        flex: 0 0 100%;
        min-width: 100%;
        max-width: 100%;
    }
    
    .tnpc-carousel-wrapper {
        padding: 0 2rem;
    }
    
    .tnpc-carousel-wrapper.tnpc-no-arrows {
        padding: 0 !important;
    }
    
    /* Ocultar overflow en móvil para que no se vean elementos parciales */
    .tnpc-carousel-container {
        overflow: hidden;
        width: 100%;
        padding: 0;
    }
    
    /* Eliminar gap en móvil para evitar espacios */
    .tnpc-carousel-track {
        gap: 0;
    }
    
    .tnpc-nav {
        width: 40px;
        height: 40px;
    }
    
    .tnpc-item-title {
        font-size: 1.125rem;
    }
    
    .tnpc-item-content {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .tnpc-carousel-wrapper {
        padding: 0 1.5rem;
        margin: 1.5rem auto;
    }
    
    .tnpc-carousel-wrapper.tnpc-no-arrows {
        padding: 0 !important;
        margin: 1.5rem 0;
    }
    
    .tnpc-nav {
        width: 36px;
        height: 36px;
    }
    
    .tnpc-nav svg {
        width: 20px;
        height: 20px;
    }
    
    .tnpc-carousel-track {
        gap: 0;
    }
    
    .tnpc-carousel-dots {
        gap: 0.5rem;
        margin-top: 1.5rem;
    }
    
    .tnpc-dot {
        width: 10px;
        height: 10px;
    }
}

/* ============================================
   Accessibility
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .tnpc-carousel-track,
    .tnpc-carousel-item,
    .tnpc-nav,
    .tnpc-dot,
    .tnpc-item-image img {
        transition: none;
    }
}

/* Focus styles for keyboard navigation */
.tnpc-nav:focus-visible,
.tnpc-dot:focus-visible,
.tnpc-item-link:focus-visible,
.tnpc-item-title a:focus-visible,
.tnpc-item-category a:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

