:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: system-ui, -apple-system, sans-serif; 
}

body { 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    min-height: 100vh; 
    overflow-x: hidden; 
}

.hidden { display: none !important; }

/* Komponen Glassmorphism */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    overflow: hidden; /* Mencegah elemen anak tumpah */
}

/* Layout Umum */
.screen { min-height: 100vh; display: flex; flex-direction: column; }
#loginScreen { justify-content: center; align-items: center; }
.container { max-width: 1000px; margin: 0 auto; padding: 2rem; width: 100%; }

/* Form Login */
.login-box { width: 100%; max-width: 400px; text-align: center; }
.logo { font-size: 1.5rem; font-weight: bold; margin-bottom: 1.5rem; color: var(--accent-color); }
input { 
    width: 100%; 
    padding: 12px; 
    margin-bottom: 1rem; 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
    background: rgba(0,0,0,0.2); 
    color: white; 
    outline: none; 
}
input:focus { border-color: var(--accent-color); }

button { 
    width: 100%; 
    padding: 12px; 
    border: none; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.2s; 
}
button[type="submit"], .btn-primary { background: var(--accent-color); color: white; }
button:hover { filter: brightness(1.1); }
.error-text { color: #ef4444; margin-top: 10px; font-size: 0.9rem; }

/* Navbar */
.navbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1rem 2rem; 
    background: var(--card-bg); 
    border-bottom: 1px solid var(--border-color); 
}
.btn-outline { width: auto; background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }

/* Dashboard Sections */
section { margin-bottom: 2rem; }
h3 { margin-bottom: 1.5rem; color: var(--text-main); }

/* Judul Video yang sedang diputar */
#nowPlayingTitle {
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    font-size: 1.1rem;
    color: #10b981; 
    margin-bottom: 1rem;
}

.btn-success { background: #10b981; color: white; margin-top: 1rem; }

/* Input File Kustom */
.file-input-wrapper input[type="file"] { display: none; }
.file-input-wrapper label { 
    display: inline-block; 
    width: auto; 
    padding: 10px 20px; 
    border-radius: 6px; 
    cursor: pointer; 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
}
#fileNameDisplay { 
    margin-left: 15px; 
    color: var(--text-muted); 
    font-size: 0.9rem; 
    word-wrap: break-word; 
}

/* Video Player Proporsi */
video { 
    width: 100%; 
    max-height: 65vh; /* Batasi tinggi maksimal agar tidak menelan layar untuk video vertikal */
    border-radius: 12px; 
    background: #000; 
    outline: none; 
    object-fit: contain; /* Memastikan video tidak gepeng/stretch */
}

/* Gallery Grid & Video Card (UPDATED) */
.grid-gallery { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); 
    gap: 1.5rem; 
}
.video-card { 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    overflow: hidden; /* Biar thumbnail gak keluar batas */
    transition: transform 0.2s; 
    display: flex; 
    flex-direction: column;
}
.video-card:hover { 
    transform: translateY(-5px); 
    border-color: var(--accent-color); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

/* Area Thumbnail (FIX UKURAN PAS & ANTI KEPOTONG) */
.thumbnail-wrapper {
    position: relative;
    width: 100%;
    height: 160px; /* Lu bisa sesuaikan tingginya kalau kurang besar */
    background: #000; /* Background hitam pekat */
    cursor: pointer;
    display: flex; /* Memastikan video benar-benar di tengah */
    align-items: center;
    justify-content: center;
}
.thumbnail-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* INI KUNCI SAKTINYA: Memaksa gambar pas tanpa dipotong */
    margin: 0;
    border-radius: 0;
    pointer-events: none; 
}
.play-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 4px 10px rgba(0,0,0,0.8);
    transition: 0.2s;
    z-index: 10; /* Biar tombol play selalu di atas video */
}
.thumbnail-wrapper:hover .play-overlay {
    color: var(--accent-color);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Area Info & Tombol Hapus */
.video-info-bar {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.video-info-bar h4 { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical;
    flex-grow: 1;
}
.btn-delete {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    width: auto;
    cursor: pointer;
}
.btn-delete:hover {
    background: #ef4444;
    color: white;
}

/* Teks Galeri */
.video-card h4 { 
    font-size: 0.85rem; 
    color: var(--text-muted); 
    text-align: center; 
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Maksimal 2 baris, sisanya titik-titik */
    -webkit-box-orient: vertical;
    width: 100%;
}