/*
 * Lesson view (designer template): defaults for the Ozobot lesson widgets, plus the layout helpers
 * the starter template uses. Everything here is a default: widget style controls and the
 * designer's own Elementor styling win. Original look: includes/lesson-display.php inline CSS.
 */

/* Page chrome that only the lesson page needs */
body.single-ozo_lesson .page-header .entry-title { display: none; }
/* Logged-out visitors see the gated page; the guard container must span the full width like the page. */
body.single-ozo_lesson .ozo-guarded-container {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

[hidden].ozo-lv-youtube, [hidden].ozo-lv-video { display: none !important; }

/* ---- Layout helpers (Advanced > CSS Classes) ---- */
/* ozo-contents-mobile: on tablet/phone the container disappears and its children join the parent's
   flow, so the children of two columns can be interleaved with ozo-m-order-N (smaller first). */
@media (max-width: 1024px) {
    .e-con.ozo-contents-mobile { display: contents; }
    .ozo-m-order-1 { order: 1; } .ozo-m-order-2 { order: 2; } .ozo-m-order-3 { order: 3; }
    .ozo-m-order-4 { order: 4; } .ozo-m-order-5 { order: 5; } .ozo-m-order-6 { order: 6; }
    .ozo-m-order-7 { order: 7; } .ozo-m-order-8 { order: 8; } .ozo-m-order-9 { order: 9; }
    .ozo-m-order-10 { order: 10; } .ozo-m-order-11 { order: 11; } .ozo-m-order-12 { order: 12; }
    .ozo-m-order-13 { order: 13; } .ozo-m-order-14 { order: 14; } .ozo-m-order-15 { order: 15; }
    .ozo-m-order-16 { order: 16; }
}
/* ozo-push-right: sends one item to the far end of a row (e.g. the language badge). */
.ozo-push-right { margin-left: auto; }

/* ---- Lesson video ---- */
.ozo-lesson-video__frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    position: relative;
    overflow: hidden;
}
.ozo-lesson-video__frame iframe,
.ozo-lesson-video__frame video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    border: 0;
    object-fit: contain;
}
.ozo-lesson-cover img { display: block; width: 100%; height: auto; box-shadow: rgba(0, 0, 0, .2) 0 3px 6px; }
/* No video: the cover sits beside the title block instead of spanning the column (desktop only; on tablet and
   phone the blocks stack as usual). A lesson has a cover here only when it has no video, so the cover is the cue. */
@media (min-width: 1025px) {
    .e-con.ozo-media-row:has(.ozo-lesson-cover) { flex-direction: row; align-items: flex-start; gap: 30px; }
    .e-con.ozo-media-row:has(.ozo-lesson-cover) > .elementor-widget-ozo-lesson-video { flex: 0 0 var(--ozo-cover-width, 30%); width: var(--ozo-cover-width, 30%); max-width: var(--ozo-cover-width, 30%); }
    .e-con.ozo-media-row:has(.ozo-lesson-cover) > .ozo-media-text { flex: 1 1 0; min-width: 0; width: auto; }
}

/* ---- Video chapters (an Icon List; look comes from its controls) ---- */
.ozo-chapter-item { cursor: pointer; }
.ozo-chapter-number { display: inline-block; min-width: 20px; text-align: center; }
.ozo-chapter-thumb { margin: 0 12px; line-height: 0; }
.ozo-chapter-thumb img { width: 115px; height: 64px; object-fit: cover; display: block; }

/* ---- Resources, steps, lists ---- */
.ozo-lesson-list { margin: 0 0 1em; padding-left: 1.25em; }
.ozo-materials-group-title { margin: 0.75em 0 0.25em; }
.ozo-lesson-steps__item { margin: 0 0 1.25em; }
.ozo-lesson-steps__goal { margin: 0 0 0.25em; font-weight: 600; }
.ozo-lesson-steps__attachments { margin: 0.5em 0 0; padding-left: 1.25em; }

/* ---- Related lessons (built-in item markup; a designer template replaces it) ---- */
.ozo-related-lessons { display: flex; flex-direction: column; gap: 24px; }
.ozo-related-item { display: flex; gap: 16px; align-items: flex-start; }
.ozo-related-item a { color: inherit; text-decoration: none; }
.ozo-related-item--designed { display: block; }
.ozo-related-item--designed > a { display: block; }
.ozo-related-empty { color: #777; }
.ozo-related-item__cover { position: relative; flex: 0 0 120px; width: 120px; height: 120px; display: block; }
.ozo-related-item__cover img, .ozo-related-item__nocover { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; background: #e5e5e5; }
.ozo-related-item__grades { position: absolute; bottom: 0; right: 0; background: #8a4baf; color: #fff; font-size: 13px; font-weight: 600; padding: 4px 8px; border-bottom-right-radius: 12px; border-top-left-radius: 8px; }
.ozo-related-item__info { display: flex; flex-direction: column; justify-content: center; padding-top: 4px; }
.ozo-related-item__title { font-size: 16px; font-weight: 500; margin: 0 0 6px; line-height: 1.3; color: #000; }
.ozo-related-item__meta { font-size: 13px; color: #777; margin: 0; }

/* ---- PDF viewer modal ---- */
.ozo-pdf-modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); z-index: 9999; }
.ozo-pdf-modal__inner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 85%; height: 85%; background: #525659; border-radius: 8px; overflow: hidden; }
.ozo-pdf-toolbar { position: absolute; top: 0; left: 0; right: 0; height: 55px; background: #323639; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); z-index: 10; }
.ozo-pdf-toolbar__group { display: flex; gap: 10px; align-items: center; }
.ozo-pdf-btn { background: #555; border: 1px solid #777; color: #fff; cursor: pointer; padding: 6px 12px; border-radius: 4px; font-weight: bold; }
.ozo-pdf-btn:hover { background: #666; }
#ozo-pdf-download { color: #fff; text-decoration: none; font-size: 14px; font-weight: bold; background: rgb(2, 121, 99); padding: 6px 14px; border-radius: 20px; }
#ozo-pdf-download:hover { background: rgb(0, 100, 80); }
.ozo-pdf-close { font-size: 32px; color: #fff; cursor: pointer; line-height: 1; }
#ozo-pdf-container { position: absolute; top: 55px; bottom: 0; left: 0; right: 0; overflow: auto; }
#ozo-pdf-pages { margin: 20px auto; }
#ozo-pdf-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #333; font-weight: bold; background: #fff; padding: 10px 20px; border-radius: 20px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); }

/* ---- Starter lesson page layout ---- */
/* Full-width page with proportional side margins (like the original page); the main column absorbs extra width. */
.e-con.ozo-lesson-page { padding-left: clamp(16px, 4.7vw, 120px); padding-right: clamp(16px, 4.7vw, 120px); box-sizing: border-box; }
/* Column widths and stacking are native Elementor settings on the starter's containers (width, flex size,
   and the tablet/mobile direction), so designers change them in the editor. Nothing is forced here. */
@media (max-width: 1024px) {
    .e-con.ozo-lesson-layout > .ozo-m-order-1, .e-con.ozo-lesson-layout > .ozo-m-order-2 { margin: 0; }
}

/* Mobile: air between the blocks of the starter page (the columns dissolve, so no parent gap applies). */
@media (max-width: 1024px) {
    .ozo-lesson-layout [class*="ozo-m-order-"] { margin-bottom: 20px; }
    .ozo-lesson-layout .ozo-m-order-1, .ozo-lesson-layout .ozo-m-order-2 { margin-bottom: 0; }
}

/* A designer-built related lesson item (template rendered outside the lesson tile) */
.ozo-related-item--designed .e-con:has(> .ozo-grow, > .ozo-fixed) { flex-wrap: nowrap; }
.ozo-related-item--designed .e-con > .ozo-grow { flex: 1 1 auto; min-width: 0; --width: auto; width: auto; }
.ozo-related-item--designed .e-con > .ozo-fixed { flex: 0 0 auto; --width: auto; width: auto; }
.ozo-related-item--designed .ozo-clamp-2 > .elementor-widget-container {
    display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; -webkit-line-clamp: 2;
}

/* Sizing helpers for rows in the starter page (Elementor rows size every child to 100% and wrap by default):
   ozo-auto = natural width, ozo-grow = takes the spare room. */
.ozo-lesson-page .ozo-auto { flex: 0 0 auto; --width: auto; width: auto; max-width: 100%; }
.ozo-lesson-page .ozo-grow { flex: 1 1 0; min-width: 0; --width: auto; width: auto; }
