/**
 * DeTube — Giao diện thống nhất toàn site
 * Tông tối + accent đỏ (#ff4757), không dùng nền xanh/tím cũ
 */

:root {
    /* Loads after style.css (see functions.php deps) — these values win the
       cascade for the shared variable names, so must stay in sync with the
       :root block in style.css. UI refresh 2026-07. */
    --bg: #0B0D12;
    --muted: rgba(245, 246, 248, 0.64);
    --badge: #FFC94D;
    --stroke: rgba(255, 255, 255, 0.08);
    --dropdown: #171A24;
    --panel: #12141C;

    --detube-surface: linear-gradient(165deg, rgba(24, 26, 38, 0.95) 0%, rgba(12, 14, 22, 0.98) 100%);
    --detube-surface-soft: linear-gradient(180deg, rgba(22, 24, 35, 0.72) 0%, rgba(15, 17, 24, 0.5) 100%);
    --detube-border: rgba(255, 255, 255, 0.08);
    --detube-border-strong: rgba(255, 255, 255, 0.14);
    --detube-radius-xl: 20px;
    --detube-radius-lg: 14px;
    --detube-radius-md: 10px;
    --detube-radius-sm: 6px;
    --detube-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
    --detube-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    --detube-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.40);
    --detube-container: 1320px;
    --detube-gutter: 20px;
    --detube-accent: #ff4757;
    --detube-accent-strong: #C4293A;
    --detube-gold: #FFC94D;
    --detube-success: #2ED573;
    --detube-warning: #F5A623;
    --detube-error: #E5484D;
    --detube-info: #38BDF8;
    --detube-accent-soft: #ff8a9b;
}

/* ── Nền & container ─────────────────────────────────────────── */
.detube-ui {
    background-color: var(--bg-primary, #0f1113);
    color: var(--text-primary, #f1f1f1);
}

.detube-ui .site-content > .container {
    max-width: var(--detube-container);
    padding-left: var(--detube-gutter);
    padding-right: var(--detube-gutter);
}

/* ── Panel / khối nội dung (search, archive, sidebar…) ───────── */
.detube-ui .search-container,
.detube-ui #advanced-search-container,
.detube-ui .category-header,
.detube-ui .tag-header,
.detube-ui .video-category-page .category-title:first-child {
    background: var(--detube-surface);
    border: 1px solid var(--detube-border);
    border-radius: var(--detube-radius-lg);
    box-shadow: var(--detube-shadow);
}

.detube-ui .search-container {
    width: 100%;
    max-width: var(--detube-container);
    margin: 1.25rem auto 2rem;
    padding: 1.25rem 1.15rem 1.5rem;
}

.detube-ui .category-header,
.detube-ui .tag-header {
    padding: 1.25rem 1.15rem;
    margin-bottom: 1.25rem;
}

.detube-ui .category-title,
.detube-ui .tag-title,
.detube-ui .video-category-page .category-videos-section > .category-title {
    margin: 0 0 0.5rem;
    padding-left: 12px;
    border-left: 3px solid var(--detube-accent);
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
}

.detube-ui .category-description,
.detube-ui .tag-description {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ── Featured / grid chung (archive, index không home-refined) ─ */
.detube-ui .featured,
.detube-ui .homepage-featured,
.detube-ui .category-videos-section,
.detube-ui .tag-videos-section {
    background: var(--detube-surface-soft);
    border: 1px solid var(--detube-border);
    border-radius: var(--detube-radius-lg);
    box-shadow: var(--detube-shadow);
    padding: 1.15rem 1rem 1.35rem;
}

.detube-ui:not(.home-refined) .video-layout-container {
    max-width: var(--detube-container);
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 2rem;
}

/* ── Thẻ video toàn site ─────────────────────────────────────── */
.detube-ui .video-card,
.detube-ui .card.video-card,
.detube-ui .related-video-card,
.detube-ui .video-item,
.detube-ui .featured-grid .card,
.detube-ui .category-videos-grid .video-card,
.detube-ui .tag-videos-grid .video-card,
.detube-ui #search-results .video-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--detube-radius-lg);
    overflow: hidden;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

@media (hover: hover) and (pointer: fine) {
    .detube-ui .video-card:hover,
    .detube-ui .card.video-card:hover,
    .detube-ui .video-item:hover,
    .detube-ui .featured-grid .card:hover,
    .detube-ui #search-results .video-card:hover {
        transform: translateY(-3px);
        border-color: rgba(255, 71, 87, 0.35);
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 71, 87, 0.08), 0 8px 18px -6px rgba(255, 71, 87, 0.22);
    }

    .detube-ui .video-card:hover .video-title a,
    .detube-ui .video-card:hover .title a,
    .detube-ui .card:hover .title a {
        color: var(--detube-accent-soft);
    }
}

.detube-ui .video-title a,
.detube-ui .card .title a,
.detube-ui .meta .title a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
}

.detube-ui .thumb .category-chip,
.detube-ui .video-thumbnail .category-chip {
    background: rgba(192, 0, 0, 0.92);
    color: #fff;
    border-radius: var(--detube-radius-sm, 6px);
    font-size: 10px;
    font-weight: 700;
}

/* ── Sidebar gợi ý (single + layout có sidebar) ──────────────── */
.detube-ui .simple-sidebar,
.detube-ui .video-layout-container .simple-sidebar {
    background: var(--detube-surface) !important;
    border: 1px solid var(--detube-border) !important;
    border-radius: var(--detube-radius-lg) !important;
    box-shadow: var(--detube-shadow) !important;
}

.detube-ui .simple-sidebar h3,
.detube-ui .sidebar-panel-title {
    color: #fff !important;
    border: none !important;
}

/* ── Slider (khi không có home-refined) ─────────────────────── */
.detube-ui:not(.home-refined) .top-videos-slider-wrapper {
    background: var(--detube-surface) !important;
    border: 1px solid var(--detube-border) !important;
    border-radius: var(--detube-radius-lg) !important;
    box-shadow: var(--detube-shadow) !important;
    padding: 1.15rem 1rem !important;
}

.detube-ui .top-videos-slider-title h2 {
    padding-left: 12px !important;
    border-left: 3px solid var(--detube-accent) !important;
    color: #fff !important;
}

/* ── Single: info + related dùng biến chung ───────────────── */
.detube-ui.single-refined .single-info-panel.video-info-combined,
.detube-ui.single-refined .related-videos-panel {
    background: var(--detube-surface);
    border-color: var(--detube-border);
}

.detube-ui.single-refined .video-player-wrapper {
    border: 1px solid var(--detube-border);
    border-radius: var(--detube-radius-md);
}

/* ── Homepage home-refined — đồng bộ biến ─────────────────── */
.detube-ui.home-refined .homepage-slider .top-videos-slider-wrapper {
    background: transparent !important;
    border-color: transparent !important;
}

.detube-ui.home-refined .homepage-featured.featured {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.detube-ui.home-refined .homepage-suggested.featured {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ── Search form ───────────────────────────────────────────── */
.detube-ui #search-input,
.detube-ui .homepage-search-form,
.detube-ui .search-form input[type="search"] {
    border-color: var(--detube-border);
}

.detube-ui .homepage-search-form .search-button,
.detube-ui .load-more-btn,
.detube-ui .related-load-more-btn {
    /* accent-strong → tối hơn, chữ trắng đạt AA contrast (~5.6:1+) thay vì
       #ff4757 trước đây chỉ ~3.3:1 */
    background: linear-gradient(135deg, var(--detube-accent-strong), #A32330);
}

.detube-ui .search-info-compact {
    border-bottom-color: var(--detube-border);
}

.detube-ui .search-query {
    color: var(--detube-accent-soft);
}

/* ── Pagination ────────────────────────────────────────────── */
.detube-ui .pagination-wrapper a,
.detube-ui .page-numbers a,
.detube-ui .page-numbers span {
    border-color: var(--detube-border);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.85);
}

.detube-ui ul.page-numbers {
    background: transparent;
}

.detube-ui .page-numbers.current {
    background: var(--detube-accent);
    border-color: var(--detube-accent);
    color: #fff;
}

/* ── Footer ──────────────────────────────────────────────────── */
/* Bố cục: [logo + cảnh báo độ tuổi] | [từ khóa tìm nhiều], rồi lưu ý nội dung, rồi dòng bản quyền.
   Dùng #colophon để thắng các rule !important cũ trong style.css (padding mobile). */
#colophon.site-footer {
    border-top: 1px solid var(--detube-border);
    background: linear-gradient(180deg, rgba(15, 17, 24, 0.98) 0%, #0a0b10 100%);
    padding: 44px 0 28px !important;
    text-align: left;
}

/* Cùng khung với nội dung trang (.site-content > .container) để mép trái/phải thẳng hàng với lưới phim */
#colophon.site-footer > .container {
    /* !important: style.css có `.single .container{max-width:100%!important}` và `.single *{max-width:100%!important}`
       làm footer trên trang phim tràn hết chiều ngang, khác các trang còn lại. */
    max-width: var(--detube-container) !important;
    margin-left: auto;
    margin-right: auto;
    padding: 0 var(--detube-gutter) !important;
}

#colophon .ft-top {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 40px 64px;
    align-items: start;
}

#colophon .ft-about {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* Điểm nhấn duy nhất của footer: huy hiệu độ tuổi */
#colophon .ft-age {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    max-width: 480px !important;
}

#colophon .ft-age-badge {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 2px solid var(--detube-accent);
    border-radius: 50%;
    color: var(--detube-accent);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

#colophon .ft-age p {
    margin: 0;
    color: rgba(245, 246, 248, 0.82);
    font-size: 0.9rem;
    line-height: 1.65;
}

#colophon .ft-heading {
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

#colophon .ft-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

#colophon .ft-tag-list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

#colophon .ft-tag-list a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--detube-border);
    border-radius: var(--detube-radius-md);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(245, 246, 248, 0.84);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

#colophon .ft-tag-list a::before {
    content: "#";
    margin-right: 2px;
    color: var(--detube-accent);
    font-weight: 600;
}

#colophon .ft-tag-list a:hover {
    border-color: rgba(255, 71, 87, 0.55);
    background: rgba(255, 71, 87, 0.12);
    color: #fff;
}

#colophon .ft-tag-list a:focus-visible,
#colophon .ft-credits a:focus-visible {
    outline: 2px solid var(--detube-accent);
    outline-offset: 3px;
}

#colophon .ft-admin-note {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: var(--detube-radius-md);
    background: rgba(255, 193, 7, 0.08);
    color: #ffc107;
    font-size: 0.85rem;
}

#colophon .ft-admin-note a {
    color: #fff;
    text-decoration: underline;
}

#colophon .ft-disclaimer {
    max-width: 72ch !important;
    margin: 36px 0 0;
    padding-top: 24px;
    border-top: 1px solid var(--detube-border);
    color: var(--text-faint, rgba(245, 246, 248, 0.5));
    font-size: 0.82rem;
    line-height: 1.7;
}

#colophon .ft-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    margin-top: 24px;
    color: var(--detube-muted, rgba(245, 246, 248, 0.64));
    font-size: 0.85rem;
}

#colophon .ft-copy,
#colophon .ft-credits {
    margin: 0;
    font-size: inherit;
}

#colophon .ft-credits {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}

#colophon .ft-credits a {
    color: rgba(245, 246, 248, 0.78);
    text-decoration: none;
}

#colophon .ft-credits a:hover {
    color: #fff;
    text-decoration: underline;
}

#colophon .ft-credits img {
    display: block;
    height: 17px;
    width: auto;
}

/* Widget cũ (chỉ hiện khi gán widget cho footer-1/2/3) - giữ tiêu đề cũ cho khỏi lệch phong cách */
.detube-ui .footer-widget h3,
.detube-ui .footer-widget .widget-title {
    color: #fff;
    padding-left: 10px;
    border-left: 2px solid var(--detube-accent);
}

@media (max-width: 900px) {
    #colophon .ft-top {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }
}

@media (max-width: 768px) {
    /* chừa chỗ cho nút "lên đầu trang" nổi ở góc phải dưới */
    #colophon.site-footer {
        padding: 28px 0 calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #colophon.site-footer > .container {
        padding: 0 12px !important;
    }

    #colophon .ft-age-badge {
        width: 46px;
        height: 46px;
        font-size: 0.95rem;
    }

    #colophon .ft-tag-list {
        gap: 8px;
    }

    #colophon .ft-tag-list a {
        min-height: 44px;
        padding: 0 14px;
    }

    #colophon .ft-disclaimer {
        margin-top: 28px;
        padding-top: 20px;
    }

    #colophon .ft-bottom {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #colophon .ft-tag-list a {
        transition: none;
    }
}

/* ── Trang tĩnh (page.php: 2257 & DMCA, chính sách...) ──────────
   style.css có .entry-content{max-height:180px;overflow-y:auto} viết cho ô mô tả phim -
   áp lên trang tĩnh làm nội dung bị cắt thành ô cuộn nhỏ. Ở đây trả về chiều cao tự nhiên. */
.detube-ui article.page-content .entry-content {
    max-height: none;
    overflow: visible;
    max-width: 78ch;
    margin-top: 1.25rem;
    padding: 24px 28px;
    font-size: 1rem;
    line-height: 1.75;
}

.detube-ui article.page-content .entry-content p {
    margin: 0 0 1.1em;
}

.detube-ui article.page-content .entry-content a {
    color: var(--detube-accent);
}

@media (max-width: 768px) {
    .detube-ui article.page-content .entry-content {
        padding: 18px 16px;
        font-size: 0.95rem;
    }
}

/* ── Trang tìm kiếm: H1 + giới thiệu (render server) ─────────── */
.detube-ui .search-seo-header {
    /* cùng bề rộng + căn giữa với ô tìm kiếm bên dưới (#advanced-search-container) */
    max-width: 900px;
    margin: 1.5rem auto 1.25rem;
}

.detube-ui .search-seo-title {
    margin: 0;
    font-size: clamp(1.25rem, 3.2vw, 1.7rem);
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
}

.detube-ui .search-container .search-seo-intro {
    margin: 8px 0 0;
    max-width: 70ch;
    color: rgba(245, 246, 248, 0.64);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ── Actors page — bỏ glow xanh ─────────────────────────────── */
.detube-ui.actors-archive-page .actors-page-hero::before {
    background:
        radial-gradient(ellipse 80% 60% at 100% 0%, rgba(255, 71, 87, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(255, 71, 87, 0.06) 0%, transparent 50%);
}

.detube-ui.actors-archive-page .actors-page-hero {
    background: var(--detube-surface);
    border-color: var(--detube-border);
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .detube-ui .site-content > .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .detube-ui .search-container,
    .detube-ui .category-header,
    .detube-ui .featured,
    .detube-ui .category-videos-section {
        border-radius: 12px;
        padding: 0.9rem 0.65rem 1rem;
    }
}

/* ── Thumbnail shimmer dùng chung ─────────────────────────────
   Cùng nhịp với .sidebar-skeleton-thumb (single-page.css) — đặt làm nền mặc
   định của khung thumb; ảnh <img> tải xong sẽ phủ lên trên nên không cần
   JS toggle class, tự động "biến mất" khi ảnh paint. */
@keyframes detube-thumb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.detube-ui .video-layout-container .thumb,
.detube-ui .home-refined .homepage-featured .thumb,
.detube-ui .single-video-layout .related-videos-section .thumb {
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.09) 50%,
        rgba(255, 255, 255, 0.04) 100%
    );
    background-size: 200% 100%;
    animation: detube-thumb-shimmer 1.4s ease-in-out infinite;
}

/* ── Scrim đáy thumbnail ───────────────────────────────────────
   Gradient tối dần ở đáy ảnh — giúp badge thời lượng/chất lượng nổi rõ hơn
   trên nền bất kỳ, đồng thời tạo chiều sâu kiểu "cinematic" của các nền tảng
   video hiện đại (Netflix/YouTube). position:relative đặt lại ở đây để chắc
   chắn ::after neo đúng vào khung thumb dù rule khác có set hay không. */
.detube-ui .video-layout-container .thumb,
.detube-ui .home-refined .homepage-featured .thumb,
.detube-ui .single-video-layout .related-videos-section .thumb,
.detube-ui .related-video-card .thumb {
    position: relative;
}

.detube-ui .video-layout-container .thumb::after,
.detube-ui .home-refined .homepage-featured .thumb::after,
.detube-ui .single-video-layout .related-videos-section .thumb::after,
.detube-ui .related-video-card .thumb::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 45%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .detube-ui .video-layout-container .thumb,
    .detube-ui .home-refined .homepage-featured .thumb,
    .detube-ui .single-video-layout .related-videos-section .thumb {
        animation: none !important;
    }
}

/* === Breadcrumb (single video / category / actor pages) === */
.detube-ui .detube-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 1rem;
    font-size: 0.875rem;
}

.detube-ui .detube-breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.detube-ui .detube-breadcrumb a:hover {
    color: var(--accent);
}

.detube-ui .detube-breadcrumb-sep {
    color: var(--text-faint);
}

.detube-ui .detube-breadcrumb-current {
    color: var(--text-primary);
}
