/* TikTok Video Gallery - Frontend Styles */

.tiktok-video-gallery {
    width: 100%;
    margin: 30px 0;
    padding: 0;
}

/* Loading Spinner */
.tvg-loading {
    text-align: center;
    padding: 60px 20px;
}

.tvg-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #fe2c55;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: tvg-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes tvg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tvg-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Grid Layout */
.tvg-grid {
    display: grid;
    gap: 15px;
    width: 100%;
}

/* Video Item */
.tvg-video-item {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 9 / 16;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tvg-video-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Video Thumbnail */
.tvg-video-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Video Element (when playing) */
.tvg-video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Overlay */
.tvg-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%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tvg-video-item:hover .tvg-video-overlay {
    opacity: 1;
}

/* Video Info */
.tvg-video-info {
    color: #fff;
}

.tvg-video-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 5px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tvg-video-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.tvg-video-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tvg-video-stat svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Play Icon */
.tvg-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: none;
}

.tvg-video-item:hover .tvg-play-icon {
    background: #fe2c55;
    transform: translate(-50%, -50%) scale(1.1);
}

.tvg-play-icon svg {
    width: 24px;
    height: 24px;
    fill: #000;
    margin-left: 3px;
}

.tvg-video-item:hover .tvg-play-icon svg {
    fill: #fff;
}

/* TikTok Logo Badge */
.tvg-tiktok-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tvg-tiktok-badge svg {
    width: 20px;
    height: 20px;
}

.tvg-tiktok-badge span {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

/* Error Message */
.tvg-error {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #c33;
}

.tvg-error h3 {
    margin: 0 0 10px 0;
    color: #c33;
}

.tvg-error p {
    margin: 0;
    color: #666;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .tvg-video-item {
        border-radius: 6px;
    }
    
    .tvg-video-title {
        font-size: 13px;
    }
    
    .tvg-video-stats {
        font-size: 11px;
        gap: 10px;
    }
    
    .tvg-play-icon {
        width: 50px;
        height: 50px;
    }
    
    .tvg-play-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Intersection Observer Animation */
.tvg-video-item {
    opacity: 0;
    transform: translateY(20px);
    animation: tvg-fade-in 0.5s ease forwards;
}

@keyframes tvg-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tvg-video-item:nth-child(1) { animation-delay: 0.05s; }
.tvg-video-item:nth-child(2) { animation-delay: 0.1s; }
.tvg-video-item:nth-child(3) { animation-delay: 0.15s; }
.tvg-video-item:nth-child(4) { animation-delay: 0.2s; }
.tvg-video-item:nth-child(5) { animation-delay: 0.25s; }
.tvg-video-item:nth-child(6) { animation-delay: 0.3s; }
.tvg-video-item:nth-child(7) { animation-delay: 0.35s; }
.tvg-video-item:nth-child(8) { animation-delay: 0.4s; }

/* Smooth loading state transition */
.tvg-loading {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.tvg-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.tvg-grid {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tvg-grid.visible {
    opacity: 1;
}

/* Muted indicator */
.tvg-muted-indicator {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #fff;
    font-size: 11px;
}

.tvg-muted-indicator svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}
