/* ==========================================================================
   Kelas Online - Premium Responsive Course Player Design
   ========================================================================== */

.ko-custom-wrapper {
    --primary: #1e3a8a;
    --primary-hover: #1e40af;
    --white: #ffffff;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --accent-gold: #fbbf24;
    
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--white);
    color: var(--text);
    padding: 24px 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    line-height: 1.6;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Memperlebar pembungkus tema WordPress agar di desktop video tidak terbatasi 780px/800px */
body.single-ko_kelas .single-article,
body.single-ko_kelas main,
body.single-ko_kelas .site-main,
body.single-ko_kelas .entry-content,
body.single-ko_kelas .content-area,
body.single-ko_kelas #content,
body.single-ko_kelas .wp-block-post-content,
body.single-ko_kelas .elementor-section.elementor-section-boxed > .elementor-container {
    max-width: 1560px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

body.single-ko_kelas .single-article {
    padding-top: 25px !important;
    padding-bottom: 50px !important;
}

/* Sembunyikan judul & meta bawaan tema Usman Innovator agar tidak menumpuk/ganda */
body.single-ko_kelas .single-article > h1:first-child,
body.single-ko_kelas .single-article > .meta {
    display: none !important;
}

/* Hilangkan padding berlebih dari pembungkus konten */
body.single-ko_kelas .entry-content {
    padding: 0 !important;
    margin: 0 !important;
}

/* Reset Box Sizing strictly scoped */
.ko-custom-wrapper *, 
.ko-custom-wrapper *::before, 
.ko-custom-wrapper *::after {
    box-sizing: border-box;
}

.ko-custom-wrapper .container {
    display: flex;
    gap: 28px;
    max-width: 1560px; /* Diperlebar agar tampilan video jauh lebih lega di monitor Desktop */
    width: 100%;
    margin: 0 auto;
    background: var(--white);
    align-items: flex-start;
}

/* ==========================================================================
   KONTEN KIRI (MAIN CONTENT / VIDEO PLAYER)
   ========================================================================== */
.ko-custom-wrapper .main-content {
    flex: 1; /* Mengambil seluruh ruang maksimal di desktop */
    min-width: 0;
    background: var(--white);
    padding: 28px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ko-custom-wrapper .course-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: var(--text);
    line-height: 1.3;
}

.ko-custom-wrapper .course-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ko-custom-wrapper .course-stats span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   CUSTOM YOUTUBE VIDEO PLAYER
   Hides YouTube native branding, title bar, & "Watch on YouTube" button.
   Provides custom Play, Pause, Scrubbing, and Fullscreen/Minimize controls.
   ========================================================================== */
.ko-custom-wrapper .video-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 24px;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

/* YouTube Iframe Wrapper - Pointer events disabled on iframe directly */
.ko-custom-wrapper .ko-yt-iframe-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Cegah interaksi langsung dengan iframe agar YouTube menu/link tidak muncul */
    overflow: hidden;
}

.ko-custom-wrapper .ko-yt-iframe-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    pointer-events: none;
}

/* Transparent click capture overlay */
.ko-custom-wrapper .ko-player-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    cursor: pointer;
    background: transparent;
}

/* Tombol Besar Play di Tengah */
.ko-custom-wrapper .ko-center-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(30, 58, 138, 0.95);
    color: #ffffff;
    border: 3px solid rgba(255, 255, 255, 0.9);
    cursor: pointer;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, opacity 0.25s ease;
}

.ko-custom-wrapper .ko-center-play-btn i {
    margin-left: 4px; /* Optically center play triangle */
}

.ko-custom-wrapper .ko-center-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--primary-hover);
}

.ko-custom-wrapper .video-placeholder.is-playing .ko-center-play-btn {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

/* Bar Kontrol Kustom di Bagian Bawah */
.ko-custom-wrapper .ko-controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 7;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.7) 60%, transparent 100%);
    padding: 16px 16px 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.ko-custom-wrapper .video-placeholder:hover .ko-controls-bar,
.ko-custom-wrapper .video-placeholder.show-controls .ko-controls-bar,
.ko-custom-wrapper .video-placeholder:not(.is-playing) .ko-controls-bar {
    opacity: 1;
    pointer-events: auto;
}

/* Tombol Kontrol (Play, Pause, Mute, Fullscreen) */
.ko-custom-wrapper .ko-ctrl-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.05rem;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s, color 0.2s;
    outline: none;
    flex-shrink: 0;
}

.ko-custom-wrapper .ko-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: scale(1.08);
}

.ko-custom-wrapper .ko-time-display {
    font-size: 0.8rem;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Progress Bar / Scrubber */
.ko-custom-wrapper .ko-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    transition: height 0.15s ease;
}

.ko-custom-wrapper .ko-progress-bar:hover {
    height: 8px;
}

.ko-custom-wrapper .ko-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    pointer-events: none;
}

.ko-custom-wrapper .ko-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--success);
    border-radius: 3px;
    pointer-events: none;
}

.ko-custom-wrapper .ko-progress-thumb {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.ko-custom-wrapper .ko-progress-bar:hover .ko-progress-thumb {
    opacity: 1;
}

/* Fullscreen Behavior */
.ko-custom-wrapper .video-placeholder:fullscreen,
.ko-custom-wrapper .video-placeholder:-webkit-full-screen,
.ko-custom-wrapper .video-placeholder.is-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: #000000;
    z-index: 999999;
}

/* ==========================================================================
   DESKRIPSI KELAS
   ========================================================================== */
.ko-custom-wrapper .description {
    margin-top: 24px;
}

.ko-custom-wrapper .description h3 {
    font-size: 1.1rem;
    margin: 0 0 8px 0;
    font-weight: 600;
    color: var(--primary);
}

.ko-custom-wrapper .description p,
.ko-custom-wrapper .description .description-text {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.7;
    margin: 0 0 12px 0;
}

/* ==========================================================================
   SIDEBAR KANAN
   ========================================================================== */
.ko-custom-wrapper .sidebar {
    width: 360px;
    flex: 0 0 360px; /* Ukuran pas agar di desktop porsi video jauh lebih dominan dan luas */
    background: var(--white);
    padding: 24px;
    border-radius: 14px;
    border: 1px solid var(--border);
    height: fit-content;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ko-custom-wrapper .sidebar h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* Progress Container */
.ko-custom-wrapper .progress-container {
    margin-bottom: 20px;
}

.ko-custom-wrapper .progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-light);
}

.ko-custom-wrapper .progress-text span:last-child {
    color: var(--primary);
    font-weight: 600;
}

.ko-custom-wrapper .progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.ko-custom-wrapper .progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--success);
    transition: width 0.4s ease;
}

/* Daftar Materi */
.ko-custom-wrapper .lesson-list {
    list-style: none;
    margin: 0 0 16px 0;
    padding: 0;
}

.ko-custom-wrapper .lesson-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
}

.ko-custom-wrapper .lesson-item:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.ko-custom-wrapper .lesson-item.active {
    border-color: var(--primary);
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

.ko-custom-wrapper .lesson-item.completed {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.ko-custom-wrapper .lesson-info {
    flex: 1;
    min-width: 0;
    padding-right: 12px;
}

.ko-custom-wrapper .lesson-info h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0 0 2px 0;
    color: var(--text);
    line-height: 1.4;
    transition: color 0.2s ease;
}

.ko-custom-wrapper .lesson-info p {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0;
}

.ko-custom-wrapper .check-icon {
    color: var(--border);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.ko-custom-wrapper .check-icon:hover {
    transform: scale(1.15);
}

.ko-custom-wrapper .lesson-item.completed .check-icon {
    color: var(--success);
}

.ko-custom-wrapper .lesson-item.completed .lesson-info h4 {
    text-decoration: line-through;
    color: var(--text-light);
}

/* ==========================================================================
   SERTIFIKAT SECTION
   ========================================================================== */
.ko-custom-wrapper .certificate-section {
    display: none;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    animation: koFadeIn 0.4s ease;
}

.ko-custom-wrapper .certificate-section.show {
    display: block;
}

.ko-custom-wrapper .cert-hint {
    font-size: 0.85rem;
    color: var(--success);
    margin: 0 0 12px 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ko-custom-wrapper .btn-cert {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    font-size: 0.95rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, transform 0.15s ease;
    text-decoration: none;
    outline: none;
}

.ko-custom-wrapper .btn-cert:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* ==========================================================================
   MODAL SERTIFIKAT
   ========================================================================== */
.ko-custom-wrapper .modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
}

.ko-custom-wrapper .modal.show {
    display: flex;
    animation: koFadeIn 0.3s ease;
}

.ko-custom-wrapper .certificate-card {
    background: #ffffff;
    width: 100%;
    max-width: 580px;
    padding: 35px 30px;
    border-radius: 16px;
    text-align: center;
    border: 4px solid var(--accent-gold);
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: koZoomIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ko-custom-wrapper .cert-icon {
    font-size: 3.2rem;
    color: var(--accent-gold);
    margin-bottom: 12px;
}

.ko-custom-wrapper .certificate-card h2 {
    font-size: 1.6rem;
    margin: 0 0 6px 0;
    color: var(--text);
    letter-spacing: 0.5px;
    font-weight: 800;
}

.ko-custom-wrapper .certificate-card p.cert-desc {
    color: var(--text-light);
    margin: 0 0 10px 0;
    font-size: 0.9rem;
}

.ko-custom-wrapper .cert-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 2px solid var(--accent-gold);
    display: inline-block;
    padding-bottom: 4px;
    margin-bottom: 10px;
}

.ko-custom-wrapper .cert-course-info {
    color: var(--text);
    font-size: 0.95rem;
    margin: 0 0 16px 0;
}

/* Kotak Cuplikan Kredensial (QR + Barcode) dalam Modal */
.ko-custom-wrapper .cert-modal-credential-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 14px 18px;
    margin: 16px 0 20px 0;
    gap: 16px;
    text-align: left;
}

.ko-custom-wrapper .cert-modal-qr-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ko-custom-wrapper .cert-modal-qr {
    width: 68px;
    height: 68px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 2px;
}

.ko-custom-wrapper .cert-modal-qr-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-light);
    margin-top: 4px;
}

.ko-custom-wrapper .cert-modal-barcode-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ko-custom-wrapper .cert-badge-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.ko-custom-wrapper .cert-badge-code {
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    background: #eff6ff;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #bfdbfe;
    display: inline-block;
    margin-bottom: 6px;
}

.ko-custom-wrapper .cert-modal-barcode {
    width: 100%;
    display: flex;
    justify-content: center;
}

.ko-custom-wrapper .cert-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.ko-custom-wrapper .btn-cert-primary {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #ffffff;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

.ko-custom-wrapper .btn-cert-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.35);
    color: #ffffff;
}

.ko-custom-wrapper .btn-cert-secondary {
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    padding: 11px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.ko-custom-wrapper .btn-cert-secondary:hover {
    background: #dbeafe;
    color: var(--primary-hover);
}

.ko-custom-wrapper .btn-close {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.ko-custom-wrapper .btn-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* ==========================================================================
   ANIMASI
   ========================================================================== */
@keyframes koFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes koZoomIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   RESPONSIF (TABLET & HP)
   ========================================================================== */
@media (max-width: 1200px) {
    .ko-custom-wrapper .sidebar {
        width: 320px;
        flex: 0 0 320px;
    }
}

@media (max-width: 960px) {
    .ko-custom-wrapper .container {
        flex-direction: column;
        gap: 20px;
    }
    
    .ko-custom-wrapper .sidebar {
        width: 100%;
        flex: 1 1 100%;
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .ko-custom-wrapper {
        padding: 12px;
    }
    
    .ko-custom-wrapper .main-content, 
    .ko-custom-wrapper .sidebar {
        padding: 20px;
    }
    
    .ko-custom-wrapper .course-title {
        font-size: 1.35rem;
    }
    
    .ko-custom-wrapper .course-stats {
        gap: 12px;
        font-size: 0.8rem;
    }
    
    .ko-custom-wrapper .ko-center-play-btn {
        width: 54px;
        height: 54px;
        font-size: 1.3rem;
    }
    
    .ko-custom-wrapper .ko-controls-bar {
        padding: 10px;
        gap: 8px;
    }
    
    .ko-custom-wrapper .ko-ctrl-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }
    
    .ko-custom-wrapper .ko-time-display {
        font-size: 0.72rem;
    }
    
    .ko-custom-wrapper .certificate-card {
        padding: 24px;
    }
    
    .ko-custom-wrapper .certificate-card h2 {
        font-size: 1.4rem;
    }
    
    .ko-custom-wrapper .cert-name {
        font-size: 1.25rem;
    }
    
    .ko-custom-wrapper .cert-icon {
        font-size: 2.8rem;
        margin-bottom: 12px;
    }
}
/* ===== Gerbang akses kelas (terkunci) & daftar kelas saya ===== */
.ko-gate { max-width: 560px; margin: 40px auto; padding: 36px 28px; text-align: center; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 10px 30px rgba(15,23,42,.06); font-family: 'Inter', sans-serif; }
.ko-gate-icon { font-size: 44px; line-height: 1; margin-bottom: 12px; }
.ko-gate-title { margin: 0 0 10px; font-size: 22px; color: #0f172a; }
.ko-gate-text { margin: 0 0 22px; color: #475569; font-size: 15px; line-height: 1.6; }
.ko-gate-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.ko-gate-btn { display: block; padding: 13px 18px; border-radius: 10px; background: #1e3a8a; color: #fff !important; font-weight: 600; font-size: 15px; text-decoration: none !important; }
.ko-gate-btn:hover { background: #1e40af; }
.ko-gate-btn--ghost { background: #fff; color: #1e3a8a !important; border: 1px solid #1e3a8a; }
.ko-gate-btn--ghost:hover { background: #eff6ff; }
.ko-gate-muted { color: #64748b; font-size: 13px; margin-top: 14px; }
.ko-my-list { list-style: none; margin: 0; padding: 0; }
.ko-my-list li { padding: 12px 0; border-bottom: 1px solid #e2e8f0; }
.ko-my-done { color: #16a34a; font-size: 13px; margin-left: 6px; }
