/* ============================================
   Feature Demo Section
   Interactive video showcase with auto-advance
   ============================================ */

/* Main Section */
.feature-demo {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.feature-demo .section-header {
    text-align: left;
    margin-bottom: 3rem;
}

.feature-demo .section-header h2 {
    font-size: 2.75rem;
    margin-bottom: 1rem;
}

.feature-demo .section-header p {
    color: var(--sp-text-secondary);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Container - Desktop Layout */
.fd-container {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
}

/* Feature List (Left Side - Desktop Buttons) */
.fd-feature-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: min(260px, 100%);
    max-width: 100%;
    flex-shrink: 0;
}

.fd-feature-item .fd-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fd-feature-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px 16px;
    box-sizing: border-box;
    background: var(--sp-glass-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--sp-glass-border, rgba(255, 255, 255, 0.06));
    border-radius: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--sp-text-secondary, #a0a0a0);
    transition: all 0.25s ease;
    width: 100%;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fd-feature-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--sp-text-primary, #fff);
}

.fd-feature-item.active {
    background: #ff7b7b;
    color: #1a1a2e;
    font-weight: 600;
    box-shadow: 0 10px 18px rgba(255, 123, 123, 0.28);
    transform: none;
    border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .fd-feature-item:hover {
        transform: translateX(4px);
    }

    .fd-feature-item.active {
        transform: translateX(4px) scale(1.02);
    }
}

.fd-feature-item .fd-item-number {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.fd-feature-item.active .fd-item-number {
    background: rgba(26, 26, 46, 0.2);
}

/* Video Area (Right Side) */
.fd-video-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Video Container with Glow */
.fd-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow:
        0 0 0 1px rgba(255, 123, 123, 0.2),
        0 20px 50px rgba(0, 0, 0, 0.4);
}

/* Composited glow overlay (avoid animating box-shadow which is non-composited) */
.fd-video-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: 0 0 80px rgba(255, 123, 123, 0.18);
    opacity: 0.55;
    will-change: opacity;
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%,
    100% {
        opacity: 0.45;
    }

    50% {
        opacity: 0.85;
    }
}

/* Video Elements */
.fd-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.fd-video.active {
    opacity: 1;
}

.fd-video.fade-out {
    opacity: 0;
}

/* Video Info */
.fd-video-info {
    padding: 0 0.5rem;
}

.fd-video-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--sp-text-primary, #fff);
    margin: 0 0 0.5rem 0;
    opacity: 0;
    transform: translateY(10px);
    animation: slideUp 0.3s ease forwards;
}

.fd-video-description {
    font-size: 1rem;
    color: var(--sp-text-secondary, #a0a0a0);
    margin: 0;
    opacity: 0;
    transform: translateY(10px);
    animation: slideUp 0.35s ease 0.05s forwards;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reset animation for transitions */
.fd-video-info.transitioning .fd-video-title,
.fd-video-info.transitioning .fd-video-description {
    animation: none;
    opacity: 0;
    transform: translateY(10px);
}

/*
   Mobile/Tablet Pill Navigation
*/
.fd-pill-nav {
    display: none;
    width: 100%;
    padding: 12px 0;
    margin: 0 -1rem; /* Extend to edges */
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: content-box;
}

/* Scroll container */
.fd-pill-track {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    overflow-x: scroll;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 0;
    padding-right: 20px; /* End spacer */
}

.fd-pill-track::-webkit-scrollbar {
    display: none;
}


/* Individual Pill Button */
.fd-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    min-height: 44px;
    box-sizing: border-box;
    background: var(--sp-glass-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--sp-glass-border, rgba(255, 255, 255, 0.06));
    border-radius: 12px;
    appearance: none;
    -webkit-appearance: none;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--sp-text-secondary, #a0a0a0);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    flex: 0 0 auto;
}

.fd-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sp-text-primary, #fff);
}

.fd-pill.active {
    background: #ff7b7b;
    color: #1a1a2e;
    font-weight: 600;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(255, 123, 123, 0.3);
}

.fd-pill .fd-pill-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.fd-pill.active .fd-pill-number {
    background: rgba(26, 26, 46, 0.2);
}

.fd-pill .fd-pill-title {
    font-size: 13px;
    font-weight: 600;
    color: inherit;
}

/* Responsive Logic */
@media (max-width: 1024px),
(max-width: 1280px) and (any-pointer: coarse) {
    .fd-container {
        flex-direction: column;
    }

    .fd-feature-list {
        display: none;
    }

    /* Show Pill Navigation */
    .fd-pill-nav {
        display: block;
        order: 2;
    }

    .fd-video-area {
        order: 1;
        width: 100%;
    }

    .feature-demo {
        padding: 4rem 1rem;
    }
}

/* Mobile Tweaks */
@media (max-width: 640px) {
    .fd-pill-track {
        gap: 8px;
    }

    .fd-pill {
        padding: 6px 12px;
        height: 40px;
        font-size: 12px;
    }

    .fd-pill .fd-pill-title {
        font-size: 12px;
    }

    .fd-pill .fd-pill-number {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .feature-demo .section-header h2 {
        font-size: 1.75rem;
    }

    .fd-pill-track {
        gap: 6px;
    }

    .fd-pill {
        gap: 6px;
        padding: 6px 10px;
    }

    .fd-pill .fd-pill-number {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
}

/* Loading State */
.fd-video-wrapper.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff7b7b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}