/* Video Feed Widget Styles - Always 2 Columns Layout with Infinite Scroll */
.vfp-widget-container {
    margin: -5px;
}

.vfp-widget-infinite-scroll {
    position: relative;
    min-height: 200px;
}

.vfp-widget-grid.vfp-widget-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.vfp-widget-item {
    break-inside: avoid;
    margin-bottom: 0;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vfp-widget-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    background: transparent;
}

.vfp-widget-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.vfp-widget-thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 6px;
    background: #f8f9fa;
}

.vfp-widget-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.vfp-widget-link:hover .vfp-widget-thumb {
    transform: scale(1.05);
}

.vfp-widget-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    font-weight: 500;
    z-index: 10;
}

.vfp-widget-meta {
    padding: 8px 0 2px;
}

/* 🎯 CẢI TIẾN: Font size linh hoạt theo màn hình */
.vfp-widget-title {
    font-size: clamp(0.625rem, 2.5vw, 0.875rem); /* 10px - 14px */
    line-height: 1.3;
    margin: 0;
    font-weight: 600;
    
    /* 🎯 Sử dụng CSS variable từ theme */
    color: var(--adv-txt, #2d3748);
    
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.6em;
    
    /* 🎯 Tối ưu cho mobile */
    word-break: break-word;
    hyphens: auto;
}

/* 🎯 CẢI TIẾN: Màu hover tương thích theme */
.vfp-widget-link:hover .vfp-widget-title {
    color: var(--adv-primary, #e53e3e);
}

/* 🎯 CẢI TIẾN: Background cho dark mode */
html[data-theme="dark"] .vfp-widget-thumb-wrapper,
body.dark-mode .vfp-widget-thumb-wrapper {
    background: var(--adv-bg-hover, #222);
}

.vfp-widget-empty {
    text-align: center;
    padding: 20px;
    color: var(--adv-txt-muted, #718096);
    font-size: 14px;
    grid-column: 1 / -1;
}

.vfp-widget-loading {
    text-align: center;
    padding: 20px;
    color: var(--adv-txt-muted, #718096);
    font-size: 14px;
    grid-column: 1 / -1;
}

.vfp-widget-load-more {
    margin-top: 15px;
    padding: 15px;
    text-align: center;
}

.vfp-widget-load-more .vfp-widget-loading {
    padding: 10px;
}

/* === 🎯 RESPONSIVE BREAKPOINTS CẢI TIẾN === */

/* 📱 Mobile nhỏ (dưới 360px) - Font nhỏ nhất */
@media (max-width: 360px) {
    .vfp-widget-grid.vfp-widget-2col {
        gap: 6px !important;
    }
    
    .vfp-widget-title {
        font-size: 0.625rem; /* 10px */
        line-height: 1.2;
        -webkit-line-clamp: 2;
        max-height: 2.4em;
    }
    
    .vfp-widget-meta {
        padding: 4px 0 1px;
    }
    
    .vfp-widget-duration {
        font-size: 8px;
        padding: 1px 3px;
        bottom: 4px;
        right: 4px;
    }
}

/* 📱 Mobile trung bình (361px - 480px) */
@media (min-width: 361px) and (max-width: 480px) {
    .vfp-widget-grid.vfp-widget-2col {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    .vfp-widget-title {
        font-size: 0.6875rem; /* 11px */
        line-height: 1.25;
    }
    
    .vfp-widget-meta {
        padding: 6px 0 1px;
    }
    
    .vfp-widget-duration {
        font-size: 9px;
        padding: 1px 3px;
    }
}

/* 📱 Mobile lớn / Tablet nhỏ (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .vfp-widget-grid.vfp-widget-2col {
        gap: 12px !important;
    }
    
    .vfp-widget-title {
        font-size: 0.75rem; /* 12px */
        line-height: 1.3;
    }
    
    .vfp-widget-meta {
        padding: 8px 0 2px;
    }
    
    .vfp-widget-duration {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* 💻 Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .vfp-widget-grid.vfp-widget-2col {
        gap: 14px !important;
    }
    
    .vfp-widget-title {
        font-size: 0.8125rem; /* 13px */
        line-height: 1.35;
    }
    
    .vfp-widget-meta {
        padding: 10px 0 3px;
    }
}

/* 🖥️ Desktop (1025px+) */
@media (min-width: 1025px) {
    .vfp-widget-grid.vfp-widget-2col {
        gap: 16px !important;
    }
    
    .vfp-widget-title {
        font-size: 0.875rem; /* 14px */
        line-height: 1.4;
        -webkit-line-clamp: 2;
        max-height: 2.8em;
    }
    
    .vfp-widget-meta {
        padding: 12px 0 4px;
    }
    
    .vfp-widget-duration {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* === 🎯 TƯƠNG THÍCH THEME DARK MODE === */

/* Dark mode support */
html[data-theme="dark"] .vfp-widget-title,
body.dark-mode .vfp-widget-title {
    color: var(--adv-txt, #f9f9f9);
}

html[data-theme="dark"] .vfp-widget-link:hover .vfp-widget-title,
body.dark-mode .vfp-widget-link:hover .vfp-widget-title {
    color: var(--adv-primary, #f3bafd);
}

html[data-theme="dark"] .vfp-widget-empty,
html[data-theme="dark"] .vfp-widget-loading,
body.dark-mode .vfp-widget-empty,
body.dark-mode .vfp-widget-loading {
    color: var(--adv-txt-muted, #aaa);
}

/* High density screens */
@media (min-resolution: 120dpi) {
    .vfp-widget-thumb {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Infinite scroll loading states */
.vfp-widget-load-more-loading {
    opacity: 0.7;
}

.vfp-widget-load-more-error {
    background: var(--adv-bg-hover, #fed7d7);
    color: var(--adv-primary-bold, #c53030);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    margin-top: 10px;
}

.vfp-widget-load-more-button {
    background: var(--adv-primary, #4299e1);
    color: var(--adv-txt-accent, white);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.vfp-widget-load-more-button:hover {
    background: var(--adv-primary-bold, #3182ce);
}

.vfp-widget-load-more-button:disabled {
    background: var(--adv-txt-muted, #a0aec0);
    cursor: not-allowed;
}

/* === 🎯 FALLBACK CHO CÁC THEME KHÔNG CÓ CSS VARIABLES === */
/* Đảm bảo hiển thị đẹp ngay cả khi theme không hỗ trợ variables */
.vfp-widget-title:not([style*="--adv-txt"]) {
    color: #2d3748;
}

html[data-theme="dark"] .vfp-widget-title:not([style*="--adv-txt"]),
body.dark-mode .vfp-widget-title:not([style*="--adv-txt"]) {
    color: #f9f9f9;
}