/* Marketplace Specific Styles */

.marketplace-header {
    background: var(--background);
    color: var(--text-primary);
    padding: 2rem 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.marketplace-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.marketplace-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Filters */
.marketplace-filters {
    background: var(--background);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 64px; /* Account for navbar height */
    z-index: 10;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.filters-content {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.genre-filter select,
.sort-filter select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.genre-filter select:focus,
.sort-filter select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Video Grid - YouTube Style */
.marketplace-content {
    padding: 2rem 0 4rem;
    min-height: 60vh;
    background: var(--background);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem 1.5rem;
    padding: 1rem 0;
}

.video-card {
    cursor: pointer;
    transition: transform 0.2s ease;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: scale(1.02);
}

/* Thumbnail Container - YouTube Style */
.video-thumbnail {
    width: 100%;
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin-bottom: 0.75rem;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hover Video Preview (YouTube-style) */
.video-thumbnail .preview-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    pointer-events: none;
}

.video-card:hover .preview-video {
    display: block;
}

.video-card:hover .video-thumbnail img {
    display: none;
}

/* Play Button Overlay */
.video-thumbnail .play-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: opacity 0.2s;
    pointer-events: none;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-button {
    width: 68px;
    height: 48px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    padding-left: 4px; /* Center the play icon visually */
}

.play-button::before {
    content: '▶';
    font-size: 1.5rem;
}

/* Duration Badge (YouTube-style) */
.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Roboto', -apple-system, sans-serif;
}

/* Video Info - YouTube Style */
.video-info {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.video-info-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.video-info-content {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.video-meta-line {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.video-meta-line:last-child {
    margin-bottom: 0;
}

.video-creator-name {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.video-creator-name:hover {
    color: var(--text-primary);
}

.video-stats {
    color: var(--text-secondary);
}

.video-stats-separator {
    margin: 0 0.25rem;
}

.video-genre-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
    margin-top: 0.25rem;
}

.video-price-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--secondary-color);
    color: white;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* Story Text Preview - Display below video card (scene structures are hidden) */
.video-story-preview {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.video-story-text {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading States */
.loading {
    text-align: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.no-results svg {
    margin: 0 auto 1rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.load-more-container {
    text-align: center;
    padding: 2rem 0;
}

/* Download CTA */
.download-cta {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4rem 0;
    text-align: center;
    margin-top: 3rem;
}

.download-cta h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.download-cta p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.download-cta .btn-primary {
    background: white;
    color: var(--primary-color);
}

.download-cta .btn-primary:hover {
    background: var(--background-alt);
}

/* Video Modal */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Responsive */
@media (max-width: 768px) {
    .marketplace-header {
        padding: 3rem 0 2rem;
    }
    
    .marketplace-header h1 {
        font-size: 2rem;
        padding: 0 1rem;
    }
    
    .marketplace-header p {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .marketplace-filters {
        padding: 1rem 0;
    }
    
    .filters-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .genre-filter,
    .sort-filter {
        width: 100%;
    }
    
    .genre-filter select,
    .sort-filter select {
        width: 100%;
    }
    
    .marketplace-content {
        padding: 2rem 0;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem 0;
    }
    
    .video-card {
        max-width: 100%;
    }
    
    .download-cta {
        padding: 3rem 1rem;
        margin-top: 2rem;
    }
    
    .download-cta h2 {
        font-size: 1.75rem;
    }
    
    .download-cta p {
        font-size: 1rem;
    }
    
    .video-modal {
        padding: 0;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
}

@media (max-width: 480px) {
    .marketplace-header h1 {
        font-size: 1.75rem;
    }
    
    .video-info {
        gap: 0.5rem;
    }
    
    .video-title {
        font-size: 0.95rem;
    }
    
    .download-cta h2 {
        font-size: 1.5rem;
    }
}

