/* YouTube Channels — Frontend Styles */

/* ========================================
   Grid Layout
   ======================================== */
.sdawchfo-grid {
    display: grid;
    grid-template-columns: repeat(var(--sdawchfo-columns, 3), 1fr);
    gap: 24px;
    margin: 20px 0;
}

/* ========================================
   Video Card
   ======================================== */
.sdawchfo-video-card {
    background: var(--sdawchfo-card-bg, #fff);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sdawchfo-video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Thumbnail */
.sdawchfo-thumbnail-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e5e5e5;
}

.sdawchfo-thumbnail-wrap a {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
    z-index: 2;
}

.sdawchfo-thumbnail {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.sdawchfo-thumbnail[src*="svg"] {
    opacity: 0;
}

.sdawchfo-thumbnail.sdawchfo-loaded {
    opacity: 1;
}

/* Subtle scrim over thumbnail for guaranteed icon contrast */
.sdawchfo-thumbnail-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.12);
    pointer-events: none;
    z-index: 1;
    transition: background 0.2s ease;
}

.sdawchfo-thumbnail-wrap:hover::after {
    background: rgba(0, 0, 0, 0.18);
}

/* Play button overlay — YouTube-style rounded rectangle */
.sdawchfo-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 48px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1), background 0.25s cubic-bezier(0, 0, 0.2, 1);
    pointer-events: none;
    z-index: 2;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.sdawchfo-thumbnail-wrap:hover .sdawchfo-play-btn {
    opacity: 1;
    background: #f00;
}

.sdawchfo-play-btn svg {
    width: 22px;
    height: 22px;
    margin-left: 3px;
}

/* Duration badge */
.sdawchfo-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1.4;
}

/* Live badge */
.sdawchfo-live-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 2;
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sdawchfo-live-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    animation: sdawchfoPulse 1.5s ease-in-out infinite;
}

@keyframes sdawchfoPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.sdawchfo-live-viewers {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
}

.sdawchfo-live-viewers-sep {
    margin-right: 2px;
    opacity: 0.85;
}

.sdawchfo-live-viewers-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Upcoming badge */
.sdawchfo-upcoming-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 2;
    background: #3182ce;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sdawchfo-upcoming-badge svg.sdawchfo-upcoming-icon {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    flex-shrink: 0;
    vertical-align: middle;
    display: inline-block;
}

/* Scheduled time */
.sdawchfo-scheduled-time {
    color: #3182ce;
    font-weight: 500;
}

/* Live duration */
.sdawchfo-live-since {
    color: #e53e3e;
    font-weight: 500;
}

/* Live section headings */
.sdawchfo-live-section-heading {
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sdawchfo-live-section-heading::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e53e3e;
    animation: sdawchfoPulse 1.5s ease-in-out infinite;
}

.sdawchfo-upcoming-heading::before {
    background: #3182ce;
    animation: none;
}

/* Bottom padding on live-wrap for external widgets */
.sdawchfo-live-wrap {
    padding-bottom: 48px;
}

/* Empty state for live shortcode */
.sdawchfo-no-live {
    text-align: center;
    color: #888;
    padding: 40px 20px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin: 20px 0;
}

/* Short badge */
.sdawchfo-short-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 3px;
}

/* Video info area */
.sdawchfo-video-info {
    padding: 12px;
}

.sdawchfo-video-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sdawchfo-video-title a {
    color: inherit;
    text-decoration: none;
}

.sdawchfo-video-title a:hover {
    color: #6366f1;
}

/* Channel badge on video card */
.sdawchfo-video-channel {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    color: #606060;
}

.sdawchfo-video-channel-avatar {
    border-radius: 50%;
    flex-shrink: 0;
}

/* Channel name below title (used in YouTube-app-style mobile layout) */
.sdawchfo-video-channel-name {
    display: none;
    font-size: 12px;
    color: #606060;
    margin-bottom: 2px;
}

/* Video meta (views, date) */
.sdawchfo-video-meta {
    font-size: 12px;
    color: #606060;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sdawchfo-video-meta span::after {
    content: "\00b7";
    margin-left: 8px;
}

.sdawchfo-video-meta span:last-child::after {
    content: none;
}

/* Description */
.sdawchfo-video-desc {
    font-size: 12px;
    color: #808080;
    margin: 6px 0 0;
    line-height: 1.5;
}

.sdawchfo-no-videos {
    text-align: center;
    color: #888;
    padding: 40px 20px;
}

/* ========================================
   Channel Header
   ======================================== */
.sdawchfo-channel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
}

.sdawchfo-channel-avatar-lg {
    border-radius: 50%;
    flex-shrink: 0;
}

.sdawchfo-channel-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.sdawchfo-channel-subs {
    font-size: 13px;
    color: #606060;
}

.sdawchfo-channel-section {
    margin-bottom: 32px;
}

/* ========================================
   Tabs Layout
   ======================================== */
.sdawchfo-tabs {
    margin: 20px 0;
}

.sdawchfo-tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e5e5;
    padding-bottom: 0;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
    scrollbar-width: none;
}

.sdawchfo-tab-bar::-webkit-scrollbar {
    display: none;
}

/* Fade gradient edges — scroll overflow indicators */
.sdawchfo-tab-bar-wrap {
    position: relative;
}

.sdawchfo-tab-bar-wrap::before,
.sdawchfo-tab-bar-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 2px;
    width: 56px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sdawchfo-tab-bar-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.8) 40%, transparent 100%);
}

.sdawchfo-tab-bar-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.8) 40%, transparent 100%);
}

.sdawchfo-tab-bar-wrap.sdawchfo-scroll-left::before {
    opacity: 1;
}

.sdawchfo-tab-bar-wrap.sdawchfo-scroll-right::after {
    opacity: 1;
}

/* Chevron arrows at fade edges */
.sdawchfo-tab-scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-size: 22px;
    font-weight: 400;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, background 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.sdawchfo-tab-scroll-arrow:hover {
    background: #fff;
    color: #222;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.sdawchfo-tab-scroll-arrow-left {
    left: 4px;
}

.sdawchfo-tab-scroll-arrow-right {
    right: 4px;
}

.sdawchfo-tab-bar-wrap.sdawchfo-scroll-left .sdawchfo-tab-scroll-arrow-left {
    opacity: 1;
    pointer-events: auto;
}

.sdawchfo-tab-bar-wrap.sdawchfo-scroll-right .sdawchfo-tab-scroll-arrow-right {
    opacity: 1;
    pointer-events: auto;
}

.sdawchfo-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #606060;
    white-space: nowrap;
    border-radius: 6px 6px 0 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.sdawchfo-tab-btn:hover {
    color: #030303;
    background: rgba(0, 0, 0, 0.03);
}

.sdawchfo-tab-btn.sdawchfo-tab-active {
    color: #1d2327;
    font-weight: 600;
    background: #f0f0f1;
    border-bottom-color: #6366f1;
}

.sdawchfo-tab-avatar {
    border-radius: 50%;
    flex-shrink: 0;
}

.sdawchfo-tab-panel {
    animation: sdawchfoFadeIn 0.3s ease;
}

.sdawchfo-tab-hidden {
    display: none;
}

@keyframes sdawchfoFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Lightbox
   ======================================== */
.sdawchfo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sdawchfo-lightbox[hidden] {
    display: none;
}

.sdawchfo-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.sdawchfo-lightbox-content {
    position: relative;
    width: 90%;
    max-width: 960px;
    z-index: 1;
}

.sdawchfo-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.sdawchfo-lightbox-close:hover {
    opacity: 1;
}

.sdawchfo-lightbox-player {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.sdawchfo-lightbox-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.sdawchfo-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 0;
}

.sdawchfo-lightbox-title {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sdawchfo-lightbox-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Lightbox prev/next arrows */
.sdawchfo-lightbox-prev,
.sdawchfo-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 48px;
    line-height: 1;
    width: 56px;
    height: 80px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s, background 0.2s;
}

.sdawchfo-lightbox-prev {
    left: 16px;
}

.sdawchfo-lightbox-next {
    right: 16px;
}

.sdawchfo-lightbox-prev:hover,
.sdawchfo-lightbox-next:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.sdawchfo-lightbox-prev:disabled,
.sdawchfo-lightbox-next:disabled {
    opacity: 0.2;
    cursor: default;
}

/* Mobile-only elements — hidden on desktop */
.sdawchfo-lightbox-drag-handle,
.sdawchfo-lightbox-mobile-nav {
    display: none;
}

/* ========================================
   Expand to Lightbox Button (inline mode)
   ======================================== */
.sdawchfo-expand-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.sdawchfo-thumbnail-wrap:hover .sdawchfo-expand-btn {
    opacity: 1;
}

.sdawchfo-expand-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Hide expand button when inline video is playing */
.sdawchfo-thumbnail-wrap.sdawchfo-inline-active .sdawchfo-expand-btn {
    display: none;
}

/* YouTube external link — top-right, always visible */
.sdawchfo-yt-link {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
    transition: opacity 0.2s, transform 0.2s;
    text-decoration: none;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

/* When expand button is also present, stack YouTube link below it */
.sdawchfo-expand-btn + .sdawchfo-yt-link {
    top: 48px;
}

.sdawchfo-thumbnail-wrap:hover .sdawchfo-yt-link {
    opacity: 1;
}

.sdawchfo-yt-link:hover {
    opacity: 1;
    transform: scale(1.15);
    color: #fff;
}

.sdawchfo-yt-link:hover svg {
    fill: #f00;
}

/* Hide YouTube link when inline video is playing */
.sdawchfo-thumbnail-wrap.sdawchfo-inline-active .sdawchfo-yt-link {
    display: none;
}

/* ========================================
   Inline Player
   ======================================== */
.sdawchfo-thumbnail-wrap.sdawchfo-inline-active a {
    visibility: hidden;
}

.sdawchfo-inline-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    border: 0;
}

.sdawchfo-inline-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.sdawchfo-thumbnail-wrap:hover .sdawchfo-inline-close {
    opacity: 1;
}

/* ========================================
   Swipe Zones (lightbox video navigation)
   ======================================== */
.sdawchfo-swipe-zone {
    position: absolute;
    top: 0;
    bottom: 48px;
    width: 50px;
    z-index: 2;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

@media (pointer: coarse) {
    .sdawchfo-swipe-zone {
        width: 30px;
        pointer-events: auto;
        cursor: grab;
    }

    .sdawchfo-expand-btn {
        opacity: 0.85;
    }
}

.sdawchfo-swipe-left {
    left: 0;
}

.sdawchfo-swipe-right {
    right: 0;
}

/* ========================================
   Mute Toggle Overlay (lightbox)
   ======================================== */
.sdawchfo-mute-toggle {
    position: absolute;
    top: 25%;
    right: 12px;
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s, background 0.3s;
    opacity: 0.9;
    -webkit-tap-highlight-color: transparent;
}

.sdawchfo-mute-toggle:hover,
.sdawchfo-mute-toggle:focus-visible {
    background: rgba(0, 0, 0, 0.9);
    opacity: 1;
}

/* Pulse once when muted to draw attention */
.sdawchfo-mute-toggle.sdawchfo-muted {
    animation: sdawchfoMutePulse 2s ease-in-out 1;
}

@keyframes sdawchfoMutePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* On desktop (mouse pointer), only show on hover */
.sdawchfo-mute-toggle.sdawchfo-mute-desktop {
    opacity: 0;
    transition: opacity 0.3s;
}

.sdawchfo-lightbox-player:hover .sdawchfo-mute-toggle.sdawchfo-mute-desktop {
    opacity: 0.85;
}

/* Swipe hint — edge onboarding overlays */
.sdawchfo-swipe-hint {
    position: absolute;
    top: 0;
    bottom: 48px;
    width: 50px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.sdawchfo-swipe-hint-left {
    left: 0;
    border-radius: 8px 0 0 0;
}

.sdawchfo-swipe-hint-right {
    right: 0;
    border-radius: 0 8px 0 0;
}

.sdawchfo-swipe-hint.sdawchfo-hint-fade {
    opacity: 0;
}

.sdawchfo-swipe-hint svg {
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.sdawchfo-swipe-hint-left .sdawchfo-swipe-hint-arrow {
    animation: sdawchfoNudgeLeft 1s ease-in-out infinite alternate;
}

.sdawchfo-swipe-hint-right .sdawchfo-swipe-hint-arrow {
    animation: sdawchfoNudgeRight 1s ease-in-out infinite alternate;
}

@keyframes sdawchfoNudgeLeft {
    from { transform: translateX(0); }
    to   { transform: translateX(-5px); }
}

@keyframes sdawchfoNudgeRight {
    from { transform: translateX(0); }
    to   { transform: translateX(5px); }
}

/* ========================================
   Slider Layout
   ======================================== */
.sdawchfo-slider {
    position: relative;
    margin: 20px 0;
    outline: none;
}

.sdawchfo-slider-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0;
}

.sdawchfo-slider-track::-webkit-scrollbar {
    display: none;
}

.sdawchfo-slider-track > .sdawchfo-video-card {
    flex: 0 0 calc(33.333% - 11px);
    scroll-snap-align: start;
    min-width: 220px;
}

.sdawchfo-slider-prev,
.sdawchfo-slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    color: #333;
    font-size: 28px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: opacity 0.2s, box-shadow 0.2s;
}

.sdawchfo-slider-prev {
    left: -12px;
}

.sdawchfo-slider-next {
    right: -12px;
}

.sdawchfo-slider-prev:hover,
.sdawchfo-slider-next:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.sdawchfo-slider-prev:disabled,
.sdawchfo-slider-next:disabled {
    opacity: 0.3;
    cursor: default;
    box-shadow: none;
}

/* Slider: no hover lift on cards to avoid layout shift */
.sdawchfo-slider-track > .sdawchfo-video-card:hover {
    transform: none;
}

/* ========================================
   Load More
   ======================================== */
.sdawchfo-load-more-wrap {
    text-align: center;
    margin: 24px 0;
}

.sdawchfo-load-more-btn {
    display: inline-block;
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 500;
    color: #6366f1;
    background: transparent;
    border: 1px solid #6366f1;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, opacity 0.2s;
}

.sdawchfo-load-more-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.sdawchfo-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Tab Navigation Modes
   ======================================== */

/* --- Wrapping Pills --- */
.sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-bar {
    flex-wrap: wrap;
    overflow: visible;
    border-bottom: none;
    gap: 8px;
}

.sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-bar-wrap::before,
.sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-bar-wrap::after {
    display: none;
}

.sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-scroll-arrow {
    display: none;
}

.sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-btn {
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 4px;
    padding: 8px 16px;
}

.sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-btn.sdawchfo-tab-active {
    border-color: currentColor;
}

/* Smaller pills on small screens */
@media (max-width: 600px) {
    .sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .sdawchfo-tabs[data-desktop-nav="wrapping"] .sdawchfo-tab-bar {
        gap: 6px;
    }
}

/* --- Avatar Strip --- */

/* "Channels" heading above the strip */
.sdawchfo-avatar-heading {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9ca3af;
    margin-bottom: 4px;
}

/* Base avatar strip layout */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-bar {
    gap: 8px;
    justify-content: center;
    border-bottom: none;
}

.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-bar-wrap::before,
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-bar-wrap::after {
    display: none;
}

.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-scroll-arrow {
    display: none;
}

/* Buttons: stack avatar + label vertically */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: none;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    margin-bottom: 0;
    flex-shrink: 0;
}

.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Avatar sizing and transitions */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-avatar {
    width: 64px;
    height: 64px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.2s ease,
                opacity 0.2s ease;
    border-radius: 50%;
}

/* Non-active avatars slightly dimmed */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn:not(.sdawchfo-tab-active) .sdawchfo-tab-avatar {
    opacity: 0.6;
}

/* Hover: brighten + scale + ring preview */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn:not(.sdawchfo-tab-active):hover .sdawchfo-tab-avatar {
    opacity: 1;
    transform: scale(1.08);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Active: full ring + slight lift */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn.sdawchfo-tab-active .sdawchfo-tab-avatar {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6366f1;
    border-radius: 50%;
    opacity: 1;
    transform: scale(1.05);
}

.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn.sdawchfo-tab-active {
    background: transparent;
}

/* Touch feedback */
.sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn:active .sdawchfo-tab-avatar {
    transform: scale(0.95);
    transition-duration: 0.08s;
}

/* Active channel name display below strip (all screens) */
.sdawchfo-avatar-active-name {
    text-align: center;
    overflow: hidden;
    margin-top: 2px;
}

.sdawchfo-avatar-active-name-inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    letter-spacing: -0.01em;
    animation: sdawchfoNameReveal 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sdawchfo-avatar-active-name-inner .sdawchfo-active-name-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    flex-shrink: 0;
}

@keyframes sdawchfoNameReveal {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* First-visit hint */
.sdawchfo-avatar-hint {
    text-align: center;
    font-size: 12px;
    color: #b0b0b0;
    margin-top: 2px;
    margin-bottom: 4px;
    transition: opacity 0.6s ease, transform 0.4s ease;
}

.sdawchfo-avatar-hint.sdawchfo-hint-fade {
    opacity: 0;
    transform: translateY(-4px);
}

/* ---- Mobile + tablet portrait: compact single-row scroll, no labels ---- */
@media (max-width: 1024px) {
    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-bar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding: 4px 8px;
    }

    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-bar::-webkit-scrollbar {
        display: none;
    }

    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn .sdawchfo-tab-label {
        display: none;
    }

    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-avatar {
        width: 64px;
        height: 64px;
    }

    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn {
        padding: 4px;
        border-radius: 50%;
    }
}

/* ---- Desktop + tablet landscape: wrapping grid with labels ---- */
@media (min-width: 1025px) {
    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-bar {
        flex-wrap: wrap;
        overflow: visible;
        gap: 4px;
    }

    /* Labels: visible, truncated */
    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn .sdawchfo-tab-label {
        font-size: 11px;
        font-weight: 500;
        color: #9ca3af;
        max-width: 72px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: center;
        transition: color 0.2s ease;
        line-height: 1.3;
    }

    /* Truncate from the left (show the end) — e.g. "...Bergen" */
    .sdawchfo-tabs[data-desktop-nav="avatars"][data-label-dir="end"] .sdawchfo-tab-btn .sdawchfo-tab-label {
        direction: rtl;
    }

    /* Hover: label brightens */
    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn:not(.sdawchfo-tab-active):hover .sdawchfo-tab-label {
        color: #606060;
    }

    /* Active label: bold + colored */
    .sdawchfo-tabs[data-desktop-nav="avatars"] .sdawchfo-tab-btn.sdawchfo-tab-active .sdawchfo-tab-label {
        color: #6366f1;
        font-weight: 700;
    }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .sdawchfo-grid {
        grid-template-columns: repeat(min(var(--sdawchfo-columns, 3), 3), 1fr);
    }

    .sdawchfo-slider-track > .sdawchfo-video-card {
        flex: 0 0 calc(33.333% - 11px);
    }
}

@media (max-width: 768px) {
    .sdawchfo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Larger touch targets for tabs on tablet */
    .sdawchfo-tab-btn {
        padding: 12px 18px;
    }

    /* --- Bottom Sheet Lightbox --- */
    .sdawchfo-lightbox {
        align-items: flex-end;
    }

    .sdawchfo-lightbox-content {
        width: 100%;
        max-width: 100%;
        background: #1a1a1a;
        border-radius: 16px 16px 0 0;
        padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
        animation: sdawchfoSlideUp 0.3s ease-out;
    }

    @keyframes sdawchfoSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Drag handle */
    .sdawchfo-lightbox-drag-handle {
        display: flex;
        justify-content: center;
        padding: 10px 0 6px;
        cursor: grab;
        touch-action: none;
    }

    .sdawchfo-lightbox-drag-pill {
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.35);
    }

    /* Close button — circle overlay */
    .sdawchfo-lightbox-close {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.6);
        font-size: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 3;
        padding: 0;
    }

    /* Hide side arrows on mobile */
    .sdawchfo-lightbox-prev,
    .sdawchfo-lightbox-next {
        display: none;
    }

    /* Player */
    .sdawchfo-lightbox-player {
        border-radius: 8px;
    }

    /* Footer */
    .sdawchfo-lightbox-footer {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        margin: 10px 0 0;
    }


    .sdawchfo-lightbox-title {
        white-space: normal;
        text-align: center;
        width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 14px;
    }

    .sdawchfo-lightbox-counter {
        width: 100%;
        text-align: center;
        font-size: 13px;
    }

    /* Mobile nav buttons */
    .sdawchfo-lightbox-mobile-nav {
        display: flex;
        gap: 10px;
        margin: 10px 0 4px;
    }

    .sdawchfo-lightbox-mobile-prev,
    .sdawchfo-lightbox-mobile-next {
        flex: 1;
        padding: 12px 0;
        border: none;
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: background 0.2s;
    }

    .sdawchfo-lightbox-mobile-prev:active,
    .sdawchfo-lightbox-mobile-next:active {
        background: rgba(255, 255, 255, 0.22);
    }

    .sdawchfo-lightbox-mobile-prev:disabled,
    .sdawchfo-lightbox-mobile-next:disabled {
        opacity: 0.25;
        cursor: default;
    }

    .sdawchfo-slider-track > .sdawchfo-video-card {
        flex: 0 0 calc(50% - 8px);
    }
}

/* Landscape mobile — optimized layouts for wide-but-short viewports */
@media (orientation: landscape) and (max-height: 500px) {
    /* All grids: 2 columns instead of 3 */
    .sdawchfo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Live grid: horizontal cards, single column, large thumbnail */
    .sdawchfo-live-wrap .sdawchfo-grid {
        grid-template-columns: 1fr;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card {
        display: flex;
        flex-direction: row;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-thumbnail-wrap {
        flex: 0 0 60%;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-video-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Expand button always visible on touch (no hover) */
    .sdawchfo-expand-btn {
        opacity: 0.85;
    }

    /* Lightbox: fit player within short viewport */
    .sdawchfo-lightbox-content {
        width: 95%;
        max-width: none;
    }

    .sdawchfo-lightbox-player {
        padding-bottom: 0;
        height: 70vh;
    }

    .sdawchfo-lightbox-close {
        top: -32px;
    }

    .sdawchfo-lightbox-footer {
        margin: 6px 0 0;
    }

    .sdawchfo-lightbox-title {
        font-size: 13px;
    }
}

/* YouTube-app-style vertical cards for live on small screens */
@media (max-width: 600px) {
    .sdawchfo-live-wrap .sdawchfo-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card {
        display: block;
        border-radius: 0;
        background: transparent;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card:hover {
        transform: none;
        box-shadow: none;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-thumbnail-wrap {
        aspect-ratio: 16 / 9;
        border-radius: 12px;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-video-info {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 0 20px;
    }

    /* Avatar floats left, text block to the right — YouTube style */
    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-video-channel {
        order: -1;
        display: block;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-video-channel span {
        display: none;
    }

    .sdawchfo-live-wrap .sdawchfo-video-card .sdawchfo-video-channel-avatar {
        width: 36px;
        height: 36px;
        margin-top: 2px;
    }

    .sdawchfo-live-wrap .sdawchfo-video-info-text {
        flex: 1;
        min-width: 0;
    }

    .sdawchfo-live-wrap .sdawchfo-video-channel-name {
        display: block;
        font-size: 12px;
        color: #606060;
        margin-bottom: 2px;
    }

    .sdawchfo-live-wrap .sdawchfo-video-title {
        font-size: 14px;
        font-weight: 500;
        -webkit-line-clamp: 2;
        margin-bottom: 4px;
        line-height: 1.4;
    }

    .sdawchfo-live-wrap .sdawchfo-video-title a {
        color: #0f0f0f;
    }

    .sdawchfo-live-wrap .sdawchfo-video-meta {
        font-size: 12px;
        color: #606060;
    }

    .sdawchfo-live-section-heading {
        font-size: 14px;
        margin: 16px 0 8px;
    }

    .sdawchfo-live-section-heading:first-child {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .sdawchfo-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .sdawchfo-tab-bar {
        gap: 0;
    }

    .sdawchfo-tab-btn {
        padding: 12px 16px;
        font-size: 13px;
    }

    .sdawchfo-slider-track > .sdawchfo-video-card {
        flex: 0 0 calc(85% - 8px);
    }

    .sdawchfo-slider-prev,
    .sdawchfo-slider-next {
        width: 32px;
        height: 32px;
        font-size: 22px;
    }

    .sdawchfo-slider-prev {
        left: -4px;
    }

    .sdawchfo-slider-next {
        right: -4px;
    }
}

/* ==========================================================================
   Visually-hidden helper for accessible status messages and hints.
   Defined locally so the plugin does not depend on a theme providing
   .screen-reader-text. (1.4.38)
   ========================================================================== */
.sdawchfo-sr-only {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ==========================================================================
   Accessibility: focus-visible outlines for keyboard users.
   Scoped to plugin elements; uses currentColor so themes that change
   text color naturally inherit the outline. (1.4.38)
   ========================================================================== */
.sdawchfo-grid a:focus-visible,
.sdawchfo-grid button:focus-visible,
.sdawchfo-slider a:focus-visible,
.sdawchfo-slider button:focus-visible,
.sdawchfo-tabs a:focus-visible,
.sdawchfo-tabs button:focus-visible,
.sdawchfo-live-wrap a:focus-visible,
.sdawchfo-live-wrap button:focus-visible,
.sdawchfo-load-more-btn:focus-visible,
.sdawchfo-lightbox-close:focus-visible,
.sdawchfo-lightbox-prev:focus-visible,
.sdawchfo-lightbox-next:focus-visible,
.sdawchfo-lightbox-mobile-prev:focus-visible,
.sdawchfo-lightbox-mobile-next:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ==========================================================================
   Accessibility: honor prefers-reduced-motion.
   Disables decorative animations, transitions, and smooth-scroll inside
   plugin wrappers. Uses the 0.01ms pattern so any code waiting on
   animationend/transitionend still fires. WCAG 2.3.3. (1.4.38)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .sdawchfo-grid,
    .sdawchfo-grid *,
    .sdawchfo-slider,
    .sdawchfo-slider *,
    .sdawchfo-tabs,
    .sdawchfo-tabs *,
    .sdawchfo-live-wrap,
    .sdawchfo-live-wrap *,
    .sdawchfo-load-more-wrap,
    .sdawchfo-load-more-wrap *,
    .sdawchfo-lightbox,
    .sdawchfo-lightbox * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
