/* ================================================================
   GENERAL LAYOUT
   ================================================================*/
.ytp-wrapper {
    margin: 20px 0;
}

.ytp-layout {
    display: flex;
    gap: 20px;
}

.ytp-sidebar {
    min-width: 200px;
    border-right: 1px solid #ddd;
    padding-right: 20px;
}

.ytp-tab,
.ytp-wrapper [class*="playlist-tab"] {
    /* Support old tab classes */
    padding: 12px 16px;
    cursor: pointer;
    border: 1px solid #ddd;
    margin-bottom: 5px;
    background: #f9f9f9;
    border-radius: 4px;
    transition: all .3s;
}

.ytp-tab:hover,
.ytp-wrapper [class*="playlist-tab"]:hover {
    background: #e9e9e9;
}

.ytp-tab.active,
.ytp-wrapper [class*="playlist-tab"].active {
    background: #0073aa;
    color: #fff;
}

.ytp-tab-contents {
    flex: 1;
    min-height: 200px;
    overflow: visible;
    position: relative;
}

.ytp-section,
.ytp-wrapper [class*="playlist-content"] {
    /* Support old content classes */
    display: none;
}

.ytp-section.active,
.ytp-wrapper [class*="playlist-content"].active {
    display: block !important;
    width: 100%;
    min-height: 100px;
    visibility: visible !important;
}

/* ================================================================
   GRID LAYOUT
   ================================================================*/
.ytp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.ytp-video {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
    transition: transform .3s, box-shadow .3s;
    background: #fff;
}

.ytp-video:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

.ytp-video img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* ================================================================
   SLIDER LAYOUT
   ================================================================*/
.ytp-slider {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    overflow: hidden;
    padding: 0 24px;
}

.ytp-slider-container {
    overflow: hidden;
    width: 100%;
    scroll-behavior: smooth;
}

.ytp-slider-track {
    display: flex;
    transition: transform .3s;
    will-change: transform;
}

.ytp-slide {
    box-sizing: border-box;
    padding: 0 10px;
}

.ytp-slider .ytp-video {
    width: 100%;
}

.ytp-slider .ytp-video img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* ================================================================
   ARROWS – MODERN, CIRCULAR
   ================================================================*/
:root {
    --ytp-nav-bg: #fff;
    --ytp-nav-bg-hover: #f0f0f0;
    --ytp-nav-fg: #333;
    --ytp-nav-size: 48px;
}

.ytp-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--ytp-nav-size);
    height: var(--ytp-nav-size);
    border-radius: 50%;
    background: var(--ytp-nav-bg);
    color: var(--ytp-nav-fg);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    transition: background .25s, transform .25s;
    opacity: 0.95;
    z-index: 10;
}

.ytp-slider-nav span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.ytp-slider-nav:hover,
.ytp-slider-nav:focus {
    background: var(--ytp-nav-bg-hover);
    transform: translateY(-50%) scale(1.08);
    outline: none;
}

.ytp-slider-nav:focus-visible {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px #0073aa;
}

.ytp-slider-nav:active {
    transform: translateY(-50%) scale(.92);
}

.ytp-slider-nav.disabled {
    display: none;
}

.ytp-nav-prev {
    left: 24px;
}

.ytp-nav-next {
    right: 24px;
}

/* RTL arrow support */
html[dir="rtl"] .ytp-layout {
    flex-direction: row-reverse;
}

html[dir="rtl"] .ytp-nav-prev {
    right: 24px;
    left: auto;
    transform: translateY(-50%) scaleX(1);
}

html[dir="rtl"] .ytp-nav-next {
    left: 24px;
    right: auto;
    transform: translateY(-50%) scaleX(1);
}

/* ================================================================
   MODAL
   ================================================================*/
.ytp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, .8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ytp-modal iframe {
    width: 90vw;
    height: 50.6vw;
    max-width: 800px;
    max-height: 450px;
    border: none;
}

/* ================================================================
   RESPONSIVE
   ================================================================*/
@media (max-width: 900px) {
    :root {
        --ytp-nav-size: 40px;
    }

    .ytp-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 600px) {
    :root {
        --ytp-nav-size: 32px;
    }

    .ytp-layout {
        flex-direction: column !important;
    }

    .ytp-sidebar {
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 0 10px 10px;
        margin-bottom: 10px;
        min-width: 0;
        display: flex !important;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.05);
    }

    .ytp-sidebar::-webkit-scrollbar {
        display: none;
    }

    .ytp-tab,
    .ytp-wrapper [class*="playlist-tab"] {
        display: inline-block !important;
        margin-bottom: 0;
        margin-right: 8px;
        padding: 8px 12px;
        font-size: 0.9rem;
        scroll-snap-align: start;
    }

    .ytp-tab:last-child,
    .ytp-wrapper [class*="playlist-tab"]:last-child {
        margin-right: 0;
    }

    .ytp-tab-contents {
        flex: 1 !important;
        width: 100% !important;
        min-height: 100%;
        overflow: visible !important;
        visibility: visible !important;
    }

    html[dir="rtl"] .ytp-sidebar {
        flex-direction: row-reverse;
        direction: ltr;
    }

    html[dir="rtl"] .ytp-sidebar>* {
        direction: rtl;
    }

    html[dir="rtl"] .ytp-tab,
    html[dir="rtl"] .ytp-wrapper [class*="playlist-tab"] {
        margin-right: 0;
        margin-left: 8px;
    }

    html[dir="rtl"] .ytp-tab:last-child,
    html[dir="rtl"] .ytp-wrapper [class*="playlist-tab"]:last-child {
        margin-left: 0;
    }

    .ytp-slide {
        padding: 0 8px;
    }

    .ytp-nav-prev {
        left: 8px;
    }

    .ytp-nav-next {
        right: 8px;
    }

    html[dir="rtl"] .ytp-nav-prev {
        right: 8px;
        left: auto;
    }

    html[dir="rtl"] .ytp-nav-next {
        left: 8px;
        right: auto;
    }
}

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

/* ================================================================
   LOADING / A11y / HIGH-CONTRAST
   ================================================================*/
.ytp-section p,
.ytp-wrapper [class*="playlist-content"] p {
    text-align: center;
    padding: 40px;
    font-size: 16px;
    color: #666;
}

.ytp-video:focus,
.ytp-tab:focus,
.ytp-slider-nav:focus,
.ytp-wrapper [class*="playlist-tab"]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

@media (prefers-contrast: high) {

    .ytp-video,
    .ytp-tab,
    .ytp-slider-nav,
    .ytp-wrapper [class*="playlist-tab"] {
        border: 2px solid #000;
    }
}