/* ==========================================================================
   1. VARIABLES & RESET DEFAULT STYLES
   ========================================================================== */
* {
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

:root {
    --primary: #007bff;
    --primary-hover: #0056b3;
    --dark: #1e293b;
    --light: #f8fafc;
    --text-muted: #64748b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --border-color: #e2e8f0;
    --toast-success: #10b981;
    --toast-error: #ef4444;
}

body.dark-mode {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --light: #1e293b;
}

body {
    background-color: var(--bg-body); 
    color: var(--text-main); 
    line-height: 1.6; 
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh; 
}

.container {
    width: 90%; 
    max-width: 1800px; 
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

/* ==========================================================================
   2. NAVBAR HEADER & GLOBAL SEARCH
   ========================================================================== */
header { 
    background: var(--bg-card); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    border-bottom: 1px solid var(--border-color);
}

.navbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 0; 
}

.logo h1 { 
    font-size: 22px; 
    font-weight: 700; 
    color: var(--text-main);
}

.logo h1 span { 
    color: var(--primary); 
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 300px;
    margin: 0 20px;
}

#global-search {
    width: 100%;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

#global-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 210;
}

.search-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-body); }
.search-item h5 { font-size: 14px; margin-bottom: 2px; color: var(--primary); }
.search-item p { font-size: 11px; color: var(--text-muted); }

nav ul { 
    display: flex; 
    list-style: none; 
    align-items: center;
}

nav ul li { 
    margin-left: 20px; 
}

nav ul li a { 
    text-decoration: none; 
    color: var(--text-main); 
    font-weight: 500; 
    font-size: 15px; 
}

nav ul li a.active, nav ul li a:hover { 
    color: var(--primary); 
}

.theme-btn {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.menu-toggle { 
    display: none; 
    flex-direction: column; 
    gap: 5px; 
    background: none; 
    border: none; 
    cursor: pointer; 
    z-index: 150; 
    padding: 5px;
}

.menu-toggle span { 
    width: 25px; 
    height: 3px; 
    background: var(--text-main); 
    border-radius: 2px; 
}

/* ==========================================================================
   3. KONTEN UTAMA & FORM HANDLING
   ========================================================================== */
#content { 
    padding: 40px 0; 
    flex: 1; 
}

.hero { 
    text-align: center; 
    padding: 60px 20px; 
    background: var(--bg-card); 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
}

.hero h2 { 
    font-size: 32px; 
    margin-bottom: 15px; 
    font-weight: 800; 
}

.hero p { 
    color: var(--text-muted); 
    max-width: 600px; 
    margin: 0 auto 20px; 
}

.btn { 
    display: inline-block; 
    background: var(--primary); 
    color: #ffffff; 
    padding: 10px 25px; 
    border: none; 
    border-radius: 5px; 
    font-weight: 600; 
    cursor: pointer; 
}
.btn:hover { background: var(--primary-hover); }

.kontak-form-wrapper {
    margin-top: 25px;
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    outline: none;
}

.form-control:focus { border-color: var(--primary); }

/* ==========================================================================
   4. INTERACTIVE TOAST NOTIFICATION & SKELETON
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 80px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 9999; 
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; 
    width: 90%;
    max-width: 420px; 
}

.toast {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15); 
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    border-left: 5px solid var(--primary);
    animation: slideDownFromTop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.toast.success { border-left-color: var(--toast-success); }
.toast.error { border-left-color: var(--toast-error); }

.skeleton-box {
    background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-body) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loadingSkeleton 1.5s infinite;
    border-radius: 4px;
    height: 20px;
    margin-bottom: 10px;
}

/* ==========================================================================
   5. HALAMAN DAFTAR & DETAIL LAYANAN (DENGAN CORE AUTH CONTAINER)
   ========================================================================== */
.page-section { 
    background: var(--bg-card); 
    padding: 30px; 
    border-radius: 8px; 
    border: 1px solid var(--border-color); 
}

.page-title { 
    margin-bottom: 25px; 
    font-size: 22px; 
    text-align: center; 
    font-weight: 700; 
}

.daftar-layanan-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); 
    gap: 20px; 
    margin-top: 20px;
    width: 100%;
}

.layanan-card { 
    background-color: var(--bg-body); 
    border: 1px solid var(--border-color); 
    padding: 25px 20px; 
    border-radius: 8px; 
    text-align: center; 
    cursor: pointer; 
}

.layanan-card:hover { 
    transform: translateY(-4px); 
    border-color: var(--primary); 
    background: var(--bg-card); 
    box-shadow: 0 10px 15px rgba(0,0,0,0.1); 
}

.layanan-card .icon { font-size: 36px; margin-bottom: 10px; }
.layanan-card h4 { font-size: 18px; margin-bottom: 6px; }
.layanan-card p { font-size: 13px; color: var(--text-muted); }

.detail-wrapper { animation: slideUp 0.25s ease; }
.btn-kembali { background: none; border: none; color: var(--primary); font-weight: 600; font-size: 14px; cursor: pointer; margin-bottom: 15px; }
.btn-kembali:hover { text-decoration: underline; }
.konten-aktif h2 { font-size: 24px; margin-bottom: 8px; }
.deskripsi-layanan { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.fitur-aplikasi { border-top: 1px solid var(--border-color); padding-top: 20px; }
.fitur-box-demo { background: var(--bg-body); padding: 20px; border-radius: 6px; border: 1px solid var(--border-color); }
.fitur-box-demo textarea { background-color: var(--bg-card); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-aksi { background: var(--primary); color: white; padding: 8px 15px; border: none; border-radius: 4px; cursor: pointer; font-weight: 600; margin-top: 10px; }

/* ── INTERACTIVE AUTH SYSTEM BOX ── */
.auth-box-ui {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    max-width: 420px;
    margin: 20px auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-input-group {
    margin-bottom: 15px;
    text-align: left;
}

.auth-input-group label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-main);
    font-weight: 500;
}

.auth-input {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
}

.auth-input:focus {
    border-color: var(--primary);
}

.btn-blue {
    background-color: var(--primary);
    color: white;
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-blue:hover {
    background-color: var(--primary-hover);
}

/* ==========================================================================
   6. FOOTER & MULTI-LANG CONTROLS
   ========================================================================== */
footer { 
    text-align: center; 
    padding: 20px 0; 
    background: var(--bg-card); 
    color: var(--text-muted); 
    font-size: 13px; 
    width: 100%;
    margin-top: auto; 
    border-top: 1px solid var(--border-color);
}

.nav-controls-wrapper { display: flex; align-items: center; gap: 15px; margin-left: 25px; }
.lang-switcher { position: relative; display: inline-block; }
.lang-btn { background: var(--bg-body); border: 1px solid var(--border-color); color: var(--text-main); padding: 6px 12px; font-size: 14px; font-weight: 600; border-radius: 20px; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.lang-dropdown { position: absolute; top: 100%; right: 0; margin-top: 8px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); min-width: 120px; z-index: 200; overflow: hidden; padding: 5px 0; }
.lang-option { background: none; border: none; color: var(--text-main); width: 100%; padding: 8px 16px; text-align: left; font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.lang-option:hover { background: var(--bg-body); color: var(--primary); }

/* ==========================================================================
   7. RESPONSIVE MOBILE (HP)
   ========================================================================== */
@media (max-width: 768px) {
    .navbar { 
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 15px;
        width: 100%;
    }

    .logo { order: 1; }
    
    .search-container { 
        order: 2; 
        flex: 1;
        max-width: 50%; 
        margin: 0 10px; 
    }
    
    .menu-toggle { 
        display: flex; 
        order: 3;
        margin-left: auto;
    }
    
    nav { 
        position: fixed; 
        right: -100%; 
        top: 0; 
        width: 240px; 
        height: 100vh; 
        background: var(--bg-card); 
        padding-top: 70px; 
        transition: right 0.3s ease; 
        box-shadow: -2px 0 10px rgba(0,0,0,0.1); 
        border-left: 1px solid var(--border-color); 
        z-index: 100; 
    }
    nav.slide { right: 0; }
    nav ul { flex-direction: column; padding: 20px; align-items: flex-start; }
    nav ul li { margin: 12px 0; margin-left: 0; width: 100%; }

    .nav-controls-wrapper { width: 100%; flex-direction: column; align-items: stretch; margin-left: 0; margin-top: 20px; gap: 12px; }
    .lang-switcher { width: 100%; }
    .lang-btn { width: 100%; justify-content: center; }
    .lang-dropdown { position: static; width: 100%; box-shadow: none; margin-top: 5px; background: var(--bg-body); }
    .lang-option { text-align: center; justify-content: center; }
    
    .menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); background: var(--primary); }
    .menu-toggle.active span:nth-child(2) { opacity: 0; }
    .menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -7px); background: var(--primary); }
    
    .hero h2 { font-size: 26px; }
    .toast-container { top: 75px; width: 95%; }

    /* ── YOUTUBE MOBILE LAYOUT ── */

    /* Hapus padding & border page-section agar player bisa full width */
    .page-section {
        padding: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    /* #content juga kurangi padding atas */
    #content {
        padding: 10px 0;
    }

    /* Layout utama: kolom, sidebar di bawah konten */
    .yt-main-layout {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .yt-main-content {
        order: 1;
        width: 100%;
    }

    .yt-sidebar {
        order: 2;
        padding: 12px 14px;
        gap: 12px;
    }

    /* Player full width tepi ke tepi */
    .yt-player-wrapper {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        margin-bottom: 0;
        width: 100%;
    }

    /* Now playing compact */
    .now-playing {
        border-radius: 0;
        border-left: none;
        border-right: none;
        margin-bottom: 0;
        flex-direction: row;
        align-items: center;
        padding: 10px 14px;
    }

    .now-playing-info h4 {
        font-size: 13px;
    }

    /* Sembunyikan iklan di mobile
    #content-ads {
        display: none;
    } */

    /* Card video lebih compact */
    .yt-card img {
        width: 110px;
        min-width: 110px;
        height: 62px;
    }

    .yt-card-title {
        font-size: 12px;
    }

    .yt-card-channel,
    .yt-card-views {
        font-size: 11px;
    }

    /* Cegah auto-zoom input di iOS */
    .yt-search-bar input,
    .yt-link-bar input {
        font-size: 16px;
    }

    /* Tombol lebih mudah diklik */
    .yt-search-bar button,
    .yt-link-bar button {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* ==========================================================================
   8. ANIMATIONS ENGINE
   ========================================================================== */
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes loadingSkeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes slideDownFromTop { from { transform: translateY(-80px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ==========================================================================
   9. YOUTUBE LAYOUT (DESKTOP + MOBILE)
   ========================================================================== */

/* Default: mobile-first, single column */
.yt-main-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Desktop: 2 kolom */
@media (min-width: 992px) {
    .yt-main-layout {
        display: grid;
        grid-template-columns: 65% 35%;
        gap: 24px;
        align-items: start;
    }
}

.yt-main-content {
    width: 100%;
}

.yt-sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── PLAYER STYLING ── */
.yt-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}
.yt-player-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}
.yt-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 14px;
    gap: 10px;
}
.yt-placeholder .play-icon { font-size: 48px; }

.yt-error-box {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #f87171;
    font-size: 14px;
    gap: 8px;
    padding: 20px;
    text-align: center;
}
.yt-error-box .err-icon { font-size: 40px; }
.yt-error-box a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.yt-error-box a:hover { text-decoration: underline; }

/* ── SEARCH & LINK BAR ── */
.yt-search-bar, .yt-link-bar {
    display: flex;
    gap: 8px;
}
.yt-search-bar input, .yt-link-bar input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}
.yt-search-bar input:focus, .yt-link-bar input:focus { border-color: var(--primary); }
.yt-search-bar button, .yt-link-bar button {
    padding: 10px 18px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}
.yt-search-bar button:hover { background: var(--primary-hover); }

/* ── GRID VIDEO DI SIDEBAR ── */
.yt-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.yt-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.15s;
}
.yt-card:hover { transform: translateX(4px); }

.yt-card img {
    width: 168px;
    min-width: 168px;
    height: 94px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.yt-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
}

.yt-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.yt-card-channel { font-size: 11px; color: var(--text-muted); }
.yt-card-views   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── NOW PLAYING BOX ── */
.now-playing {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.now-playing-info h4 { margin: 0 0 3px; font-size: 14px; }
.now-playing-info p  { margin: 0; font-size: 12px; color: var(--text-muted); }

.btn-buka-yt {
    padding: 6px 14px;
    background: #ff0000;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.section-lbl {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 8px;
}

.info-box {
    background: rgba(0,123,255,0.08);
    border: 1px solid rgba(0,123,255,0.2);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── MINI PLAYER ── */
#player-wrapper.mini-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    height: 180px;
    z-index: 999;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

#player-wrapper.mini-player #yt-iframe {
    width: 100%;
    height: 100%;
}

#player-wrapper.mini-player #yt-placeholder,
#player-wrapper.mini-player #error-box {
    display: none !important;
}

/* ── SUGGEST BOX ── */
.yt-suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.yt-suggest-item:hover {
    background: var(--bg-body);
}

/* ── SKELETON LOADING CARD ── */
.yt-thumb-wrap {
    position: relative;
    width: 130px;
    min-width: 130px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.yt-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

@media (min-width: 992px) {
    .yt-thumb-wrap {
        width: 168px;
        min-width: 168px;
    }
}

@media (max-width: 768px) {
    .yt-results {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .yt-card {
        flex-direction: column;
        gap: 6px;
        overflow: hidden;
        min-width: 0;
    }

    .yt-thumb-wrap {
        width: 100%;
        min-width: unset;
        border-radius: 8px;
    }

    .yt-card-info {
        min-width: 0;
        padding: 0 2px;
    }

    .yt-card-title  { font-size: 13px; }
    .yt-card-channel,
    .yt-card-views  { font-size: 12px; }
    .yt-card:hover  { transform: none; }
}

.yt-thumb-skeleton,
.yt-skeleton-thumb,
.yt-skeleton-line {
    background: linear-gradient(90deg,
        var(--border-color) 25%,
        var(--bg-body) 50%,
        var(--border-color) 75%);
    background-size: 200% 100%;
    animation: loadingSkeleton 1.2s infinite;
    border-radius: 4px;
}

.yt-thumb-skeleton {
    position: absolute;
    inset: 0;
    border-radius: 6px;
}

.yt-skeleton-thumb {
    width: 110px;
    min-width: 110px;
    height: 62px;
    border-radius: 6px;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .yt-skeleton-thumb {
        width: 168px;
        min-width: 168px;
        height: 94px;
    }
}

@media (max-width: 768px) {
    #dompet-container {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    #dompet-container {
        grid-template-columns: 1fr !important;
    }
}
