/**
 * MyEduFiles Resource Manager - Frontend Stylesheet
 * Scoped under .mefrm-app to prevent external theme style leakage.
 * Classic preserves v1.6.1 styling 100%; modern theme rules strictly scoped to theme classes.
 */

/* ==========================================================================
   1. Base App Container & Custom Properties (Classic / Baseline Default)
   ========================================================================== */
.mefrm-resource-page,
.mefrm-app {
    --mefrm-accent: #4B16B5;
    --mefrm-accent-dark: #3A1090;
    --mefrm-accent-soft: #f3eefa;
    --mefrm-accent-teal: #00897B;
    --mefrm-text: #14202b;
    --mefrm-muted: #667085;
    --mefrm-border: #e7edf1;
    --mefrm-soft: #f6f9fb;
    --mefrm-surface: #fff;
    --mefrm-shadow: 0 18px 50px rgba(15, 36, 50, 0.08);
    --mefrm-shadow-soft: 0 8px 26px rgba(15, 36, 50, 0.07);
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 22px 16px 104px;
    color: var(--mefrm-text);
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

.mefrm-resource-page *,
.mefrm-app * {
    box-sizing: border-box;
}

.mefrm-resource {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    min-width: 0;
}

/* ==========================================================================
   2. Baseline v1.6.1 Gallery & Single Components
   ========================================================================== */

/* Screenshot Gallery */
.mefrm-gallery {
    margin: 0 0 28px;
    width: 100%;
    min-width: 0;
}

.mefrm-gallery-stage {
    position: relative;
    width: 100%;
    min-width: 0;
    background: var(--mefrm-surface);
    border: 1px solid var(--mefrm-border);
    border-radius: 22px;
    box-shadow: var(--mefrm-shadow);
    overflow: hidden;
}

.mefrm-gallery-open {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    font: inherit;
    color: inherit;
    overflow: hidden;
}

.mefrm-gallery-open:focus-visible {
    outline: 3px solid var(--mefrm-accent);
    outline-offset: 3px;
}

.mefrm-gallery-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 660px;
    object-fit: contain;
    background: #fff;
    transition: transform 0.25s ease;
}

.mefrm-gallery-open:hover .mefrm-gallery-image {
    transform: scale(1.006);
}

.mefrm-gallery--single .mefrm-gallery-stage {
    border: 1px solid var(--mefrm-border);
    border-radius: 22px;
    box-shadow: var(--mefrm-shadow);
}

.mefrm-gallery-zoom-hint {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(17, 31, 44, 0.78);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Thumbnail Strip */
.mefrm-gallery-thumbs {
    display: flex;
    gap: 10px;
    padding: 12px 2px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.mefrm-gallery-thumbs::-webkit-scrollbar {
    height: 4px;
}

.mefrm-gallery-thumbs::-webkit-scrollbar-thumb {
    background: #cbd5dc;
    border-radius: 4px;
}

.mefrm-gallery-thumb {
    flex: 0 0 84px;
    height: 60px;
    margin: 0;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: var(--mefrm-soft);
    cursor: pointer;
    scroll-snap-align: start;
    opacity: 0.68;
    transition: opacity 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
    overflow: hidden;
}

.mefrm-gallery-thumb:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.mefrm-gallery-thumb.is-active {
    opacity: 1;
    border-color: var(--mefrm-accent);
    box-shadow: 0 2px 8px rgba(75, 22, 181, 0.22);
}

.mefrm-gallery-thumb:focus-visible {
    outline: 2px solid var(--mefrm-accent);
    outline-offset: 2px;
}

.mefrm-gallery-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

/* Header & Typography */
.mefrm-resource-header {
    margin: 0 0 26px;
    min-width: 0;
}

.mefrm-resource-title {
    margin: 0;
    max-width: 100%;
    font-size: clamp(1.85rem, 7vw, 2.9rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.035em;
    text-wrap: balance;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* About & Features */
.mefrm-about {
    margin: 0;
    padding: 26px 0 30px;
    border-top: 1px solid var(--mefrm-border);
    min-width: 0;
}

.mefrm-about h2,
.mefrm-related h2 {
    margin: 0 0 14px;
    font-size: 1.2rem;
    line-height: 1.25;
    font-weight: 780;
    letter-spacing: -0.015em;
}

.mefrm-about-content {
    max-width: 100%;
    font-size: 1rem;
    line-height: 1.78;
    color: #334155;
    overflow-wrap: break-word;
}

.mefrm-about-content > :first-child {
    margin-top: 0;
}

.mefrm-about-content > :last-child {
    margin-bottom: 0;
}

.mefrm-about-content a {
    color: var(--mefrm-accent);
    text-underline-offset: 3px;
}

.mefrm-about-content img {
    max-width: 100%;
    height: auto;
}

.mefrm-features {
    list-style: none;
    margin: 22px 0 0;
    padding: 0;
    display: grid;
    gap: 11px;
    max-width: 100%;
    min-width: 0;
}

.mefrm-features li {
    position: relative;
    padding: 2px 0 2px 34px;
    line-height: 1.55;
    color: #263746;
    overflow-wrap: break-word;
}

.mefrm-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--mefrm-accent-soft);
    color: var(--mefrm-accent-dark);
    font-size: 0.79rem;
    font-weight: 900;
}

.mefrm-feature-extra:not([hidden]) {
    animation: mefrm-fade-in 0.18s ease-out;
}

.mefrm-features-wrapper {
    min-width: 0;
    max-width: 100%;
}

.mefrm-features-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 16px;
    border: 1px solid var(--mefrm-border);
    border-radius: 999px;
    background: #fff;
    color: var(--mefrm-accent);
    font-size: 0.87rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.mefrm-features-toggle:hover {
    background: var(--mefrm-accent-soft);
    border-color: var(--mefrm-accent);
    color: var(--mefrm-accent-dark);
}

.mefrm-features-toggle:focus-visible {
    outline: 2px solid var(--mefrm-accent);
    outline-offset: 2px;
}

/* Purchase Box */
.mefrm-purchase-box {
    display: grid;
    gap: 16px;
    margin: 2px 0 0;
    padding: 22px;
    background: linear-gradient(145deg, #fff 0%, #f8f6fc 100%);
    border: 1px solid var(--mefrm-border);
    border-radius: 20px;
    box-shadow: var(--mefrm-shadow-soft);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.mefrm-price {
    font-size: clamp(1.45rem, 6vw, 1.9rem);
    line-height: 1.15;
    font-weight: 850;
    letter-spacing: -0.03em;
    color: var(--mefrm-text);
    overflow-wrap: break-word;
    min-width: 0;
}

.mefrm-purchase-box--support .mefrm-price {
    font-size: clamp(1.25rem, 5vw, 1.65rem);
}

.mefrm-purchase-actions {
    display: grid;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.mefrm-cta-primary-wrap {
    display: grid;
    gap: 5px;
    min-width: 0;
    width: 100%;
}

.mefrm-cta-secondary-wrap {
    min-width: 0;
    width: 100%;
}

.mefrm-cta-caption {
    display: block;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--mefrm-muted);
    letter-spacing: -0.01em;
}

.mefrm-primary-button,
.mefrm-mobile-sticky-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 54px;
    padding: 13px 22px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: linear-gradient(135deg, #4B16B5 0%, #3A1090 100%);
    color: #fff !important;
    text-align: center;
    text-decoration: none !important;
    font-size: 1rem;
    font-weight: 780;
    line-height: 1.2;
    box-shadow: 0 8px 20px rgba(75, 22, 181, 0.22);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    overflow-wrap: break-word;
}

.mefrm-primary-button:hover,
.mefrm-mobile-sticky-button:hover {
    background: linear-gradient(135deg, #3A1090 0%, #2C0C6C 100%);
    transform: translateY(-1px);
    box-shadow: 0 11px 24px rgba(75, 22, 181, 0.28);
}

.mefrm-primary-button:active,
.mefrm-mobile-sticky-button:active {
    transform: translateY(0);
    box-shadow: 0 5px 14px rgba(75, 22, 181, 0.20);
}

.mefrm-primary-button:focus-visible,
.mefrm-mobile-sticky-button:focus-visible {
    outline: 3px solid rgba(0, 137, 123, 0.55);
    outline-offset: 3px;
}

.mefrm-primary-button.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.mefrm-cta-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 6px 0;
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: lowercase;
}

.mefrm-cta-divider::before,
.mefrm-cta-divider::after {
    content: '';
    flex: 1;
    min-width: 0;
    border-bottom: 1px solid var(--mefrm-border);
}

.mefrm-cta-divider__text {
    padding: 0 10px;
    flex-shrink: 0;
}

.mefrm-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 10px 18px;
    border: 1px solid var(--mefrm-border);
    border-radius: 12px;
    background: #fff;
    color: var(--mefrm-text) !important;
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(15, 36, 50, 0.04);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    overflow-wrap: break-word;
}

.mefrm-secondary-button:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
    background: #fafcfd;
    box-shadow: 0 6px 16px rgba(15, 36, 50, 0.08);
}

.mefrm-secondary-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(15, 36, 50, 0.04);
}

.mefrm-secondary-button:focus-visible {
    outline: 2px solid var(--mefrm-accent);
    outline-offset: 2px;
}

.mefrm-btn-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

.mefrm-btn-icon--messenger {
    color: #fff;
}

.mefrm-btn-icon--raket {
    border-radius: 4px;
}

/* Related Resources & Baseline Cards (Uncropped 16:9, No Transform Zoom) */
.mefrm-related {
    max-width: 100%;
    margin: 52px auto 0;
    padding-top: 30px;
    border-top: 1px solid var(--mefrm-border);
    min-width: 0;
}

.mefrm-related h2 {
    font-size: 1.3rem;
    margin-bottom: 18px;
}

.mefrm-related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.mefrm-related-card {
    overflow: hidden;
    background: var(--mefrm-surface);
    border: 1px solid var(--mefrm-border);
    border-radius: 18px;
    box-shadow: 0 4px 16px rgba(15, 36, 50, 0.045);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    min-width: 0;
}

.mefrm-related-card:hover {
    transform: translateY(-2px);
    border-color: #d9e4e9;
    box-shadow: 0 12px 30px rgba(15, 36, 50, 0.09);
}

.mefrm-related-image {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    background: #fff;
    overflow: hidden;
}

.mefrm-related-image img,
.mefrm-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
}

.mefrm-placeholder {
    background: linear-gradient(135deg, #edf3f5, #f9fbfc);
}

.mefrm-related-body {
    padding: 15px 16px 17px;
    min-width: 0;
    overflow-wrap: break-word;
}

.mefrm-related-body h3,
.mefrm-related-body h2 {
    margin: 0 0 8px;
    font-size: 1rem;
    line-height: 1.38;
    font-weight: 760;
    letter-spacing: -0.01em;
}

.mefrm-related-body h3 a,
.mefrm-related-body h2 a {
    color: var(--mefrm-text);
    text-decoration: none;
}

.mefrm-related-body h3 a:hover,
.mefrm-related-body h2 a:hover {
    color: var(--mefrm-accent-dark);
}

.mefrm-related-price {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--mefrm-accent-dark);
}

/* Mobile Sticky Action */
.mefrm-mobile-sticky {
    position: fixed;
    z-index: 9999;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(222, 232, 237, 0.95);
    border-radius: 17px;
    box-shadow: 0 14px 38px rgba(15, 36, 50, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-width: 100%;
}

.mefrm-mobile-sticky-price {
    padding-left: 6px;
    font-size: 0.92rem;
    font-weight: 850;
    line-height: 1.2;
    letter-spacing: -0.015em;
    overflow-wrap: anywhere;
    min-width: 0;
}

.mefrm-mobile-sticky-button {
    min-height: 48px;
    padding: 10px 13px;
    border-radius: 11px;
    font-size: 0.91rem;
    box-shadow: none;
}

/* Baseline v1.6.1 Archive */
.mefrm-archive-page {
    max-width: 1120px;
    width: 100%;
}

.mefrm-archive-header {
    margin: 6px 0 26px;
}

.mefrm-archive-header h1 {
    margin: 0;
    font-size: clamp(1.9rem, 7vw, 2.7rem);
    font-weight: 820;
    letter-spacing: -0.035em;
}

.mefrm-archive-subtitle {
    margin: 6px 0 0;
    font-size: 1rem;
    color: var(--mefrm-muted);
}

.mefrm-archive-grid {
    gap: 20px;
}

.mefrm-pagination {
    margin-top: 32px;
}

.mefrm-pagination .nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.mefrm-pagination .page-numbers {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--mefrm-border);
    border-radius: 10px;
    color: var(--mefrm-text);
    text-decoration: none;
    background: #fff;
    font-weight: 600;
}

.mefrm-pagination .page-numbers:hover {
    border-color: #cddbe1;
    background: var(--mefrm-soft);
}

.mefrm-pagination .current {
    background: var(--mefrm-accent);
    border-color: var(--mefrm-accent);
    color: #fff;
    font-weight: 800;
}

/* Fullscreen Screenshot Lightbox */
.mefrm-lightbox[hidden] {
    display: none !important;
}

.mefrm-lightbox {
    position: fixed;
    z-index: 100000;
    inset: 0;
    animation: mefrm-fade-in 0.16s ease-out;
}

.mefrm-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 12, 20, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mefrm-lightbox-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    grid-template-rows: 1fr auto;
    align-items: center;
    padding: max(14px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}

.mefrm-lightbox-stage {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    touch-action: pan-y;
}

.mefrm-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 82px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    user-select: none;
    -webkit-user-drag: none;
    animation: mefrm-scale-in 0.18s ease-out;
}

.mefrm-lightbox-close,
.mefrm-lightbox-nav {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.mefrm-lightbox-close {
    position: absolute;
    z-index: 2;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    border-radius: 999px;
    font-size: 1.8rem;
    line-height: 1;
}

.mefrm-lightbox-nav {
    width: 42px;
    height: 54px;
    border-radius: 12px;
    font-size: 1.45rem;
}

.mefrm-lightbox-prev {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
}

.mefrm-lightbox-next {
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
}

.mefrm-lightbox-close:hover,
.mefrm-lightbox-nav:hover,
.mefrm-lightbox-close:focus-visible,
.mefrm-lightbox-nav:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

.mefrm-lightbox-counter {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 760;
    padding-top: 8px;
    opacity: 0.9;
}

.mefrm-lightbox-open {
    overflow: hidden !important;
}


/* ==========================================================================
   3. Scoped Modern Themes (Clean Catalog, Modern Marketplace, Editorial Studio)
   ========================================================================== */

/* Clean Catalog (Calm, friendly, straightforward) */
.mefrm-ui-theme--clean-catalog {
    --mefrm-accent: #2563eb;
    --mefrm-accent-dark: #1d4ed8;
    --mefrm-accent-soft: #eff6ff;
    --mefrm-radius-md: 12px;
    --mefrm-radius-lg: 16px;
}

/* Modern Marketplace (High visual discovery, vibrant, modern) */
.mefrm-ui-theme--modern-marketplace {
    --mefrm-accent: #4B16B5;
    --mefrm-accent-dark: #3A1090;
    --mefrm-accent-soft: #f5f0ff;
    --mefrm-accent-teal: #059669;
    --mefrm-radius-md: 16px;
    --mefrm-radius-lg: 22px;
    --mefrm-shadow-sm: 0 4px 20px rgba(75, 22, 181, 0.07);
    --mefrm-shadow-md: 0 12px 32px rgba(75, 22, 181, 0.10);
}

/* Editorial Studio (Spacious, elegant, editorial typography) */
.mefrm-ui-theme--editorial-studio {
    --mefrm-accent: #0f172a;
    --mefrm-accent-dark: #020617;
    --mefrm-accent-soft: #f1f5f9;
    --mefrm-accent-teal: #0284c7;
    --mefrm-radius-md: 10px;
    --mefrm-radius-lg: 14px;
    --mefrm-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.04);
    --mefrm-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.07);
}

/* ==========================================================================
   4. Breadcrumbs (Clean Catalog, Modern Marketplace, Editorial Studio)
   ========================================================================== */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 22px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--mefrm-muted);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-breadcrumbs a {
    color: #475569;
    text-decoration: none;
    transition: color 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-breadcrumbs a:hover {
    color: var(--mefrm-accent);
    text-decoration: underline;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-breadcrumb-sep {
    color: #94a3b8;
    font-size: 0.95rem;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-breadcrumb-current {
    color: var(--mefrm-text);
    font-weight: 600;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ==========================================================================
   5. Prototype Archive Hero & Discovery Engine
   ========================================================================== */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-archive-hero {
    text-align: center;
    padding: 32px 16px 28px;
    margin-bottom: 24px;
    background: linear-gradient(180deg, var(--mefrm-accent-soft) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: var(--mefrm-radius-lg, 20px);
}

.mefrm-ui-theme--clean-catalog .mefrm-archive-hero {
    background: #f8fafc;
    border: 1px solid var(--mefrm-border);
    padding: 36px 20px;
}

.mefrm-ui-theme--editorial-studio .mefrm-archive-hero {
    background: transparent;
    border-bottom: 1px solid var(--mefrm-border);
    border-radius: 0;
    padding: 44px 0 32px;
    text-align: left;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-hero-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 9999px;
    background: var(--mefrm-accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-hero-eyebrow {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mefrm-accent-teal, #0284c7);
    margin-bottom: 10px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-hero-title {
    margin: 0 0 10px;
    font-size: clamp(2rem, 5vw, 2.85rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--mefrm-text);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-hero-subtitle {
    margin: 0 auto 24px;
    max-width: 600px;
    font-size: 1.05rem;
    line-height: 1.55;
    color: #475569;
}

.mefrm-ui-theme--editorial-studio .mefrm-hero-subtitle {
    margin-left: 0;
}

/* Hero Search Box Form */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-hero-search-form {
    display: flex;
    justify-content: center;
    max-width: 540px;
    margin: 0 auto;
    width: 100%;
}

.mefrm-ui-theme--editorial-studio .mefrm-hero-search-form {
    margin-left: 0;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--mefrm-surface);
    border: 2px solid var(--mefrm-border);
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-input-wrap:focus-within {
    border-color: var(--mefrm-accent);
    box-shadow: 0 0 0 4px rgba(75, 22, 181, 0.12);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-icon {
    position: absolute;
    left: 16px;
    font-size: 1.05rem;
    color: var(--mefrm-muted);
    pointer-events: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-input-wrap input[type="search"] {
    width: 100%;
    padding: 13px 44px 13px 46px;
    border: none;
    background: transparent;
    font-size: 0.98rem;
    color: var(--mefrm-text);
    outline: none;
    font-family: inherit;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-clear {
    position: absolute;
    right: 76px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #f1f5f9;
    color: var(--mefrm-muted);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    transition: background 0.15s ease, color 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-clear:hover {
    background: #e2e8f0;
    color: var(--mefrm-text);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-submit {
    position: absolute;
    right: 6px;
    padding: 8px 16px;
    border-radius: 9999px;
    border: none;
    background: var(--mefrm-accent);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-search-submit:hover {
    background: var(--mefrm-accent-dark);
}

/* Category Chips Strip */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-category-chips-nav {
    margin: 0 0 20px;
    width: 100%;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-chips-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-category-chips {
    display: flex;
    gap: 8px;
    padding: 4px 2px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-category-chips::-webkit-scrollbar {
    display: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid var(--mefrm-border);
    background: var(--mefrm-surface);
    color: #475569;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-chip:hover {
    border-color: var(--mefrm-accent);
    color: var(--mefrm-accent);
    background: var(--mefrm-accent-soft);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-chip.is-active {
    background: var(--mefrm-accent);
    border-color: var(--mefrm-accent);
    color: #fff;
    box-shadow: 0 3px 10px rgba(75, 22, 181, 0.22);
}

/* Discovery Filter Toolbar */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-discovery-bar {
    margin: 0 0 24px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-filter-form--desktop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 18px;
    background: var(--mefrm-surface);
    border: 1px solid var(--mefrm-border);
    border-radius: var(--mefrm-radius-md, 14px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-editorial-search-inline {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-editorial-search-input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid var(--mefrm-border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--mefrm-text);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-filter-desktop-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid var(--mefrm-border);
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat calc(100% - 10px) center;
    color: var(--mefrm-text);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-select:focus-visible {
    border-color: var(--mefrm-accent);
    box-shadow: 0 0 0 3px rgba(75, 22, 181, 0.12);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-filter-submit {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: var(--mefrm-accent);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

/* Mobile Filter Disclosure Drawer */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-mobile-filter-disclosure {
    display: none;
    background: var(--mefrm-surface);
    border: 1px solid var(--mefrm-border);
    border-radius: var(--mefrm-radius-md, 14px);
    overflow: hidden;
    margin-bottom: 16px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-mobile-filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--mefrm-text);
    cursor: pointer;
    list-style: none;
    user-select: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-mobile-filter-toggle::-webkit-details-marker {
    display: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-mobile-filter-drawer {
    padding: 16px;
    border-top: 1px solid var(--mefrm-border);
    background: var(--mefrm-soft);
    display: grid;
    gap: 14px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-drawer-field {
    display: grid;
    gap: 6px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-drawer-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-drawer-field .mefrm-select {
    width: 100%;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-drawer-actions {
    display: grid;
    gap: 10px;
    margin-top: 4px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-drawer-apply {
    width: 100%;
    min-height: 46px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-drawer-clear {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ef4444;
    text-decoration: none;
}

/* Discovery Meta & Result Count */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-discovery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    padding: 0 4px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-result-summary {
    font-size: 0.92rem;
    font-weight: 600;
    color: #64748b;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-clear-filters-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ef4444;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-clear-filters-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   6. Modern 16:9 Resource Cards Grid (NO Image Scaling / Zoom on Hover)
   ========================================================================== */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 22px;
    margin: 0 0 36px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-resource-card {
    display: flex;
    flex-direction: column;
    background: var(--mefrm-surface);
    border: 1px solid var(--mefrm-border);
    border-radius: var(--mefrm-radius-md, 14px);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-resource-card:hover {
    transform: translateY(-3px);
    border-color: #cbd5e1;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

/* 16:9 Uncropped Featured Image Container — NO scaling on hover */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    overflow: hidden;
    text-decoration: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    object-position: center;
    background: #ffffff;
    /* Explicitly no transform scaling on hover */
    transform: none !important;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-image-wrap img {
    object-fit: contain;
    object-position: center;
    transform: none !important;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-price-tag {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-floating-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--mefrm-accent-dark);
    font-size: 0.72rem;
    font-weight: 750;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 18px 18px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-category {
    margin-bottom: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-category a {
    color: var(--mefrm-accent);
    text-decoration: none;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-category a:hover {
    text-decoration: underline;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-title {
    margin: 0 0 8px;
    font-size: 1.08rem;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-title a {
    color: var(--mefrm-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-title a:hover {
    color: var(--mefrm-accent-dark);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-excerpt {
    margin: 0 0 16px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #475569;
    flex: 1;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    gap: 8px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-price {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--mefrm-accent-dark);
    letter-spacing: -0.02em;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    border-radius: 8px;
    background: var(--mefrm-soft);
    border: 1px solid var(--mefrm-border);
    color: var(--mefrm-text);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-card-action:hover {
    background: var(--mefrm-accent);
    border-color: var(--mefrm-accent);
    color: #fff;
}

/* Category Badge Pill */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-category-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    background: var(--mefrm-accent-soft);
    color: var(--mefrm-accent-dark);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-pricing-mode-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: var(--mefrm-accent-soft);
    color: var(--mefrm-accent-dark);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-pricing-mode-pill--free {
    background: #e0f2f1;
    color: #00897B;
}

/* Empty State */
:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-empty-state {
    text-align: center;
    padding: 64px 20px;
    background: var(--mefrm-surface);
    border: 1px dashed var(--mefrm-border);
    border-radius: var(--mefrm-radius-lg, 20px);
    margin: 20px 0 40px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-empty-title {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 780;
    color: var(--mefrm-text);
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-empty-desc {
    margin: 0 0 20px;
    font-size: 0.95rem;
    color: #475569;
}

:is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-empty-action {
    display: inline-flex;
    width: auto;
    padding: 10px 24px;
    min-height: auto;
    border-radius: 9999px;
}


/* ==========================================================================
   7. Modern Single Resource Layouts
   ========================================================================== */

/* 2-Column Marketplace Layout (Modern Marketplace) */
.mefrm-ui-theme--modern-marketplace .mefrm-resource--modern-marketplace {
    max-width: 1120px;
}

.mefrm-ui-theme--modern-marketplace .mefrm-product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: start;
}

.mefrm-ui-theme--modern-marketplace .mefrm-resource-header--mobile-only {
    display: block;
}

.mefrm-ui-theme--modern-marketplace .mefrm-resource-header--desktop-only {
    display: none;
}

.mefrm-ui-theme--modern-marketplace .mefrm-sticky-card {
    background: var(--mefrm-surface);
    border: 1px solid var(--mefrm-border);
    border-radius: var(--mefrm-radius-lg, 20px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    padding: 26px 24px;
}

.mefrm-ui-theme--modern-marketplace .mefrm-price-box-sticky {
    display: grid;
    gap: 16px;
}

.mefrm-ui-theme--modern-marketplace .mefrm-price-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.mefrm-ui-theme--modern-marketplace .mefrm-price-value {
    font-size: 1.85rem;
    font-weight: 850;
    color: var(--mefrm-accent-dark);
    letter-spacing: -0.03em;
}

.mefrm-ui-theme--modern-marketplace .mefrm-quick-specs {
    list-style: none;
    margin: 8px 0 0;
    padding: 14px 0 0;
    border-top: 1px solid #f1f5f9;
    display: grid;
    gap: 8px;
    font-size: 0.84rem;
    color: #475569;
}

.mefrm-ui-theme--modern-marketplace .mefrm-quick-specs li {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Editorial Studio Layout (Prototype C) */
.mefrm-ui-theme--editorial-studio .mefrm-editorial-header {
    text-align: center;
    margin: 0 auto 32px;
    max-width: 840px;
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-eyebrow {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mefrm-accent-teal, #0284c7);
    text-decoration: none;
    margin-bottom: 10px;
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-eyebrow:hover {
    text-decoration: underline;
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-title {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 850;
    line-height: 1.12;
    letter-spacing: -0.035em;
    color: var(--mefrm-text);
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin: 28px 0 32px;
    padding: 18px 24px;
    background: var(--mefrm-soft);
    border: 1px solid var(--mefrm-border);
    border-radius: var(--mefrm-radius-md, 10px);
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-price-badge {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 1.35rem;
    color: var(--mefrm-text);
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-price-badge .mefrm-price-label-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--mefrm-muted);
}

.mefrm-ui-theme--editorial-studio .mefrm-editorial-price-badge strong {
    font-weight: 850;
    color: var(--mefrm-accent);
}

.mefrm-ui-theme--editorial-studio .mefrm-about--editorial {
    border-top: none;
    padding-top: 0;
}


/* ==========================================================================
   8. Keyframes & Animations
   ========================================================================== */
@keyframes mefrm-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes mefrm-scale-in {
    from { opacity: 0.7; transform: scale(0.985); }
    to   { opacity: 1; transform: scale(1); }
}


/* ==========================================================================
   9. Responsive Media Queries
   ========================================================================== */

/* Tablet & Desktop (>= 700px) */
@media (min-width: 700px) {
    .mefrm-resource-page {
        padding: 38px 24px 64px;
    }

    .mefrm-gallery {
        margin-bottom: 36px;
    }

    .mefrm-gallery-thumb {
        flex: 0 0 96px;
        height: 68px;
    }

    .mefrm-resource-header {
        margin-bottom: 30px;
    }

    .mefrm-about {
        padding: 30px 0 34px;
    }

    .mefrm-purchase-box {
        grid-template-columns: minmax(0, 1fr) minmax(0, auto);
        align-items: center;
        padding: 24px 26px;
    }

    .mefrm-purchase-actions {
        max-width: 280px;
    }

    .mefrm-related-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .mefrm-mobile-sticky {
        display: none;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-mobile-filter-disclosure {
        display: none;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-filter-form--desktop {
        display: flex;
    }
}

/* Desktop Grid & Marketplace 2-Column (>= 980px) */
@media (min-width: 980px) {
    .mefrm-resource-page {
        padding-top: 48px;
    }

    .mefrm-resource-title {
        font-size: 3rem;
    }

    .mefrm-ui-theme--modern-marketplace .mefrm-product-layout {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
        gap: 40px;
    }

    .mefrm-ui-theme--modern-marketplace .mefrm-resource-header--mobile-only {
        display: none;
    }

    .mefrm-ui-theme--modern-marketplace .mefrm-resource-header--desktop-only {
        display: block;
    }

    .mefrm-ui-theme--modern-marketplace .mefrm-product-sidebar {
        position: sticky;
        top: 24px;
    }

    .mefrm-related {
        margin-top: 64px;
        padding-top: 34px;
    }
}

/* Mobile Screens (<= 699px) */
@media (max-width: 699px) {
    .mefrm-resource-page {
        padding-left: 12px;
        padding-right: 12px;
        padding-bottom: 96px;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-filter-form--desktop {
        display: none;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-mobile-filter-disclosure {
        display: block;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-archive-hero {
        padding: 24px 12px 20px;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-hero-title {
        font-size: 1.85rem;
    }

    .mefrm-gallery {
        margin-left: 0;
        margin-right: 0;
    }

    .mefrm-gallery-stage {
        border-radius: 16px;
    }

    .mefrm-gallery-open {
        border-radius: 0;
    }

    .mefrm-gallery-image {
        border-radius: 0;
        max-height: 420px;
    }

    .mefrm-gallery-zoom-hint {
        right: 9px;
        bottom: 9px;
        padding: 7px 9px;
        font-size: 0.69rem;
    }

    .mefrm-gallery-thumbs {
        gap: 8px;
        padding: 10px 0 2px;
    }

    .mefrm-gallery-thumb {
        flex: 0 0 66px;
        height: 48px;
        border-radius: 8px;
    }

    .mefrm-gallery-thumb img {
        border-radius: 5px;
    }

    :is(.mefrm-ui-theme--clean-catalog, .mefrm-ui-theme--modern-marketplace, .mefrm-ui-theme--editorial-studio) .mefrm-resource-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .mefrm-purchase-box {
        padding: 16px;
        border-radius: 16px;
    }

    .mefrm-primary-button {
        min-height: 52px;
        padding: 12px 16px;
        border-radius: 12px;
        font-size: 0.95rem;
    }

    .mefrm-secondary-button {
        padding: 10px 14px;
        font-size: 0.88rem;
    }

    .mefrm-related {
        margin-top: 36px;
        padding-top: 22px;
    }

    .mefrm-related-grid {
        gap: 16px;
    }

    .mefrm-related-card {
        border-radius: 16px;
    }

    .mefrm-related-body {
        padding: 14px 15px 16px;
    }

    .mefrm-related-body h3,
    .mefrm-related-body h2 {
        font-size: 0.96rem;
        margin-bottom: 6px;
    }

    .mefrm-related-price {
        font-size: 0.92rem;
    }

    .mefrm-lightbox-dialog {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        padding-left: 3px;
        padding-right: 3px;
    }

    .mefrm-lightbox-nav {
        width: 36px;
        height: 46px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.07);
    }

    .mefrm-lightbox-image {
        max-height: calc(100vh - 74px);
        border-radius: 5px;
    }

    .mefrm-mobile-sticky {
        left: 8px;
        right: 8px;
        bottom: 8px;
        padding: 8px;
        gap: 8px;
        border-radius: 14px;
    }

    .mefrm-mobile-sticky-price {
        font-size: 0.84rem;
        padding-left: 4px;
    }

    .mefrm-mobile-sticky-button {
        min-height: 44px;
        padding: 9px 10px;
        border-radius: 10px;
        font-size: 0.85rem;
        gap: 6px;
    }
}

/* ==========================================================================
   How to Avail Payment Instructions Modal & Elements
   ========================================================================== */
html.mefrm-modal-open,
body.mefrm-modal-open {
    overflow: hidden !important;
}

html.mefrm-modal-open .mefrm-mobile-sticky {
    display: none !important;
}

.mefrm-avail-modal[hidden] {
    display: none !important;
}

.mefrm-avail-modal,
.mefrm-avail-modal * {
    box-sizing: border-box;
}

.mefrm-avail-modal {
    --mefrm-accent: #4B16B5;
    --mefrm-accent-dark: #3A1090;
    --mefrm-accent-soft: #f3eefa;
    --mefrm-accent-teal: #00897B;
    --mefrm-text: #14202b;
    --mefrm-muted: #667085;
    --mefrm-border: #e7edf1;
    --mefrm-soft: #f6f9fb;
    --mefrm-surface: #fff;
    --mefrm-shadow: 0 18px 50px rgba(15, 36, 50, 0.08);
    --mefrm-shadow-soft: 0 8px 26px rgba(15, 36, 50, 0.07);
    position: fixed !important;
    z-index: 1000000 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.mefrm-modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #0f172a;
    background: rgba(15, 23, 42, 0.82) !important;
    z-index: 1 !important;
}

.mefrm-modal-dialog {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    max-width: 720px !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    margin: auto !important;
    background-color: #ffffff !important;
    background: #ffffff !important;
    border-radius: 20px;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.08);
    isolation: isolate;
    box-sizing: border-box !important;
}

/* Sticky Header */
.mefrm-modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--mefrm-border);
    background-color: var(--mefrm-soft) !important;
    background: var(--mefrm-soft) !important;
    flex-shrink: 0;
}

.mefrm-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--mefrm-text);
    letter-spacing: -0.01em;
}

.mefrm-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    border: 1px solid var(--mefrm-border);
    background: #ffffff;
    color: var(--mefrm-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.mefrm-modal-close:hover,
.mefrm-modal-close:focus-visible {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    outline: none;
}

/* Scrollable Body */
.mefrm-modal-body {
    padding: 18px 22px 22px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #ffffff !important;
    background: #ffffff !important;
    flex: 1 1 auto;
    min-height: 0;
}

/* Combined Summary Card */
.mefrm-modal-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
}

.mefrm-modal-summary--support {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-color: #d8b4fe;
}

.mefrm-modal-summary-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.mefrm-modal-summary-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #166534;
    opacity: 0.85;
}

.mefrm-modal-summary--support .mefrm-modal-summary-eyebrow {
    color: #6b21a8;
}

.mefrm-modal-summary-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #166534;
    line-height: 1.3;
}

.mefrm-modal-summary--support .mefrm-modal-summary-title {
    color: #6b21a8;
}

.mefrm-modal-summary-price {
    flex-shrink: 0;
    text-align: right;
}

.mefrm-modal-summary-amount {
    font-size: 1.35rem;
    font-weight: 800;
    color: #166534;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.mefrm-modal-summary-support {
    font-size: 0.82rem;
    font-weight: 700;
    color: #6b21a8;
    line-height: 1.25;
    max-width: 120px;
    text-align: right;
}

.mefrm-selectable-text {
    user-select: all;
    -webkit-user-select: all;
}

/* 3-Stage Progress Indicator */
.mefrm-modal-stages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 8px 12px;
    background: var(--mefrm-soft);
    border: 1px solid var(--mefrm-border);
    border-radius: 10px;
}

.mefrm-stage {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--mefrm-text);
    white-space: nowrap;
}

.mefrm-stage-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--mefrm-accent);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}

.mefrm-stage-divider {
    display: block;
    width: 24px;
    height: 1px;
    background: var(--mefrm-border);
    margin: 0 8px;
    flex-shrink: 0;
}

/* Payment Section */
.mefrm-modal-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--mefrm-text);
    margin: 0 0 4px;
}

.mefrm-pm-section-help {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: var(--mefrm-muted);
    line-height: 1.35;
}

/* Payment Method Tabs */
.mefrm-pm-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.mefrm-pm-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 100px;
    border: 1.5px solid var(--mefrm-border);
    background: #ffffff;
    color: var(--mefrm-text);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.mefrm-pm-tab:hover {
    border-color: var(--mefrm-accent);
    color: var(--mefrm-accent);
}

.mefrm-pm-tab[aria-selected="true"] {
    background: var(--mefrm-accent);
    color: #ffffff;
    border-color: var(--mefrm-accent);
}

.mefrm-pm-tab:focus-visible {
    outline: 3px solid rgba(75, 22, 181, 0.3);
    outline-offset: 2px;
}

/* Payment Method Panels */
.mefrm-pm-panel[hidden] {
    display: none !important;
}

.mefrm-payment-methods-grid {
    display: grid;
    gap: 10px;
}

.mefrm-pm-display-card {
    background: #ffffff;
    border: 1px solid var(--mefrm-border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.mefrm-pm-display-header {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--mefrm-text);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--mefrm-soft);
}

.mefrm-pm-display-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    min-width: 0;
}

.mefrm-pm-info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
}

.mefrm-pm-info-label {
    color: var(--mefrm-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.mefrm-pm-num-copy-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--mefrm-soft);
    border: 1px solid var(--mefrm-border);
    border-radius: 7px;
    padding: 2px 4px 2px 8px;
    max-width: 100%;
}

.mefrm-pm-num-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--mefrm-text);
    background: transparent;
    padding: 0;
    border: none;
}

.mefrm-copy-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 5px;
    border: 1px solid var(--mefrm-border);
    background: #ffffff;
    color: var(--mefrm-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mefrm-copy-pill-btn:hover {
    background: var(--mefrm-accent);
    color: #ffffff;
    border-color: var(--mefrm-accent);
}

.mefrm-copy-pill-btn .mefrm-copied-text {
    display: none;
}

.mefrm-copy-pill-btn.is-copied {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}

.mefrm-copy-pill-btn.is-copied .mefrm-copy-text {
    display: none;
}

.mefrm-copy-pill-btn.is-copied .mefrm-copied-text {
    display: inline;
}
/* QR Code */
.mefrm-pm-qr-box {
    margin: 6px auto;
    text-align: center;
    max-width: 180px;
    background: #ffffff;
    padding: 6px;
    border: 1px solid var(--mefrm-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.mefrm-pm-qr-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--mefrm-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.mefrm-pm-qr-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.mefrm-pm-custom-notes {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--mefrm-muted);
    line-height: 1.35;
}

.mefrm-modal-empty-payment {
    padding: 14px;
    border: 1px dashed var(--mefrm-border);
    border-radius: 10px;
    background: var(--mefrm-soft);
    text-align: center;
}

.mefrm-modal-empty-payment p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--mefrm-muted);
}

/* Delivery Details Section */
.mefrm-modal-delivery {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mefrm-modal-email-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--mefrm-soft);
    border: 1px solid var(--mefrm-border);
    border-radius: 10px;
    padding: 12px 14px;
}

.mefrm-email-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.86rem;
    font-weight: 750;
    color: var(--mefrm-text);
}

.mefrm-required-star {
    color: #dc2626;
    font-weight: 800;
}

.mefrm-email-help-text {
    margin: 0;
    font-size: 0.76rem;
    color: var(--mefrm-muted);
    line-height: 1.35;
}

.mefrm-email-input-wrapper {
    position: relative;
    width: 100%;
    margin-top: 4px;
}

.mefrm-email-input {
    width: 100%;
    box-sizing: border-box;
    height: 42px;
    padding: 8px 12px;
    border: 1.5px solid var(--mefrm-border);
    border-radius: 8px;
    font-size: 0.92rem;
    color: var(--mefrm-text);
    background: #ffffff;
    transition: all 0.15s ease;
}

.mefrm-email-input:focus {
    border-color: var(--mefrm-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(75, 22, 181, 0.15);
}

.mefrm-email-input.is-invalid {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
    background: #fef2f2;
}

.mefrm-email-error-msg {
    margin: 4px 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #dc2626;
    line-height: 1.35;
}

.mefrm-email-error-msg[hidden] {
    display: none !important;
}

.mefrm-email-privacy-text {
    margin: 4px 0 0;
    font-size: 0.72rem;
    color: var(--mefrm-muted);
    line-height: 1.3;
}

/* Copy Message Actions (Desktop inline) */
.mefrm-modal-copy-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.mefrm-copy-msg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 18px;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 10px;
    border: 2px solid var(--mefrm-accent);
    background: #ffffff;
    color: var(--mefrm-accent);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mefrm-copy-msg-btn:hover {
    background: var(--mefrm-accent-soft);
}

.mefrm-copy-msg-btn .mefrm-copied-text {
    display: none;
}

.mefrm-copy-msg-btn.is-copied {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}

.mefrm-copy-msg-btn.is-copied .mefrm-copy-text {
    display: none;
}

.mefrm-copy-msg-btn.is-copied .mefrm-copied-text {
    display: inline;
}

/* Messenger Block */
.mefrm-modal-messenger-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.mefrm-messenger-caption {
    margin: 0;
    font-size: 0.76rem;
    color: var(--mefrm-muted);
    line-height: 1.35;
}

.mefrm-modal-messenger-cta {
    width: 100%;
    min-height: 46px;
    font-size: 0.92rem;
    justify-content: center;
}

/* Sticky Footer */
.mefrm-modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: #ffffff;
    border-top: 1px solid var(--mefrm-border);
    flex-shrink: 0;
}

.mefrm-footer-copy-msg {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    border: 2px solid var(--mefrm-accent);
    background: #ffffff;
    color: var(--mefrm-accent);
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 44px;
}

.mefrm-footer-copy-msg:hover {
    background: var(--mefrm-accent-soft);
}

.mefrm-footer-copy-msg .mefrm-copied-text {
    display: none;
}

.mefrm-footer-copy-msg.is-copied {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}

.mefrm-footer-copy-msg.is-copied .mefrm-copy-text {
    display: none;
}

.mefrm-footer-copy-msg.is-copied .mefrm-copied-text {
    display: inline;
}

.mefrm-footer-messenger {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 10px;
    border: 1px solid transparent;
    background: linear-gradient(135deg, #4B16B5 0%, #3A1090 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 44px;
}

.mefrm-footer-messenger:hover {
    background: linear-gradient(135deg, #3A1090 0%, #2C0C6C 100%);
}

.mefrm-footer-messenger.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mefrm-footer-messenger svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Modal theme refinements */
.mefrm-ui-theme--clean-catalog .mefrm-modal-dialog {
    border-radius: 14px;
}
.mefrm-ui-theme--editorial-studio .mefrm-modal-dialog {
    border-radius: 12px;
}

/* ========================================================================
   Mobile (≤ 600px)
   ========================================================================== */
@media (max-width: 600px) {
    .mefrm-avail-modal {
        padding: 6px !important;
    }
    .mefrm-modal-dialog {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 94vh !important;
        max-height: 94dvh !important;
        border-radius: 16px;
    }
    .mefrm-modal-header {
        padding: 12px 14px;
    }
    .mefrm-modal-title {
        font-size: 1rem;
    }
    .mefrm-modal-close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 22px;
    }
    .mefrm-modal-body {
        padding: 12px 14px 16px;
        gap: 12px;
    }
    .mefrm-modal-summary {
        padding: 10px 12px;
        gap: 8px;
    }
    .mefrm-modal-summary-title {
        font-size: 0.88rem;
    }
    .mefrm-modal-summary-amount {
        font-size: 1.15rem;
    }
    .mefrm-modal-stages {
        padding: 6px 10px;
    }
    .mefrm-stage {
        font-size: 0.72rem;
    }
    .mefrm-stage-num {
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
    }
    .mefrm-stage-divider {
        width: 16px;
        margin: 0 4px;
    }
    .mefrm-pm-section-help {
        font-size: 0.78rem;
        margin: 0 0 8px;
    }
    .mefrm-pm-tab {
        padding: 6px 12px;
        font-size: 0.78rem;
    }
    .mefrm-pm-display-card {
        padding: 10px 12px;
    }
    .mefrm-modal-email-block {
        padding: 10px 12px;
    }
    .mefrm-email-input {
        height: 38px;
        font-size: 0.88rem;
    }
    .mefrm-pm-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .mefrm-pm-num-copy-wrap {
        width: 100%;
        justify-content: space-between;
    }
    .mefrm-pm-qr-box {
        max-width: 160px;
    }
    /* Hide duplicate inline actions on mobile — use sticky footer exclusively */
    .mefrm-modal-copy-actions,
    .mefrm-modal-messenger-cta {
        display: none !important;
    }
    .mefrm-modal-messenger-block {
        gap: 0;
        margin-top: -4px;
    }
    .mefrm-modal-footer {
        padding: 10px 14px;
        gap: 6px;
    }
    .mefrm-footer-copy-msg,
    .mefrm-footer-messenger {
        padding: 9px 10px;
        font-size: 0.8rem;
        min-height: 44px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mefrm-gallery-image,
    .mefrm-gallery-thumb,
    .mefrm-primary-button,
    .mefrm-secondary-button,
    .mefrm-mobile-sticky-button,
    .mefrm-features-toggle,
    .mefrm-related-card,
    .mefrm-related-image img,
    .mefrm-lightbox,
    .mefrm-lightbox-image,
    .mefrm-avail-modal,
    .mefrm-pm-tab,
    .mefrm-copy-msg-btn,
    .mefrm-footer-copy-msg,
    .mefrm-footer-messenger {
        transition: none !important;
        animation: none !important;
    }
}
