/**
 * TVStartup OTT Platform - Channel Player Styles
 *
 * Styles for the [ts_ott_channel_player] shortcode.
 * Layout: player on left/top, channel list sidebar on right/bottom.
 *
 * @package Tvstartup_OTT_Platform
 * @since   1.6.0
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

.ts-ott-channel-player-wrapper {
    --ts-ott-cp-primary: #2271b1;
    --ts-ott-cp-primary-hover: #135e96;
    --ts-ott-cp-accent: #e74c3c;
    --ts-ott-cp-text: #1d2327;
    --ts-ott-cp-text-light: #646970;
    --ts-ott-cp-text-muted: #a7aaad;
    --ts-ott-cp-border: #dcdcde;
    --ts-ott-cp-bg: #f6f7f7;
    --ts-ott-cp-bg-dark: #1a1a2e;
    --ts-ott-cp-bg-sidebar: #ffffff;
    --ts-ott-cp-bg-item-hover: #f0f0f1;
    --ts-ott-cp-bg-item-active: rgba(34, 113, 177, 0.06);
    --ts-ott-cp-radius: 8px;
    --ts-ott-cp-radius-lg: 12px;
    --ts-ott-cp-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --ts-ott-cp-sidebar-width: 360px;
}

/* ==========================================================================
   Wrapper
   ========================================================================== */

.ts-ott-channel-player-wrapper {
    font-family: var(--ts-ott-cp-font-family);
    line-height: 1.5;
    box-sizing: border-box;
    max-width: 1400px;
    margin: 0 auto;
}

.ts-ott-channel-player-wrapper *,
.ts-ott-channel-player-wrapper *::before,
.ts-ott-channel-player-wrapper *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Error Message
   ========================================================================== */

.ts-ott-channel-player-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--ts-ott-cp-text-light);
    font-size: 15px;
}

/* ==========================================================================
   Layout: Player + Sidebar
   ========================================================================== */

.ts-ott-channel-player-layout {
    display: flex;
    gap: 0;
    border: 1px solid var(--ts-ott-cp-border);
    border-radius: var(--ts-ott-cp-radius-lg);
    overflow: hidden;
    background: var(--ts-ott-cp-bg-sidebar);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   Player Main Area
   ========================================================================== */

.ts-ott-channel-player-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Player Container - 16:9 aspect ratio */
.ts-ott-channel-player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: var(--ts-ott-cp-bg-dark);
}

.ts-ott-artplayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Player Info Bar */
.ts-ott-channel-player-info {
    padding: 16px 20px;
    border-top: 1px solid var(--ts-ott-cp-border);
    background: var(--ts-ott-cp-bg-sidebar);
}

.ts-ott-channel-player-now-playing {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.ts-ott-channel-player-live-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--ts-ott-cp-accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 4px;
    line-height: 1.4;
    text-transform: uppercase;
    flex-shrink: 0;
}

.ts-ott-channel-player-title {
    margin: 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--ts-ott-cp-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-ott-channel-player-description {
    margin: 4px 0 0 0;
    padding: 0;
    font-size: 14px;
    color: var(--ts-ott-cp-text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.ts-ott-channel-player-sidebar {
    width: var(--ts-ott-cp-sidebar-width);
    flex-shrink: 0;
    border-left: 1px solid var(--ts-ott-cp-border);
    display: flex;
    flex-direction: column;
    background: var(--ts-ott-cp-bg-sidebar);
}

.ts-ott-channel-player-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ts-ott-cp-border);
    flex-shrink: 0;
}

.ts-ott-channel-player-sidebar-header h4 {
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--ts-ott-cp-text);
}

.ts-ott-channel-player-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--ts-ott-cp-bg);
    color: var(--ts-ott-cp-text-light);
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
}

/* Channel List (scrollable) */
.ts-ott-channel-player-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Scrollbar styling */
.ts-ott-channel-player-list::-webkit-scrollbar {
    width: 6px;
}

.ts-ott-channel-player-list::-webkit-scrollbar-track {
    background: transparent;
}

.ts-ott-channel-player-list::-webkit-scrollbar-thumb {
    background: var(--ts-ott-cp-border);
    border-radius: 3px;
}

.ts-ott-channel-player-list::-webkit-scrollbar-thumb:hover {
    background: #a7aaad;
}

/* ==========================================================================
   Channel List Items
   ========================================================================== */

.ts-ott-channel-player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--ts-ott-cp-border);
    outline: none;
}

.ts-ott-channel-player-item:last-child {
    border-bottom: none;
}

.ts-ott-channel-player-item:hover {
    background: var(--ts-ott-cp-bg-item-hover);
}

.ts-ott-channel-player-item:focus-visible {
    background: var(--ts-ott-cp-bg-item-hover);
    box-shadow: inset 0 0 0 2px var(--ts-ott-cp-primary);
}

/* Active item */
.ts-ott-channel-player-item--active {
    background: var(--ts-ott-cp-bg-item-active);
    border-left: 3px solid var(--ts-ott-cp-primary);
    padding-left: 13px;
}

.ts-ott-channel-player-item--active:hover {
    background: var(--ts-ott-cp-bg-item-active);
}

/* Thumbnail */
.ts-ott-channel-player-item-thumb {
    position: relative;
    width: 100px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--ts-ott-cp-bg);
}

.ts-ott-channel-player-item-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ts-ott-channel-player-item-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--ts-ott-cp-text-muted);
    background: var(--ts-ott-cp-bg);
}

/* Now-playing overlay on thumbnail */
.ts-ott-channel-player-item-playing {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Equalizer animation bars */
.ts-ott-channel-player-eq {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.ts-ott-channel-player-eq span {
    display: block;
    width: 3px;
    background: #ffffff;
    border-radius: 1px;
    animation: ts-ott-eq-bar 0.8s ease-in-out infinite;
}

.ts-ott-channel-player-eq span:nth-child(1) {
    height: 8px;
    animation-delay: 0s;
}

.ts-ott-channel-player-eq span:nth-child(2) {
    height: 14px;
    animation-delay: 0.2s;
}

.ts-ott-channel-player-eq span:nth-child(3) {
    height: 10px;
    animation-delay: 0.4s;
}

@keyframes ts-ott-eq-bar {
    0%, 100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}

/* Item info */
.ts-ott-channel-player-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ts-ott-channel-player-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ts-ott-cp-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-ott-channel-player-item--active .ts-ott-channel-player-item-title {
    color: var(--ts-ott-cp-primary);
}

.ts-ott-channel-player-item-desc {
    font-size: 12px;
    color: var(--ts-ott-cp-text-light);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Channel Guide (Now-Playing Playlist)
   ========================================================================== */

.ts-ott-channel-guide {
    border-top: 1px solid var(--ts-ott-cp-border);
    background: var(--ts-ott-cp-bg-sidebar);
}

.ts-ott-channel-guide-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--ts-ott-cp-border);
    background: var(--ts-ott-cp-bg);
}

.ts-ott-channel-guide-header h4 {
    margin: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ts-ott-cp-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Guide Content */
.ts-ott-channel-guide-content {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ts-ott-channel-guide-content::-webkit-scrollbar {
    width: 6px;
}

.ts-ott-channel-guide-content::-webkit-scrollbar-track {
    background: transparent;
}

.ts-ott-channel-guide-content::-webkit-scrollbar-thumb {
    background: var(--ts-ott-cp-border);
    border-radius: 3px;
}

.ts-ott-channel-guide-content::-webkit-scrollbar-thumb:hover {
    background: #a7aaad;
}

/* Guide List */
.ts-ott-channel-guide-list {
    display: flex;
    flex-direction: column;
}

/* Guide Item */
.ts-ott-channel-guide-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--ts-ott-cp-border);
    transition: background-color 0.15s ease;
}

.ts-ott-channel-guide-item:last-child {
    border-bottom: none;
}

.ts-ott-channel-guide-item:hover {
    background: var(--ts-ott-cp-bg-item-hover);
}

/* Currently playing item */
.ts-ott-channel-guide-item--current {
    background: var(--ts-ott-cp-bg-item-active);
    border-left: 3px solid var(--ts-ott-cp-primary);
    padding-left: 17px;
}

.ts-ott-channel-guide-item--current:hover {
    background: var(--ts-ott-cp-bg-item-active);
}

/* Guide Item Thumbnail */
.ts-ott-channel-guide-item-thumb {
    position: relative;
    width: 100px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--ts-ott-cp-bg);
}

.ts-ott-channel-guide-item-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ts-ott-channel-guide-item-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--ts-ott-cp-text-muted);
    background: var(--ts-ott-cp-bg);
}

/* Now Playing badge on thumbnail */
.ts-ott-channel-guide-now-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    background: var(--ts-ott-cp-accent);
    color: #ffffff;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 3px;
    line-height: 1.4;
    text-transform: uppercase;
}

/* Duration badge on thumbnail */
.ts-ott-channel-guide-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 3px;
    line-height: 1.4;
}

/* Guide Item Info */
.ts-ott-channel-guide-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ts-ott-channel-guide-item-badge {
    display: inline-flex;
    align-self: flex-start;
    padding: 1px 6px;
    background: var(--ts-ott-cp-primary);
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-radius: 3px;
    line-height: 1.5;
    text-transform: uppercase;
}

.ts-ott-channel-guide-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ts-ott-cp-text);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-ott-channel-guide-item--current .ts-ott-channel-guide-item-title {
    color: var(--ts-ott-cp-primary);
}

.ts-ott-channel-guide-item-genres {
    font-size: 11px;
    color: var(--ts-ott-cp-text-light);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading State */
.ts-ott-channel-guide-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px 20px;
    color: var(--ts-ott-cp-text-light);
    font-size: 13px;
}

.ts-ott-channel-guide-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--ts-ott-cp-border);
    border-top-color: var(--ts-ott-cp-primary);
    border-radius: 50%;
    animation: ts-ott-guide-spin 0.8s linear infinite;
}

@keyframes ts-ott-guide-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.ts-ott-channel-guide-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--ts-ott-cp-text-light);
    font-size: 13px;
}

/* ==========================================================================
   Responsive: Tablet (sidebar below)
   ========================================================================== */

@media screen and (max-width: 900px) {
    .ts-ott-channel-player-layout {
        flex-direction: column;
    }

    .ts-ott-channel-player-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--ts-ott-cp-border);
        max-height: 400px;
    }

    .ts-ott-channel-guide-content {
        max-height: 260px;
    }
}

/* ==========================================================================
   Responsive: Mobile
   ========================================================================== */

@media screen and (max-width: 600px) {
    .ts-ott-channel-player-wrapper {
        --ts-ott-cp-radius-lg: 0;
    }

    .ts-ott-channel-player-layout {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .ts-ott-channel-player-info {
        padding: 12px 16px;
    }

    .ts-ott-channel-player-title {
        font-size: 16px;
    }

    .ts-ott-channel-player-sidebar {
        max-height: 350px;
    }

    .ts-ott-channel-player-item-thumb {
        width: 80px;
        height: 45px;
    }

    .ts-ott-channel-guide-item {
        padding: 8px 16px;
    }

    .ts-ott-channel-guide-item-thumb {
        width: 80px;
        height: 45px;
    }

    .ts-ott-channel-guide-content {
        max-height: 220px;
    }

    .ts-ott-channel-guide-header {
        padding: 10px 16px;
    }
}

/* ==========================================================================
   Lock Overlay (Subscription / PPV)
   ========================================================================== */

.ts-ott-channel-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    color: #ffffff;
    text-align: center;
    overflow: hidden;
}

.ts-ott-channel-lock-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(6px) brightness(0.3);
    -webkit-filter: blur(6px) brightness(0.3);
    transform: scale(1.1);
}

.ts-ott-channel-lock-overlay-inner {
    position: relative;
    z-index: 2;
    padding: 24px;
    max-width: 100%;
}

.ts-ott-lock-content {
    max-width: 440px;
    width: 100%;
}

.ts-ott-lock-icon {
    margin-bottom: 16px;
    opacity: 0.7;
}

.ts-ott-lock-icon svg {
    width: 48px;
    height: 48px;
    stroke: #ffffff;
}

.ts-ott-lock-content h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
}

.ts-ott-lock-subtitle {
    margin: 0 0 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.ts-ott-lock-event-name {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.ts-ott-lock-ppv-image {
    max-width: 200px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Plan cards */
.ts-ott-lock-plans {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.ts-ott-lock-plan-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
    min-width: 140px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #ffffff;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    cursor: pointer;
}

.ts-ott-lock-plan-card:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    color: #ffffff;
    text-decoration: none;
}

.ts-ott-lock-plan-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.ts-ott-lock-plan-price {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.ts-ott-lock-plan-period {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

/* Buttons */
.ts-ott-lock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    border: none;
}

.ts-ott-lock-btn--primary {
    background: #2271b1;
    color: #ffffff;
}

.ts-ott-lock-btn--primary:hover {
    background: #135e96;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.ts-ott-lock-btn--outline {
    background: transparent;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.ts-ott-lock-btn--outline:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

.ts-ott-lock-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.ts-ott-lock-login-hint {
    margin: 12px 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.ts-ott-lock-login-hint a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

.ts-ott-lock-login-hint a:hover {
    color: #ffffff;
}

/* Plan cards below the player */
.ts-ott-channel-plans-below {
    margin-top: 24px;
}

.ts-ott-channel-plans-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    text-align: center;
    margin: 0 0 24px;
}

.ts-ott-channel-plans-below .ts-ott-plans-wrapper {
    max-width: 100%;
}

/* Single plan: center and constrain width */
.ts-ott-channel-plans-below .ts-ott-plans--grid.ts-ott-plans--single .ts-ott-plans__grid {
    max-width: 380px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 480px) {
    .ts-ott-lock-content h3 {
        font-size: 17px;
    }

    .ts-ott-lock-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .ts-ott-lock-btn {
        width: 100%;
        padding: 12px 16px;
    }
}
