/* ZYM Products Plugin — Stylesheet
 * BEM naming, mobile-first, no external dependencies.
 */

/* ── Custom properties ─────────────────────────────────────────────────────── */
:root {
    --zym-primary:      #3BB4BD;
    --zym-primary-dk:   #2a9aa3;
    --zym-accent:       #1A4FBF;   /* selected variant button; overridden via inline style from settings */
    --zym-discount:     #EF4444;   /* discount badge; overridden via inline style from settings */
    --zym-text:         #1a1a1a;
    --zym-muted:        #888;
    --zym-border:       #e8e8e8;
    --zym-bg-soft:      #f8f9fa;
    --zym-radius-sm:    6px;
    --zym-radius-md:    10px;
    --zym-radius-lg:    16px;
    --zym-radius-badge: 6px;       /* all tag/badge elements share this */
    --zym-shadow:       0 2px 12px rgba(0,0,0,.08);
}

/* ── Container ─────────────────────────────────────────────────────────────── */
.zym-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

@media (min-width: 900px) {
    .zym-container {
        max-width: 1200px;
        padding: 0 24px 64px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   Product Detail Page — 2-column layout on desktop
══════════════════════════════════════════════════════════════════════════════ */

/* Mobile: single column */
.zym-product__layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* Desktop: image left, detail right */
@media (min-width: 900px) {
    .zym-product__layout {
        grid-template-columns: 1fr 1fr;
        gap: 48px;
        align-items: start;
    }
    .zym-product__media {
        position: sticky;
        top: 24px;
    }
}

/* ── Gallery ───────────────────────────────────────────────────────────────── */
.zym-gallery {
    position: relative;
    background: var(--zym-bg-soft);
    border-radius: var(--zym-radius-lg);
    overflow: hidden;
}

.zym-gallery__track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.zym-gallery__track::-webkit-scrollbar { display: none; }

/* Slide — fixed height, background covers the box */
.zym-gallery__slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    position: relative;
    height: 260px;
}

@media (min-width: 900px) {
    .zym-gallery__slide { height: 340px; }
}

/* Background-cover fill — clickable → lightbox */
.zym-gallery__bg {
    position: absolute;
    inset: 0;
    background-size: contain;
    background-position: top center;
    background-repeat: no-repeat;
    cursor: zoom-in;
    transition: transform .3s;
    aspect-ratio: 3 / 4;
}
.zym-gallery__bg:hover { transform: scale(1.025); }

/* ── Thumbnail strip ───────────────────────────────────────────────────────── */
.zym-thumbs {
    margin-top: 8px;
}

.zym-thumbs__track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0 4px;
}
.zym-thumbs__track::-webkit-scrollbar { display: none; }

.zym-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: var(--zym-radius-sm);
    border: 2px solid var(--zym-border);
    overflow: hidden;
    padding: 0;
    background: var(--zym-bg-soft);
    cursor: pointer;
    transition: border-color .15s;
}
.zym-thumb.is-active { border-color: var(--zym-accent, #1A4FBF); }
.zym-thumb:hover:not(.is-active) { border-color: var(--zym-muted); }

.zym-thumb__img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ── Lightbox ──────────────────────────────────────────────────────────────── */
.zym-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.zym-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.zym-lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--zym-radius-md);
    transform: scale(.95);
    transition: transform .25s;
    display: block;
}
.zym-lightbox.is-open .zym-lightbox__img { transform: scale(1); }

.zym-lightbox__close,
.zym-lightbox__prev,
.zym-lightbox__next {
    position: fixed;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.18);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 1;
}
.zym-lightbox__close:hover,
.zym-lightbox__prev:hover,
.zym-lightbox__next:hover { background: rgba(255,255,255,.32); }

.zym-lightbox__close { top: 16px; right: 16px; }
.zym-lightbox__prev  { left: 16px;  top: 50%; transform: translateY(-50%); }
.zym-lightbox__next  { right: 16px; top: 50%; transform: translateY(-50%); }
.zym-lightbox__prev[hidden],
.zym-lightbox__next[hidden] { display: none; }

/* ── Product info ──────────────────────────────────────────────────────────── */
.zym-product__info {
    padding: 16px 0 8px;
}

/* ── Tags / Badges — all share --zym-radius-badge ─────────────────────────── */
.zym-condition-wrap {
    margin-bottom: 8px;
}

.zym-condition {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--zym-radius-badge);
    border: 1px solid var(--zym-border);
    font-size: 12px;
    color: var(--zym-muted);
    background: #fff;
}

.zym-discount-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: var(--zym-discount);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--zym-radius-badge);
    letter-spacing: .3px;
}

/* ── Product header ────────────────────────────────────────────────────────── */
.zym-product__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.zym-product__name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--zym-text);
    margin: 0;
    flex: 1;
}

@media (min-width: 600px) {
    .zym-product__name { font-size: 24px; }
}

/* Share button */
.zym-share-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--zym-border);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--zym-muted);
    transition: border-color .2s, color .2s;
}
.zym-share-btn:hover {
    border-color: var(--zym-primary);
    color: var(--zym-primary);
}

/* ── Pricing ───────────────────────────────────────────────────────────────── */
.zym-pricing {
    margin-bottom: 20px;
}

.zym-pricing__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.zym-price {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

@media (min-width: 600px) {
    .zym-price { font-size: 32px; }
}

.zym-price-original {
    font-size: 13px;
    color: var(--zym-muted);
    text-decoration: line-through;
}

.zym-pricing__member {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zym-member-label {
    font-size: 13px;
    color: var(--zym-muted);
}

.zym-member-value {
    font-size: 15px;
    font-weight: 700;
}

/* ── Variant selectors ─────────────────────────────────────────────────────── */
.zym-variants {
    margin-bottom: 8px;
}

.zym-variant-group {
    margin-bottom: 16px;
}

.zym-variant-group__label {
    font-size: 14px;
    color: var(--zym-text);
    margin: 0 0 10px;
}

.zym-variant-group__label strong {
    font-weight: 600;
}

.zym-variant-group__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.zym-variant-btn {
    padding: 7px 16px;
    border-radius: var(--zym-radius-sm);
    border: 1.5px solid var(--zym-border);
    background: #fff;
    color: var(--zym-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
    line-height: 1.4;
}

.zym-variant-btn:hover:not(:disabled) {
    border-color: var(--zym-accent);
}

.zym-variant-btn.is-selected {
    background: var(--zym-accent);
    border-color: var(--zym-accent);
    color: #fff;
}

.zym-variant-btn.is-out-of-stock,
.zym-variant-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* ── Accordions ────────────────────────────────────────────────────────────── */
.zym-accordions {
    margin-top: 8px;
    border-top: 1px solid var(--zym-border);
}

.zym-accordion {
    border-bottom: 1px solid var(--zym-border);
}

.zym-accordion__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--zym-text);
    text-align: left;
}

.zym-accordion__chevron {
    flex-shrink: 0;
    transition: transform .25s;
}

.zym-accordion__trigger.is-open .zym-accordion__chevron {
    transform: rotate(180deg);
}

.zym-accordion__body {
    padding-bottom: 20px;
    animation: zymFadeIn .2s ease;
}

@keyframes zymFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Description HTML */
.zym-description {
    font-size: 14px;
    line-height: 1.7;
    color: #444;
}
.zym-description img {
    max-width: 100%;
    height: auto;
    border-radius: var(--zym-radius-sm);
    margin: 8px 0;
}
.zym-description ul,
.zym-description ol {
    padding-left: 20px;
}
.zym-description li {
    margin-bottom: 4px;
}
.zym-description h2 {
    font-size: 24px;
}

/* Spec table */
.zym-spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.zym-spec-table tr {
    border-bottom: 1px solid var(--zym-border);
}
.zym-spec-table td {
    padding: 11px 4px;
    vertical-align: top;
}
.zym-spec-table__key {
    width: 45%;
    color: var(--zym-muted);
    font-size: 13px;
}
.zym-spec-table__val {
    color: var(--zym-text);
    font-weight: 500;
}

/* ── Share toast ───────────────────────────────────────────────────────────── */
.zym-share-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1a1a2e;
    color: #fff;
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 9999;
    white-space: nowrap;
}
.zym-share-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ══════════════════════════════════════════════════════════════════════════════
   Categories Shortcode
══════════════════════════════════════════════════════════════════════════════ */
.zym-categories {
    padding: 8px 0;
}

.zym-category {
    margin-bottom: 24px !important;
    padding: 0 !important;         /* override theme section padding */
}

.zym-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.zym-category__name {
    font-size: 20px;
    font-weight: 700;
    color: var(--zym-text);
    margin: 0;
}

/* Product grid — 2 columns on mobile, 3 on tablet, 4 on desktop */
.zym-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .zym-product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}
@media (min-width: 960px) {
    .zym-product-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
}

/* Product card */
.zym-product-card {
    display: block;
    border-radius: var(--zym-radius-md);
    background: #fff;
    box-shadow: var(--zym-shadow);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s, transform .2s;
}
a.zym-product-card:hover,
.zym-product-card[data-zym-modal]:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.13);
    transform: translateY(-2px);
}
.zym-product-card[data-zym-modal] {
    cursor: pointer;
}

/* Thumbnail via background-image — fills full card area */
.zym-product-card__image-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background-color: var(--zym-bg-soft);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Tag badge — top right */
.zym-tag-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: var(--zym-radius-badge);
    background: var(--zym-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    line-height: 1.4;
}

/* Discount badge — bottom left */
.zym-product-card__image-wrap .zym-discount-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    font-size: 10px;
}

.zym-product-card__body {
    padding: 10px 12px 14px;
}

.zym-product-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--zym-text);
    margin: 0 0 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.zym-product-card__pricing {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.zym-product-card__original {
    font-size: 11px;
    color: var(--zym-muted);
    text-decoration: line-through;
}

.zym-product-card__price {
    font-size: 14px;
    font-weight: 700;
}

/* ── Member Price Banner ────────────────────────────────────────────────────── */
.zym-member-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    margin: 16px 0 8px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    transition: box-shadow .2s, border-color .2s;
}
.zym-member-banner:hover {
    border-color: #b6c6e0;
    box-shadow: 0 3px 10px rgba(26,79,191,.1);
}
.zym-member-banner:active { transform: scale(.99); }
.zym-member-banner__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.zym-member-banner__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.zym-member-banner__title {
    font-size: 15px;
    font-weight: 700;
    color: #1A4FBF;
    line-height: 1.3;
}
.zym-member-banner__sub {
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}
.zym-member-banner__chevron {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* ── App Download Modal ─────────────────────────────────────────────────────── */
.zym-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.zym-modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.zym-modal {
    background: #fff;
    border-radius: var(--zym-radius-lg);
    padding: 32px 28px 28px;
    max-width: 380px;
    width: 100%;
    position: relative;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    text-align: center;
    transform: translateY(16px) scale(.97);
    transition: transform .25s;
}
.zym-modal-overlay.is-open .zym-modal {
    transform: translateY(0) scale(1);
}

.zym-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--zym-bg-soft);
    color: var(--zym-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.zym-modal__close:hover { background: var(--zym-border); color: var(--zym-text); }

.zym-modal__icon {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--zym-primary), var(--zym-cta-color, #1A4FBF));
    border-radius: var(--zym-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}

.zym-modal__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--zym-text);
    margin: 0 0 8px;
}

.zym-modal__subtitle {
    font-size: 14px;
    color: var(--zym-muted);
    line-height: 1.6;
    margin: 0 0 24px;
}

.zym-app-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.zym-app-badge-link {
    display: inline-block;
    transition: opacity .15s, transform .1s;
}
.zym-app-badge-link:hover  { opacity: .88; transform: translateY(-1px); }
.zym-app-badge-link:active { transform: translateY(0); }
.zym-app-badge-link img    { display: block; height: 48px; width: auto; }

/* ── Notices ───────────────────────────────────────────────────────────────── */
.zym-notice {
    padding: 16px;
    background: var(--zym-bg-soft);
    border-left: 3px solid var(--zym-primary);
    border-radius: var(--zym-radius-sm);
    font-size: 14px;
    color: var(--zym-muted);
}
