:root {
    --bg-color: #0b0e14;
    --card-bg: #161b22;
    --accent-color: #38bdf8;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top, rgba(56, 189, 248, 0.1), transparent);
    pointer-events: none;
    z-index: -1;
}

main {
    width: 100%;
    min-height: 94vh;
    height: auto;
}

header {
    padding: 60px 20px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.video-title {
    width: 90%;
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(to right, #fff, var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search Bar dengan Icon Presisi */
.search-container {
    width: 90%;
    max-width: 600px;
    margin: 30px auto 10px auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 20px;
    color: var(--accent-color);
    font-size: 1.1rem;
    z-index: 10;
}

.search-container input {
    width: 100%;
    padding: 15px 25px 15px 55px;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    transition: 0.3s;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 10px 40px 100px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
    padding: 20px;
}

.video-card {
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.4s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.video-card:hover {
    transform: translateY(-10px);
    border-color: var(--accent-color);
    box-shadow: 0 25px 50px -12px rgba(56, 189, 248, 0.3);
}

.thumb-container {
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    position: relative;
    overflow: hidden;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;
    /* Awalnya sembunyi, tampilkan setelah frame terambil */
    transition: opacity 0.5s ease;
}

.thumb-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    color: rgba(255, 255, 255, 0.05);
    z-index: 1;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
    z-index: 10;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.play-overlay i {
    font-size: 3.5rem;
    color: var(--accent-color);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.video-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-main);
    height: 3rem;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tombol Download Lebih Kecil & Rapi */
.download-wrapper {
    padding: 0 20px 20px;
    margin-top: auto;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: 0.3s;
}

.btn-download:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

footer {
    height: 6vh;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 600px) {
    .video-title {
        font-size: 1.8rem;
    }

    .container {
        width: 90%;
        max-width: 1300px;
        padding: 0px 0px 100px;
    }

    .video-grid {
        display: flex;
        grid-template-columns: none;
        flex-direction: column;
    }

    .video-card {
        width: 100%;
        background: var(--card-bg);
        border-radius: 24px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        transition: all 0.4s ease;
        position: relative;
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }
}

@media (max-width: 420px) {
    .video-title {
        font-size: 2rem;
    }
}