/* ==========================================================================
   FR YouTube Gallery - Frontend Styles
   Clean white design with dark navy blue (#1a2744) accents.
   ========================================================================== */

/* Reset & Container */
.fr-ytg-gallery {
    --_bg: var(--fr-ytg-bg, #ffffff);
    --_card-bg: var(--fr-ytg-card-bg, #f5f7fa);
    --_text: var(--fr-ytg-text, #1a2744);
    --_accent: var(--fr-ytg-accent, #1a2744);
    --_tab-active: var(--fr-ytg-tab-active, #1a2744);
    --_tab-inactive: var(--fr-ytg-tab-inactive, #f5f7fa);
    --_per-view: var(--fr-ytg-per-view-desktop, 3);

    background: var(--_bg);
    color: var(--_text);
    padding: 30px 24px;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

.fr-ytg-gallery *,
.fr-ytg-gallery *::before,
.fr-ytg-gallery *::after {
    box-sizing: border-box;
}

/* Title */
.fr-ytg-title {
    color: var(--_text);
    margin: 0 0 24px 0;
    padding: 0;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.02em;
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.fr-ytg-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 24px;
    padding: 0;
    justify-content: center;
    border-bottom: 2px solid #e2e6ec;
    background: #ffffff;
}

.fr-ytg-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #6b7a90;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    line-height: 1.3;
    outline: none;
    margin-bottom: -2px;
}

.fr-ytg-tab:hover {
    color: var(--_accent);
    background: transparent;
    opacity: 1;
    transform: none;
}

.fr-ytg-tab:focus-visible {
    outline: 2px solid var(--_accent);
    outline-offset: -2px;
}

.fr-ytg-tab--active {
    color: var(--_accent);
    border-bottom-color: var(--_accent);
    background: transparent;
    box-shadow: none;
}

.fr-ytg-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #e2e6ec;
    color: #1a2744;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.fr-ytg-tab--active .fr-ytg-tab-count {
    background: var(--_accent);
    color: #ffffff;
}

/* ==========================================================================
   Panels
   ========================================================================== */
.fr-ytg-panel {
    display: none;
}

.fr-ytg-panel--active {
    display: block;
    animation: frYtgFadeIn 0.3s ease;
}

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

/* ==========================================================================
   Carousel
   ========================================================================== */
.fr-ytg-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
}

.fr-ytg-carousel-track-container {
    flex: 1;
    overflow: hidden;
    margin: 0 8px;
}

.fr-ytg-carousel-track {
    display: flex;
    gap: 16px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Video cards sizing based on CSS var */
.fr-ytg-video-card {
    flex: 0 0 calc((100% - (var(--_per-view) - 1) * 16px) / var(--_per-view));
    min-width: 0;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e6ec;
}

.fr-ytg-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(26, 39, 68, 0.15);
}

.fr-ytg-video-card--active {
    outline: 3px solid var(--_accent);
    outline-offset: -3px;
}

/* Carousel Buttons */
.fr-ytg-carousel-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    align-self: center;
    background: transparent;
    border: 2px solid #1a2744;
    border-radius: 8px;
    color: #1a2744;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    z-index: 2;
}

.fr-ytg-carousel-btn svg {
    width: 20px;
    height: 20px;
    stroke: #1a2744;
    stroke-width: 3;
}

.fr-ytg-carousel-btn:hover {
    background: #1a2744;
    color: #ffffff;
}

.fr-ytg-carousel-btn:hover svg {
    stroke: #ffffff;
}

.fr-ytg-carousel-btn:focus-visible {
    outline: 2px solid #1a2744;
    outline-offset: 2px;
}

.fr-ytg-carousel-btn:disabled {
    opacity: 0.2;
    cursor: default;
    border-color: #ccc;
}

.fr-ytg-carousel-btn:disabled svg {
    stroke: #ccc;
}

.fr-ytg-carousel-btn:disabled:hover {
    background: transparent;
    color: #ccc;
}

/* ==========================================================================
   Thumbnail & Play Overlay
   ========================================================================== */
.fr-ytg-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    overflow: hidden;
    background: #e2e6ec;
}

.fr-ytg-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.fr-ytg-video-card:hover .fr-ytg-thumbnail {
    transform: scale(1.05);
    filter: brightness(0.8);
}

.fr-ytg-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.fr-ytg-video-card:hover .fr-ytg-play-overlay {
    opacity: 1;
}

.fr-ytg-play-icon {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.fr-ytg-video-card:hover .fr-ytg-play-icon {
    transform: scale(1.1);
}

/* Duration Badge */
.fr-ytg-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

/* Video Info */
.fr-ytg-video-info {
    padding: 12px 14px;
}

.fr-ytg-video-title {
    color: var(--_text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fr-ytg-video-views {
    color: #6b7a90;
    font-size: 12px;
    line-height: 1.3;
}

/* ==========================================================================
   Player Area (below carousel) - 33% width, centered
   ========================================================================== */
.fr-ytg-player-area {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: frYtgSlideDown 0.35s ease;
}

.fr-ytg-player-inner {
    width: 44%;
    min-width: 400px;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #e2e6ec;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(26, 39, 68, 0.1);
}

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

.fr-ytg-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #f5f7fa;
    border-bottom: 1px solid #e2e6ec;
}

.fr-ytg-player-title {
    color: var(--_text);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 16px;
}

.fr-ytg-player-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e2e6ec;
    border-radius: 50%;
    background: #ffffff;
    color: var(--_text);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.fr-ytg-player-close:hover {
    background: var(--_accent);
    color: #ffffff;
    border-color: var(--_accent);
    transform: scale(1.1);
}

.fr-ytg-player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

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

/* ==========================================================================
   Empty / No Videos State
   ========================================================================== */
.fr-ytg-no-videos,
.fr-ytg-empty-category {
    text-align: center;
    padding: 48px 24px;
    color: #6b7a90;
    font-size: 15px;
}

.fr-ytg-no-videos p,
.fr-ytg-empty-category p {
    margin: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: <= 1024px */
@media (max-width: 1024px) {
    .fr-ytg-gallery {
        --_per-view: var(--fr-ytg-per-view-tablet, 2);
        padding: 24px 16px;
    }

    .fr-ytg-title {
        font-size: 24px;
    }

    .fr-ytg-tab {
        padding: 10px 14px;
        font-size: 13px;
    }

    .fr-ytg-carousel-btn {
        width: 38px;
        height: 38px;
    }

    .fr-ytg-player-inner {
        width: 50%;
    }
}

/* Mobile: <= 767px */
@media (max-width: 767px) {
    .fr-ytg-gallery {
        --_per-view: var(--fr-ytg-per-view-mobile, 1);
        padding: 16px 12px;
    }

    .fr-ytg-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .fr-ytg-tabs {
        gap: 0;
        margin-bottom: 16px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0;
        justify-content: flex-start;
    }

    .fr-ytg-tabs::-webkit-scrollbar {
        display: none;
    }

    .fr-ytg-tab {
        padding: 8px 12px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .fr-ytg-tab-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .fr-ytg-carousel-btn {
        width: 32px;
        height: 32px;
    }

    .fr-ytg-carousel-track-container {
        margin: 0 4px;
    }

    .fr-ytg-carousel-track {
        gap: 10px;
    }

    .fr-ytg-video-card {
        flex: 0 0 calc((100% - (var(--_per-view) - 1) * 10px) / var(--_per-view));
    }

    .fr-ytg-video-info {
        padding: 10px 12px;
    }

    .fr-ytg-video-title {
        font-size: 13px;
    }

    .fr-ytg-player-header {
        padding: 10px 14px;
    }

    .fr-ytg-player-title {
        font-size: 14px;
    }

    .fr-ytg-player-inner {
        width: 100%;
        min-width: 0;
    }
}

/* Small mobile: <= 480px */
@media (max-width: 480px) {
    .fr-ytg-gallery {
        padding: 12px 8px;
        border-radius: 8px;
    }

    .fr-ytg-carousel-btn {
        width: 28px;
        height: 28px;
    }

    .fr-ytg-carousel-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ==========================================================================
   Touch / swipe hint for mobile
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    .fr-ytg-play-overlay {
        opacity: 0.8;
    }

    .fr-ytg-video-card:hover .fr-ytg-thumbnail {
        transform: none;
        filter: none;
    }

    .fr-ytg-video-card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
    .fr-ytg-gallery {
        background: #fff;
        color: #000;
    }

    .fr-ytg-carousel-btn,
    .fr-ytg-play-overlay,
    .fr-ytg-player-area {
        display: none !important;
    }
}
