/* =========================
   VIDEO GRID — Cinematic Edition
========================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Square+Peg&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap');

:root {
    --card-bg: #0f1117;
    --card-surface: #181c27;
    --card-border: rgba(255,255,255,0.07);
    --card-hover-border: rgba(255,165,0,0.35);
    --accent: #ff6b35;
    --accent-warm: #ffaa00;
    --accent-glow: rgba(255, 107, 53, 0.25);
    --text-primary: #f0f2f8;
    --text-secondary: #8a91a8;
    --like-active: #ff4466;
    --like-active-glow: rgba(255, 68, 102, 0.35);
    --star-active: #ffcc00;
    --badge-bg: rgba(255,107,53,0.15);
    --badge-color: #ffaa55;
    --radius-card: 18px;
    --radius-sm: 10px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
    --shadow-hover: 0 16px 56px rgba(0,0,0,0.55), 0 0 0 1px var(--card-hover-border);
    --transition-card: all 0.38s cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* ── Section ────────────────────── */
.video-grid {
    padding: 4rem 0 5rem;
    background: #fffaf4;
    min-height: 60vh;
}

.video-grid .container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 400px; 
    margin-left: auto;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 40px; 
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: var(--card-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none; 
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); 
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); 
    pointer-events: none; 
    font-size: 0.9rem;
}

/* ── Search ─────────────────────── */
#videoSearch {
    display: block;
    width: 100%;
    max-width: 420px;
    border-radius: 50px;
    border: 1.5px solid #ddd;
    background: #fffaf4;
    color: #451d00;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    outline: 0;
    margin-bottom: 2.5rem;
    margin-left: auto;
    transition: border-color 0.25s, box-shadow 0.25s;
}

#videoSearch::placeholder { color: var(--text-secondary); }

#videoSearch:focus {
    border-color: var(--accent);
}

/* ── Grid Heading ───────────────── */
.grid-heading {
    margin-bottom: 2rem;
}

.grid-heading h2 {
    font-family: 'Square Peg', sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    color: #451d00;
    letter-spacing: -0.03em;
    position: relative;
    display: inline-block;
}

.grid-heading h2::after {
    content: '';
    display: block;
    margin-top: 6px;
    height: 3px;
    width: 48px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
}

/* ── Grid Container ─────────────── */
.video-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* ── Card ───────────────────────── */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(28px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modern-video-card {
    background: var(--card-surface);
    border-radius: var(--radius-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: var(--transition-card);
    animation: cardIn 0.5s ease both;
    position: relative;
}

.modern-video-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, rgba(255,107,53,0.06) 0%, transparent 60%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s;
    z-index: 0;
}

.modern-video-card:hover {
    transform: translateY(-8px) scale(1.012);
    border-color: var(--card-hover-border);
}

.modern-video-card:hover::before {
    opacity: 1;
}

/* ── Thumbnail Wrapper ──────────── */
.video-frame-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.video-thumb {
    position: absolute;
    inset: 0;
    cursor: pointer;
    overflow: hidden;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.4s ease;
    display: block;
}

.video-thumb img.loaded {
    opacity: 1;
}

.modern-video-card:hover .video-thumb img {
    transform: scale(1.06);
}

/* ── Play Overlay ───────────────── */
.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
    transition: background 0.3s;
}

.modern-video-card:hover .play-overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.25) 60%, transparent 100%);
}

.play-btn-icon {
    width: 52px;
    height: 52px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.5);
}

.play-btn-icon i {
    color: #fff;
    font-size: 18px;
    margin-left: 3px; /* optical center for play icon */
}

.play-btn-ring {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255,107,53,0.35);
    animation: ringPulse 2.2s ease-in-out infinite;
    z-index: 1;
}

@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.18); opacity: 0.15; }
}

.modern-video-card:hover .play-btn-icon {
    transform: scale(1.15);
    box-shadow: 0 12px 36px rgba(255, 107, 53, 0.65);
}

/* ── Category Badge ─────────────── */
.video-category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--badge-bg);
    color: var(--badge-color);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 50px;
    border: 1px solid rgba(255,170,85,0.2);
    backdrop-filter: blur(8px);
    z-index: 3;
}

/* ── Iframe ─────────────────────── */
.video-frame {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 4;
}

.video-frame-wrapper.playing .video-frame {
    display: block;
}

/* ── Meta ───────────────────────── */
.video-meta {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
    background: #fff;
}


.video-title {
    font-family: 'Square Peg', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #451d00;
    line-height: 1.45;
    margin: 0;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Title Layout ──────────────── */
.video-title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.video-title-container .video-title {
    flex: 1;
    margin: 0;
    font-size: 1.5rem;
}

/* ── Download Pill ──────────────── */
.btn-download-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 107, 53, 0.1);
    color: var(--accent);
    border: 1px solid rgba(255, 107, 53, 0.3);
    padding: 5px 12px;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn-download-pill:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.2);
}

.btn-download-pill i {
    font-size: 0.85rem;
}

/* ── Interaction Bar ────────────── */
.interaction-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Like Button ────────────────── */
.btn-like {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1.5px solid #000;
    background: rgba(255,255,255,0.04);
    color: #000;
    padding: 7px 14px;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.25s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn-like i {
    font-size: 15px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-like:hover {
    border-color: var(--like-active);
    color: var(--like-active);
    background: rgba(255, 68, 102, 0.08);
}

.btn-like:hover i {
    transform: scale(1.25);
}

.btn-like.liked {
    background: linear-gradient(135deg, #ff4466, #ff2255);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 18px var(--like-active-glow);
}

.btn-like.liked i {
    color: #fff;
}

/* Like pop animation */
@keyframes likePop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.btn-like.pop i {
    animation: likePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Star Rating ────────────────── */
.star-rating {
    display: flex;
    gap: 4px;
}

.star-rating i {
    font-size: 15px;
    color: #000;
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}

.star-rating i.active {
    color: var(--star-active);
}

.star-rating i.hover {
    color: rgba(255, 204, 0, 0.6);
    transform: scale(1.15);
}

/* ── Load More/Less Buttons ─────── */
.load-more-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 5rem;
}

.btn-load {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 32px;
    border-radius: 50px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.2, 1);
    border: none;
    outline: none;
}

#videoLoadMore {
    background: #2b2b2b;
    color: #fff;
}

#videoLoadMore:hover {
    transform: translateY(-3px) scale(1.03);
}

#videoLoadLess {
    color: var(--text-secondary);
    border: 1.5px solid rgba(255,255,255,0.12);
}

#videoLoadLess:hover {
    background: #2b2b2b;
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-2px);
}

/* ── Responsive ─────────────────── */
@media (max-width: 768px) {
    .video-wrapper {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 18px;
    }

    .video-meta {
        padding: 14px 15px 16px;
    }

    .video-title {
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    .video-wrapper {
        grid-template-columns: 1fr;
    }

    .load-more-wrap {
        flex-direction: column;
        gap: 10px;
    }

    .btn-load {
        width: 100%;
        justify-content: center;
    }
}