/* ==========================================================================
   593 IPTV / X593X - WEBPLAYER STYLESHEET
   Design System: x593x-tokens.css
   ========================================================================== */

/* Resets & Base */
body.x593x-webplayer-body {
    background-color: var(--x-bg-canvas);
    color: var(--x-text-main);
    font-family: var(--x-font-display);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 72px; /* Space for mobile bottom nav */
}

@media (min-width: 768px) {
    body.x593x-webplayer-body {
        padding-bottom: 0;
    }
}

/* Glass Navbar */
.x-web-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1rem 4%;
    z-index: 1000;
    transition: background-color var(--x-transition-normal), backdrop-filter var(--x-transition-normal), box-shadow var(--x-transition-normal);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(8, 12, 20, 0.95) 0%, rgba(8, 12, 20, 0.4) 70%, transparent 100%);
}

.x-web-navbar.scrolled {
    background: rgba(8, 12, 20, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--x-border-subtle);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
}

.x-brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--x-font-display);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: #ffffff;
    text-decoration: none;
    transition: transform var(--x-transition-fast);
}

.x-brand-logo:hover {
    transform: scale(1.02);
    color: #ffffff;
}

.x-brand-logo .x-cyan-dot {
    color: var(--x-cyan);
    text-shadow: 0 0 12px var(--x-cyan-glow);
}

.x-nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: 2rem;
}

.x-nav-links a {
    color: var(--x-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.4rem 0.6rem;
    border-radius: var(--x-radius-sm);
    transition: color var(--x-transition-fast), background-color var(--x-transition-fast);
}

.x-nav-links a:hover,
.x-nav-links a.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.x-nav-links a.active {
    color: var(--x-cyan);
    font-weight: 600;
}

/* Navbar Right Controls */
.x-nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.x-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(14, 22, 38, 0.7);
    border: 1px solid var(--x-border-subtle);
    border-radius: var(--x-radius-full);
    padding: 0.4rem 0.9rem;
    transition: border-color var(--x-transition-fast), box-shadow var(--x-transition-fast), width var(--x-transition-normal);
}

.x-search-box:focus-within {
    border-color: var(--x-cyan);
    box-shadow: 0 0 0 2px var(--x-cyan-glow);
    background: rgba(14, 22, 38, 0.95);
}

.x-search-box i {
    color: var(--x-text-muted);
    font-size: 0.9rem;
}

.x-search-box input {
    background: transparent;
    border: none;
    color: #ffffff;
    outline: none;
    margin-left: 0.5rem;
    width: 110px;
    font-size: 0.85rem;
    transition: width var(--x-transition-normal);
}

@media (min-width: 576px) {
    .x-search-box input {
        width: 170px;
    }
    .x-search-box:focus-within input {
        width: 230px;
    }
}

.x-search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(14, 22, 38, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--x-border-subtle);
    border-radius: var(--x-radius-md);
    width: min(340px, 90vw);
    max-height: 420px;
    overflow-y: auto;
    z-index: 1050;
    box-shadow: var(--x-shadow-elevated);
}

.x-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    color: var(--x-text-main);
    transition: background var(--x-transition-fast);
}

.x-search-item:last-child {
    border-bottom: none;
}

.x-search-item:hover {
    background: rgba(0, 229, 255, 0.08);
    color: #ffffff;
}

.x-search-thumb {
    width: 44px;
    height: 64px;
    border-radius: var(--x-radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: #111;
}

.x-user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--x-text-main);
    font-size: 0.85rem;
    font-weight: 500;
}

.x-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--x-cyan-dark), var(--x-indigo));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

/* Bottom Navigation Bar (Mobile / Touch Viewports) */
.x-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(8, 12, 20, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--x-border-subtle);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1020;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.x-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--x-text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    flex: 1;
    height: 100%;
    transition: color var(--x-transition-fast);
}

.x-bottom-nav-item i {
    font-size: 1.2rem;
    transition: transform var(--x-transition-fast);
}

.x-bottom-nav-item:hover,
.x-bottom-nav-item:focus {
    color: #ffffff;
}

.x-bottom-nav-item.active {
    color: var(--x-cyan);
    font-weight: 600;
}

.x-bottom-nav-item.active i {
    transform: translateY(-2px);
    text-shadow: 0 0 10px var(--x-cyan-glow);
}

/* Hero Banner */
.x-hero-banner {
    position: relative;
    height: clamp(480px, 75vh, 750px);
    background-size: cover;
    background-position: center 20%;
    display: flex;
    align-items: flex-end;
    padding-bottom: 4rem;
}

.x-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(8, 12, 20, 0.3) 0%,
        rgba(8, 12, 20, 0.6) 50%,
        var(--x-bg-canvas) 100%
    ),
    radial-gradient(
        circle at 20% 50%,
        rgba(0, 0, 0, 0.8) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.x-hero-container {
    position: relative;
    z-index: 2;
    padding: 0 4%;
    width: 100%;
    max-width: 850px;
}

.x-hero-title {
    font-family: var(--x-font-display);
    font-size: clamp(2rem, 4vw + 1rem, 3.8rem);
    font-weight: 800;
    line-height: 1.1;
    color: #ffffff;
    margin-bottom: 0.85rem;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
}

.x-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.x-hero-meta-pill {
    padding: 0.2rem 0.6rem;
    border-radius: var(--x-radius-sm);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    color: #ffffff;
    font-weight: 600;
}

.x-hero-meta-pill.cyan {
    background: rgba(0, 229, 255, 0.2);
    color: var(--x-cyan);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.x-hero-plot {
    font-size: clamp(0.9rem, 1vw + 0.5rem, 1.1rem);
    line-height: 1.5;
    color: var(--x-text-main);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.x-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.btn-x-play {
    background: var(--x-cyan);
    color: #040810;
    border: none;
    padding: 0.75rem 1.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: var(--x-radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 16px var(--x-cyan-glow);
    transition: background var(--x-transition-fast), transform var(--x-transition-fast);
}

.btn-x-play:hover {
    background: #33ecff;
    color: #040810;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.4);
}

.btn-x-info {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: var(--x-radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--x-transition-fast), transform var(--x-transition-fast);
}

.btn-x-info:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-2px);
}

/* Category Rails / Swiper Containers */
.x-category-rail {
    position: relative;
    padding: 1.5rem 0 1rem 4%;
    z-index: 3;
}

.x-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-right: 4%;
}

.x-category-title {
    font-family: var(--x-font-display);
    font-size: clamp(1.1rem, 1.4vw + 0.6rem, 1.45rem);
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.x-category-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1.1em;
    background: var(--x-cyan);
    border-radius: 2px;
}

.x-category-more {
    font-size: 0.85rem;
    color: var(--x-text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color var(--x-transition-fast);
}

.x-category-more:hover {
    color: var(--x-cyan);
}

/* Media Poster Card */
.x-media-card {
    position: relative;
    border-radius: var(--x-radius-md);
    overflow: hidden;
    background: var(--x-bg-card);
    border: 1px solid var(--x-border-subtle);
    aspect-ratio: 2 / 3;
    cursor: pointer;
    transition: transform var(--x-transition-normal), box-shadow var(--x-transition-normal), border-color var(--x-transition-normal);
}

.x-media-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--x-transition-normal);
}

.x-media-card:hover {
    transform: translateY(-6px) scale(1.03);
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 20px var(--x-cyan-glow);
    z-index: 10;
}

.x-media-card:focus-visible {
    outline: 2px solid var(--x-cyan);
    outline-offset: 2px;
}

.x-media-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(8, 12, 20, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.15rem 0.45rem;
    border-radius: var(--x-radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    color: #ffffff;
    z-index: 2;
}

.x-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(8, 12, 20, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    z-index: 3;
    transition: background var(--x-transition-fast), color var(--x-transition-fast), transform var(--x-transition-fast);
}

.x-fav-btn:hover {
    background: rgba(0, 229, 255, 0.25);
    color: var(--x-cyan);
    transform: scale(1.1);
}

.x-media-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(8, 12, 20, 0.95) 100%);
    opacity: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.75rem;
    transition: opacity var(--x-transition-normal);
}

.x-media-card:hover .x-media-card-overlay {
    opacity: 1;
}

.x-media-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.x-media-sub {
    font-size: 0.75rem;
    color: var(--x-text-muted);
    display: flex;
    justify-content: space-between;
}

/* Media Grid Layout (Catalogs, My List, Search) */
.x-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 1rem;
    padding: 1.5rem 0;
}

@media (min-width: 576px) {
    .x-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1.25rem;
    }
}

@media (min-width: 992px) {
    .x-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        gap: 1.5rem;
    }
}

/* WebPlayer Page Wrapper */
.x-webplayer-page {
    padding: 5.5rem 4% 3rem 4%;
    min-height: 80vh;
}

.x-webplayer-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--x-border-subtle);
    padding-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.x-webplayer-title {
    font-family: var(--x-font-display);
    font-size: clamp(1.4rem, 2vw + 0.8rem, 2rem);
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

/* Category Filter Tabs */
.x-category-filter {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}

.x-filter-chip {
    padding: 0.4rem 0.9rem;
    border-radius: var(--x-radius-full);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--x-border-subtle);
    color: var(--x-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--x-transition-fast);
}

.x-filter-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.x-filter-chip.active {
    background: var(--x-cyan);
    color: #040810;
    border-color: var(--x-cyan);
    font-weight: 700;
}

/* Player View Container */
.x-player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 85vh;
    background: #000000;
    border-radius: var(--x-radius-lg);
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
}

.x-player-wrapper video,
.x-player-wrapper .video-js,
.x-player-wrapper .dplayer {
    width: 100%;
    height: 100%;
}

/* Live TV Channel Card */
.x-channel-card {
    background: var(--x-bg-card);
    border: 1px solid var(--x-border-subtle);
    border-radius: var(--x-radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: var(--x-text-main);
    transition: transform var(--x-transition-fast), border-color var(--x-transition-fast), background var(--x-transition-fast);
}

.x-channel-card:hover {
    background: var(--x-bg-card-hover);
    border-color: var(--x-border-hover);
    transform: translateY(-2px);
    color: #ffffff;
}

.x-channel-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: var(--x-radius-sm);
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    flex-shrink: 0;
}

/* Empty States */
.x-empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--x-text-muted);
}

.x-empty-state i {
    font-size: 3rem;
    color: var(--x-text-faint);
    margin-bottom: 1rem;
}

.x-empty-state h4 {
    color: #ffffff;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}
