/**
 * Newsmatic — Video Styles
 *
 * Responsive embed, video cards, carousel, related videos.
 * All colors and spacing inherit from theme tokens.
 *
 * @package Newsmatic
 * @since   2.0.0
 */

/* =========================================================
   Responsive Video Embed Wrapper (16:9)
   ========================================================= */

.nm-video-embed-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.nm-video-embed-wrap iframe,
.nm-video-embed-wrap video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.nm-video-embed-wrap.nm-video-native {
    padding-bottom: 0;
    height: auto;
}

.nm-video-embed-wrap.nm-video-native video {
    position: static;
    width: 100%;
    height: auto;
    max-height: 540px;
    display: block;
}

.nm-video-embed-container {
    margin-bottom: 28px;
}

/* =========================================================
   Video Duration Badge
   ========================================================= */

.nm-video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
}

.nm-video-duration-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* =========================================================
   Play Icon Overlay
   ========================================================= */

.nm-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.9;
    z-index: 2;
    pointer-events: none;
}

.nm-video-card__thumb:hover .nm-video-play-icon,
.nm-video-carousel__thumb:hover .nm-video-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

/* =========================================================
   Video Card (shared by archive grid, related, carousel)
   ========================================================= */

.nm-video-card {
    display: flex;
    flex-direction: column;
    background: var(--nm-card-bg, #fff);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.nm-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.nm-video-card__thumb-link {
    display: block;
    text-decoration: none;
}

.nm-video-card__thumb {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #1a1a2e;
    overflow: hidden;
}

.nm-video-card__thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.nm-video-card:hover .nm-video-card__thumb img {
    transform: scale(1.05);
}

.nm-video-card__thumb-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    color: rgba(255,255,255,0.4);
    font-size: 40px;
}

.nm-video-card__body {
    padding: 16px 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nm-video-card__cats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.nm-video-card__cats .cat-links {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nm-video-card__cats .cat-links:hover {
    opacity: 0.75;
}

.nm-video-card__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

.nm-video-card__title a {
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.nm-video-card__title a:hover {
    opacity: 0.75;
}

.nm-video-card__meta {
    font-size: 12px;
    opacity: 0.6;
}

/* =========================================================
   Video Pages — Full-Width Layout (no sidebars)
   ========================================================= */

body.nm-video-page #theme-content .row {
    display: block;
}

body.nm-video-page #theme-content .primary-content {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
}

body.nm-video-page .nm-video-archive-main,
body.nm-video-page .nm-video-single-main {
    padding: 8px 0 48px;
}

body.nm-video-page .nm-video-single-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
    background: var(--nm-card-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

/* =========================================================
   Video Archive Page
   ========================================================= */

.nm-video-archive-header {
    margin-bottom: 36px;
    padding: 36px 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.08) 0%, rgba(26, 26, 46, 0.04) 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
}

.nm-video-archive-header__inner {
    max-width: 640px;
    margin: 0 auto;
}

.nm-video-archive-header .page-title {
    margin: 0 0 10px;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.nm-video-archive-header__desc {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.6;
    opacity: 0.72;
}

.nm-video-archive-count {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
}

.nm-section-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--global-preset-theme-color, #e63946);
    color: #fff;
    margin-bottom: 12px;
}

.nm-video-archive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .nm-video-archive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

@media (max-width: 900px) {
    .nm-video-archive-header {
        padding: 28px 24px;
    }

    .nm-video-archive-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
}

@media (max-width: 580px) {
    .nm-video-archive-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    body.nm-video-page .nm-video-single-wrapper {
        padding: 16px;
        border-radius: 0;
        box-shadow: none;
    }
}

/* =========================================================
   Homepage Video Carousel Section
   ========================================================= */

.nm-video-carousel-section {
    padding: 36px 0;
    margin-bottom: 8px;
}

.nm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.nm-carousel-heading {
    margin: 0 !important;
}

.nm-view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: gap 0.2s ease, opacity 0.2s;
    opacity: 0.75;
}

.nm-view-all-link:hover {
    opacity: 1;
    gap: 8px;
}

.nm-video-carousel-wrapper {
    position: relative;
}

.nm-video-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    scroll-behavior: smooth;
    padding-bottom: 4px; /* prevent clip on box-shadow */
}

.nm-video-carousel::-webkit-scrollbar {
    display: none;
}

.nm-video-carousel__item {
    flex: 0 0 calc(25% - 15px);
    min-width: 220px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

/* Make carousel card use same card styles */
.nm-video-carousel__item .nm-video-card {
    height: 100%;
}

.nm-video-carousel__thumb-link {
    display: block;
    text-decoration: none;
}

.nm-video-carousel__thumb {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #1a1a2e;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
}

.nm-video-carousel__thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.nm-video-carousel__item:hover .nm-video-carousel__thumb img {
    transform: scale(1.05);
}

.nm-video-carousel__placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e293b;
    color: rgba(255,255,255,.35);
    font-size: 40px;
}

.nm-video-carousel__body {
    padding: 12px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: var(--nm-card-bg, #fff);
    border-radius: 0 0 10px 10px;
    flex: 1;
}

.nm-video-carousel__cat .cat-links {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
}

.nm-video-carousel__title {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

.nm-video-carousel__title a {
    text-decoration: none;
    transition: opacity 0.2s;
}

.nm-video-carousel__title a:hover { opacity: 0.75; }

.nm-video-carousel__date {
    font-size: 11px;
    opacity: 0.55;
}

/* Carousel nav buttons */
.nm-carousel-btn {
    position: absolute;
    top: calc(28.1% - 22px); /* center on thumb area */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s ease, transform 0.2s ease;
    color: #1a1a2e;
}

.nm-carousel-btn:hover {
    background: #fff;
    transform: scale(1.08);
}

.nm-carousel-btn--prev {
    left: -22px;
}

.nm-carousel-btn--next {
    right: -22px;
    transform: scaleX(-1); /* flip chevron */
}

.nm-carousel-btn--next:hover {
    transform: scaleX(-1) scale(1.08);
}

@media (max-width: 768px) {
    .nm-carousel-btn { display: none; }

    .nm-video-carousel__item {
        flex: 0 0 calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .nm-video-carousel {
        flex-direction: column;
        overflow-x: visible;
        scroll-snap-type: none;
    }
    .nm-video-carousel__item {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* =========================================================
   Single Video Page
   ========================================================= */

.nm-video-single .nm-video-embed-container {
    margin-bottom: 24px;
}

/* =========================================================
   Related Videos Section
   ========================================================= */

.nm-related-videos {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid rgba(0,0,0,0.07);
}

.nm-related-title {
    margin-bottom: 20px !important;
}

.nm-related-videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 760px) {
    .nm-related-videos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .nm-related-videos-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Dark Mode
   ========================================================= */

.dark_bk .nm-video-card,
.dark_bk .nm-video-carousel__body {
    background: rgba(255,255,255,0.05);
}

.dark_bk .nm-carousel-btn {
    background: rgba(30,30,50,0.9);
    color: #e2e8f0;
}

.dark_bk .nm-carousel-btn:hover {
    background: #1e293b;
}

.dark_bk .nm-video-archive-header {
    background: linear-gradient(135deg, rgba(230, 57, 70, 0.15) 0%, rgba(255, 255, 255, 0.04) 100%);
    border-color: rgba(255, 255, 255, 0.08);
}

.dark_bk .nm-video-archive-count {
    background: rgba(255, 255, 255, 0.1);
}

.dark_bk body.nm-video-page .nm-video-single-wrapper,
body.dark_bk.nm-video-page .nm-video-single-wrapper {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}
