/**
 * SAC YouTube Gallery Styles
 */

.sac-youtube-gallery {
    margin-bottom: 2em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
}

/* Player Container */
.sac-ytg-player-container {
    margin-bottom: 2em;
    background: #000;
    border-radius: var(--sac-ytg-border-radius, 8px);
    overflow: hidden;
}

.sac-ytg-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.sac-ytg-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* Player Info */
.sac-ytg-player-info {
    padding: 1.5em;
    background: #990000;
    border-top: 1px solid #660000;
}

.sac-ytg-player-info h2 {
    margin: 0;
    padding: 0;
    font-size: 1.25em;
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
}

/* Playlist */
.sac-ytg-playlist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1em;
    margin-bottom: 2em;
}

/* Loading State */
.sac-ytg-loading {
    grid-column: 1 / -1;
    padding: 2em;
    text-align: center;
    color: #999;
    font-size: 1em;
}

/* Video Item */
.sac-ytg-video-item {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: var(--sac-ytg-border-radius, 8px);
    overflow: hidden;
    background: #fff;
    border: 2px solid transparent;
}

.sac-ytg-video-item:hover {
    border-color: #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.sac-ytg-video-item.active {
    border-color: #990000;
    background: #990000;
}

.sac-ytg-video-item.active .sac-ytg-video-title {
    color: #fff;
}

/* Thumbnail */
.sac-ytg-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}

.sac-ytg-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s ease;
}

.sac-ytg-video-item:hover .sac-ytg-thumbnail img {
    opacity: 0.8;
}

/* Play Button */
.sac-ytg-play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.8;
}

.sac-ytg-play-button svg {
    width: 15px;
    height: 15px;
    margin-left: 2px;
}

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

/* Video Title */
.sac-ytg-video-title {
    padding: 0.75em;
    font-size: 0.9em;
    color: #333;
    font-weight: 700;
    line-height: 1.3;
    overflow: hidden;
    max-height: 4em;
}

/* First part of split title - 1.15em size */
.sac-ytg-title-first {
    font-size: 1.15em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .sac-ytg-playlist {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75em;
    }

    .sac-ytg-player-info {
        padding: 1em;
    }

    .sac-ytg-player-info h2 {
        font-size: 1.1em;
    }

    .sac-ytg-video-title {
        padding: 0.5em;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .sac-ytg-playlist {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5em;
    }

    .sac-ytg-player-info {
        padding: 0.75em;
    }

    .sac-ytg-player-info h2 {
        font-size: 1em;
    }

    .sac-ytg-video-title {
        padding: 0.5em;
        font-size: 0.8em;
    }

    .sac-ytg-play-button {
        width: 24px;
        height: 24px;
    }

    .sac-ytg-play-button svg {
        width: 12px;
        height: 12px;
    }
}

/* Error States */
.sac-ytg-error {
    padding: 2em;
    background: #fee;
    color: #c00;
    border: 1px solid #fcc;
    border-radius: 4px;
    text-align: center;
}
