/* Apply Jakarta Plus Sans font globally */
body {
    font-family: 'Jakarta Plus Sans', sans-serif;
    background-color: #121212; /* Dark background */
    color: #e0e0e0; /* Light gray text */
    margin: 0;
    padding: 20px;
    line-height: 1.5; /* Improve readability */
}

/* Fade-in Animation for Tagline */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Keyframes for Animated Border --- */
@keyframes border-flow {
    to {
        background-position: 200% center;
    }
}


/* Logo */
.logo {
    width: 80px; /* Reduced logo size */
    height: auto;
    margin-bottom: 10px;
}

/* Title */
.title {
    font-size: 1.5rem; /* Reduced title size */
    font-weight: 600;
    color: #e0e0e0;
    margin: 0;
}

/* Tagline (Description) */
.tagline {
    font-size: 0.875rem; /* Reduced description size */
    color: #888;
    margin-top: 5px;
    font-weight: 400;
    font-style: italic;
    animation: fadeIn 1s ease-in-out; /* Apply animation */
}

/* Toast Notifications */
.custom-toast-container { 
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.custom-toast { 
    background-color: #333;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-in-out;
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    background-color: #1e1e1e;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Search Input */
#searchQuery {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 15px auto;
    display: block;
    padding: 10px;
    font-size: 0.875rem;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: #2a2a2a;
    color: #e0e0e0;
}

#searchQuery::placeholder {
    color: #777;
}

/* Video Player */
.video-container {
    display: none;
    margin-top: 15px;
    width: 100%;
    max-width: 1600px;
    aspect-ratio: 16 / 9;
    margin-left: auto;
    margin-right: auto;
}

iframe {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    transition: filter 0.2s ease-in-out;
}

/* Close button for the video player */
#closePlayerBtn {
    position: absolute;
    top: -15px;
    right: -10px;
    z-index: 1000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #fff;
    background-color: #121212;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

#closePlayerBtn:hover {
    background-color: #e53935;
    transform: scale(1.1);
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

/* Buttons - Compact and Dark Theme */
.btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 4px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
    border: none;
    background-color: #333;
    color: #e0e0e0;
}

.btn:hover {
    transform: translateY(-2px);
}

#filterCaret {
    margin-left: 5px;
    font-size: 0.7em;
    opacity: 0.8;
}

/* Settings Container & Panel */
.settings-container {
    position: relative;
}

.settings-panel {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 120%; /* Position above the button */
    left: 50%;
    transform: translateX(-50%);
    background-color: #2a2a2a;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 1010;
    width: 200px;
    text-align: center;
}

.settings-panel.visible {
    display: block; /* Show panel */
}

.settings-panel label {
    font-size: 0.8rem;
    margin-bottom: 10px;
    display: block;
}


.btn-primary { background-color: #1e88e5; }
.btn-primary:hover { background-color: #1565c0; }
.btn-danger { background-color: #e53935; }
.btn-danger:hover { background-color: #c62828; }
.btn-secondary { background-color: #444; }
.btn-secondary:hover { background-color: #555; }
.btn-success { background-color: #43a047; }
.btn-success:hover { background-color: #2e7d32; }

/* Search Results & Video Item */
.search-results {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.video-item {
    background-color: #2a2a2a;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent; /* Reserve space for border */
}

/* --- Style for the currently playing video thumbnail (UPDATED) --- */
.video-item.now-playing {
    background-image: linear-gradient(#2a2a2a, #2a2a2a), 
                      linear-gradient(90deg, #1e88e5, #e0e0e0, #1e88e5); /* UPDATED GRADIENT */
    background-origin: border-box;
    background-clip: padding-box, border-box;
    background-size: 200% auto;
    animation: border-flow 3s linear infinite;
}


.video-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}

.video-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    filter: brightness(0.6) contrast(0.8);
    transition: filter 0.3s ease;
}

.video-item:hover img {
    filter: brightness(0.8) contrast(1);
}

.video-item p {
    padding: 8px;
    margin: 0;
    font-size: 0.75rem;
    color: #e0e0e0;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.video-item:hover p {
    color: #1e88e5;
}

/* Footer Styles */
footer {
    margin-top: 30px;
    padding: 15px 0;
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-top: 1px solid #444;
    text-align: center;
}

footer p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Mobile-Friendly Adjustments */
@media (max-width: 768px) {
    .container { padding: 10px; }
    .logo { width: 60px; }
    .title { font-size: 1.25rem; }
    .tagline { font-size: 0.75rem; }
    .video-container { max-width: 100%; margin-top: 10px; }
    #closePlayerBtn { top: 5px; right: 5px; }
    .search-results { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
    .video-item p { padding: 6px; }
    .btn { padding: 5px 10px; }
    #searchQuery { padding: 8px; }
}

/* --- Tambahan untuk Tombol Sembunyikan dan Animasi --- */

/* Tombol Sembunyikan Video */
.hide-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    opacity: 0; /* Sembunyikan secara default */
    transition: opacity 0.3s ease;
    z-index: 10;
}

.video-item:hover .hide-btn {
    opacity: 1; /* Tampilkan saat mouse hover di atas video */
}

/* Animasi untuk Menghilangkan Video */
@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

.video-item-fade-out {
    animation: fadeOut 0.4s ease-out forwards;
}