/**
 * Streamer Portal Styles
 * File: html/main.css
 * [MERGED & UPDATED VERSION]
 */

:root {
    /* --- BRAND COLORS --- */
    --brand: #6644ff;
    --plyr-color-main: #ffcc00 !important;

    /* --- DEFAULT THEME (Dark Mode) --- */
    --bg: #0a0a0a;
    --card: #161616;
    --text: #ffffff;
    --border: #333333;
}

/* --- LIGHT MODE OVERRIDE --- */
body.theme-light {
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #111111;
    --border: #e0e0e0;
}

/* 1. Global fix for fractional pixel glitches */
* {
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    position: relative;
    background-color: var(--bg);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* --- NAVBAR --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px 30px;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    border-radius: 0;
    margin-bottom: 0;
    border: none;
    /* Center inner content */
    padding: 20px max(20px, calc(50% - 600px));
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-links a {
    color: white;
    margin-left: 1rem;
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
}

.nav-disabled {
    color: #444 !important;
    pointer-events: none;
    cursor: default;
    text-decoration: none;
}

#nav-channel-logo {
    width: 200px;
}

/* --- SECONDARY NAVIGATION (Sub-nav) --- */
.sub-nav {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.sub-nav a {
    color: #888;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding-bottom: 10px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.sub-nav a:hover,
.sub-nav a.active {
    color: var(--text);
    border-bottom-color: var(--brand);
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}


/* --- LAYOUT UTILITIES --- */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-40 {
    margin-bottom: 40px;
}

.gap-10 {
    gap: 10px;
}

.hidden {
    display: none !important;
}

/* Flex Utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Typography */
.h1-large {
    font-size: 2.5rem;
    margin-bottom: 10px;
    line-height: 1.2;
}

.h1-xl {
    font-size: 3rem;
    margin-bottom: 10px;
    line-height: 1.2;
}

.h2-gold {
    color: var(--brand);
    font-size: 2rem;
    margin-top: 0;
}

.h3-price {
    font-size: 2.5rem;
    margin: 20px 0;
}

.text-muted {
    color: #888;
}

.text-muted-light {
    color: #aaa;
}

.text-gold {
    color: gold;
}

.text-brand {
    color: var(--brand);
}

.text-small {
    font-size: 0.9rem;
}

/* --- GRID SYSTEMS --- */
.vod-grid,
#tenant-grid,
#playlists-grid,
.blog-container,
#related-videos-grid {
    display: grid;
    /* Minimum 280px per card, distributed evenly. 
       auto-fill creates ghost columns to prevent single items from stretching. */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    width: 100%;
    /* Prevents cards from stretching vertically to match neighbors */
    align-items: start;
    justify-content: start;
}

/* --- CARD STYLES --- */
.video-card,
.blog-card,
.archive-card,
.archive-video-card {
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
    contain: content;
    color: var(--text);
    /* Constrain cards so they don't become excessively wide on mobile or single-item rows */
    width: 100%;
    max-width: 380px;
    margin: 0;
    /* Let the grid handle spacing */
}

.archive-video-card {
    background: transparent;
    /* Cleaner look for archives */
    border: none;
    border-radius: 0;
    overflow: visible;
}

.archive-card:hover,
.video-card:hover {
    transform: translateY(-5px);
    border-color: var(--brand);
}

/* --- THUMBNAIL ASPECT RATIO FIX (The core fix) --- */
.archive-thumb-wrapper,
.video-wrapper {
    width: 100%;
    /* Enforce strict 16:9 ratio */
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
    /* Reset old padding hack if it exists on specific elements */
    padding-bottom: 0 !important;
    height: auto !important;
}

/* Make images fit perfectly inside the 16:9 box */
.archive-thumb,
.video-wrapper img,
.video-wrapper video,
.video-wrapper .plyr {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    object-fit: cover;
    /* Crops image cleanly */
    display: block;
}

.archive-meta .archive-title {
    font-size: 1.1rem;
    line-height: 1.3;
    margin: 0 0 5px 0;
    font-weight: 600;
}

.archive-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #888;
}

/* Tenant Card Specifics */
.tenant-card-wrapper {
    height: 140px;
    background: #000;
    position: relative;
}

.tenant-card-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tenant-card-no-banner {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.tenant-info {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.tenant-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}

.tenant-text {
    flex: 1;
    min-width: 0;
}

.tenant-name {
    margin: 0;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tenant-desc {
    color: #888;
    font-size: 0.85rem;
    margin: 3px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- THEATER MODE (Playlists) --- */
.theater-layout {
    display: grid;
    /* 1fr for player, fixed 350px for sidebar queue */
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

@media (max-width: 900px) {
    .theater-layout {
        grid-template-columns: 1fr;
    }
}

.theater-sidebar {
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 800px;
    /* Constrain height so it scrolls */
    border: 1px solid var(--border);
}

.playlist-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
}

.playlist-queue {
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.queue-item {
    display: flex;
    gap: 15px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    align-items: center;
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.queue-item.active {
    background: rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--brand);
}

.queue-thumb {
    width: 100px;
    flex-shrink: 0;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.queue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-info {
    flex-grow: 1;
    min-width: 0;
}

.queue-title {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* --- BLOG STYLES --- */
.blog-container {
    max-width: 800px;
    margin: 0 auto;
}

.blog-card {
    padding: 0 !important;
}

.blog-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    overflow: hidden;
    border-bottom: 1px solid #222;
}

.blog-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.blog-card:hover {
    transform: scale(1.05);
}

.blog-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.blog-info h3 {
    margin-top: 0;
    margin-bottom: 5px;
}

.blog-info small {
    color: var(--brand);
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
}

/* --- PLYR OVERRIDES --- */
.plyr--full-ui.plyr--video .plyr__controls {
    z-index: 10;
}

input[type=range]::-webkit-slider-runnable-track,
input[type=range]::-webkit-slider-thumb {
    background: #ffcc00 !important;
}

/* --- MEMBERSHIP STYLES --- */
.membership-container {
    padding-top: 50px;
    max-width: 800px;
    margin: 0 auto;
}

.membership-card {
    max-width: 500px;
    margin: 0 auto;
    background: #1a1a1a;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
}

.membership-features {
    text-align: left;
    margin: 30px auto;
    display: inline-block;
    color: #ccc;
    padding-left: 0;
    list-style: none;
}

.membership-features li {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.membership-input {
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #000;
    color: white;
    margin-bottom: 15px;
    font-size: 1rem;
}

.membership-btn {
    width: 100%;
    font-size: 1.2rem;
    cursor: pointer;
    background: #ff4444;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-weight: bold;
    transition: opacity 0.2s;
}

.membership-btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 8px 16px;
    margin-top: 20px;
    cursor: pointer;
    border-radius: 4px;
}

.payment-success-msg {
    color: #4caf50;
    font-size: 1.5rem;
    font-weight: bold;
}

/* --- HOME CATEGORY SCROLLER --- */
.category-scroller {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    width: 100%;
    align-items: start;
    justify-content: start;
    padding-bottom: 20px;
}

.category-card-home {
    width: 100%;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    border: 1px solid #333;
    position: relative;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.category-card-home:hover {
    transform: translateY(-5px);
    border-color: var(--brand);
}

.category-card-thumb {
    height: 120px;
    width: 100%;
    overflow: hidden;
}

.category-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card-home:hover .category-card-img {
    transform: scale(1.05);
}

.category-card-fallback {
    width: 100%;
    height: 100%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: bold;
}

.category-card-info {
    padding: 10px;
    text-align: center;
}

.category-card-title {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white;
}

/* --- BANNER STYLES --- */
.channel-banner {
    width: 100%;
    height: 55vh;
    background-color: #161616;
    background-size: cover;
    background-position: center top;
    border-radius: 0;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .channel-banner {
        height: 50vh;
        aspect-ratio: auto;
    }
}

.hero {
    position: relative;
    z-index: 2;
    padding-top: 10px;
    border-radius: 12px;
}

#view-home {
    padding: 0 !important;
}

#view-home .content-container {
    padding-top: 20px;
    padding-bottom: 60px;
}

/* --- PAGE VIEW UTILS --- */
.page-view {
    display: block;
    padding: 120px !important;
    min-height: 80vh;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- BUTTONS & MISC --- */
.btn-join,
.btn-read {
    display: inline-block;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 10px;
}

.btn-join {
    background: #ff4444;
}

.back-btn {
    background: #000;
    border: none;
    padding-bottom: 2em;
    cursor: pointer;
    color: #fff;
}

#global-share-btn {
    background-color: transparent;
    color: var(--brand);
    border: 1px solid var(--brand);
    padding: 4px 12px;
    border-radius: 4px;
    font-family: inherit;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    margin-left: 15px;
}

#global-share-btn:hover {
    background-color: var(--brand);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    transform: translateY(-1px);
}

#global-share-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.admin-edit-btn {
    display: inline-flex;
    align-items: center;
    background: #333;
    color: #aaa;
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    margin-left: 10px;
    border: 1px solid #444;
}

/* --- MODAL STYLES --- */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
    box-sizing: border-box;
}

.modal-content {
    background-color: #111;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 40px;
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.close-modal {
    color: #888;
    position: absolute;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    top: 15px;
    right: 20px;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #fff;
    text-decoration: none;
}

.oauth-btn {
    width: 100%;
    padding: 14px;
    background: #fff;
    color: #111;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}

.oauth-btn:hover {
    background: #eee;
    transform: translateY(-1px);
}

/* --- NEWSLETTER --- */
.newsletter-box {
    margin-top: 60px;
    margin-bottom: 40px;
    padding: 40px;
    background: linear-gradient(145deg, #1e1e1e, #111);
    border: 1px solid #333;
    border-radius: 12px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.newsletter-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), transparent);
}

.newsletter-content h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: white;
}

.newsletter-content p {
    color: #aaa;
    margin-bottom: 30px;
    max-width: 500px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    max-width: 400px;
    margin: 0 auto;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 12px 15px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #000;
    color: white;
}

.input-group button {
    padding: 12px 25px;
    border-radius: 6px;
    border: none;
    background: var(--brand);
    color: white;
    font-weight: bold;
    cursor: pointer;
}

/* --- FEATURED & SECONDARY --- */
.featured-box {
    background: linear-gradient(145deg, #1e1e1e, #161616);
    border-radius: 15px;
    padding: 30px;
    margin-top: 20px;
    text-align: center;
}

.featured-box.archive-card {
    padding: 0;
}

.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.secondary-card {
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.secondary-card .thumb-area {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.secondary-card .thumb-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- LIVE & SCHEDULE --- */
.live-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #ff4444;
    border-radius: 50%;
    margin-left: 5px;
    box-shadow: 0 0 8px #ff4444;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        transform: scale(0.95);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
    }
}

.event-card {
    display: flex;
    align-items: center;
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 20px;
    gap: 20px;
}

.event-date-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #222;
    min-width: 70px;
    height: 70px;
    border-radius: 12px;
    border: 1px solid #444;
}

.day-num {
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
}

.event-info {
    flex: 1;
}

.event-image-wrapper {
    width: 120px;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
}

.event-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    z-index: 10;
}

.player-container video,
.player-container .plyr,
.player-container iframe {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    border: none;
}

/* --- MISC UTILS --- */
.hero-avatar-graphic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--brand);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: block;
    margin: 0 auto 20px auto;
    object-fit: cover;
}

.lock-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 5px;
    border-radius: 50%;
    font-size: 1.2rem;
    z-index: 10;
}

.rss-btn {
    display: inline-flex;
    align-items: center;
    background: #ee802f;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
}

.typography {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #ddd;
}

.typography img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

#archive-banner {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
    background: #000;
    position: relative;
}

.cat-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

@media (max-width: 768px) {
    #archive-banner {
        height: 180px;
    }
}

#home-categories-section {
    text-align: left;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

#clear-filter-btn {
    display: none !important;
}

/* --- ARCHIVE TOOLBAR (The New Header) --- */
.archive-toolbar {
    display: flex;
    justify-content: space-between;
    /* Pushes content to edges */
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toolbar-right {
    flex-grow: 0;
}

#archive-title {
    margin: 0;
    font-size: 1.8rem;
    white-space: nowrap;
}

/* New Search Bar Style */
#archive-search {
    width: 300px;
    padding: 10px 15px;
    background: #111;
    border: 1px solid #444;
    color: white;
    border-radius: 20px;
    /* Modern pill shape */
}

#archive-search:focus {
    outline: none;
    border-color: var(--brand);
}

/* Mobile Tweak for Header */
@media (max-width: 768px) {
    .archive-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .toolbar-right,
    #archive-search {
        width: 100%;
    }
}

#live-indicator {
    display: none;
    /* Hidden by default */
    align-items: center;
    background: rgba(255, 0, 0, 0.1);
    color: #ff4d4d;
    padding: 6px 14px;
    border-radius: 50px;
    font-weight: 800;
    border: 1px solid #ff4d4d;
    font-family: sans-serif;
    letter-spacing: 0.5px;
}

.pulse {
    width: 10px;
    height: 10px;
    background: #ff4d4d;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 0 rgba(255, 77, 77, 0.4);
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(255, 77, 77, 0);
    }

    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
    }
}

/* --- GLOBAL FOOTER --- */
.global-footer {
    margin-top: auto;
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
}

.global-footer a {
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.global-footer a:hover {
    color: var(--brand);
}