/*
 * ACL YouTube Playlists — Grid + Detail Page Styles
 * v1.2.0
 */

/* ─────────────────────────────────────────────
   SECTION WRAPPER
───────────────────────────────────────────── */

.acl-playlists-section {
    width: 100%;
}

.acl-playlists-header h2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1a1a1a;
    margin: 0;
}
.acl-playlists-header h2 svg {
    flex-shrink: 0;
    position: relative;
    top: -1px;
    color: #ff0000;
}

/* ─────────────────────────────────────────────
   PLAYLIST GRID  (4-col → 3 → 2)
───────────────────────────────────────────── */

.acl-playlists-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 14px;
    width: 100%;
}

@media only screen and (max-width: 1100px) {
    .acl-playlists-grid { grid-template-columns: repeat(3, 1fr); }
}
@media only screen and (max-width: 768px) {
    .acl-playlists-grid { grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
}
@media only screen and (max-width: 480px) {
    .acl-playlists-grid { grid-template-columns: repeat(2, 1fr); gap: 10px 8px; }
}

/* ─────────────────────────────────────────────
   PLAYLIST CARD
───────────────────────────────────────────── */

.acl-playlist-card { display: flex; flex-direction: column; min-width: 0; }

.acl-playlist-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Thumbnail wrapper */
.acl-playlist-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    flex-shrink: 0;
    margin-bottom: 6px; /* space for stack shadow */
}

/* Stacked-pages shadow (mimics YouTube's playlist card) */
.acl-playlist-stack-shadow {
    position: absolute;
    bottom: -4px;
    left: 4px;
    right: 4px;
    height: 8px;
    background: #c0c0c0;
    border-radius: 0 0 6px 6px;
    z-index: 0;
    pointer-events: none;
}
.acl-playlist-stack-shadow::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 6px;
    right: 6px;
    height: 6px;
    background: #a8a8a8;
    border-radius: 0 0 4px 4px;
}

.acl-playlist-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
    z-index: 1;
}
.acl-playlist-link:hover .acl-playlist-thumb { transform: scale(1.04); }

.acl-playlist-thumb--placeholder { background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%); }

/* Video count bar */
.acl-playlist-count-bar {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.82);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    padding: 5px 8px 5px 6px;
    border-radius: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 3;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.acl-playlist-count-bar svg { width: 12px; height: 12px; flex-shrink: 0; color: #fff; }

/* Hover play overlay */
.acl-playlist-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.22s ease;
    z-index: 4;
    pointer-events: none;
    border-radius: 8px;
}
.acl-playlist-play-overlay span {
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.acl-playlist-link:hover .acl-playlist-play-overlay { opacity: 1; }

/* Card info */
.acl-playlist-info { padding: 2px 0 0; display: flex; flex-direction: column; flex: 1; }

.acl-playlist-title {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
    color: #1a1a1a;
    margin: 0 0 0.25rem;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.acl-playlist-link:hover .acl-playlist-title { color: #c8a04a; }

.acl-playlist-desc {
    font-size: 0.72rem;
    line-height: 1.4;
    color: #606060;
    margin: 0 0 0.35rem;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.acl-playlist-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #c8a04a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.acl-playlist-link:hover .acl-playlist-meta { opacity: 1; }

/* Error state */
.acl-playlists-error {
    color: #cc0000;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}


/* ═══════════════════════════════════════════════════════════════════
   PLAYLIST DETAIL PAGE   (/playlist/?list=...)
═══════════════════════════════════════════════════════════════════ */

.acl-detail-page {
    width: 100%;
}

/* ── Back navigation ── */
.acl-detail-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #606060;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.25rem;
    transition: color 0.2s ease;
    line-height: 1;
}
.acl-detail-back:hover { color: #c8a04a; }
.acl-detail-back svg { transition: transform 0.2s ease; }
.acl-detail-back:hover svg { transform: translateX(-2px); }

/* ── Empty state (no ?list= param) ── */
.acl-detail-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #606060;
}
.acl-detail-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: border-color 0.2s, color 0.2s;
}
.acl-detail-back-btn:hover { border-color: #c8a04a; color: #c8a04a; }

/* ── Hero: thumbnail (left) + info (right) ── */
.acl-detail-hero {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.75rem;
    margin-bottom: 2.25rem;
    align-items: start;
}

.acl-detail-hero-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    flex-shrink: 0;
    margin-bottom: 6px; /* space for stack shadow */
}
/* Re-use the stack shadow on the detail hero */
.acl-detail-hero-thumb-wrap .acl-playlist-stack-shadow { z-index: 0; }

.acl-detail-hero-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.acl-detail-hero-thumb--placeholder {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
}

.acl-detail-hero-info {
    padding-top: 0.125rem;
    display: flex;
    flex-direction: column;
}

.acl-detail-title {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
    color: #1a1a1a;
    margin: 0 0 0.75rem;
    padding: 0;
}

.acl-detail-desc {
    font-size: 0.82rem;
    line-height: 1.6;
    color: #606060;
    margin: 0 0 1.1rem;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.acl-detail-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.acl-detail-count {
    font-size: 0.78rem;
    font-weight: 600;
    color: #606060;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* "Play all on YouTube" button */
.acl-detail-play-all {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #ff0000;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s ease;
    line-height: 1;
}
.acl-detail-play-all:hover { background: #cc0000; color: #ffffff; }

/* ── Videos section heading ── */
.acl-detail-videos-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1a1a1a;
    margin: 0 0 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

/* ── Videos grid  (4-col → 3 → 2) ── */
.acl-detail-videos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 14px;
}

@media only screen and (max-width: 1100px) {
    .acl-detail-videos-grid { grid-template-columns: repeat(3, 1fr); }
}
@media only screen and (max-width: 768px) {
    .acl-detail-hero    { grid-template-columns: 1fr; gap: 1.25rem; }
    .acl-detail-videos-grid { grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
}
@media only screen and (max-width: 480px) {
    .acl-detail-videos-grid { grid-template-columns: repeat(2, 1fr); gap: 10px 8px; }
}

/* ── Video card ── */
.acl-video-card { min-width: 0; }

.acl-video-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.acl-video-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1a;
    margin-bottom: 0.45rem;
}

.acl-video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}
.acl-video-link:hover .acl-video-thumb { transform: scale(1.04); }

.acl-video-thumb--placeholder { background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%); }

/* Position number badge (bottom-left) */
.acl-video-num {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.78);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 3px;
    z-index: 2;
    pointer-events: none;
}

/* Play overlay on hover */
.acl-video-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.48);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 3;
    border-radius: 6px;
    pointer-events: none;
}
.acl-video-link:hover .acl-video-play-overlay { opacity: 1; }

/* Video title */
.acl-video-title {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a1a;
    margin: 0;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.acl-video-link:hover .acl-video-title { color: #c8a04a; }

/* Empty playlist */
.acl-detail-empty {
    color: #606060;
    font-size: 0.85rem;
    padding: 2rem 0;
}


/* ═══════════════════════════════════════════════════════════════════
   PLAYLIST ROW CAROUSEL   ([acl_playlists_row])
═══════════════════════════════════════════════════════════════════ */

.acl-playlists-row-section {
    width: 100%;
}

/* Section header reuses .ytc-latest-header from the theme */
.acl-playlists-row-header h2 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1a1a1a;
    margin: 0;
}
.acl-playlists-row-header h2 svg {
    flex-shrink: 0;
    position: relative;
    top: -1px;
    color: #ff0000;
}

/* ── Carousel outer shell ── */
.acl-playlists-row-carousel {
    position: relative;
    display: flex;
    align-items: flex-start;  /* allows arrows to be offset to thumb centre */
    gap: 0;
}

/* ── Nav buttons (identical to shorts carousel) ── */
.acl-row-nav {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    color: #1a1a1a;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    z-index: 2;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    /* Centre against 16:9 thumbnail: (270px × 9/16 / 2) − (34px / 2) ≈ 59px */
    margin-top: calc( 270px * 9 / 16 / 2 - 17px );
}
.acl-row-nav:hover {
    background: #f5f5f5;
    border-color: #c8a04a;
    color: #c8a04a;
}
.acl-row-nav:disabled,
.acl-row-nav[aria-disabled="true"] {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}
.acl-row-prev { margin-right: 8px; }
.acl-row-next { margin-left:  8px; }

/* ── Scrollable track ── */
.acl-row-track-wrap {
    flex: 1;
    overflow: hidden;
}
.acl-row-track {
    display: flex;
    gap: 10px;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* ── Individual playlist card ── */
.acl-row-item {
    flex: 0 0 auto;
    width: 270px;
}
.acl-row-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Thumbnail 16:9 */
.acl-row-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1a;
    margin-bottom: 6px;   /* room for stack shadow */
}
.acl-row-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
    z-index: 1;
}
.acl-row-link:hover .acl-row-thumb { transform: scale(1.04); }
.acl-row-thumb--placeholder { background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%); }

/* Stack-page shadow */
.acl-row-stack-shadow {
    position: absolute;
    bottom: -4px;
    left: 4px;
    right: 4px;
    height: 8px;
    background: #c0c0c0;
    border-radius: 0 0 6px 6px;
    z-index: 0;
    pointer-events: none;
}
.acl-row-stack-shadow::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 6px;
    right: 6px;
    height: 6px;
    background: #a8a8a8;
    border-radius: 0 0 4px 4px;
}

/* Video count badge */
.acl-row-count-bar {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.82);
    color: #ffffff;
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1;
    padding: 4px 6px 4px 5px;
    border-radius: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 3;
    pointer-events: none;
    white-space: nowrap;
}
.acl-row-count-bar svg { width: 10px; height: 10px; flex-shrink: 0; }

/* Hover overlay */
.acl-row-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s ease;
    z-index: 4;
    pointer-events: none;
    border-radius: 6px;
}
.acl-row-link:hover .acl-row-hover-overlay { opacity: 1; }

/* Title */
.acl-row-title {
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a1a;
    margin: 0;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}
.acl-row-link:hover .acl-row-title { color: #c8a04a; }

/* ── Responsive ── */
@media only screen and (max-width: 768px) {
    .acl-row-item  { width: 200px; }
    .acl-row-nav   { width: 28px; height: 28px;
                     /* Centre against 200px-wide 16:9 thumb, 28px button */
                     margin-top: calc( 200px * 9 / 16 / 2 - 14px ); }
}
@media only screen and (max-width: 480px) {
    .acl-row-item  { width: 160px; }
    .acl-row-nav   { display: none; }
    /* Allow native touch-scroll on small screens */
    .acl-row-track-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .acl-row-track-wrap::-webkit-scrollbar { display: none; }
}

/* ── Modifier: hide card titles ── */
.acl-row--no-title .acl-row-title { display: none !important; }

/* ── Modifier: light text (white) for use on dark backgrounds ── */
.acl-row--light-text .acl-playlists-row-header h2,
.acl-row--light-text .acl-playlists-row-header h2 svg { color: #ffffff; }

.acl-row--light-text .acl-playlists-row-header a { color: rgba(255,255,255,0.7); }
.acl-row--light-text .acl-playlists-row-header a:hover { color: #ffffff; }

.acl-row--light-text .acl-row-title { color: #ffffff !important; }
.acl-row--light-text .acl-row-link:hover .acl-row-title { color: rgba(255,255,255,0.75) !important; }

.acl-row--light-text .acl-row-nav {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    box-shadow: none;
}
.acl-row--light-text .acl-row-nav:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
    color: #ffffff;
}


/* ═══════════════════════════════════════════════════════════════════
   VIDEO MODAL PLAYER
═══════════════════════════════════════════════════════════════════ */

/* Prevent body scroll while modal is open */
body.acl-modal-open { overflow: hidden; }

.acl-video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99990;
    align-items: center;
    justify-content: center;
}
.acl-video-modal.is-open { display: flex; }

/* Dark backdrop */
.acl-video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    cursor: pointer;
}

/* Content wrapper — sits above the backdrop */
.acl-video-modal-wrap {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 960px;
    animation: acl-modal-in 0.22s ease;
}

@keyframes acl-modal-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* Close button */
.acl-video-modal-close {
    position: absolute;
    top: -38px;
    right: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.3rem;
    line-height: 1;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 2;
}
.acl-video-modal-close:hover { color: #ffffff; }

/* 16:9 ratio box */
.acl-video-modal-ratio {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
}
.acl-video-modal-frame {
    position: absolute;
    inset: 0;
}
.acl-video-modal-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* "Open on YouTube" link below the player */
.acl-video-modal-yt-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
    width: fit-content;
}
.acl-video-modal-yt-link:hover { color: #ffffff; }
