/* Video Feed Plugin - Instagram Style CSS */

/* Container */
.vf-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Video Wrapper */
.vf-video-wrapper {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.vf-video-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* Individual Video Item */
.vf-video-item {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Video Element */
.vf-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Video Overlay */
.vf-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
    pointer-events: none;
    z-index: 2;
}

/* Video Info */
.vf-video-info {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 80px;
    color: #fff;
    pointer-events: auto;
}

.vf-username {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.vf-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.vf-caption {
    font-size: 14px;
    line-height: 1.4;
    max-height: 100px;
    overflow-y: auto;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Video Actions */
.vf-video-actions {
    position: absolute;
    bottom: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    pointer-events: auto;
}

.vf-action-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: transform 0.2s;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

.vf-action-btn:hover {
    transform: scale(1.1);
}

.vf-action-btn:active {
    transform: scale(0.95);
}

.vf-action-btn svg {
    transition: all 0.2s;
}

/* Like Button */
.vf-like-btn {
    animation: pulse 0.3s ease;
}

.vf-like-btn.liked svg {
    fill: #ff4d4f;
    animation: heartbeat 0.3s ease;
}

.vf-like-count {
    font-size: 12px;
    font-weight: 600;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Mute Button */
.vf-mute-btn.muted .vf-mute-icon {
    display: block;
}

.vf-mute-btn.muted .vf-unmute-icon {
    display: none;
}

.vf-mute-btn:not(.muted) .vf-mute-icon {
    display: none;
}

.vf-mute-btn:not(.muted) .vf-unmute-icon {
    display: block;
}

/* Views Counter */
.vf-views {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

/* Play/Pause Overlay */
.vf-play-pause-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 3;
}

.vf-play-pause-overlay.show {
    opacity: 0.8;
    animation: fadeOut 0.5s ease 0.3s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.vf-video-item.paused .vf-play-pause-overlay svg {
    opacity: 0.6;
}

/* Loading Spinner */
.vf-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 3;
}

.vf-loading.show {
    opacity: 1;
}

.vf-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Fullscreen Mode */
.vf-container.vf-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .vf-video {
        object-fit: cover;
    }
    
    .vf-video-info {
        bottom: 60px;
        left: 15px;
        right: 70px;
    }
    
    .vf-username {
        font-size: 14px;
    }
    
    .vf-avatar {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .vf-caption {
        font-size: 13px;
        max-height: 80px;
    }
    
    .vf-video-actions {
        bottom: 60px;
        right: 15px;
        gap: 16px;
    }
    
    .vf-action-btn svg {
        width: 26px;
        height: 26px;
    }
}

/* Tablet and Desktop */
@media (min-width: 769px) {
    .vf-container {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .vf-video {
        object-fit: contain;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .vf-container {
        max-width: 600px;
    }
}

/* Scrollbar for caption */
.vf-caption::-webkit-scrollbar {
    width: 4px;
}

.vf-caption::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.vf-caption::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

/* Smooth Transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

.vf-video-item {
    transition: opacity 0.3s ease;
}

/* Loading State */
.vf-video-item.loading .vf-video {
    opacity: 0.5;
}

/* Error State */
.vf-video-item.error {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.vf-video-item.error::after {
    content: 'Failed to load video';
    font-size: 16px;
}

/* Accessibility */
.vf-action-btn:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Hide video controls */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-enclosure {
    display: none !important;
}

/* Animation for new videos (infinite scroll) */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vf-video-item.new {
    animation: slideIn 0.3s ease;
}

/* Network Error Message */
.vf-network-error {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 77, 79, 0.9);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Progress Bar (optional) */
.vf-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: #fff;
    z-index: 4;
    transition: width 0.1s linear;
}

/* Safe Area Padding for iOS */
@supports (padding: max(0px)) {
    .vf-video-info {
        bottom: max(80px, env(safe-area-inset-bottom));
        left: max(20px, env(safe-area-inset-left));
        right: max(80px, env(safe-area-inset-right));
    }
    
    .vf-video-actions {
        bottom: max(80px, env(safe-area-inset-bottom));
        right: max(20px, env(safe-area-inset-right));
    }
}
