/* Lifteach Saved Folders — 1.0.4
   Save button + Folders account page. Brand: orange #fb8500, teal #219ebc, navy #334155. */

.lifteach-resource-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin: 8px 0 12px;
    max-width: 100%;
    min-width: 0;
}
.lifteach-resource-actions .add-to-calendar-wrapper,
.lifteach-resource-actions .lifteach-save-wrap {
    margin: 0;
    display: flex;
    align-items: stretch;
    min-width: 0;
}
/* Match the height of the orange Download / Calendar buttons. */
.lifteach-resource-actions .lifteach-save-btn,
.lifteach-resource-actions .add-to-calendar-btn,
.lifteach-resource-actions a.button,
.lifteach-resource-actions .woocommerce-MyAccount-downloads-file,
.lifteach-resource-actions .resources-button {
    box-sizing: border-box;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 0 !important;
}
@media (max-width: 767px) {
    .lifteach-resource-actions {
        width: 100%;
    }
    .lifteach-resource-actions .add-to-calendar-wrapper,
    .lifteach-resource-actions .lifteach-save-wrap,
    .lifteach-resource-actions a.button {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
        max-width: 100%;
    }
    .lifteach-resource-actions .lifteach-save-btn,
    .lifteach-resource-actions .add-to-calendar-btn,
    .lifteach-resource-actions a.button {
        width: 100%;
    }
    .lifteach-resource-actions .lifteach-save-popover,
    .lifteach-save-wrap--product .lifteach-save-popover {
        left: auto;
        right: 0;
        min-width: 0;
        width: max-content;
        max-width: calc(100vw - 24px);
    }
}
.lifteach-save-wrap {
    position: relative;
    display: inline-block;
}
.lifteach-save-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    margin: 0 !important;
    padding: 8px 16px !important;
    border: 2px solid #219ebc !important;
    border-radius: 6px !important;
    background: #fff !important;
    color: #334155 !important;
    font-family: inherit;
    font-size: 15px !important;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    box-shadow: none !important;
    cursor: pointer;
    white-space: nowrap;
}
.lifteach-save-btn:hover,
.lifteach-save-btn:focus {
    background: #e8f6f9 !important;
    border-color: #fb8500 !important;
    color: #fb8500 !important;
}
.lifteach-save-btn:focus-visible {
    outline: 2px solid #fb8500;
    outline-offset: 2px;
}
.lifteach-save-btn.is-saved,
.lifteach-save-btn[aria-pressed="true"] {
    background: #fb8500 !important;
    border-color: #fb8500 !important;
    color: #fff !important;
}
.lifteach-save-btn.is-saved:hover,
.lifteach-save-btn.is-saved:focus {
    background: #e07700 !important;
    border-color: #e07700 !important;
    color: #fff !important;
}
.lifteach-save-icon {
    display: block;
    flex: 0 0 auto;
}
.lifteach-save-btn--loop {
    padding: 6px 10px !important;
    font-size: 13px !important;
    margin-top: 0 !important;
}

/* Shop / archive cards: compact Save sits under the full-width nowrap
   Add to cart button (v1.0.1) so the 3-col <1024 / 2-col <767 grid stays intact. */
.woocommerce ul.products li.product .lifteach-save-wrap--loop,
.woocommerce-page ul.products li.product .lifteach-save-wrap--loop {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 8px 0 0;
    position: relative;
    z-index: 2;
}
.woocommerce ul.products li.product .lifteach-save-btn--loop,
.woocommerce-page ul.products li.product .lifteach-save-btn--loop {
    display: inline-flex !important;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px !important;
    font-size: 13px !important;
    line-height: 1.2;
    white-space: nowrap;
}
.woocommerce ul.products li.product .lifteach-save-wrap--loop .lifteach-save-popover,
.woocommerce-page ul.products li.product .lifteach-save-wrap--loop .lifteach-save-popover {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
/* Do not let card overflow or stacking clip the folder menu. */
.woocommerce ul.products li.product:has(.lifteach-save-popover:not([hidden])),
.woocommerce-page ul.products li.product:has(.lifteach-save-popover:not([hidden])) {
    z-index: 5;
    overflow: visible;
}

/* Popover */
.lifteach-save-popover {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    left: 0;
    box-sizing: border-box;
    min-width: 240px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 12px 14px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    color: #334155;
    font-size: 14px;
    line-height: 1.4;
}
.lifteach-save-popover[hidden] {
    display: none !important;
}
.lifteach-save-popover.is-above {
    top: auto;
    bottom: calc(100% + 8px);
}
.lifteach-save-popover__title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #334155;
}
.lifteach-save-popover__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
    max-height: 220px;
    overflow: auto;
}
.lifteach-save-popover__item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 4px 0;
    cursor: pointer;
}
.lifteach-save-popover__item input {
    margin: 0;
    accent-color: #fb8500;
}
.lifteach-save-popover__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.lifteach-save-popover__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.lifteach-save-popover__actions button,
.lifteach-save-popover__actions a {
    font-size: 13px;
}
.lifteach-save-popover__actions .button.alt {
    background: #fb8500 !important;
    border: 2px solid #fb8500 !important;
    color: #fff !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-weight: 600;
}
.lifteach-save-popover__actions .button:not(.alt) {
    background: #fff !important;
    border: 2px solid #219ebc !important;
    color: #219ebc !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-weight: 600;
    box-shadow: none !important;
}
.lifteach-folders-row__tags {
    display: inline;
}
.lifteach-save-popover__hint {
    margin: 0 0 8px;
    color: #334155;
}
.lifteach-save-popover__field {
    width: 100%;
    margin: 0 0 8px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
}
.lifteach-emoji-row,
.lifteach-color-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0 0 8px;
}
.lifteach-emoji-row button,
.lifteach-color-row button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    line-height: 1;
}
.lifteach-emoji-row button.is-selected,
.lifteach-color-row button.is-selected {
    border-color: #fb8500;
    box-shadow: 0 0 0 2px rgba(251, 133, 0, 0.25);
}
.lifteach-color-row button span {
    display: block;
    width: 16px;
    height: 16px;
    margin: 5px auto;
    border-radius: 50%;
}

/* Folders page
   Everything in this block is written to stay inside the dashboard
   content column on small screens (min-width:0, max-width:100%,
   box-sizing, wrapping titles). */
.lifteach-folders,
.lifteach-folders *,
.lifteach-folders *::before,
.lifteach-folders *::after {
    box-sizing: border-box;
}
.lifteach-folders {
    width: 100%;
    max-width: 1100px;
    min-width: 0;
}
/* Common account / dashboard shells — keep our page from blowing out a flex/grid parent. */
.wpdashboard-main,
.wpdashboard-content,
.wpdashboard-page,
.wpdashboard-body,
.wpdashboard-wrapper,
.woocommerce-MyAccount-content,
.woocommerce-account .ast-container,
.woocommerce-account #content,
.woocommerce-account #primary {
    min-width: 0;
    max-width: 100%;
}
.lifteach-folders__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    min-width: 0;
    max-width: 100%;
}
.lifteach-folders__title {
    margin: 0;
    min-width: 0;
    font-size: 28px;
    font-weight: 600;
    color: #023047;
    overflow-wrap: anywhere;
}
.lifteach-folders__new {
    flex: 0 0 auto;
}
.lifteach-folders__intro {
    margin: 0 0 16px;
    max-width: 100%;
    color: #334155;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.lifteach-folders__cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 3px; /* room for the active ring so it is not clipped or overflowed */
}
.lifteach-folder-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    padding: 14px 14px 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 5px solid var(--folder-color, #219ebc);
    border-radius: 10px;
    text-decoration: none !important;
    color: #334155 !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lifteach-folder-card:hover,
.lifteach-folder-card:focus {
    border-color: #219ebc;
    box-shadow: 0 4px 14px rgba(33, 158, 188, 0.12);
}
.lifteach-folder-card.is-active {
    border-color: var(--folder-color, #fb8500);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--folder-color, #fb8500) 30%, transparent);
}
.lifteach-folder-card__emoji {
    font-size: 22px;
    line-height: 1;
}
.lifteach-folder-card__name {
    font-weight: 600;
    font-size: 16px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.lifteach-folder-card__count {
    font-size: 13px;
    color: #64748b;
}
.lifteach-folders__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    min-width: 0;
    max-width: 100%;
}
.lifteach-folders__current {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.lifteach-folders__search {
    flex: 1 1 180px;
    min-width: 0;
    max-width: 100%;
}
.lifteach-folders__search input {
    width: 100%;
    max-width: 100%;
    height: 42px;
    min-width: 0;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font: inherit;
}
.lifteach-folders__empty {
    margin: 16px 0;
    color: #334155;
}
.lifteach-folders__table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.lifteach-folders-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}
.lifteach-folders-table th {
    background: #219ebc;
    color: #fff;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 12px 14px;
}
.lifteach-folders-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    color: #334155;
    font-size: 14px;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.lifteach-folders-table tr:last-child td {
    border-bottom: none;
}
.lifteach-folders-row__link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    max-width: 100%;
    color: #023047 !important;
    text-decoration: none !important;
    font-weight: 600;
}
.lifteach-folders-row__thumb {
    flex: 0 0 auto;
}
.lifteach-folders-row__title {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.lifteach-folders-row__thumb img,
.lifteach-folders-row__thumb .wp-post-image {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}
.lifteach-folders-row__files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.lifteach-folders-row__files .button,
.lifteach-folders-row .button.alt {
    padding: 6px 12px !important;
    font-size: 13px !important;
    background: #fb8500 !important;
    border-color: #fb8500 !important;
    color: #fff !important;
    border-radius: 6px !important;
}
.lifteach-folders-move {
    display: inline-block;
    margin-left: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: #219ebc;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}
.lifteach-folders-muted {
    color: #64748b;
}
.lifteach-folders-gate {
    max-width: 520px;
    padding: 24px;
    background: #fff;
    border-radius: 10px;
}
.lifteach-folders__danger {
    background: transparent !important;
    border: 1px solid #e11d48 !important;
    color: #e11d48 !important;
}

@media (max-width: 767px) {
    .lifteach-folders {
        overflow-x: clip;
    }
    .lifteach-folders__title {
        font-size: 24px;
    }
    .lifteach-folders__cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .lifteach-folders__search {
        flex: 1 1 100%;
    }
    .lifteach-folders-table {
        table-layout: auto;
    }
    .lifteach-folders-table thead {
        display: none;
    }
    .lifteach-folders-table,
    .lifteach-folders-table tbody,
    .lifteach-folders-table tr,
    .lifteach-folders-table td {
        display: block;
        width: 100%;
        max-width: 100%;
    }
    .lifteach-folders-table tr {
        padding: 12px 0;
        border-bottom: 1px solid #e2e8f0;
    }
    .lifteach-folders-table td {
        border: 0;
        padding: 6px 0;
    }
    .lifteach-folders-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: #219ebc;
        margin-bottom: 2px;
    }
    .lifteach-folders-table td.lifteach-folders-row__resource::before {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lifteach-folder-card,
    .lifteach-save-btn {
        transition: none;
    }
}

/* Error / status toast — used when a Save request fails. */
.lifteach-folders-toast {
    position: fixed;
    z-index: 100000;
    right: 16px;
    bottom: 16px;
    max-width: min(360px, calc(100vw - 24px));
    background: #334155;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font: 14px/1.45 Poppins, system-ui, sans-serif;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}
.lifteach-folders-toast.is-error {
    background: #9f1239;
}

/* WP Dashboard typography + layout.
   `.wpdashboard h1, .wpdashboard p { font-size: var(--text-base) }` beats a
   single-class title/intro rule. Other dashboard pages also wrap in .content
   (flex:1; overflow-y:auto; padding: 18px 20px) inside .main { overflow:hidden }. */
body.wpdashboard .lifteach-folders,
.wpdashboard .lifteach-folders {
    font-family: Poppins, "Segoe UI", sans-serif;
    color: #334155;
    width: 100%;
    max-width: 1100px;
}
body.wpdashboard .main > .lifteach-folders {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 20px;
}
body.wpdashboard h1.lifteach-folders__title,
.wpdashboard h1.lifteach-folders__title,
.lifteach-folders__title {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.25;
    color: #023047;
}
body.wpdashboard p.lifteach-folders__intro,
.wpdashboard p.lifteach-folders__intro {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.5;
    color: #334155;
}
body.wpdashboard .lifteach-folders__new,
.wpdashboard .lifteach-folders__new,
.lifteach-folders__new.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 6px;
    background: #fb8500;
    color: #fff;
    font: 600 14px/1.2 Poppins, "Segoe UI", sans-serif;
    cursor: pointer;
    text-decoration: none;
}
body.wpdashboard .lifteach-folders__new:hover,
.wpdashboard .lifteach-folders__new:hover {
    background: #e07700;
    color: #fff;
}
body.wpdashboard a.lifteach-folder-card,
.wpdashboard a.lifteach-folder-card {
    display: flex;
    flex-direction: column;
    color: #023047;
    text-decoration: none;
    font-family: Poppins, "Segoe UI", sans-serif;
}
