/* ==========================================================================
   lms.css — Freyas Studio LMS polish
   Scoped enhancements for the public course catalog cards, the member course
   cards, and the reusable trailer / video facade. Kept out of the global
   style.css to avoid collisions with the admin-layout work.
   Brand tokens: --color-primary #1a616e, --color-accent #e8c4a0, cream #f8f4ef.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Member course card (partials/course_card.html) — subtle hover lift so the
   logged-in "Meine Kurse" / "Alle Kurse" grid matches the catalog polish.
   -------------------------------------------------------------------------- */
.course-card {
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px -16px rgba(26, 97, 110, 0.32);
    border-color: var(--color-accent, #e8c4a0);
}

.course-card .card-image {
    transition: transform 0.3s ease;
}

.course-card:hover .card-image {
    transform: scale(1.04);
}

.course-card .course-card-image-link {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Public catalog grid — slightly larger, breathing room
   -------------------------------------------------------------------------- */
.pub-course-grid {
    gap: var(--space-7, 1.75rem);
}

/* --------------------------------------------------------------------------
   Public catalog card — richer hover motion + framing
   -------------------------------------------------------------------------- */
.pub-course-card {
    border-radius: var(--radius-xl, 16px);
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.pub-course-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px -16px rgba(26, 97, 110, 0.35);
    border-color: var(--color-accent, #e8c4a0);
}

/* Hero image — cleaner aspect ratio + subtle zoom + gradient scrim */
.pub-course-card-img-wrap {
    aspect-ratio: 16 / 10;
}

.pub-course-card-img-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(26, 97, 110, 0.28) 0%,
        rgba(26, 97, 110, 0.04) 38%,
        transparent 60%
    );
    opacity: 0.85;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.pub-course-card:hover .pub-course-card-img-wrap::after {
    opacity: 1;
}

.pub-course-card:hover .pub-course-card-img-wrap img {
    transform: scale(1.06);
}

/* Count badges floating on the image (module / lesson) */
.pub-course-card-imgbadges {
    position: absolute;
    left: var(--space-3, 12px);
    bottom: var(--space-3, 12px);
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pub-course-imgbadge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full, 999px);
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-primary-dark, #14525d);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.pub-course-imgbadge svg {
    flex-shrink: 0;
}

/* Card title scales up a touch for hierarchy */
.pub-course-card-title {
    font-size: 1.18rem;
}

/* Footer price + CTA — make the CTA the clear primary action */
.pub-course-card-footer {
    border-radius: 0 0 var(--radius-xl, 16px) var(--radius-xl, 16px);
}

.pub-course-price {
    line-height: 1.1;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.pub-course-cta-btn {
    box-shadow: 0 4px 12px -4px rgba(26, 97, 110, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pub-course-card:hover .pub-course-cta-btn {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(26, 97, 110, 0.55);
}

/* USP / meta line under the title */
.pub-course-card-usp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--color-primary, #1a616e);
    font-weight: 600;
}

.pub-course-card-usp svg {
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   "Vorschau abspielen" trailer chip on a catalog card image
   -------------------------------------------------------------------------- */
.pub-course-trailer-chip {
    position: absolute;
    top: var(--space-3, 12px);
    right: var(--space-3, 12px);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px 5px 9px;
    border: 0;
    cursor: pointer;
    border-radius: var(--radius-full, 999px);
    background: rgba(20, 82, 93, 0.88);
    color: #fff;
    font-family: var(--font-body, 'Open Sans', sans-serif);
    font-size: 0.72rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background 0.2s ease, transform 0.15s ease;
}

.pub-course-trailer-chip:hover {
    background: var(--color-accent, #e8c4a0);
    color: var(--color-primary-dark, #14525d);
    transform: scale(1.04);
}

.pub-course-trailer-chip svg {
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Trailer modal (catalog) — lightweight Alpine-driven overlay
   -------------------------------------------------------------------------- */
.lms-trailer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5, 20px);
    background: rgba(15, 40, 45, 0.78);
    backdrop-filter: blur(3px);
}

.lms-trailer-dialog {
    width: 100%;
    max-width: 880px;
    background: #000;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
    position: relative;
}

.lms-trailer-dialog .yt-embed-wrap,
.lms-trailer-dialog video,
.lms-trailer-dialog iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
}

.lms-trailer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.lms-trailer-close:hover {
    background: rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------------------------
   Landing-page hero trailer — replaces the static hero image when present
   -------------------------------------------------------------------------- */
.pub-hero-trailer {
    flex-shrink: 0;
    width: 420px;
    max-width: 100%;
}

.pub-hero-trailer .yt-embed-wrap,
.pub-hero-trailer video,
.pub-hero-trailer iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.55);
    display: block;
}

@media (max-width: 768px) {
    .pub-hero-trailer {
        width: 100%;
    }
}

/* ------------------------------------------------------------------ */
/* 360° Video viewer (threesixty lessons)                              */
/* ------------------------------------------------------------------ */

.threesixty {
    width: 100%;
}

.threesixty-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0b0b0d;
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.55);
}

.threesixty-host {
    position: absolute;
    inset: 0;
}

.threesixty-host canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: grab;
}

.threesixty-host canvas:active {
    cursor: grabbing;
}

/* Tap-to-start overlay */
.threesixty-start {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0b0d;
    color: #fff;
}

.threesixty-start-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

.threesixty-start-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 16px;
}

.threesixty-start-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary, #1a616e);
    color: #fff;
    box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.6);
}

.threesixty-start-label {
    font-weight: 700;
    font-size: 1.05rem;
}

.threesixty-start-sub {
    font-size: 0.85rem;
    opacity: 0.85;
}

/* Controls bar */
.threesixty-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
    z-index: 3;
}

.threesixty-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: background 0.15s ease;
}

.threesixty-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.threesixty-btn.is-active {
    background: var(--accent, #c39641);
    color: #1a1a1a;
}

.threesixty-btn-next {
    margin-left: auto;
}

.threesixty-scene-label {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    margin: 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

/* When there's no "next" button, push the fullscreen button to the right. */
.threesixty-controls > .threesixty-btn:last-child {
    margin-left: auto;
}
.threesixty-controls > .threesixty-btn-next ~ .threesixty-btn:last-child {
    margin-left: 0;
}

.threesixty-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.threesixty-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    animation: threesixty-spin 0.8s linear infinite;
}

@keyframes threesixty-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scene strip */
.threesixty-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 2px 4px;
    -webkit-overflow-scrolling: touch;
}

.threesixty-thumb {
    flex: 0 0 auto;
    width: 116px;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: #f2f2f2;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.threesixty-thumb img,
.threesixty-thumb-empty {
    display: block;
    width: 100%;
    height: 66px;
    object-fit: cover;
}

.threesixty-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary, #1a616e);
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
}

.threesixty-thumb-label {
    display: block;
    padding: 6px 8px;
    font-size: 0.78rem;
    color: var(--color-text, #222);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.threesixty-thumb.is-active {
    border-color: var(--accent, #c39641);
}

/* Fullscreen — native and CSS pseudo-fullscreen (iPhone fallback). 100dvh
   handles the mobile URL bar; both states make the stage fill the screen. */
.threesixty.pseudo-fs {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    flex-direction: column;
}

.threesixty.pseudo-fs .threesixty-stage,
.threesixty.native-fs .threesixty-stage {
    aspect-ratio: auto;
    flex: 1 1 auto;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
}

.threesixty.pseudo-fs .threesixty-strip {
    display: none;
}

body.threesixty-noscroll {
    overflow: hidden;
}

/* Scene manager (admin lesson editor) */
.scene-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.scene-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.scene-handle {
    cursor: grab;
    color: #9ca3af;
    display: inline-flex;
}

.scene-thumb {
    width: 64px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    background: #f2f2f2;
    flex: 0 0 auto;
}

.scene-thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary, #1a616e);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.scene-row-title {
    font-weight: 600;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scene-row-link {
    font-size: 0.8rem;
    color: var(--primary, #1a616e);
}

.scene-add-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.form-label-sm {
    font-size: 0.85rem;
}

/* ============================================================
   Phase 6.1/6.2 — Lektions-Bewertung (Skalen + Favorit) +
   "Meine markierten Lektionen"-Ansicht
   ============================================================ */

.lesson-rating {
    margin: var(--space-8, 2rem) 0;
    padding-top: var(--space-6, 1.5rem);
    border-top: 1px solid var(--color-border-light, #e5e0d8);
    display: flex;
    flex-direction: column;
    gap: var(--space-5, 1.25rem);
}

.lesson-rating-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
    margin-bottom: 8px;
}

.lesson-rating-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text, #2b2b2b);
}

.lesson-rating-hint {
    font-size: 0.8rem;
    color: var(--color-text-light, #8a8378);
}

.rating-scale {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rating-scale form { margin: 0; }

.rating-num {
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    border: 1px solid var(--color-border, #d8d2c8);
    border-radius: 8px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #2b2b2b);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.rating-num:hover {
    border-color: var(--primary, #1a616e);
    color: var(--primary, #1a616e);
}

.rating-num-active {
    background: var(--primary, #1a616e);
    border-color: var(--primary, #1a616e);
    color: #fff;
}

.lesson-rating-fav-row form { margin: 0; }

.rating-fav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--color-border, #d8d2c8);
    border-radius: 999px;
    background: var(--color-surface, #fff);
    color: var(--color-text, #2b2b2b);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.rating-fav:hover { border-color: var(--accent, #c39641); }

.rating-fav-active {
    border-color: var(--accent, #c39641);
    color: var(--accent, #c39641);
    background: color-mix(in srgb, var(--accent, #c39641) 12%, transparent);
}

/* ---- Meine markierten Lektionen ---- */
.marked-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: var(--space-4, 1rem) 0 var(--space-6, 1.5rem);
}

.marked-tab { text-decoration: none; }

.marked-group { margin-bottom: var(--space-6, 1.5rem); }

.marked-group-title {
    font-size: 1.1rem;
    margin: 0 0 var(--space-3, 0.75rem);
    color: var(--primary, #1a616e);
}

.marked-lesson { margin-bottom: 6px; }

.marked-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 10px 0;
    padding-left: 4px;
}

.marked-badge,
.marked-badge-fav {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-bg-muted, #f2f2f2);
    color: var(--color-text-light, #6b6357);
}

.marked-badge-fav {
    background: color-mix(in srgb, var(--accent, #c39641) 16%, transparent);
    color: var(--accent, #c39641);
}

@media (max-width: 600px) {
    .rating-scale { gap: 4px; }
    .rating-num { min-width: 30px; height: 30px; font-size: 0.82rem; }
}
