:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(18, 24, 38, 0.85);
    --bg-glass: rgba(15, 23, 42, 0.85);
    --border-glass: rgba(255, 255, 255, 0.1);
    
    --primary: #3b82f6;
    --accent: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-md: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.25);
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Navbar */
.public-nav {
    position: sticky;
    top: 0;
    background: #0f172a;
    border-bottom: 1px solid var(--border-glass);
    z-index: 99;
    padding: 12px 16px;
    pointer-events: auto !important;
}

.nav-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 100;
    flex-wrap: wrap;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
    cursor: pointer;
    z-index: 101;
}

.brand-logo .logo-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    box-shadow: var(--shadow-glow);
}

.brand-logo .logo-text {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-logo .logo-text span {
    font-size: 9px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    margin-left: 3px;
}

.nav-search {
    flex: 1;
    min-width: 180px;
    position: relative;
    z-index: 101;
}

.nav-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
    font-size: 13px;
}

.nav-search input {
    width: 100%;
    background: #1e293b;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    padding: 8px 14px 8px 34px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    cursor: text;
}

.nav-search input:focus {
    border-color: var(--primary);
    background: #243247;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 102;
}

.sort-select {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 103;
}

.sort-select option {
    background: #0f172a;
    color: #fff;
    padding: 8px;
}

.btn-admin-link {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    z-index: 103;
    font-size: 13px;
}

.btn-admin-link:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* Main Container */
.public-main {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px 16px 60px 16px;
    position: relative;
    z-index: 10;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: var(--shadow-md);
}

.video-thumb {
    position: relative;
    padding-top: 56.25%; /* 16:9 */
    background: #0f172a;
    overflow: hidden;
}

.video-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .video-thumb img {
    transform: scale(1.06);
}

.play-hover-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.85);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    opacity: 0;
    transition: var(--transition);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.video-card:hover .play-hover-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.video-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.video-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

/* Pagination */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 20px auto;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    width: fit-content;
    box-shadow: var(--shadow-md);
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.page-btn:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.page-btn.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--text-dim);
    padding: 0 4px;
}

/* Fullscreen TikTok-Style Video Player */
.player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1000;
    display: none;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    user-select: none;
}

.player-overlay.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.player-header {
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 20;
    flex-shrink: 0;
}

.player-info h3 {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70vw;
}

.player-info span {
    font-size: 11px;
    color: var(--primary);
    font-weight: 700;
}

.btn-close-player {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--border-glass);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-close-player:hover {
    background: rgba(239, 68, 68, 0.85);
}

.player-stage {
    flex: 1;
    width: 100%;
    height: calc(100vh - 90px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 8px 12px 16px 12px;
    touch-action: none;
}

.player-stage video {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #000;
    border-radius: var(--radius-sm);
    outline: none;
    transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.28s ease;
}

.tiktok-actions {
    position: absolute;
    right: 16px;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 25;
}

.tiktok-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(20, 26, 40, 0.75);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.tiktok-action-btn i {
    font-size: 16px;
}

.tiktok-action-btn span {
    font-size: 8px;
    font-weight: 700;
    margin-top: 2px;
    text-transform: uppercase;
}

.tiktok-action-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.player-footer {
    height: 34px;
    background: rgba(11, 15, 25, 0.85);
    border-top: 1px solid var(--border-glass);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.swipe-hint {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 13px;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive: Searchbox Tetap Tampil Rapih & Terlihat */
@media (max-width: 768px) {
    .public-nav { padding: 10px 12px; }
    .nav-container { gap: 8px; }
    .brand-logo .logo-text { display: none; } /* Hanya tampilkan ikon logo di HP kecil agar searchbox punya ruang luas */
    .nav-search { flex: 1; min-width: 140px; }
    .nav-search input { padding: 7px 12px 7px 30px; font-size: 12px; }
    .nav-search i { left: 10px; font-size: 11px; }
    .sort-select { padding: 6px 8px; font-size: 11px; }
    .btn-admin-link { width: 30px; height: 30px; font-size: 11px; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .player-stage { height: calc(100vh - 80px); padding: 4px; }
    .tiktok-actions { right: 10px; bottom: 45px; gap: 10px; }
    .tiktok-action-btn { width: 42px; height: 42px; }
    .player-info h3 { max-width: 70vw; font-size: 13px; }
    .swipe-hint { font-size: 10px; }
}
