/* PyViet Clone Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

html,
body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: #333;
    background: #f8f9fa;
    /* overflow: hidden; Removed global hidden to fix Archive scroll */
}

/* Single Lesson App Mode needs fixed height/hidden */
body.single-course_lesson {
    overflow: hidden;
}

/* Layout Grid */
.py-app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR STYLES */
.py-sidebar {
    width: 320px;
    background: #fff;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

/* Brand - Purple Header */
.py-brand {
    height: 50px;
    background: #6f42c1;
    /* Purple */
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.py-brand a {
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.py-brand a:hover {
    color: #fff1f1;
}

/* Progress Box */
.py-progress-box {
    padding: 20px;
    background: #fdfdfd;
    border-bottom: 1px solid #f0f0f0;
}

.py-prog-top {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #6f42c1;
    font-weight: 600;
    margin-bottom: 5px;
}

.py-prog-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.py-prog-fill {
    height: 100%;
    background: #6f42c1;
    border-radius: 4px;
    transition: width 0.3s;
}

.py-prog-note {
    font-size: 11px;
    color: #999;
    text-align: center;
}

/* Menu List */
.py-menu-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.py-lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.py-item {
    position: relative;
    margin-bottom: 2px;
}

.py-item a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.py-item:hover a {
    background: #f8f9fa;
    color: #333;
}

/* Number Circle */
.py-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f1f3f5;
    color: #868e96;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Active State */
.py-item.active a {
    background: #f3f0ff;
    /* Light Purple */
    color: #6f42c1;
    font-weight: 600;
    border-left-color: #6f42c1;
}

.py-item.active .py-num {
    background: #6f42c1;
    color: #fff;
}

.py-arrow {
    margin-left: auto;
    font-size: 10px;
    color: #6f42c1;
    flex-shrink: 0;
}

/* Lesson Title - truncate long titles */
.py-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Lock Icon - consistent size */
.py-lock-icon {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
}

/* Trial Badge */
.py-trial-badge {
    flex-shrink: 0;
}

/* Sidebar Footer Buttons */
.py-sidebar-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.py-btn {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    border: none;
    transition: all 0.2s;
}

.py-btn-coffee {
    background: #ff9f1c;
    /* Orange */
    color: #fff;
}

.py-btn-coffee:hover {
    background: #e68e18;
}

.py-btn-outline {
    background: #fff;
    border: 1px solid #ddd;
    color: #555;
}

.py-btn-outline:hover {
    background: #f8f9fa;
}

.py-btn-ghost {
    background: transparent;
    color: #777;
    font-weight: 400;
}

.py-btn-ghost:hover {
    color: #333;
}

/* MAIN CONTENT */
.py-main {
    flex: 1;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.py-header {
    background: #fff;
    padding: 9px 40px;
    border-bottom: 1px solid #eee;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.py-meta {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.py-lesson-title {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
    color: #333;
}

/* Scrollable Area */
.py-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.py-content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

/* Cards */
.py-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 30px;
    /* transition: box-shadow 0.2s; */
}

/* .py-card:hover { box-shadow: 0 5px 15px rgba(0,0,0,0.05); } */

.py-card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f3f5;
    font-weight: 600;
    color: #495057;
    background: #fcfcfc;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.py-card-header.bg-dark {
    background: #212529;
    color: #fff;
    border-bottom: none;
}

.py-card-body {
    padding: 30px;
    font-size: 16px;
    line-height: 1.7;
    color: #333;
}

/* Content Typography */
.py-card-body h2,
.py-card-body h3 {
    margin-top: 5px;
    color: #222;
}

.py-card-body p {
    margin-bottom: 20px;
}

.py-card-body code {
    background: #f1f3f5;
    color: #e83e8c;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9em;
}

.py-card-body pre {
    background: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
}




/* Quiz Styles */
.py-quiz-card {
    border: 1px solid #dee2e6;
}

.py-opt {
    display: block;
    padding: 12px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.py-opt:hover {
    background: #e9ecef;
}

.py-opt input {
    margin-right: 10px;
}

.py-opt.correct {
    border-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.py-opt.wrong {
    border-color: #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.py-btn-primary {
    background: #6f42c1;
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.py-btn-primary:hover {
    background: #5a32a3;
}

/* Navigation Footer */
.py-nav-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    margin-top: 40px;
    border-top: 1px solid #eee;
}

.py-nav-link {
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.py-nav-link:hover {
    text-decoration: underline;
}

.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: #007bff !important;
}

/* Mobile */
@media (max-width: 900px) {
    .py-app {
        flex-direction: column;
        overflow: auto;
        height: auto;
    }

    .py-sidebar {
        width: 100%;
        height: auto;
        max-height: none;
    }

    .py-menu-scroll {
        max-height: 300px;
    }

    /* Expandable */
    .py-content-scroll {
        overflow: visible;
        padding: 20px;
    }
}


/* FANCY QUIZ STYLES */
.py-quiz-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 40px;
    border: 1px solid #eee;
}

.py-quiz-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #7c3aed;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
}

.py-quiz-icon {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.py-quiz-label {
    flex: 1;
    font-weight: 700;
    color: #5b21b6;
}

.py-quiz-counter {
    background: #ede9fe;
    color: #7c3aed;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

.py-quiz-question {
    font-size: 18px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 25px;
    color: #333;
}

/* Options */
.py-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.py-opt {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    position: relative;
    font-weight: 500;
    color: #555;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.py-opt:hover {
    border-color: #ddd;
    background: #fcfcfc;
}

.hidden-radio {
    display: none;
}

.py-opt-letter {
    width: 28px;
    height: 28px;
    background: #f5f5f5;
    color: #999;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.2s;
}

/* Selected / Correct States */
/* Selected (Pre-check) - PURPLE */
.py-opt.selected {
    border-color: #8c68cd !important;
    /* Bold Purple */
    background: #fbf9ff !important;
    /* Light Purple Bg */
    color: #5a32a3;
    box-shadow: 0 0 0 1px #8c68cd;
    /* Thicker border effect */
}

.py-opt.selected .py-opt-letter {
    background: #8c68cd;
    color: #fff;
}

/* Correct (Post-check) - GREEN */
.py-opt.correct {
    border-color: #2ecc71 !important;
    background: #f0fdf4 !important;
    color: #155724;
    box-shadow: 0 0 0 1px #2ecc71;
}

.py-opt.correct .py-opt-letter {
    background: #2ecc71;
    color: #fff;
}

/* Wrong (Post-check) - RED */
.py-opt.wrong {
    border-color: #e74c3c !important;
    background: #feEdEd !important;
    color: #c0392b;
}

.py-opt.wrong .py-opt-letter {
    background: #e74c3c;
    color: #fff;
}

/* Result Box */
.py-result-box {
    margin-top: 25px;
    padding: 20px;
    border-radius: 8px;
    background: #f0fdf4;
    /* Success Green Bg */
    border: 1px solid #bbf7d0;
    color: #166534;
}

.py-result-box.error {
    background: #feEdEd;
    border-color: #fecaca;
    color: #991b1b;
}

.result-title {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    margin-bottom: 8px;
}

.result-desc {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    margin-left: 34px;
    /* Align with title text (Icon 24px + Gap 10px approx) */
}

.py-btn-next-lesson {
    background: #2ecc71;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none !important;
}

.py-btn-next-lesson:hover {
    background: #27ae60;
    color: #fff;
}

/* Check Button - PURPLE */
#py-check-btn {
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
    background: #8c68cd;
    /* Purple Brand */
    color: #fff;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    width: auto;
    min-width: 150px;
}

#py-check-btn:hover {
    background: #7a5bb5;
    box-shadow: 0 4px 12px rgba(140, 104, 205, 0.3);
}

/* Confetti Animation */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: #f00;
    top: -10px;
    z-index: 9999;
    animation: fall 3s linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(720deg);
    }
}

/* 5. Disabled State */
#py-check-btn.disabled,
.py-btn-primary:disabled {
    background: #e9ecef !important;
    color: #adb5bd !important;
    cursor: not-allowed;
    pointer-events: none;
}

.py-opt.disabled-opt {
    pointer-events: none;
    opacity: 0.8;
}

/* 6. Retry & Skip Buttons */
.py-retry-area {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Result Icons */
.py-res-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    margin-right: 5px;
}

.py-res-icon.success {
    background: #2ecc71;
}

.py-res-icon.error {
    background: #ff7465;
    /* Red Circle */
}

/* Option Icons Transformation */
.py-opt.correct .py-opt-letter {
    font-size: 0;
    /* Hide letter */
    background: #2ecc71;
}

.py-opt.correct .py-opt-letter::after {
    content: '✓';
    font-size: 14px;
    color: #fff;
}

.py-opt.wrong .py-opt-letter {
    font-size: 0;
    background: #e74c3c;
}

.py-opt.wrong .py-opt-letter::after {
    content: '✕';
    font-size: 14px;
    color: #fff;
}

/* Skip Button */
.py-btn-skip {
    background: transparent;
    border: 1px solid #ddd;
    color: #555;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
}

.py-btn-skip:hover {
    background: #f8f9fa;
}

.py-btn-retry {
    background: #8c68cd;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.py-btn-retry:hover {
    background: #7a5bb5;
}

.py-btn-skip {
    background: #f1f3f5;
    color: #495057;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.py-btn-skip:hover {
    background: #e9ecef;
}

/* 2. Completed Checkmark in Sidebar */
.py-item.completed .py-num {
    background: #27ae60 !important;
    color: transparent !important;
    /* Hide number */
    position: relative;
}

.py-item.completed .py-num::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

/* 3. Option Hover Border */
.py-opt:hover {
    border-color: #8c68cd !important;
    /* Purple hover */
    background: #fbf9ff !important;
}

/* 4. Hide Radio Icon Completely */
.hidden-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

/* =========================================
   FIX STUCK PRELOADER (Flatsome & Others)
   Because we unload theme JS, preloader might stay forever.
   Force hide it here.
   ========================================= */
.page-loader,
.preloader,
#preloader,
.loading-page {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    z-index: -9999 !important;
}

body.archive.post-type-archive-course_lesson {
    opacity: 1 !important;
    visibility: visible !important;
    overflow: auto !important;
}

/* Fix List Indentation (More padding) */
.py-card-body ul,
.py-card-body ol {
    margin-left: 20px;
}

.py-card-body li {
    padding-left: 5px;
}

/* --- SUPER BEAUTIFUL COMPLETION MODAL --- */
.py-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.py-modal-overlay.active {
    opacity: 1;
    display: flex;
}

.py-completion-card {
    background: #fff;
    width: 90%;
    max-width: 480px;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(30px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.py-modal-overlay.active .py-completion-card {
    transform: translateY(0) scale(1);
}

.py-trophy-anim {
    font-size: 80px;
    margin-bottom: 20px;
    display: inline-block;
    animation: bouncePop 1s infinite alternate;
}

@keyframes bouncePop {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

.py-comp-title {
    font-size: 24px;
    font-weight: 800;
    color: #333;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #8c68cd 0%, #ff5f56 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.py-comp-desc {
    color: #666;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 30px;
}

.py-btn-home {
    background: #8c68cd;
    color: #fff;
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
    box-shadow: 0 5px 20px rgba(140, 104, 205, 0.4);
    transition: all 0.3s;
}

.py-btn-home:hover {
    box-shadow: 0 8px 25px rgba(140, 104, 205, 0.6);
    transform: translateY(-2px);
    color: #fff;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 30px;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    background: transparent;
    border: none;
}

/* --- MOBILE RESPONSIVE STYLES --- */

/* Defaults hidden on desktop */
.py-mobile-topbar,
.py-sidebar-close,
.py-mobile-overlay {
    display: none;
}

@media (max-width: 991px) {

    /* 0. FORCE NATIVE SCROLL (Fix Stuck Scroll) */
    html,
    body {
        overflow: auto !important;
        height: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .py-app {
        height: auto !important;
        display: block !important;
        overflow: visible !important;
    }

    /* 1. Sidebar becomes Drawer */
    .py-sidebar {
        position: fixed;
        left: -300px;
        /* Hidden */
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 10000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        display: flex;
        /* NEW: Flex Column */
        flex-direction: column;
        height: 100vh;
        /* Sidebar stays full height */
        overflow: hidden;
        /* Prevent body scroll, use inner scroll */
    }

    .py-sidebar.active {
        left: 0;
    }

    /* Ensure Header is Fixed relative to content */
    .py-brand {
        flex-shrink: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-right: 15px;
        /* Space for close btn */
        position: relative;
    }

    /* Progress fixed too */
    .py-progress-box {
        flex-shrink: 0;
    }

    /* Scrollable Menu */
    .py-menu-scroll {
        flex: 1;
        /* Take remaining space */
        overflow-y: auto;
        /* Internal Scroll */
        height: auto !important;
        /* Override fixed height */
    }

    /* Footer fixed at bottom */
    .py-sidebar-footer {
        flex-shrink: 0;
    }

    /* 2. Close Button inside Sidebar */
    .py-sidebar-close {
        display: block;
        /* Position relative to Flex container py-brand */
        position: static;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
        opacity: 0.8;
        margin-left: auto;
        /* Push to right */
    }

    .py-sidebar-close:hover {
        opacity: 1;
    }

    /* 3. Overlay Backdrop */
    .py-mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
        display: none;
        backdrop-filter: blur(2px);
    }

    .py-mobile-overlay.active {
        display: block;
    }

    /* 4. Mobile Top Bar (FIXED) */
    .py-mobile-topbar {
        display: flex;
        align-items: center;
        padding: 12px 15px;
        background: #fff;
        border-bottom: 1px solid #e5e7eb;
        position: fixed;
        /* FIXED */
        top: 0;
        left: 0;
        width: 100%;
        z-index: 50;
        height: 60px;
        /* Explicit height */
        box-sizing: border-box;
    }

    .py-mobile-menu-btn {
        background: transparent;
        border: none;
        padding: 5px;
        margin-right: 12px;
        color: #6c757d;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    .py-mobile-meta {
        display: flex;
        flex-direction: column;
        margin-left: 15px;
    }

    .py-m-meta {
        font-size: 11px;
        color: #adb5bd;
        margin-bottom: 2px;
    }

    .py-m-title {
        font-size: 14px;
        font-weight: 700;
        color: #333;
        line-height: 1.2;
    }

    /* 5. Adjust Main Content (With Padding for Fixed Header) */
    .py-main {
        margin-left: 0;
        padding-top: 60px;
        /* Padding for Topbar */
        width: 100%;
        height: auto !important;
        /* Native Scroll */
        display: block !important;
        overflow: visible !important;
    }

    .desktop-only {
        display: none !important;
    }

    /* 6. Content Scroll Fix */
    .py-content-scroll {
        /* Remove Flex/Scroll locks */
        flex: none !important;
        height: auto !important;
        overflow: visible !important;
        padding: 20px 15px;
        /* Optimized padding */
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll iOS */
    }
}

/* 7. Completed Checkmark Visibility */
.py-item.completed .py-check-icon {
    display: flex !important;
}

.py-item.completed .py-num {
    background: #d1fae5;
    /* Green Light Bg for number */
    color: #10b981;
}

/* AJAX Loading Overlay */
.py-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    transition: opacity 0.3s;
}

.py-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6f42c1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- 8. CONTENT TYPOGRAPHY & EMBEDS (Enhanced) --- */

/* Responsive Images */
.py-card-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin: 10px 0;
}

/* Responsive Videos (YouTube / Iframe) */
.py-card-body iframe,
.py-card-body video,
.py-card-body object,
.py-card-body embed {
    max-width: 100%;
    border-radius: 8px;
}

/* 16:9 Aspect Ratio Wrapper for Embeds */
.wp-block-embed__wrapper,
.video-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    padding-top: 25px;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 20px;
}

.wp-block-embed__wrapper iframe,
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Links */
.py-card-body a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted #6f42c1;
    transition: all 0.2s;
}

.py-card-body a:hover {
    border-bottom-style: solid;
}

/* Blockquotes */
.py-card-body blockquote {
    margin: 20px 0;
    padding: 15px 20px;
    border-left: 4px solid #6f42c1;
    background: #f8f9fa;
    color: #555;
    font-style: italic;
    border-radius: 0 8px 8px 0;
}

/* Tables */
.py-card-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}

.py-card-body th,
.py-card-body td {
    padding: 12px 15px;
    border: 1px solid #e9ecef;
    text-align: left;
}

.py-card-body th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}


.py-card-body tr:nth-child(even) {
    background: #fcfcfc;
}

/* --- 9. ALERT BOXES (Ghi chú quan trọng) --- */
.py-alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 15px;
    line-height: 1.6;
}

/* Warning (Yellow) - Như ảnh gui */
.py-alert-warning {
    background: #fff9e6;
    border: 1px solid #ffeeba;
    color: #856404;
}

.py-alert-warning::before {
    content: '⚠️';
    /* Hoặc dùng icon SVG nếu muốn */
    font-size: 18px;
}

/* Info (Blue) */
.py-alert-info {
    background: #eef9fd;
    border: 1px solid #b8daff;
    color: #0c5460;
}

.py-alert-info::before {
    content: 'ℹ️';
}

/* Success (Green) */
.py-alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.py-alert-success::before {
    content: '✅';
}

/* Topic Closed State */
.py-topic-closed .py-progress-box {
    border: 2px solid #10b981;
    /* Green Border */
    background: #fbfdfc;
    border-radius: 12px;
    /* Rounded corners */
    margin: 15px;
    /* Card-like spacing */
    padding: 25px;
    /* Spacious padding */
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.1);
    /* Subtle green shadow */
}

/* Revert note text color/margin */
.py-topic-closed .py-progress-box .py-prog-note {
    color: #666;
    margin-top: 10px;
}

/* ============================
   DONATION MODAL STYLES
   ============================ */
.py-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 99999;
    display: none;
    /* Changed from flex to none */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.py-modal-overlay.active {
    display: flex;
}

.py-modal-content {
    background: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.py-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.py-modal-close:hover {
    color: #333;
}

/* Header */
.py-donate-icon {
    width: 60px;
    height: 60px;
    background: #ffce45;
    /* Yellow */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 15px;
    color: #fff;
    box-shadow: 0 5px 15px rgba(255, 206, 69, 0.3);
}

.py-donate-header h3 {
    margin: 0 0 5px;
    font-size: 22px;
    color: #333;
    font-weight: 700;
}

.py-donate-header p {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

/* QR Code Box */
.py-donate-qr {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    background: #f9f9f9;
    margin-bottom: 20px;
}

.py-donate-qr img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* Footer Box */
.py-donate-footer {
    background: #f0fdf4;
    /* Light Green */
    color: #166534;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

button {
    margin-bottom: 0em !important;
    margin-right: 0em !important;
    padding: 0em !important;
}

/* =========================================
   FIX STUCK PRELOADER (Flatsome & Others) - AGGRESSIVE FIX
   ========================================= */
html,
body {
    opacity: 1 !important;
    visibility: visible !important;
}

.page-loader,
.preloader,
#preloader,
.loading-page,
.blockUI {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    z-index: -9999 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Ensure archive body specific is also covered */
body.post-type-archive-course_lesson,
body.single-course_lesson {
    opacity: 1 !important;
    visibility: visible !important;
    overflow: auto !important;
}