/* ============================================
   RSD YouTube Embed — Frontend Styles
   Navy (#1A1F3A) + Gold (#C8A96E) Theme
   ============================================ */

:root {
    --rsd-yt-navy: #1A1F3A;
    --rsd-yt-navy-deep: #0E1225;
    --rsd-yt-gold: #C8A96E;
    --rsd-yt-gold-dark: #9A7B3F;
    --rsd-yt-cream: #FAF6EE;
    --rsd-yt-white: #FFFFFF;
    --rsd-yt-text: #3A3A4A;
    --rsd-yt-text-light: #6B6B7B;
    --rsd-yt-radius: 8px;
    --rsd-yt-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --rsd-yt-cols: 3;
}

/* ============================================
   WRAPPER & SECTION HEADER
   ============================================ */
.rsd-yt-wrap {
    margin: 24px 0;
}
.rsd-yt-section-header {
    text-align: center;
    margin-bottom: 36px;
}
.rsd-yt-overline {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--rsd-yt-gold);
    font-weight: 600;
    margin-bottom: 8px;
}
.rsd-yt-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.8rem;
    color: var(--rsd-yt-navy);
    margin: 0 0 12px;
}
.rsd-yt-gold-line {
    width: 60px;
    height: 3px;
    background: var(--rsd-yt-gold);
    margin: 0 auto;
    border-radius: 2px;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.rsd-yt-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--rsd-yt-radius);
    padding: 16px 20px;
    color: #991b1b;
    font-size: 0.9rem;
    margin: 16px 0;
}

/* ============================================
   GRID LAYOUT
   ============================================ */
.rsd-yt-grid {
    display: grid;
    gap: 24px;
}
.rsd-yt-grid[data-layout="grid"],
.rsd-yt-grid.rsd-yt-grid {
    grid-template-columns: repeat(var(--rsd-yt-cols), 1fr);
}

/* LIST LAYOUT */
.rsd-yt-list {
    grid-template-columns: 1fr !important;
}
.rsd-yt-list .rsd-yt-card {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
}
.rsd-yt-list .rsd-yt-thumb { border-radius: var(--rsd-yt-radius) 0 0 var(--rsd-yt-radius); }
.rsd-yt-list .rsd-yt-info { padding: 20px 24px; }

/* CAROUSEL LAYOUT */
.rsd-yt-carousel {
    display: flex !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 20px;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}
.rsd-yt-carousel .rsd-yt-card {
    flex: 0 0 calc(100% / var(--rsd-yt-cols) - 14px);
    scroll-snap-align: start;
}
.rsd-yt-carousel::-webkit-scrollbar { height: 6px; }
.rsd-yt-carousel::-webkit-scrollbar-track { background: var(--rsd-yt-cream); border-radius: 3px; }
.rsd-yt-carousel::-webkit-scrollbar-thumb { background: var(--rsd-yt-gold); border-radius: 3px; }

/* ============================================
   VIDEO CARD
   ============================================ */
.rsd-yt-card {
    background: var(--rsd-yt-white);
    border-radius: var(--rsd-yt-radius);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.rsd-yt-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--rsd-yt-shadow);
}

/* Thumbnail */
.rsd-yt-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    cursor: pointer;
    background: var(--rsd-yt-navy);
}
.rsd-yt-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.4s ease;
}
.rsd-yt-thumb:hover img { transform: scale(1.05); }
.rsd-yt-lazy { opacity: 0; }
.rsd-yt-lazy.loaded { opacity: 1; }

/* Play Button */
.rsd-yt-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    transition: all 0.3s ease;
    pointer-events: none;
}
.rsd-yt-thumb:hover .rsd-yt-play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Duration Badge */
.rsd-yt-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

/* Info Section */
.rsd-yt-info { padding: 14px 16px 16px; }

.rsd-yt-title {
    font-family: 'Source Sans 3', -apple-system, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--rsd-yt-navy);
    margin: 0 0 6px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rsd-yt-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--rsd-yt-text-light);
    margin-bottom: 6px;
}
.rsd-yt-desc {
    font-size: 0.84rem;
    color: var(--rsd-yt-text-light);
    line-height: 1.5;
    margin: 6px 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   SINGLE VIDEO PLAYER
   ============================================ */
.rsd-yt-single {
    margin: 24px auto;
}
.rsd-yt-player {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--rsd-yt-radius);
    background: var(--rsd-yt-navy);
    cursor: pointer;
}
.rsd-yt-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.rsd-yt-player-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rsd-yt-play-lg {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.rsd-yt-player:hover .rsd-yt-play-lg {
    transform: translate(-50%, -50%) scale(1.15);
}

/* ============================================
   LIGHTBOX / MODAL
   ============================================ */
.rsd-yt-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.rsd-yt-modal.active {
    opacity: 1;
    visibility: visible;
}
.rsd-yt-modal-content {
    width: 100%;
    max-width: 900px;
    aspect-ratio: 16 / 9;
    position: relative;
}
.rsd-yt-modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--rsd-yt-radius);
}
.rsd-yt-modal-close {
    position: absolute;
    top: -36px;
    right: 0;
    background: none;
    border: none;
    color: var(--rsd-yt-gold);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.3s;
}
.rsd-yt-modal-close:hover { color: #fff; }

/* ============================================
   SUBSCRIBE BUTTON
   ============================================ */
.rsd-yt-subscribe {
    text-align: center;
    margin-top: 28px;
}
.rsd-yt-sub-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--rsd-yt-gold), var(--rsd-yt-gold-dark));
    color: var(--rsd-yt-navy) !important;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
}
.rsd-yt-sub-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(200,169,110,0.4);
    color: var(--rsd-yt-navy) !important;
}
.rsd-yt-sub-minimal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1.5px solid var(--rsd-yt-gold);
    color: var(--rsd-yt-gold) !important;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-decoration: none;
}
.rsd-yt-sub-minimal:hover {
    background: rgba(200,169,110,0.1);
}

/* ============================================
   CHANNEL BANNER
   ============================================ */
.rsd-yt-channel-banner {
    background: linear-gradient(135deg, var(--rsd-yt-navy-deep), var(--rsd-yt-navy));
    border-radius: var(--rsd-yt-radius);
    overflow: hidden;
    margin: 24px 0;
}
.rsd-yt-channel-inner { padding: 32px; }
.rsd-yt-channel-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}
.rsd-yt-channel-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--rsd-yt-gold);
}
.rsd-yt-channel-name {
    color: #fff;
    font-size: 1.3rem;
    margin: 0 0 4px;
}
.rsd-yt-channel-stats {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
}
.rsd-yt-channel-desc {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ============================================
   LOAD MORE
   ============================================ */
.rsd-yt-load-more-wrap {
    text-align: center;
    margin-top: 24px;
}
.rsd-yt-load-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: transparent;
    border: 2px solid var(--rsd-yt-navy);
    color: var(--rsd-yt-navy);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.rsd-yt-load-more:hover {
    background: var(--rsd-yt-navy);
    color: var(--rsd-yt-gold);
}
.rsd-yt-load-more.loading {
    opacity: 0.6;
    pointer-events: none;
}
.rsd-yt-load-more.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: rsd-spin 0.6s linear infinite;
}
@keyframes rsd-spin { to { transform: rotate(360deg); } }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .rsd-yt-grid { --rsd-yt-cols: 2 !important; }
    .rsd-yt-carousel .rsd-yt-card { flex: 0 0 calc(50% - 10px); }
}
@media (max-width: 640px) {
    .rsd-yt-grid { --rsd-yt-cols: 1 !important; }
    .rsd-yt-list .rsd-yt-card { grid-template-columns: 1fr; }
    .rsd-yt-list .rsd-yt-thumb { border-radius: var(--rsd-yt-radius) var(--rsd-yt-radius) 0 0; }
    .rsd-yt-carousel .rsd-yt-card { flex: 0 0 calc(100% - 20px); }
    .rsd-yt-modal { padding: 16px; }
    .rsd-yt-channel-header { flex-direction: column; text-align: center; }
}
