/**
 * Sortd YouTube Integration - Main Styles
 */

/* Base Styles */
.sortd-yt-error {
    color: #d63638;
    padding: 1em;
    background: #fcf0f1;
    border-left: 4px solid #d63638;
}

.sortd-yt-no-results {
    text-align: center;
    padding: 2em;
    color: #666;
}

/* Embed Wrapper */
.sortd-yt-embed-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1em 0;
}

.sortd-yt-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Carousel Wrapper */
.sortd-yt-carousel-wrapper {
    position: relative;
    margin: 1em 0;
    padding: 0 3em;
}

.sortd-yt-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    padding: 0;
}

.sortd-yt-carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.sortd-yt-carousel-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.sortd-yt-carousel-arrow:disabled:hover {
    transform: translateY(-50%) scale(1);
}

.sortd-yt-carousel-prev {
    left: 0;
}

.sortd-yt-carousel-next {
    right: 0;
}

/* Wall Layout */
.sortd-yt-wall-layout {
    display: flex;
    gap: 1.5em;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.sortd-yt-wall-layout::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sortd-yt-video-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    min-width: 251px;
    flex: 0 0 auto;
    width: 251px;
}

.sortd-yt-video-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sortd-yt-thumbnail {
    position: relative;
    width: 100%;
    min-width: 251px;
    padding-bottom: 56.25%; /* 16:9 aspect ratio (251px width = 141px height) */
    overflow: hidden;
    background: #000;
}

.sortd-yt-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sortd-yt-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s ease;
    cursor: pointer;
}

.sortd-yt-video-item:hover .sortd-yt-play-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.sortd-yt-title {
    margin: 0.75em 1em 0.5em;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.4;
}

.sortd-yt-description {
    margin: 0 1em 0.5em;
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
}

.sortd-yt-channel,
.sortd-yt-date {
    margin: 0 1em 0.75em;
    font-size: 0.85em;
    color: #999;
}

/* Player Layout */
.sortd-yt-player-layout {
    margin: 1em 0;
}

.sortd-yt-featured-player {
    margin-bottom: 2em;
}

.sortd-yt-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
    border-radius: 8px;
    margin-bottom: 1em;
}

.sortd-yt-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.sortd-yt-player-title {
    font-size: 1.5em;
    margin: 0.5em 0;
}

.sortd-yt-player-description {
    color: #666;
    line-height: 1.6;
}

.sortd-yt-video-list {
    display: grid;
    gap: 1em;
}

.sortd-yt-list-item {
    display: flex;
    gap: 1em;
    padding: 1em;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sortd-yt-list-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.sortd-yt-list-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 160px;
    padding-bottom: 90px; /* 16:9 */
    overflow: hidden;
    background: #000;
    border-radius: 4px;
}

.sortd-yt-list-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sortd-yt-play-button-small {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 0, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sortd-yt-play-button-small::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 12px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    margin-left: 2px;
}

.sortd-yt-list-content {
    flex: 1;
}

.sortd-yt-list-title {
    margin: 0 0 0.5em;
    font-size: 1em;
    font-weight: 600;
}

/* Feature Layout */
.sortd-yt-feature-layout {
    margin: 1em 0;
}

.sortd-yt-feature-wrapper {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sortd-yt-feature-player {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
}

.sortd-yt-feature-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.sortd-yt-feature-content {
    padding: 1.5em;
}

.sortd-yt-feature-title {
    font-size: 1.75em;
    margin: 0 0 0.75em;
}

.sortd-yt-feature-meta {
    display: flex;
    gap: 1em;
    margin-bottom: 1em;
    font-size: 0.9em;
    color: #666;
}

.sortd-yt-feature-description {
    line-height: 1.7;
    color: #444;
}

/* Showcase Layout */
.sortd-yt-showcase-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2em;
    margin: 1em 0;
}

.sortd-yt-showcase-layout.sortd-yt-columns-1 {
    grid-template-columns: 1fr;
}

.sortd-yt-showcase-layout.sortd-yt-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.sortd-yt-showcase-layout.sortd-yt-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.sortd-yt-showcase-layout.sortd-yt-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.sortd-yt-showcase-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.sortd-yt-showcase-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.sortd-yt-showcase-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: #000;
}

.sortd-yt-showcase-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sortd-yt-showcase-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sortd-yt-showcase-item:hover .sortd-yt-showcase-overlay {
    opacity: 1;
}

.sortd-yt-play-button-large {
    transform: scale(1.2);
}

.sortd-yt-showcase-content {
    padding: 1.5em;
}

.sortd-yt-showcase-title {
    font-size: 1.2em;
    margin: 0 0 0.5em;
    font-weight: 600;
}

.sortd-yt-showcase-channel {
    margin: 0 0 0.75em;
    font-size: 0.9em;
    color: #666;
}

.sortd-yt-showcase-description {
    margin: 0;
    font-size: 0.95em;
    color: #555;
    line-height: 1.6;
}

/* Status Layout */
.sortd-yt-status-layout {
    margin: 1em 0;
}

.sortd-yt-live-streams {
    display: grid;
    gap: 1.5em;
}

.sortd-yt-live-item {
    display: flex;
    gap: 1.5em;
    padding: 1.5em;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #ff0000;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sortd-yt-live-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sortd-yt-live-badge {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: rgba(255, 0, 0, 0.9);
    color: #fff;
    padding: 0.25em 0.75em;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    z-index: 2;
}

.sortd-yt-live-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.sortd-yt-live-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 200px;
    padding-bottom: 112.5px; /* 16:9 */
    overflow: hidden;
    background: #000;
    border-radius: 4px;
}

.sortd-yt-live-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sortd-yt-live-content {
    flex: 1;
}

.sortd-yt-live-title {
    font-size: 1.3em;
    margin: 0 0 0.5em;
    font-weight: 600;
}

.sortd-yt-live-channel {
    margin: 0 0 0.75em;
    font-size: 0.95em;
    color: #666;
}

.sortd-yt-live-description {
    margin: 0;
    font-size: 0.9em;
    color: #555;
    line-height: 1.6;
}

.sortd-yt-no-live {
    text-align: center;
    padding: 3em;
    background: #f5f5f5;
    border-radius: 8px;
    color: #666;
}

/* Popup Modal */
.sortd-yt-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.sortd-yt-modal.active {
    display: flex;
}

.sortd-yt-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
}

.sortd-yt-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.sortd-yt-modal-close:hover {
    opacity: 0.7;
}

.sortd-yt-modal-close::before {
    content: '×';
}

.sortd-yt-modal-iframe {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    position: relative;
}

.sortd-yt-modal-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .sortd-yt-carousel-wrapper {
        padding: 0 2.5em;
    }
    
    .sortd-yt-carousel-arrow {
        width: 40px;
        height: 40px;
    }
    
    .sortd-yt-carousel-arrow svg {
        width: 20px;
        height: 20px;
    }
    
    .sortd-yt-showcase-layout {
        grid-template-columns: 1fr !important;
    }
    
    .sortd-yt-list-item {
        flex-direction: column;
    }
    
    .sortd-yt-list-thumbnail {
        width: 100%;
        padding-bottom: 56.25%;
    }
    
    .sortd-yt-live-item {
        flex-direction: column;
    }
    
    .sortd-yt-live-thumbnail {
        width: 100%;
        padding-bottom: 56.25%;
    }
}

