/* =========================================================================
   TubeVault v1.2 – Frontend Styles
   ========================================================================= */

/* ----------  Reset / Base  ---------- */
.tv-grid-wrapper,
.tv-filter-grid-wrapper,
.tv-watch-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #0f0f0f;
    box-sizing: border-box;
}
.tv-grid-wrapper *,
.tv-filter-grid-wrapper *,
.tv-watch-container * {
    box-sizing: border-box;
}

/* ----------  Grid  ---------- */
.tv-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.tv-cols-1 { grid-template-columns: repeat(1, 1fr); }
.tv-cols-2 { grid-template-columns: repeat(2, 1fr); }
.tv-cols-3 { grid-template-columns: repeat(3, 1fr); }
.tv-cols-4 { grid-template-columns: repeat(4, 1fr); }
.tv-cols-5 { grid-template-columns: repeat(5, 1fr); }
.tv-cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1200px) {
    .tv-cols-5, .tv-cols-6 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
    .tv-cols-4, .tv-cols-5, .tv-cols-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 650px) {
    .tv-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
    .tv-grid { grid-template-columns: 1fr; }
}

/* ----------  Card  ---------- */
.tv-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: transform .2s ease, box-shadow .2s ease;
    display: flex;
    flex-direction: column;
}
.tv-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.tv-card-thumb-link {
    display: block;
    text-decoration: none;
}
.tv-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #0f0f0f;
    overflow: hidden;
}
.tv-card-thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity .3s;
}
.tv-card:hover .tv-card-thumb img {
    opacity: .85;
}

.tv-play-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 48px; height: 48px;
    background: rgba(0,0,0,.68);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.3rem;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    padding-left: 3px;
}
.tv-card:hover .tv-play-icon {
    opacity: 1;
}

.tv-duration {
    position: absolute;
    bottom: 6px; right: 6px;
    background: rgba(0,0,0,.82);
    color: #fff;
    font-size: .72rem;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: .03em;
}

.tv-card-info {
    padding: .75rem .85rem .85rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.tv-card-title {
    margin: 0;
    font-size: .92rem;
    line-height: 1.35;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tv-card-title a {
    color: #0f0f0f;
    text-decoration: none;
}
.tv-card-title a:hover {
    color: #ff0000;
}
.tv-card-meta-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tv-card-category {
    font-size: .75rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.tv-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .2rem;
}

/* ----------  Tags  ---------- */
.tv-tag {
    display: inline-block;
    background: #f1f3f4;
    color: #555;
    font-size: .68rem;
    padding: 2px 7px;
    border-radius: 99px;
    font-weight: 500;
}

/* ----------  Category Tabs  ---------- */
.tv-category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1.5rem;
}
.tv-tab {
    display: inline-block;
    padding: .35rem .95rem;
    border-radius: 99px;
    background: #f1f3f4;
    color: #333;
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.tv-tab:hover,
.tv-tab-active {
    background: #ff0000;
    color: #fff;
}

/* ----------  Pagination  ---------- */
.tv-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin: 1.8rem 0;
    justify-content: center;
}
.tv-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .65rem;
    border-radius: 6px;
    background: #f1f3f4;
    color: #333;
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.tv-page-btn:hover {
    background: #e0e0e0;
}
.tv-page-current {
    background: #ff0000;
    color: #fff !important;
}
.tv-page-ellipsis {
    padding: 0 .3rem;
    color: #888;
}

/* ----------  Slider  ---------- */
.tv-slider-wrapper {
    position: relative;
    overflow: hidden;
    padding: 0 40px;
    margin-bottom: 2rem;
}
.tv-slider-track {
    display: flex;
    gap: 1rem;
    transition: transform .35s ease;
    will-change: transform;
}
.tv-slide {
    flex: 0 0 230px;
    min-width: 230px;
}
.tv-slide-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.tv-slide-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #0f0f0f;
    border-radius: 8px;
    overflow: hidden;
}
.tv-slide-thumb img {
    position: absolute;
    top:0;left:0;width:100%;height:100%;
    object-fit: cover;
    transition: opacity .25s;
}
.tv-slide:hover .tv-slide-thumb img { opacity: .82; }
.tv-slide:hover .tv-play-icon { opacity: 1; }
.tv-slide-info {
    padding: .5rem .25rem;
}
.tv-slide-title {
    margin: 0 0 .2rem;
    font-size: .85rem;
    line-height: 1.3;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #0f0f0f;
}
.tv-slide-cat {
    font-size: .72rem;
    color: #888;
    text-transform: uppercase;
}
.tv-slider-btn {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px;
    background: rgba(0,0,0,.65);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    line-height: 1;
    padding: 0;
}
.tv-slider-btn:hover { background: rgba(0,0,0,.9); }
.tv-slider-prev { left: 2px; }
.tv-slider-next { right: 2px; }

/* =========================================================================
   DEDICATED VIDEO WATCH PAGE & ADSTERRA AD SLOTS
   ========================================================================= */

.tv-watch-container {
    max-width: 1360px;
    margin: 2rem auto;
    padding: 0 1.25rem;
}
.tv-watch-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.tv-watch-main {
    flex: 1;
    min-width: 0;
}
.tv-watch-sidebar {
    width: 380px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .tv-watch-layout {
        flex-direction: column;
    }
    .tv-watch-sidebar {
        width: 100%;
    }
}

/* ----------  Ad Slots  ---------- */
.tv-ad-slot {
    width: 100%;
    text-align: center;
    margin: 1.25rem 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}
.tv-ad-top {
    margin-top: 0;
    margin-bottom: 1.25rem;
}
.tv-ad-bottom {
    margin: 1.75rem 0;
    padding: 1rem 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.tv-ad-sidebar {
    margin-top: 0;
    margin-bottom: 1.75rem;
}

/* ----------  Player on Watch Page  ---------- */
.tv-player-wrapper {
    margin-bottom: 1.5rem;
}
.tv-player-embed {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
}
.tv-player-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}
.tv-player-title {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 1rem 0 .6rem;
    color: #0f0f0f;
}
.tv-player-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .85rem;
    flex-wrap: wrap;
}
.tv-player-category {
    background: #ff0000;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.tv-player-duration {
    font-size: .85rem;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}
.tv-player-duration .dashicons {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
}
.tv-player-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .6rem;
}

/* ----------  Related Videos Sidebar  ---------- */
.tv-related-section {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    border: 1px solid #eee;
}
.tv-related-heading {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid #ff0000;
    color: #0f0f0f;
}
.tv-related-list {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.tv-related-card {
    display: flex;
    gap: .85rem;
    text-decoration: none;
    align-items: flex-start;
}
.tv-related-thumb-link {
    flex-shrink: 0;
    width: 130px;
    text-decoration: none;
}
.tv-related-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}
.tv-related-thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity .2s;
}
.tv-related-card:hover .tv-related-thumb img {
    opacity: .82;
}
.tv-related-info {
    flex: 1;
    min-width: 0;
}
.tv-related-title {
    margin: 0 0 .3rem;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tv-related-title a {
    color: #0f0f0f;
    text-decoration: none;
}
.tv-related-title a:hover {
    color: #ff0000;
}
.tv-related-cat {
    font-size: .72rem;
    color: #777;
    text-transform: uppercase;
    font-weight: 500;
}

/* =========================================================================
   COMMENTS SECTION
   ========================================================================= */

.tv-comments-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f1f1f1;
}
.tv-comments-header h3 {
    font-size: 1.25rem;
    margin: 0 0 1.25rem;
    font-weight: 700;
}
.tv-comment-form {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 2rem;
}
.tv-comment-form-row {
    margin-bottom: .85rem;
}
.tv-input,
.tv-textarea {
    width: 100%;
    padding: .75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.tv-input:focus,
.tv-textarea:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 0 3px rgba(255,0,0,.15);
}
.tv-comment-form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.tv-comment-submit-btn {
    background: #ff0000;
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: .95rem;
    padding: .65rem 1.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s;
}
.tv-comment-submit-btn:hover {
    background: #cc0000;
}
.tv-comment-status {
    font-size: .85rem;
    color: #666;
}

/* Comments List */
.tv-comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.tv-comment-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.tv-comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ff0000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.tv-comment-content {
    flex: 1;
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: .85rem 1.1rem;
}
.tv-comment-author-line {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .35rem;
}
.tv-comment-author {
    font-size: .95rem;
    font-weight: 700;
    color: #0f0f0f;
}
.tv-comment-time {
    font-size: .75rem;
    color: #888;
}
.tv-comment-body {
    font-size: .9rem;
    color: #333;
    line-height: 1.5;
}
.tv-no-comments {
    color: #888;
    font-style: italic;
    padding: 1rem 0;
}

/* Lightbox fallback overlay */
.tv-lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
.tv-lightbox-overlay.tv-lb-open { display: flex; }
.tv-lightbox-inner { position: relative; width: 90vw; max-width: 900px; }
.tv-lightbox-frame { position: relative; width: 100%; padding-top: 56.25%; background: #000; }
.tv-lightbox-frame iframe { position: absolute; top:0;left:0;width:100%;height:100%; border: none; }
.tv-lightbox-title { color: #fff; margin-top: .6rem; font-size: 1rem; font-weight: 600; text-align: center; }
.tv-lb-close { position: absolute; top: -40px; right: -6px; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; }

.tv-no-videos {
    text-align: center;
    color: #888;
    padding: 2.5rem;
    font-size: 1.05rem;
}
