/**
 * 3D Carousel Slider - Professional CSS
 * Dark theme with proper 3D perspective and transforms
 */

/* ============================================
   WRAPPER & CONTAINER
   ============================================ */

.tcs-carousel-wrapper {
    --perspective: 1800px;
    
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 100px 0;
    background: #0a0a0a;
    overflow: hidden;
}

/* Transparent background variant */
.tcs-carousel-wrapper.tcs-transparent-bg {
    background: transparent !important;
}

/* Light theme variant */
.tcs-carousel-wrapper.tcs-theme-light {
    background: #f5f5f7;
}

.tcs-carousel-container {
    position: relative;
    width: 100%;
    height: 580px;
    perspective: var(--perspective);
    perspective-origin: 50% 50%;
    overflow: visible;
    /* Force GPU layer for container */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.tcs-carousel-layout {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
}

/* ============================================
   CAROUSEL ITEMS (CARDS)
   ============================================ */

.tcs-carousel-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 580px;
    max-width: 45vw;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-origin: center center;
    cursor: grab;
    pointer-events: none;
    /* Force GPU layer */
    will-change: transform;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

.tcs-carousel-item.active {
    pointer-events: auto;
    cursor: default;
}

.tcs-carousel-item.active .tcs-item-media {
    cursor: default;
}

.tcs-carousel-item.active:active {
    cursor: grabbing;
}

/* Item Link */
.tcs-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ============================================
   MEDIA CONTAINER (IMAGE/VIDEO HOLDER)
   ============================================ */

.tcs-item-media {
    position: relative;
    width: 100%;
    border-radius: 0px 15px 0px 20px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 3 / 2;
    isolation: isolate;
    /* Smooth rounded corners on GPU */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    /* Force compositing layer */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.tcs-carousel-item.active .tcs-item-media {
    /* Active state - no shadow for clean look on any background */
}

.tcs-item-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    /* Prevent image rendering issues */
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
}

/* ============================================
   VIDEO WRAPPER
   ============================================ */

.tcs-video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    pointer-events: none; /* Disable interaction since videos autoplay */
}

.tcs-video-wrapper iframe,
.tcs-video-wrapper video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 177.78%; /* 16:9 aspect ratio coverage for 3:2 container */
    height: 133.33%;
    transform: translate(-50%, -50%);
    border: none;
    object-fit: cover;
    pointer-events: none;
}

/* Self-hosted video keeps its own aspect ratio */
.tcs-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video poster - shown when video is hidden for performance */
.tcs-video-poster {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #000;
    display: none;
}

/* ============================================
   CONTENT OVERLAY
   ============================================ */

.tcs-item-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.tcs-carousel-item.active:hover .tcs-item-content {
    opacity: 1;
    transform: translateY(0);
}

.tcs-item-title {
    margin: 0 0 10px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.tcs-item-description {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    opacity: 0.9;
}

/* ============================================
   NAVIGATION ARROWS
   ============================================ */

.tcs-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 100;
    padding: 0 20px;
}

.tcs-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 100;
}

.tcs-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.08);
}

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

.tcs-nav-btn.tcs-prev {
    left: 20px;
}

.tcs-nav-btn.tcs-next {
    right: 20px;
}

.tcs-nav-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

/* Light theme navigation */
.tcs-carousel-wrapper.tcs-theme-light .tcs-nav-btn {
    background: rgba(0, 0, 0, 0.08);
    color: #1d1d1f;
}

.tcs-carousel-wrapper.tcs-theme-light .tcs-nav-btn:hover {
    background: rgba(0, 0, 0, 0.15);
}

/* ============================================
   PAGINATION DOTS
   ============================================ */

.tcs-pagination {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 100;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 30px;
}

.tcs-pagination-dot {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.tcs-pagination-dot:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scale(1.2);
}

.tcs-pagination-dot.active {
    background: #ffffff;
    width: 24px;
    border-radius: 4px;
}

/* Light theme pagination */
.tcs-carousel-wrapper.tcs-theme-light .tcs-pagination {
    background: rgba(0, 0, 0, 0.05);
}

.tcs-carousel-wrapper.tcs-theme-light .tcs-pagination-dot {
    background: rgba(0, 0, 0, 0.25);
}

.tcs-carousel-wrapper.tcs-theme-light .tcs-pagination-dot:hover {
    background: rgba(0, 0, 0, 0.5);
}

.tcs-carousel-wrapper.tcs-theme-light .tcs-pagination-dot.active {
    background: #1d1d1f;
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.tcs-carousel-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tcs-error {
    padding: 20px;
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
    border-radius: 8px;
    color: #ff6b6b;
    text-align: center;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 1400px) {
    .tcs-carousel-container {
        height: 520px;
    }
    
    .tcs-carousel-item {
        width: 500px;
        max-width: 40vw;
    }
}

@media (max-width: 1200px) {
    .tcs-carousel-container {
        height: 450px;
    }
    
    .tcs-carousel-item {
        width: 420px;
        max-width: 38vw;
    }
    
    .tcs-item-title {
        font-size: 22px;
    }
}

@media (max-width: 1024px) {
    .tcs-carousel-wrapper {
        padding: 60px 0;
    }
    
    .tcs-carousel-container {
        height: 380px;
    }
    
    .tcs-carousel-item {
        width: 340px;
        max-width: 40vw;
    }
    
    .tcs-nav-btn {
        width: 48px;
        height: 48px;
    }
    
    .tcs-nav-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .tcs-item-content {
        padding: 24px;
    }
    
    .tcs-item-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .tcs-carousel-wrapper {
        padding: 50px 0;
    }
    
    .tcs-carousel-container {
        height: 320px;
    }
    
    .tcs-carousel-item {
        width: 280px;
        max-width: 45vw;
    }
    
    .tcs-nav-btn {
        width: 44px;
        height: 44px;
    }
    
    .tcs-nav-btn.tcs-prev {
        left: 10px;
    }
    
    .tcs-nav-btn.tcs-next {
        right: 10px;
    }
    
    .tcs-item-content {
        padding: 20px;
    }
    
    .tcs-item-title {
        font-size: 18px;
        margin-bottom: 6px;
    }
    
    .tcs-item-description {
        font-size: 13px;
    }
    
    .tcs-item-media {
        border-radius: 14px;
    }
    
    .tcs-pagination {
        bottom: 15px;
        padding: 8px 12px;
        gap: 6px;
    }
    
    .tcs-pagination-dot {
        width: 6px;
        height: 6px;
    }
    
    .tcs-pagination-dot.active {
        width: 18px;
    }
}

@media (max-width: 480px) {
    .tcs-carousel-wrapper {
        padding: 40px 0;
    }
    
    .tcs-carousel-container {
        height: 220px;
    }
    
    .tcs-carousel-item {
        width: 200px;
        max-width: 45vw;
    }
    
    .tcs-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .tcs-nav-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .tcs-item-content {
        padding: 16px;
    }
    
    .tcs-item-title {
        font-size: 16px;
    }
    
    .tcs-item-description {
        font-size: 12px;
        line-height: 1.4;
    }
    
    .tcs-item-media {
        border-radius: 10px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.tcs-nav-btn:focus,
.tcs-pagination-dot:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.tcs-carousel-wrapper.tcs-theme-light .tcs-nav-btn:focus,
.tcs-carousel-wrapper.tcs-theme-light .tcs-pagination-dot:focus {
    outline-color: #1d1d1f;
}

/* Reduced motion - only affect CSS transitions, not JS animations */
@media (prefers-reduced-motion: reduce) {
    .tcs-nav-btn,
    .tcs-pagination-dot,
    .tcs-item-content {
        transition: none !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .tcs-navigation,
    .tcs-pagination {
        display: none;
    }
    
    .tcs-carousel-item {
        position: relative !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        margin-bottom: 20px;
    }
}

/* ============================================
   UTILITY
   ============================================ */

* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
