/* Courses catalogue — poster on top, ALL 4 buttons always visible, list scrolls only */
body.fi-courses-catalog-page {
    overflow: hidden !important;
    height: 100dvh;
}

body.fi-courses-catalog-page .fi-shell {
    display: flex;
    flex-direction: column;
    width: min(1240px, calc(100% - 3rem));
    height: 100dvh;
    margin: 0 auto;
    overflow: hidden;
}

body.fi-courses-catalog-page .fi-main {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
}

body.fi-courses-catalog-page .fi-site-footer {
    display: none !important;
}

/* Keep sticky promo ribbons from covering the 4 buttons */
body.fi-courses-catalog-page .fi-banner-zone--ribbon,
body.fi-courses-catalog-page .fi-ribbon-rail {
    display: none !important;
}

.fi-courses-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    overflow: hidden;
    padding-bottom: 0.5rem;
}

.fi-courses-page .fi-courses-hero {
    flex-shrink: 0;
    margin-bottom: 0;
    padding: 0.55rem 1rem;
}

.fi-courses-page .fi-courses-hero .fi-eyebrow {
    margin-bottom: 0.15rem;
}

.fi-courses-page .fi-courses-hero .fi-heading-xl {
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    margin: 0 0 0.1rem;
}

.fi-courses-page .fi-courses-hero .fi-lead {
    margin: 0;
    font-size: 0.8rem;
}

.fi-courses-split {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    overflow: hidden;
}

.fi-courses-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(220px, 30%) minmax(0, 1fr);
    overflow: hidden;
}

.fi-courses-list-panel {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--fi-border, #e5e2db);
    background: #f9f8f5;
}

.fi-courses-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem;
    scrollbar-width: thin;
}

.fi-courses-list-item {
    appearance: none;
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: inherit;
    padding: 0.85rem 0.95rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
}

.fi-courses-list-item:hover,
.fi-courses-list-item.is-active {
    background: rgba(249, 168, 37, 0.08);
    border-color: rgba(249, 168, 37, 0.35);
}

.fi-courses-list-item__title {
    display: block;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.fi-courses-list-item__meta {
    display: block;
    font-size: 0.85rem;
    opacity: 0.75;
}

.fi-courses-list-empty {
    padding: 1rem;
    opacity: 0.8;
}

/* Kill legacy "Select a course..." block */
html body .fi-courses-detail-empty,
html body [data-course-empty] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

html body .fi-courses-detail-empty *,
html body [data-course-empty] * {
    display: none !important;
}

html body .fi-courses-detail-meta {
    display: none !important;
}

/* Right panel */
html body .fi-courses-detail-panel {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    background: #ffffff;
}

html body .fi-courses-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem 0;
    border-bottom: 1px solid var(--fi-border, #e5e2db);
    background: #f7f6f3;
}

html body .fi-courses-split > .fi-courses-tabs {
    flex-shrink: 0;
    padding: 0.5rem 1rem 0;
    border-bottom: 1px solid var(--fi-border, #e5e2db);
}

.fi-courses-tab {
    appearance: none;
    border: 1px solid var(--fi-border, #e5e2db);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    background: #ffffff;
    color: var(--fi-text, #1a1a1a);
    font: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
}

.fi-courses-tab.is-active {
    background: rgba(249, 168, 37, 0.14);
    border-color: rgba(249, 168, 37, 0.5);
    color: #b45309;
}

/*
 * Detail body: poster flexes, actions row is ALWAYS reserved.
 * Bottom 2 buttons were clipped because poster ate the full height.
 */
html body .fi-courses-detail-body,
html body [data-course-body],
html body [data-course-body][hidden] {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    visibility: visible !important;
}

html body .fi-courses-poster-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100% - 9.5rem);
    overflow: hidden;
    width: 100%;
    margin: 0;
    background: #f3f1ec;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

html body .fi-courses-poster {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: top center;
    background: #f3f1ec;
}

html body .fi-courses-poster[hidden] {
    display: none !important;
}

html body .fi-courses-poster-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    background:
        linear-gradient(180deg, rgba(249, 168, 37, 0.08) 0%, transparent 42%),
        #f3f1ec;
}

html body .fi-courses-poster-placeholder[hidden] {
    display: none !important;
}

/* Reserved footer for Manual / Materials / Recording / Register — lifted above bottom clip */
html body .fi-courses-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: auto auto !important;
    gap: 0.45rem !important;
    padding: 0.55rem 0.7rem 0.65rem !important;
    margin: 0 0.65rem 2.75rem !important;
    border: 1px solid var(--fi-border, #e5e2db);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(26, 26, 26, 0.06);
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    min-height: 6.5rem !important;
    max-height: none !important;
    overflow: visible !important;
    z-index: 5;
    position: relative;
}

html body .fi-courses-action,
html body .fi-courses-actions .fi-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    height: auto;
    padding: 0.45rem 0.5rem;
    text-align: center;
    line-height: 1.2;
    font-size: clamp(0.74rem, 1vw, 0.84rem);
    font-weight: 700;
    border-radius: 12px;
    white-space: normal;
}

html body .fi-courses-actions .fi-btn.is-disabled {
    opacity: 0.38;
    pointer-events: none;
    filter: grayscale(0.35);
}

/* Wide screens: one row of all 4 so nothing can clip */
@media (min-width: 1100px) {
    html body .fi-courses-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        grid-template-rows: auto !important;
        min-height: 3.2rem !important;
        margin: 0 0.75rem 3rem !important;
        padding: 0.6rem 0.75rem !important;
    }

    html body .fi-courses-poster-wrap {
        max-height: calc(100% - 7.5rem);
    }
}

@media (max-width: 900px) {
    body.fi-courses-catalog-page .fi-shell {
        width: calc(100% - 1.25rem);
    }

    .fi-courses-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 32%) minmax(0, 1fr);
    }

    .fi-courses-list-panel {
        border-right: none;
        border-bottom: 1px solid var(--fi-border, #e5e2db);
    }

    html body .fi-courses-actions {
        min-height: 6.2rem !important;
    }
}

@media (min-width: 901px) and (max-height: 760px) {
    .fi-courses-page .fi-courses-hero {
        padding: 0.4rem 0.85rem;
    }

    .fi-courses-page .fi-courses-hero .fi-heading-xl {
        font-size: 1.05rem;
    }

    .fi-courses-page .fi-courses-hero .fi-lead {
        display: none;
    }

    html body .fi-courses-action,
    html body .fi-courses-actions .fi-btn {
        min-height: 2.15rem;
        font-size: 0.72rem;
    }

    html body .fi-courses-actions {
        min-height: 5.8rem !important;
        padding: 0.4rem 0.55rem !important;
        margin: 0 0.55rem 2.5rem !important;
        gap: 0.35rem !important;
    }

    html body .fi-courses-poster-wrap {
        max-height: calc(100% - 8.5rem);
    }
}
