/* ==========================================================
   TIKTOK FEED LIVE SECTION - 247MOBILE.VN
   - Desktop: Responsive grid, modern cards
   - Mobile: 2 hàng ngang x 3 hàng dọc (2 columns x 3 rows = 6 ô)
   ========================================================== */

.tiktok_index_wrapper, #tiktok-247mobile {
    padding: 30px 0 40px 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    font-family: inherit;
    clear: both;
}

.tiktok_index_wrapper .container,
.tiktok_index_wrapper .container-fluid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Channel Header Bar */
.tiktok_channel_header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 22px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    flex-wrap: wrap;
    gap: 15px;
}

.tiktok_channel_info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tiktok_avatar_wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.tiktok_avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fe2c55;
}

.tiktok_badge_icon {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #20d5ec;
    color: #fff;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    font-weight: bold;
}

.tiktok_channel_text h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.tiktok_channel_handle {
    font-size: 13px;
    color: #64748b;
    margin-top: 3px;
}

.tiktok_channel_handle strong {
    color: #fe2c55;
}

.tiktok_stats_pills {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

.tiktok_stat_pill {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.tiktok_btn_follow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fe2c55;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(254, 44, 85, 0.25);
}

.tiktok_btn_follow:hover {
    background: #e02449;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(254, 44, 85, 0.35);
}

/* Videos Grid Layout */
.tiktok_videos_grid, .tiktok-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* Single Video Card */
.tiktok_video_card, .tiktok-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
}

.tiktok_video_card:hover, .tiktok-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

/* Aspect ratio 9:16 vertical shorts */
.tiktok-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #0f172a;
    overflow: hidden;
}

.tiktok-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.tiktok_video_card:hover .tiktok-cover,
.tiktok-card:hover .tiktok-cover {
    transform: scale(1.05);
}

.tiktok-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.tiktok_video_card:hover .tiktok-overlay,
.tiktok-card:hover .tiktok-overlay {
    opacity: 1;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.7) 100%);
}

.tiktok-play-btn {
    width: 42px;
    height: 42px;
    background: rgba(254, 44, 85, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 15px;
    padding-left: 2px;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tiktok_video_card:hover .tiktok-play-btn,
.tiktok-card:hover .tiktok-play-btn {
    transform: scale(1.15);
    background: #fe2c55;
}

.tiktok-stats {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 2;
}

.stat-views {
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.65);
    padding: 3px 7px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tiktok-badge-logo {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 6px;
    padding: 3px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tiktok-info {
    padding: 10px 12px;
    background: #ffffff;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tiktok-caption {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: #1e293b;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 35px;
}

/* Card Slot 6: Branded CTA when < 6 videos */
.tiktok-channel-cta {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border: 1px solid #334155 !important;
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tiktok-cta-inner {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.tiktok-cta-icon {
    margin-bottom: 12px;
}

.tiktok-cta-title {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.tiktok-cta-desc {
    margin: 0 0 16px 0;
    font-size: 11px;
    line-height: 1.4;
    color: #94a3b8;
}

.tiktok-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #fe2c55;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.tiktok-channel-cta:hover .tiktok-cta-btn {
    background: #e02449;
}

/* Footer Action */
.tiktok_footer_action {
    text-align: center;
    margin-top: 10px;
}

.tiktok_btn_viewall {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #0f172a;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.tiktok_btn_viewall:hover {
    background: #fe2c55;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(254, 44, 85, 0.3);
}

/* Skeleton Loading */
.tiktok-skeleton {
    animation: tiktokShimmer 1.5s infinite linear;
    pointer-events: none;
}

.tiktok-skeleton .tiktok-thumb-wrap {
    background: #e2e8f0;
}

.skel-line {
    height: 12px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 6px;
}

.skel-line.short {
    width: 60%;
}

@keyframes tiktokShimmer {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Error State */
.tiktok-error {
    grid-column: 1 / -1;
    padding: 24px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    color: #64748b;
    font-size: 14px;
    border: 1px dashed #cbd5e1;
}

/* ==========================================================
   MOBILE: 2 HÀNG NGANG X 3 HÀNG DỌC (2 COLUMNS x 3 ROWS = 6 Ô)
   ========================================================== */
@media (max-width: 768px) {
    .tiktok_index_wrapper, #tiktok-247mobile {
        padding: 20px 0 28px 0;
    }

    .tiktok_channel_header {
        padding: 12px 14px;
        margin-bottom: 16px;
    }

    .tiktok_channel_text h3 {
        font-size: 15px;
    }

    .tiktok_avatar_wrap {
        width: 44px;
        height: 44px;
    }

    .tiktok_btn_follow {
        padding: 7px 14px;
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }

    /* ĐÚNG YÊU CẦU CỐT LÕI: Bản mobile hiển thị 2 hàng ngang, 3 hàng dọc (2 cột x 3 hàng) */
    .tiktok_videos_grid, .tiktok-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 18px;
    }

    .tiktok_video_card, .tiktok-card {
        border-radius: 10px;
    }

    .tiktok-play-btn {
        width: 36px;
        height: 36px;
        font-size: 13px;
    }

    .tiktok-info {
        padding: 8px 10px;
    }

    .tiktok-caption {
        font-size: 11px;
        line-height: 1.35;
        min-height: 30px;
    }

    .stat-views {
        font-size: 10px;
        padding: 2px 5px;
    }

    .tiktok-cta-inner {
        padding: 12px 8px;
    }

    .tiktok-cta-title {
        font-size: 13px;
    }

    .tiktok-cta-desc {
        font-size: 10px;
        margin-bottom: 10px;
    }

    .tiktok-cta-btn {
        padding: 5px 10px;
        font-size: 10px;
    }

    .tiktok_btn_viewall {
        font-size: 12px;
        padding: 8px 18px;
        width: 100%;
        justify-content: center;
    }
}
