/**
 * Catalog Widget Styles
 */

/* Container */
.cda-tv-catalog-container {
    position: relative;
}

/* Breadcrumbs */
.cda-tv-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.cda-tv-breadcrumbs a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cda-tv-breadcrumbs a:hover {
    color: #005582;
}

.cda-tv-breadcrumb-separator {
    opacity: 0.5;
}

/* Categories Navigation */
.cda-tv-categories-nav {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}

.cda-tv-categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cda-tv-category-item {
    display: inline-block;
    padding: 8px 20px;
    background: #f0f0f0;
    border-radius: 25px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.cda-tv-category-item:hover {
    background: #e0e0e0;
    color: #000;
}

.cda-tv-category-item.active {
    background: #0073aa;
    color: #fff;
}

.cda-tv-category-item .count {
    opacity: 0.7;
    margin-left: 5px;
}

/* Toolbar */
.cda-tv-catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

/* Search */
.cda-tv-catalog-search {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 400px;
}

.cda-tv-search-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.cda-tv-search-button {
    padding: 10px 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cda-tv-search-button:hover {
    background: #005582;
}

/* Filters */
.cda-tv-catalog-filters {
    position: relative;
}

.cda-tv-filter-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 15px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cda-tv-filter-toggle:hover {
    background: #e0e0e0;
}

.cda-tv-filter-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
    min-width: 250px;
    padding: 20px;
}

.cda-tv-filter-group {
    margin-bottom: 15px;
}

.cda-tv-filter-group:last-child {
    margin-bottom: 0;
}

.cda-tv-filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.cda-tv-filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Sort */
.cda-tv-catalog-sort select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

/* Wrapper */
.cda-tv-catalog-wrapper {
    display: flex;
    gap: 30px;
}

.cda-tv-catalog-wrapper.has-sidebar {
    display: flex;
}

/* Sidebar */
.cda-tv-catalog-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.cda-tv-categories-sidebar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.cda-tv-categories-sidebar h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
}

.cda-tv-categories-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cda-tv-categories-tree li {
    margin-bottom: 10px;
}

.cda-tv-categories-tree a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cda-tv-categories-tree a:hover {
    background: rgba(0,115,170,0.1);
    color: #0073aa;
}

.cda-tv-categories-tree a.active {
    background: #0073aa;
    color: #fff;
}

.cda-tv-categories-tree .count {
    opacity: 0.7;
    font-size: 12px;
}

/* Sub-categories */
.cda-tv-subcategories {
    margin-left: 20px;
    margin-top: 10px;
}

.cda-tv-has-children > a::before {
    content: '▸';
    margin-right: 5px;
    transition: transform 0.2s ease;
}

.cda-tv-has-children.expanded > a::before {
    transform: rotate(90deg);
}

/* Main Content */
.cda-tv-catalog-main {
    flex: 1;
    min-width: 0;
}

/* Loading */
.cda-tv-catalog-loading {
    display: none;
    text-align: center;
    padding: 40px;
}

.cda-tv-catalog-loading.active {
    display: block;
}

.cda-tv-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Grid Layout */
.cda-tv-catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.layout-grid .cda-tv-catalog-content {
    display: grid;
}

/* List Layout */
.layout-list .cda-tv-catalog-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Video Card */
.cda-tv-video-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.cda-tv-video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

/* Thumbnail */
.cda-tv-video-thumbnail {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    overflow: hidden;
}

.cda-tv-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cda-tv-video-thumbnail .placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
}

.cda-tv-video-thumbnail .placeholder .dashicons {
    font-size: 48px;
    color: #ccc;
}

/* Duration Badge */
.cda-tv-duration-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Play Overlay */
.cda-tv-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cda-tv-video-card:hover .cda-tv-play-overlay {
    opacity: 1;
}

.cda-tv-play-button {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cda-tv-play-button:hover {
    background: #fff;
    transform: scale(1.1);
}

.cda-tv-play-button .dashicons {
    font-size: 32px;
    color: #0073aa;
    margin-left: 3px;
}

/* Video Info */
.cda-tv-video-info {
    padding: 15px;
}

.cda-tv-video-category {
    font-size: 12px;
    color: #0073aa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.cda-tv-video-title {
    font-size: 16px;
    font-weight: 600;
    color: #23282d;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cda-tv-video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.cda-tv-video-meta span {
    display: flex;
    align-items: center;
}

.cda-tv-video-meta .format {
    color: #0073aa;
}

.cda-tv-video-meta .episode {
    background: #e5e5e5;
    padding: 2px 8px;
    border-radius: 3px;
}

.cda-tv-video-meta .views {
    opacity: 0.7;
}

/* List Layout Specific */
.layout-list .cda-tv-video-card {
    display: flex;
    gap: 20px;
}

.layout-list .cda-tv-video-thumbnail {
    width: 300px;
    flex-shrink: 0;
    padding-bottom: 0;
    height: 169px;
}

.layout-list .cda-tv-video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.layout-list .cda-tv-video-description {
    flex: 1;
    margin-top: 10px;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Format/Season Navigation */
.cda-tv-format-header {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.cda-tv-format-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.cda-tv-format-description {
    color: #666;
    margin-bottom: 20px;
}

.cda-tv-seasons-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cda-tv-season-tab {
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 25px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.cda-tv-season-tab:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.cda-tv-season-tab.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

/* Episodes Grid */
.cda-tv-episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.cda-tv-episode-card {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cda-tv-episode-card:hover {
    background: #e8f5ff;
}

.cda-tv-episode-number {
    font-size: 24px;
    font-weight: 700;
    color: #0073aa;
    width: 40px;
    text-align: center;
}

.cda-tv-episode-info {
    flex: 1;
}

.cda-tv-episode-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.cda-tv-episode-duration {
    font-size: 13px;
    color: #666;
}

/* Pagination */
.cda-tv-catalog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.cda-tv-catalog-pagination a,
.cda-tv-catalog-pagination span {
    display: inline-block;
    padding: 8px 12px;
    min-width: 40px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.cda-tv-catalog-pagination a:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

.cda-tv-catalog-pagination .current {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.cda-tv-catalog-pagination .dots {
    border: none;
}

/* Player */
.cda-tv-catalog-player {
    position: relative;
    background: #000;
}

.cda-tv-player-wrapper {
    position: relative;
}

.cda-tv-player-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cda-tv-player-close:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.cda-tv-player-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

.cda-tv-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cda-tv-player iframe,
.cda-tv-player video {
    width: 100%;
    height: 100%;
}

.cda-tv-player-info {
    background: #fff;
    padding: 20px;
}

.cda-tv-player-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.cda-tv-player-meta {
    color: #666;
    margin-bottom: 20px;
}

.cda-tv-player-controls {
    display: flex;
    gap: 10px;
    padding: 0 20px 20px;
    background: #fff;
}

.cda-tv-player-controls button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cda-tv-player-controls button:hover {
    background: #f0f0f0;
    border-color: #0073aa;
    color: #0073aa;
}

/* Player Overlay */
.cda-tv-player-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: #fff;
    padding: 40px 20px 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cda-tv-player-overlay.show {
    opacity: 1;
}

.cda-tv-overlay-content h4 {
    font-size: 24px;
    margin: 0 0 10px 0;
}

.cda-tv-overlay-content p {
    margin: 0 0 10px 0;
    opacity: 0.9;
}

.cda-tv-overlay-meta {
    font-size: 14px;
    opacity: 0.8;
}

/* Modal Player */
.cda-tv-player-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
}

.cda-tv-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.cda-tv-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
}

/* Inline Player Mode */
.player-inline .cda-tv-catalog-player {
    margin-bottom: 30px;
}

.player-inline.playing .cda-tv-catalog-content {
    display: none;
}

/* Sidebar Player Mode */
.player-sidebar .cda-tv-catalog-wrapper {
    position: relative;
}

.player-sidebar .cda-tv-catalog-player {
    position: sticky;
    top: 20px;
    width: 400px;
    margin-left: 30px;
}

/* Spot Overlay */
.cda-tv-catalog-spot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 100;
}

.cda-tv-spot-info {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.cda-tv-spot-label {
    padding: 5px 15px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cda-tv-spot-countdown {
    color: #fff;
    font-size: 14px;
}

.cda-tv-spot-skip {
    padding: 8px 20px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cda-tv-spot-skip:hover {
    background: rgba(255,255,255,0.3);
}

/* Responsive */
@media (max-width: 1200px) {
    .cda-tv-catalog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .cda-tv-catalog-wrapper {
        flex-direction: column;
    }
    
    .cda-tv-catalog-sidebar {
        width: 100%;
        margin-bottom: 30px;
    }
    
    .cda-tv-catalog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .player-sidebar .cda-tv-catalog-player {
        width: 100%;
        margin-left: 0;
        margin-bottom: 30px;
        position: relative;
    }
}

@media (max-width: 768px) {
    .cda-tv-catalog-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cda-tv-catalog-search {
        max-width: 100%;
    }
    
    .cda-tv-catalog-grid {
        grid-template-columns: 1fr;
    }
    
    .layout-list .cda-tv-video-card {
        flex-direction: column;
    }
    
    .layout-list .cda-tv-video-thumbnail {
        width: 100%;
        height: 0;
        padding-bottom: 56.25%;
    }
    
    .cda-tv-categories-list {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }
    
    .cda-tv-modal-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Editor Specific */
.elementor-editor .cda-tv-catalog-container {
    min-height: 400px;
}

.elementor-editor .cda-tv-catalog-loading {
    display: block;
}

.elementor-editor .cda-tv-catalog-content::after {
    content: 'Catalog Widget - ' attr(data-layout);
    display: block;
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 2px;
}
