/* =============================================================================
   MetaMorphe LMS — Homepage / Module Grid Styles
   [mmlms_homepage]  [mmlms_user_progress]
   Butterfly design system: cyan · green · pink · yellow — warm neutral palette
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =============================================================================
   LEGACY: simple module card grid (kept for backward compat)
   ============================================================================= */

.mmlms-no-modules,
.mmlms-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #807a72;
    font-size: 15px;
    font-family: "Inter", system-ui, sans-serif;
    background: #faf8f4;
    border-radius: 12px;
    border: 1px solid #e7e4df;
}

.mmlms-homepage-grid {
    display: grid;
    gap: 24px;
    margin: 24px 0;
    padding: 0;
    font-family: "Inter", system-ui, sans-serif;
}

.mmlms-homepage-grid[data-columns="1"] { grid-template-columns: 1fr; }
.mmlms-homepage-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.mmlms-homepage-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.mmlms-homepage-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .mmlms-homepage-grid[data-columns="4"],
    .mmlms-homepage-grid[data-columns="3"] { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .mmlms-homepage-grid { grid-template-columns: 1fr !important; gap: 16px; }
}

.mmlms-module-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e7e4df;
    box-shadow: 0 1px 0 rgba(28,26,23,.04), 0 1px 2px rgba(28,26,23,.04);
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    flex-direction: column;
}
.mmlms-module-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(28,26,23,.04), 0 8px 24px -8px rgba(28,26,23,.12); }
.mmlms-module-card::before { display: none; }
.mmlms-module-link { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.mmlms-module-link:hover { text-decoration: none; color: inherit; }

.mmlms-module-badge {
    position: absolute !important; top: 12px !important; right: 12px !important;
    padding: 5px 12px !important; border-radius: 999px !important;
    font-size: 11px !important; font-weight: 700 !important;
    font-family: "Inter", system-ui, sans-serif !important;
    display: inline-flex !important; align-items: center !important; gap: 5px !important;
    z-index: 10 !important; white-space: nowrap !important; line-height: 1 !important;
    width: auto !important; text-decoration: none !important;
    letter-spacing: .04em !important; text-transform: uppercase !important;
    box-shadow: 0 2px 8px rgba(28,26,23,.12) !important;
}
.mmlms-module-badge .dashicons { width: 16px !important; height: 16px !important; font-size: 16px !important; flex-shrink: 0 !important; line-height: 1 !important; display: flex !important; align-items: center !important; justify-content: center !important; }
.mmlms-badge-purchased, .mmlms-badge-free { background: #8fcc5a !important; color: #fff !important; padding: 5px 14px !important; }
.mmlms-badge-locked { background: #ecd84b !important; color: #7a6411 !important; padding: 5px 14px !important; }

.mmlms-module-image { width: 100%; height: 160px; overflow: hidden; background: #f6f3ee; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.mmlms-module-image img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s ease; }
.mmlms-module-card:hover .mmlms-module-image img { transform: scale(1.04); }
.mmlms-module-image.mmlms-no-image { background: linear-gradient(135deg, #e0f1f5 0%, #ecf6dc 100%); }
.mmlms-module-image.mmlms-no-image .dashicons { font-size: 52px; width: 52px; height: 52px; color: #4ec0d8; opacity: .7; }

.mmlms-module-content { padding: 16px 18px; }
.mmlms-module-link .mmlms-module-content { padding-bottom: 0; }
.mmlms-module-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: #1c1a17; line-height: 1.3; letter-spacing: -.01em; }
.mmlms-module-description { margin: 0; font-size: 13px; color: #807a72; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mmlms-module-card.mmlms-module-purchased { border-color: #cfe6a4; }
.mmlms-module-card.mmlms-module-purchased .mmlms-module-title { color: #4d7a26; }
.mmlms-module-badge, .mmlms-module-image, .mmlms-module-content { position: relative; z-index: 2; }
.mmlms-module-unlock-wrapper { padding: 14px 18px; border-top: 1px solid #e7e4df; margin-top: auto; display: flex; justify-content: center; align-items: center; }


/* =============================================================================
   LEARNER COURSE VIEW  [mmlms_homepage]
   ============================================================================= */

.mmlms-learner-course {
    display: flex;
    flex-direction: column;
    gap: 18px;
    font-family: "Inter", system-ui, sans-serif;
}

/* ---------- Module section ---------- */

.mmlms-learner-module {
    background: #fff;
    border: 1px solid #e7e4df;
    border-radius: 16px;
    overflow: hidden;
}

.mmlms-learner-module.mmlms-mod-locked {
    background: #faf8f4;
}

/* ---------- Module header bar ---------- */

.mmlms-learner-mod-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 22px;
    border-bottom: 1px solid;
    flex-wrap: wrap;
}

.mmlms-learner-mod-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mmlms-learner-mod-badge {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.mmlms-learner-mod-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.mmlms-learner-mod-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
}

.mmlms-learner-mod-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mmlms-learner-mod-progress-info {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.mmlms-learner-mod-bar {
    width: 80px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}

.mmlms-learner-mod-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .35s ease;
}

.mmlms-learner-mod-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity .15s ease;
}
.mmlms-learner-mod-details-btn:hover { opacity: .78; text-decoration: none; }

/* ---------- Locked module hint ---------- */

.mmlms-learner-locked-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    font-size: 13px;
    color: #807a72;
}

/* ---------- Items grid ---------- */

.mmlms-learner-items-grid {
    display: grid;
    gap: 16px;
    padding: 20px 22px 24px;
}

.mmlms-learner-cols-1 { grid-template-columns: 1fr; }
.mmlms-learner-cols-2 { grid-template-columns: repeat(2, 1fr); }
.mmlms-learner-cols-3 { grid-template-columns: repeat(3, 1fr); }
.mmlms-learner-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1100px) {
    .mmlms-learner-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
    .mmlms-learner-cols-4,
    .mmlms-learner-cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .mmlms-learner-cols-4,
    .mmlms-learner-cols-3,
    .mmlms-learner-cols-2 { grid-template-columns: 1fr; }
}

/* ---------- Item card ---------- */

.mmlms-learner-item {
    background: #fff;
    border: 1px solid #e7e4df;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease;
}

.mmlms-learner-item.mmlms-item-locked { opacity: .68; }
.mmlms-learner-item.mmlms-item-locked:hover { transform: none; }
.mmlms-learner-item:not(.mmlms-item-locked):hover { transform: translateY(-2px); }

/* ---------- Item cover ---------- */

.mmlms-learner-item-cover {
    position: relative;
    height: 120px;
    display: grid;
    place-items: center;
    border-bottom: 1px solid rgba(0,0,0,.04);
    overflow: hidden;
}

.mmlms-learner-item-illu {
    display: grid;
    place-items: center;
}

.mmlms-learner-item-thumb {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
}

.mmlms-learner-item-thumb.mmlms-item-thumb-locked {
    opacity: 0.4;
    filter: grayscale(40%);
}

.mmlms-learner-item-num,
.mmlms-learner-item-badge {
    z-index: 1;
}

.mmlms-learner-item-num {
    position: absolute;
    top: 10px;
    left: 10px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    font-weight: 600;
}

.mmlms-learner-item-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
}

.mmlms-learner-pulse {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    animation: mmlms-pulse 1.6s ease-in-out infinite;
}

@keyframes mmlms-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .6; transform: scale(1.3); }
}

/* ---------- Item body ---------- */

.mmlms-learner-item-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.mmlms-learner-item-pills {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.mmlms-learner-item-kind {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    border: 1px solid;
    border-radius: 999px;
}

.mmlms-learner-item-required {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9c2f51;
    background: #fae2e9;
    border: 1px solid #efc1cf;
    border-radius: 999px;
}

.mmlms-learner-item-title {
    margin: 2px 0 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -.005em;
    line-height: 1.3;
}

.mmlms-learner-item-sub {
    font-size: 12px;
    color: #807a72;
    margin-top: 2px;
}

/* ---------- Item CTA ---------- */

.mmlms-learner-item-cta {
    margin-top: auto;
    padding-top: 10px;
}

.mmlms-learner-cta-primary,
.mmlms-learner-cta-secondary,
.mmlms-learner-cta-available,
.mmlms-learner-cta-disabled,
.mmlms-learner-cta-required {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: "Inter", system-ui, sans-serif;
    text-decoration: none;
    transition: opacity .15s ease, transform .15s ease;
    cursor: pointer;
    border: none;
    text-align: center;
}

.mmlms-learner-cta-primary {
    color: #fff;
}
.mmlms-learner-cta-primary:hover { opacity: .88; transform: translateY(-1px); color: #fff; text-decoration: none; }

.mmlms-learner-cta-secondary {
    color: #3c3832;
    background: #fff;
    border: 1px solid #e7e4df;
}
.mmlms-learner-cta-secondary:hover { background: #f6f3ee; color: #1c1a17; text-decoration: none; }

.mmlms-learner-cta-available {
    background: transparent;
    border: 1px solid; /* color and border-color come from inline style */
    cursor: default;
}

.mmlms-learner-cta-disabled {
    color: #a8a39a;
    background: #f6f3ee;
    cursor: default;
}

.mmlms-learner-cta-required {
    color: #9c2f51;
    background: #fae2e9;
    border: 1px solid #efc1cf;
    font-size: 11px;
    cursor: default;
}


/* =============================================================================
   PROGRESS CARD  [mmlms_user_progress]
   ============================================================================= */

.mmlms-prog-card {
    background: #fff;
    border: 1px solid #e7e4df;
    border-radius: 16px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-family: "Inter", system-ui, sans-serif;
    box-shadow: 0 1px 0 rgba(28,26,23,.04), 0 1px 2px rgba(28,26,23,.04);
}

.mmlms-prog-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.mmlms-prog-card-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #807a72;
}

.mmlms-prog-card-pct {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #1c1a17;
}

.mmlms-prog-bar-wrap {
    height: 8px;
    border-radius: 999px;
    background: #efece7;
    overflow: hidden;
}

.mmlms-prog-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #4ec0d8, #8fcc5a);
    transition: width .4s ease;
}

/* ---------- Stepper ---------- */

.mmlms-prog-stepper {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mmlms-prog-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mmlms-prog-step-dot {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.mmlms-prog-step-info {
    flex: 1;
    min-width: 0;
}

.mmlms-prog-step-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mmlms-prog-step-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.mmlms-prog-step-bar-wrap {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: #efece7;
    overflow: hidden;
}

.mmlms-prog-step-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .4s ease;
}

.mmlms-prog-step-bar-pct {
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 28px;
    text-align: right;
}

.mmlms-prog-step-here {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border: 1px solid;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}


/* =============================================================================
   [mmlms_user_progress] — LEGACY summary bar (kept if used elsewhere)
   ============================================================================= */

.mmlms-user-progress-wrap {
    margin: 18px 0;
    font-family: "Inter", system-ui, sans-serif;
}

.mmlms-user-progress-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #e0f1f5;
    border-radius: 999px;
    border: 1px solid #b4dde6;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.mmlms-user-progress-label { font-weight: 700; font-size: 13px; color: #1d6e80; white-space: nowrap; }

.mmlms-user-progress-bar-container { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px; }

.mmlms-user-global-bar.mmlms-reporting-progress-bar {
    flex: 1; max-width: 280px; width: auto; height: 6px; display: block;
    background: rgba(255,255,255,.5); border-radius: 999px; overflow: hidden; border: none;
}

.mmlms-user-progress-count { font-size: 12px; color: #1d6e80; white-space: nowrap; font-weight: 600; }

.mmlms-user-progress-actions { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }

.mmlms-user-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    background: rgba(255,255,255,.7); border: 1px solid #b4dde6;
    border-radius: 50%; cursor: pointer; color: #1d6e80;
    transition: background .15s, border-color .15s, color .15s;
}
.mmlms-user-icon-btn:hover { background: #4ec0d8; border-color: #4ec0d8; color: #fff; }
.mmlms-user-icon-btn .dashicons { font-size: 14px; width: 14px; height: 14px; }

@media screen and (max-width: 600px) {
    .mmlms-user-progress-summary { flex-direction: column; align-items: flex-start; border-radius: 12px; }
    .mmlms-user-global-bar.mmlms-reporting-progress-bar { max-width: 100%; }
}

/* ---------- Responsive overall ---------- */

@media (max-width: 768px) {
    .mmlms-learner-mod-head { padding: 14px 16px; }
    .mmlms-learner-items-grid { padding: 14px 16px 18px; gap: 12px; }
    .mmlms-learner-mod-title { font-size: 17px; }
    .mmlms-prog-card { padding: 16px 18px; }
    .mmlms-prog-card-pct { font-size: 22px; }
}
