/**
 * JW Player Playlist Integration Styles
 */

/* Container */
.jwppi-container {
    margin: 0 0 50px;
    max-width: 100%;
    padding-bottom: 30px;
    border-bottom: 1px solid #f0f0f0;
}

.jwppi-container:last-child {
    border-bottom: none;
}

/* Playlist Title and Description */
.jwppi-playlist-title {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 700;
    color: #222;
}

.jwppi-playlist-description {
    margin: 0 0 25px;
    font-size: 16px;
    line-height: 1.5;
    color: #666;
}

/* Main Player Container */
.jwppi-main-player-container {
    margin-bottom: 40px;
    padding: 0 0 20px;
    border-bottom: 1px solid #eee;
}

.jwppi-player-title {
    margin: 15px 0 5px;
    font-size: 22px;
    font-weight: 600;
    color: #333;
}

.jwppi-player-description {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.5;
    color: #666;
}

.jwppi-section-title {
    margin: 0 0 20px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

/* Featured Player */
.jwppi-featured-player {
    margin-bottom: 30px;
}

/* Grid Layout */
.jwppi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 20px;
    margin-bottom: 20px;
}

@media screen and (max-width: 1200px) {
    .jwppi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .jwppi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 480px) {
    .jwppi-grid {
        grid-template-columns: 1fr;
    }
}

.jwppi-grid-item {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px;
    background-color: #fff;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.jwppi-grid-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.jwppi-grid-item.jwppi-active {
    border: 2px solid #1e73be;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.jwppi-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
    cursor: pointer;
    border-radius: 16px 16px 0 0;
}

.jwppi-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.jwppi-grid-item:hover .jwppi-thumbnail img {
    transform: scale(1.08);
}

.jwppi-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.7) 100%);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    backdrop-filter: blur(4px);
    letter-spacing: 0.5px;
}

.jwppi-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    border-radius: 50%;
    z-index: 2;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.jwppi-play-button:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid #1a1a2e;
}

.jwppi-grid-item:hover .jwppi-play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.jwppi-title {
    margin: 16px 16px 8px;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 700;
    color: #1a1a2e;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.jwppi-description {
    margin: 0 16px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List Layout */
.jwppi-list {
    margin-bottom: 20px;
}

.jwppi-list-item {
    display: flex;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-radius: 5px;
    background-color: #fff;
    overflow: hidden;
    cursor: pointer;
}

.jwppi-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.jwppi-list-item.jwppi-active {
    border: 2px solid #1e73be;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.jwppi-list-thumbnail {
    flex: 0 0 200px;
    position: relative;
    overflow: hidden;
}

@media screen and (max-width: 767px) {
    .jwppi-list-item {
        flex-direction: column;
    }
    
    .jwppi-list-thumbnail {
        flex: 0 0 auto;
        width: 100%;
        aspect-ratio: 16/9;
    }
}

.jwppi-list-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.jwppi-list-thumbnail:hover img {
    transform: scale(1.05);
}

.jwppi-list-content {
    flex: 1;
    padding: 15px;
}

.jwppi-list-item .jwppi-title {
    margin: 0 0 10px;
}

.jwppi-list-item .jwppi-description {
    margin: 0;
}

/* Pagination */
.jwppi-pagination {
    text-align: center;
    margin-top: 20px;
}

.jwppi-page-link {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 3px;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.jwppi-page-link:hover,
.jwppi-page-link.jwppi-current {
    background-color: #1e73be;
    color: #fff;
    border-color: #1e73be;
}

.jwppi-prev,
.jwppi-next {
    font-weight: bold;
}

/* Error message */
.jwppi-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

/* Modal Styles */
.jwppi-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.jwppi-modal-content {
    position: relative;
    margin: 5% auto;
    width: 80%;
    max-width: 900px;
}

.jwppi-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #f1f1f1;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1;
}

.jwppi-modal-player {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
}

/* Search Form Styles */
.jwppi-search-container {
    margin: 15px 0 30px;
    padding: 20px;
    position: relative;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #1e73be;
}

.jwppi-search-container h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 600;
    color: #1e73be;
    position: relative;
    display: inline-block;
}

.jwppi-search-container h3:after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #1e73be;
    opacity: 0.5;
}

.jwppi-search-field {
    width: 100%;
    padding: 16px 20px 16px 50px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background-color: #f8fafc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-repeat: no-repeat;
    background-position: 18px center;
}

.jwppi-search-field:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.jwppi-search-field::placeholder {
    color: #94a3b8;
    font-style: normal;
}

.jwppi-no-results {
    padding: 15px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin: 20px 0;
    color: #666;
    font-style: italic;
    border-left: 4px solid #dc3545;
}

.jwppi-hidden {
    display: none !important;
}

.jwppi-search-results {
    margin-top: 10px;
    font-size: 14px;
}

.jwppi-results-count {
    color: #333;
    font-weight: 600;
}

.jwppi-results-count.jwppi-no-match {
    color: #dc3545;
}

/* Single Video Page Styles */
.jwppi-single-video-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.jwppi-back-link {
    margin-bottom: 20px;
}

.jwppi-back-link a {
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
}

.jwppi-back-link a:hover {
    text-decoration: underline;
}

.jwppi-single-title {
    font-size: 28px;
    margin-bottom: 20px;
    color: #333;
}

.jwppi-player-wrapper {
    margin-bottom: 25px;
    background: #000;
}

.jwppi-single-description {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin-bottom: 20px;
}

.jwppi-single-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.jwppi-meta-item {
    display: inline-block;
}

.jwppi-single-tags {
    font-size: 14px;
    color: #666;
}

.jwppi-tag {
    display: inline-block;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 3px;
    margin: 2px 4px 2px 0;
    font-size: 13px;
}

/* Search wrapper and button */
.jwppi-search-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Visible clickable tags */
.jwppi-tags-visible {
    margin: 12px 16px 16px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.jwppi-tag-clickable {
    display: inline-block;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    color: #475569;
    padding: 6px 14px;
    margin: 0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.jwppi-tag-clickable:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.jwppi-tag-clickable.jwppi-tag-active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
}

.jwppi-clear-filter {
    display: inline-block;
    margin-left: 10px;
    color: #dc3545;
    cursor: pointer;
    font-size: 13px;
}

.jwppi-clear-filter:hover {
    text-decoration: underline;
}

/* Playlist sections */
.jwppi-playlists-container {
    max-width: 1200px;
    margin: 0 auto;
}

.jwppi-playlist-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.jwppi-playlist-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.jwppi-playlist-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #0073aa;
    display: inline-block;
}

/* Playlist cards grid */
.jwppi-playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.jwppi-playlist-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.jwppi-playlist-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.jwppi-playlist-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 24px 48px rgba(0,0,0,0.18);
}

.jwppi-playlist-thumb {
    position: relative;
    padding-top: 56.25%;
    background: #1a1a1a;
}

.jwppi-playlist-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jwppi-playlist-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.7) 100%);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    letter-spacing: 0.3px;
}

.jwppi-playlist-name {
    padding: 18px 20px;
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -0.3px;
}

/* Back button */
.jwppi-back-btn {
    background: none;
    color: #3b82f6;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.jwppi-back-btn:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Playlist videos header layout */
.jwppi-playlist-videos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.jwppi-playlist-videos .jwppi-playlist-title {
    flex: 1;
    min-width: 200px;
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 22px;
}

.jwppi-playlist-videos .jwppi-sort-controls {
    margin-bottom: 0;
}

.jwppi-playlist-videos .jwppi-grid,
.jwppi-playlist-videos .jwppi-list {
    flex-basis: 100%;
    margin-top: 16px;
}

/* Tag results view */
.jwppi-tag-results-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

.jwppi-current-tag {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-style: normal;
}

.jwppi-tag-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.jwppi-tag-videos-grid .jwppi-grid-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.jwppi-tag-videos-grid .jwppi-grid-item.jwppi-visible {
    display: block !important;
}

.jwppi-tag-results-view {
    min-height: 200px;
}

/* Sort Controls */
.jwppi-sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    justify-content: flex-end;
}

.jwppi-sort-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.jwppi-sort-select {
    padding: 8px 32px 8px 14px;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background-color: #f8fafc;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 170px;
}

.jwppi-sort-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.jwppi-sort-select:hover {
    border-color: #94a3b8;
}

@media screen and (max-width: 480px) {
    .jwppi-sort-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .jwppi-sort-select {
        width: 100%;
    }
}

/* Single video page tags */
.jwppi-video-tags {
    margin-top: 15px;
    padding: 10px 0;
}

.jwppi-tags-label {
    font-weight: 600;
    color: #666;
    margin-right: 5px;
}

.jwppi-video-tag-link {
    display: inline-block;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
    color: #475569;
    padding: 8px 16px;
    border-radius: 24px;
    margin: 4px 8px 4px 0;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.jwppi-video-tag-link:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
