/* VideoVault Pro — Frontend Styles
 * Loaded only on vvpro_video pages and pages containing plugin shortcodes.
 * Mobile-first. No inline styles anywhere in the plugin.
 */

/* ── Player wrapper — maintains 16:9 ratio ─────────────────────────────────── */

.vvpro-player-wrap {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.vvpro-ratio-16-9 {
    aspect-ratio: 16 / 9;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
    .vvpro-ratio-16-9::before {
        content: '';
        display: block;
        padding-top: 56.25%;
    }

    .vvpro-ratio-16-9 > * {
        position: absolute;
        inset: 0;
    }
}

/* ── Local video ───────────────────────────────────────────────────────────── */

.vvpro-video-local {
    display: block;
    width: 100%;
    height: auto;
    background: #000;
}

/* ── Lazy-load placeholder ─────────────────────────────────────────────────── */

.vvpro-player-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
}

.vvpro-player-placeholder:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

.vvpro-player-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.2s ease;
}

.vvpro-player-placeholder:hover .vvpro-player-thumb,
.vvpro-player-placeholder:focus .vvpro-player-thumb {
    filter: brightness(0.85);
}

.vvpro-player-thumb-placeholder {
    position: absolute;
    inset: 0;
    background: #1a1a1a;
}

.vvpro-play-btn {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.vvpro-player-placeholder:hover .vvpro-play-btn,
.vvpro-player-placeholder:focus .vvpro-play-btn {
    transform: scale(1.1);
}

.vvpro-play-btn svg {
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

/* ── Consent notice ────────────────────────────────────────────────────────── */

.vvpro-consent-notice {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 12px 16px;
    font-size: 0.85em;
    line-height: 1.5;
    z-index: 3;
    text-align: center;
}

.vvpro-consent-notice p {
    margin: 0;
}

/* ── Injected iframe ────────────────────────────────────────────────────────── */

.vvpro-iframe,
.vvpro-player-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Unavailable placeholder ───────────────────────────────────────────────── */

.vvpro-player-unavailable {
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    border-radius: 4px;
}

.vvpro-player-unavailable p {
    color: #a8a8a8;
    margin: 0;
    font-size: 0.9em;
}

/* ── Video grid ─────────────────────────────────────────────────────────────── */

.vvpro-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
}

.vvpro-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.vvpro-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.vvpro-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.vvpro-grid--cols-5 { grid-template-columns: repeat(5, 1fr); }
.vvpro-grid--cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ── Video card ─────────────────────────────────────────────────────────────── */

.vvpro-video-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.vvpro-video-card__player {
    width: 100%;
}

.vvpro-video-card__body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.vvpro-video-card__title {
    font-size: 0.95em;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.4;
}

.vvpro-video-card__title a {
    text-decoration: none;
    color: inherit;
}

.vvpro-video-card__title a:hover {
    text-decoration: underline;
}

.vvpro-video-card__meta {
    font-size: 0.8em;
    color: #666;
    margin-top: auto;
    padding-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Meta helpers ─────────────────────────────────────────────────────────── */

.vvpro-meta-channel::before { content: '📺 '; }
.vvpro-meta-duration::before { content: '⏱ '; }
.vvpro-meta-date::before { content: '📅 '; }

/* ── Featured video ────────────────────────────────────────────────────────── */

.vvpro-featured-video {
    margin-bottom: 24px;
}

.vvpro-featured-video__title {
    margin-top: 12px;
    font-size: 1.2em;
}

.vvpro-featured-video__meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.85em;
    color: #555;
    margin-top: 6px;
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */

.vvpro-pagination {
    margin-top: 32px;
    text-align: center;
}

.vvpro-pagination .page-numbers {
    display: inline-flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.vvpro-pagination .page-numbers li {
    margin: 0;
}

.vvpro-pagination .page-numbers a,
.vvpro-pagination .page-numbers span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.vvpro-pagination .page-numbers a:hover {
    background: #f0f0f0;
}

.vvpro-pagination .current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* ── Notices ─────────────────────────────────────────────────────────────── */

.vvpro-no-videos,
.vvpro-error {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #555;
}

/* ── Video meta strip (single-video and card) ────────────────────────────── */

.vvpro-video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 0.875em;
    color: #555;
    margin-bottom: 12px;
}

.vvpro-meta-provider::before { content: '🎬 '; }

.vvpro-meta-source {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
    background: #555;
    color: #fff;
    letter-spacing: 0.01em;
}

.vvpro-source-YouTube { background: #e52d27; }
.vvpro-source-Vimeo   { background: #1ab7ea; }

/* ── Archive page layout ─────────────────────────────────────────────────── */

.vvpro-archive-page {
    max-width: var(--wp--style--global--content-size, 1200px);
    margin-inline: auto;
    padding: 40px 24px;
    width: 100%;
    box-sizing: border-box;
}

.vvpro-archive__header {
    margin-bottom: 32px;
}

.vvpro-archive__title {
    font-size: 1.8em;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}

.vvpro-archive__description {
    color: #666;
    font-size: 0.95em;
    max-width: 60ch;
    margin: 0;
}

/* ── Single video page layout ────────────────────────────────────────────── */

.vvpro-single-video-page {
    max-width: var(--wp--style--global--content-size, 900px);
    margin-inline: auto;
    padding: 40px 24px;
    width: 100%;
    box-sizing: border-box;
}

.vvpro-single-video__player {
    margin-bottom: 24px;
}

.vvpro-single-video__header {
    margin-bottom: 16px;
}

.vvpro-single-video__title {
    font-size: 1.6em;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}

.vvpro-single-video__excerpt {
    color: #555;
    font-size: 0.95em;
    line-height: 1.6;
    margin-bottom: 16px;
}

.vvpro-single-video__content {
    margin-bottom: 24px;
}

.vvpro-single-video__terms {
    margin-bottom: 6px;
    font-size: 0.875em;
    color: #555;
}

.vvpro-terms-label {
    font-weight: 600;
    margin-right: 4px;
}

.vvpro-single-video__terms a {
    color: var(--wp--preset--color--primary, #0073aa);
    text-decoration: none;
}

.vvpro-single-video__terms a:hover {
    text-decoration: underline;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .vvpro-grid--cols-4,
    .vvpro-grid--cols-5,
    .vvpro-grid--cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .vvpro-grid--cols-2,
    .vvpro-grid--cols-3,
    .vvpro-grid--cols-4,
    .vvpro-grid--cols-5,
    .vvpro-grid--cols-6 {
        grid-template-columns: 1fr;
    }
}
