/*
    v2 post listing (WB_POST_LISTING template "v2", handle wb-post-listing-v2): My Saved Posts.

    Self-contained: the page does not load wb-post-listing-v1.css. The container, control
    sizing, grid columns and pagination rules are copied from there so both listings line up.

    .wb-post-listing-post-card-v2   the card (wb_render_post_listing_card_v2())
    .wb-saved-posts-*               the saved-posts page: heading chip, filter row, pills, empty states
    --wb-primary / --wb-link / --wb-accent   set inline on #wb-saved-posts from the theme mods
                                    (primary_button_color, link_color, header_primary_button_color)
*/

/* ---------------------------------------------------------------------
 * Container and heading
 * ------------------------------------------------------------------ */

.wb-post-listing-container {
    overflow: hidden;
    padding-left: 2rem !important;
}

#wb-post-listing-container-wrapper {
    padding-right: .8rem !important;
}

.wb-post-listing-container h1,
.wb-post-listing-container h2 {
    color: #000000;
    font-size: 24px;
    margin-bottom: 1rem;
}

.wb-post-listing-breadcrumb-section {
    padding-left: 2rem;
}

.wb-saved-posts-wrapper h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.wb-saved-posts-count {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background-color: #F1F3F5;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* ---------------------------------------------------------------------
 * Controls: search, channel, Apply / Clear, status pills, sort
 * ------------------------------------------------------------------ */

#wb-post-listing-filters-and-sorters-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.wb-saved-posts-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.wb-saved-posts-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.wb-saved-posts-field--search {
    flex: 1 1 320px;
}

.wb-saved-posts-field--channel,
.wb-saved-posts-field--lms-channel {
    flex: 0 1 260px;
}

.wb-saved-posts-field--actions {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
}

.wb-saved-posts-field-label {
    margin: 0;
    color: #6C757D;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

#wb-post-listing-search-container button,
#wb-post-listing-search-container .wb-component,
#wb-post-listing-filters-and-sorters-container button,
#wb-post-listing-filters-and-sorters-container .wb-component {
    border-radius: 8px;
    height: 40px;
}

#wb-post-listing-filters-and-sorters-container .wb-component .dropdown-btn {
    height: 40px;
}

#wb-post-listing-search-container .wb-component.input-group.prepend {
    width: 100%;
}

#wb-post-listing-search-container .wb-component.input-group.prepend .input-group-prepend {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

#wb-post-listing-search-container .wb-component.input-group.prepend > .form-control {
    border-radius: 0 8px 8px 0;
    max-width: none;
}

.wb-component .dropdown-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wb-component .dropdown-btn > .selected-count {
    margin-left: 6px;
    padding: 0 6px;
}

.wb-saved-posts-channel-dropdown .dropdown-btn {
    width: 100%;
    min-width: 220px;
}

/* Nothing saved yet: the row stays, greyed out */
.wb-saved-posts-filter-row.is-disabled .wb-saved-posts-field-label {
    color: #ADB5BD;
}

#wb-post-listing-search-container .form-control:disabled,
.wb-saved-posts-filter-row .dropdown-btn:disabled,
.wb-saved-posts-filter-row .btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.wb-saved-posts-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
}

.wb-saved-posts-status {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.wb-saved-posts-pill {
    margin: 0;
    cursor: pointer;
}

.wb-saved-posts-pill > span {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border: 1px solid #CED4DA;
    border-radius: 999px;
    background-color: #FFFFFF;
    color: #212529;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.wb-saved-posts-pill > span:hover {
    border-color: #ADB5BD;
    background-color: #F8F9FA;
}

.wb-saved-posts-pill > input:checked + span {
    border-color: #212529;
    background-color: #212529;
    color: #FFFFFF;
}

.wb-saved-posts-pill > input:focus-visible + span {
    outline: 3px solid #000;
    outline: 3px auto -webkit-focus-ring-color;
    outline-offset: 2px;
}

.wb-saved-posts-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.wb-saved-posts-sort-label {
    color: #6C757D;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.wb-component.dropdown-container.wb-post-listing-sort-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.wb-post-listing-sort-container .dropdown-btn {
    width: 180px;
}

/* ---------------------------------------------------------------------
 * Grid
 * ------------------------------------------------------------------ */

.wb-post-listing-list {
    gap: 20px;
}

.wb-post-listing-list-v2 {
    margin: 0 0 1.5rem;
    list-style: none;
}

.wb-post-listing-list-v2 > li {
    display: flex;
}

/* ---------------------------------------------------------------------
 * Card
 * ------------------------------------------------------------------ */

.wb-post-listing-post-article-v2 {
    position: relative;
    width: 100%;
}

.wb-post-listing-post-card-v2 {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.wb-post-card-v2-thumb {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background-color: #E9ECEF;
    aspect-ratio: 16 / 9;
}

@supports not (aspect-ratio: 16 / 9) {
    .wb-post-card-v2-thumb {
        height: 0;
        padding-bottom: 56.25%;
    }

    .wb-post-card-v2-thumb > a,
    .wb-post-card-v2-thumb-placeholder {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }
}

.wb-post-card-v2-thumb > a {
    display: block;
    width: 100%;
    height: 100%;
}

.wb-post-card-v2-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wb-post-card-v2-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #ADB5BD;
}

.wb-post-card-v2-badges {
    position: absolute;
    top: 8px;
    right: 48px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    pointer-events: none;
}

.wb-post-card-v2-badge {
    display: inline-block;
    padding: 5px 8px 4px;
    border-radius: 8px;
    background-color: #4B5660;
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.wb-post-card-v2-badge--paid {
    min-width: 26px;
    background-color: #1E7B34;
    text-align: center;
}

.wb-post-card-v2-badge--unavailable {
    background-color: #6C757D;
}

/* Bookmark: a small glyph on a dark circle */
.wb-post-card-v2-save-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, .65);
    color: #FFFFFF;
    cursor: pointer;
    transition: background-color .15s ease;
}

.wb-post-card-v2-save-btn:hover {
    background-color: rgba(0, 0, 0, .85);
}

/* The thumbnail clips overflow, so the ring sits inside the button */
.wb-post-card-v2-save-btn:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: -4px;
    background-color: rgba(0, 0, 0, .85);
}

.wb-post-card-v2-save-btn svg {
    width: 10px;
    height: 14px;
    fill: none;
}

.wb-post-card-v2-save-btn[data-post-saved="true"] svg {
    fill: currentColor;
}

.wb-post-card-v2-save-btn[data-saving="true"] {
    opacity: .6;
    cursor: progress;
}

.wb-post-card-v2-bottom {
    position: absolute;
    right: 8px;
    bottom: 8px;
    pointer-events: none;
}

.wb-post-card-v2-duration,
.wb-post-card-v2-status-pill,
.wb-post-card-v2-completed-badge {
    display: inline-block;
    padding: 5px 8px 4px;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, .6);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.wb-post-card-v2-status-pill--live {
    background-color: #E81B00;
}

/* Replaces the duration once the member has finished the post */
.wb-post-card-v2-completed-badge {
    background-color: #1E7B34;
}

/* Progress bar along the foot of the thumbnail; the bottom-right badge sits 8px up, clear of it */
.wb-post-card-v2-progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 4px;
    background-color: rgba(255, 255, 255, .45);
    pointer-events: none;
}

.wb-post-card-v2-progress-bar {
    width: 0;
    height: 100%;
    background-color: #E0533F;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}

.wb-post-card-v2-progress.completed .wb-post-card-v2-progress-bar {
    background-color: #1E7B34;
}

/* Progress text under the title: "00:12:35 of 00:45:10", "28% read", "Completed Sep 28, 2026" + Updated */
.wb-post-card-v2-meta--progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.wb-post-card-v2-progress-updated {
    display: inline-block;
    padding: 3px 8px 2px;
    border-radius: 8px;
    background-color: #FFF3CD;
    color: #7A4F01;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.wb-post-card-v2-body {
    padding: 10px 2px 0;
}

.wb-post-card-v2-date {
    margin-bottom: 4px;
    color: #6C757D;
    font-size: 13px;
    line-height: 1.3;
}

.wb-post-card-v2-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.wb-post-card-v2-title a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--wb-link, #065F5D);
    text-overflow: ellipsis;
}

.wb-post-card-v2-title a:hover,
.wb-post-card-v2-title a:focus {
    text-decoration: underline;
}

.wb-post-card-v2-title--unavailable {
    color: #495057;
}

.wb-post-card-v2-meta {
    margin: 6px 0 0;
    color: #6C757D;
    font-size: 13px;
    line-height: 1.4;
}

.wb-post-card-v2-meta:empty {
    display: none;
}

.wb-post-card-v2-remove-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--wb-link, #065F5D);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.wb-post-listing-post-card-v2.is-unavailable .wb-post-card-v2-save-btn {
    background-color: rgba(0, 0, 0, .45);
}

/* ---------------------------------------------------------------------
 * Removal toast (wb_show_toast(), reshaped by dismiss_in_place_of_icon() in the script):
 * the helper's cross icon is gone and the real dismiss button sits in its place on the
 * left, in the icon's grey circle. Scoped to .wb-post-listing-v2-toast, so the helper's
 * stylesheet and the single-post toasts are untouched.
 * ------------------------------------------------------------------ */

.wb-toast.wb-post-listing-v2-toast.wb-toast--has-close {
    padding-right: 18px;
}

.wb-toast.wb-post-listing-v2-toast .wb-toast__close {
    position: static;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    background-color: #EFEFEF;
    color: #555555;
    transition: background-color .15s ease, color .15s ease;
}

.wb-toast.wb-post-listing-v2-toast .wb-toast__close svg {
    width: 14px;
    height: 14px;
}

.wb-toast.wb-post-listing-v2-toast .wb-toast__close:hover,
.wb-toast.wb-post-listing-v2-toast .wb-toast__close:focus-visible {
    background-color: #DDDDDD;
    color: #1B1B1B;
}

/* Docked on phones: the dark variant */
.wb-toast.wb-post-listing-v2-toast.wb-toast--docked.wb-toast--has-close {
    padding-right: 20px;
}

.wb-toast.wb-post-listing-v2-toast.wb-toast--docked .wb-toast__close {
    background-color: rgba(255, 255, 255, .14);
    color: #FFFFFF;
}

.wb-toast.wb-post-listing-v2-toast.wb-toast--docked .wb-toast__close:hover,
.wb-toast.wb-post-listing-v2-toast.wb-toast--docked .wb-toast__close:focus-visible {
    background-color: rgba(255, 255, 255, .28);
}

/* ---------------------------------------------------------------------
 * Empty states
 * ------------------------------------------------------------------ */

.wb-saved-posts-filtered-empty {
    padding: 48px 16px;
    text-align: center;
}

.wb-saved-posts-filtered-empty h2 {
    margin-bottom: 16px;
    font-size: 20px;
}

.wb-saved-posts-empty-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 24px;
    border: 1px solid #DEE2E6;
    border-radius: 12px;
    text-align: center;
}

.wb-saved-posts-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    border-radius: 50%;
    background-color: #E6EFEF;
    background-color: color-mix(in srgb, var(--wb-accent, #065F5D) 12%, #FFFFFF);
    color: var(--wb-accent, #065F5D);
}

.wb-saved-posts-empty-icon svg {
    width: 22px;
    height: 30px;
    fill: none;
}

.wb-saved-posts-empty-panel h2 {
    margin-bottom: 8px;
    font-size: 24px;
    font-weight: 700;
}

.wb-saved-posts-empty-panel p {
    max-width: 480px;
    margin: 0 0 24px;
    color: #6C757D;
    font-size: 16px;
}

/* ---------------------------------------------------------------------
 * Pagination
 * ------------------------------------------------------------------ */

.wb-pagination-list {
    gap: 5px;
}

.wb-pagination-list li {
    display: flex;
}

.wb-pagination-list li.ellipsis {
    align-items: center;
    border-radius: 12px;
    border: 1px solid #B4CFCE;
    padding: 8px 15px;
    justify-content: center;
}

.wb-pagination-list li a,
.wb-pagination-list li span {
    border-radius: 12px;
    border: 1px solid #B4CFCE;
    padding: 8px 15px;
}

.wb-pagination-list li a.wb-disabled {
    opacity: .5;
}

.wb-post-listing-pagination .wb-component .dropdown-btn {
    background-color: #FFFFFF;
    border: 1px solid #B4CFCE;
    padding: 8px 15px;
}

/* ---------------------------------------------------------------------
 * Breakpoints
 * ------------------------------------------------------------------ */

@media (max-width: 1024px) {
    section.col-lg-9.col-sm-12.col-12.wb-ent-has-banner.wb-post-listing-container {
        padding-right: 15px !important;
    }

    .wb-post-listing-breadcrumb-section {
        padding-left: 0 !important;
    }

    nav.wb-pagination {
        width: 100% !important;
    }
}

@media (min-width: 992px) {
    .wb-post-listing-container.col-lg-9 {
        -ms-flex: 0 0 76%;
        flex: 0 0 76%;
        max-width: 76%;
    }

    #wb-post-listing-banner-wrapper.col-lg-3 {
        -ms-flex: 0 0 24%;
        flex: 0 0 24%;
        max-width: 24%;
    }

    .wb-post-listing-list > li.col-lg-4 {
        -ms-flex: 0 0 calc(33.333333% - 13.5px);
        flex: 0 0 calc(33.333333% - 13.5px);
        max-width: calc(33.333333% - 13.5px);
    }

    .wb-post-listing-list > li.col-lg-3 {
        -ms-flex: 0 0 calc(25% - 15px);
        flex: 0 0 calc(25% - 15px);
        max-width: calc(25% - 15px);
    }
}

@media (min-width: 480px) and (max-width: 1300px) {
    .wb-post-listing-list > li.col-md-6 {
        -ms-flex: 0 0 calc(50% - 10px);
        flex: 0 0 calc(50% - 10px);
        max-width: calc(50% - 10px);
    }
}

@media (min-width: 768px) {
    /* Tablet and up: pagination and counter on one row */
    .wb-post-listing-pagination nav.wb-pagination {
        width: auto !important;
        flex: 0 0 auto;
    }

    .wb-post-listing-pagination > div.d-flex {
        width: auto !important;
        flex: 0 0 auto;
    }
}

@media (max-width: 768px) {
    /* 16px gutters either side of the cards on phones */
    #wb-post-listing-container-wrapper {
        padding-right: 1rem !important;
        padding-left: 1rem !important;
    }
}

@media (max-width: 767px) {
    .wb-saved-posts-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .wb-saved-posts-field--search,
    .wb-saved-posts-field--channel,
    .wb-saved-posts-field--lms-channel {
        flex-basis: auto;
    }

    .wb-saved-posts-field--actions .btn {
        flex: 1 1 0;
    }

    .wb-saved-posts-channel-dropdown,
    .wb-saved-posts-channel-dropdown .dropdown-btn {
        width: 100%;
        min-width: 0;
    }

    .wb-saved-posts-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .wb-saved-posts-sort {
        margin-left: 0;
    }

    .wb-saved-posts-sort .wb-post-listing-sort-container {
        flex: 1 1 auto;
    }

    .wb-post-listing-sort-container .dropdown-btn {
        width: 100%;
    }

    .wb-saved-posts-empty-panel {
        padding: 40px 16px;
    }

    /* Pagination and the per-page counter stack and centre */
    .wb-post-listing-pagination {
        justify-content: center !important;
    }

    .wb-post-listing-pagination nav.wb-pagination {
        width: 100% !important;
        margin-bottom: 1rem;
    }

    .wb-post-listing-pagination nav.wb-pagination .wb-pagination-list {
        justify-content: center !important;
    }

    .wb-post-listing-pagination > div.d-flex {
        width: 100% !important;
        justify-content: center !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wb-post-card-v2-save-btn,
    .wb-saved-posts-pill > span,
    .wb-toast.wb-post-listing-v2-toast .wb-toast__close {
        transition: none;
    }
}
