/* ============================================================================
   msera-offers.css — Product Offers & Pricing presentation layer (ADDITIVE)
   ----------------------------------------------------------------------------
   Styles the badge stack, struck MRP / sale price / save amount, product
   labels and the flash-sale countdown produced by ms_engine.php helpers
   (ms_offer_badges / ms_offer_price_html / ms_offer_labels_html /
   ms_offer_flash_html). Mobile-first; on-brand forest + gold + cream.
   Class-namespaced (ms-*) so it never collides with existing card CSS.
   ========================================================================== */

:root {
    --ms-forest: #0E2A1B;
    --ms-gold:   #C9A227;
    --ms-cream:  #F7F3EE;
    --ms-sale:   #E05B5B;
    --ms-save:   #1E7B45;
}

/* ── Badge stack (top-left of product image) ─────────────────────────────── */
.ms-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    pointer-events: none;
}
.ms-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.15;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    font-family: inherit;
}
/* Custom badge keeps the exact text/case the admin typed (e.g. "Buy 1 Get 1"). */
.ms-badge-custom   { background: var(--ms-forest); color: #fff; }
/* System badges read as labels → uppercase. */
.ms-badge-disc,
.ms-badge-stock,
.ms-badge-out_of_stock,
.ms-badge-coming_soon,
.ms-badge-pre_order { text-transform: uppercase; letter-spacing: 0.04em; }
.ms-badge-disc     { background: var(--ms-sale);   color: #fff; }
.ms-badge-stock    { background: #6b7280;          color: #fff; }
.ms-badge-out_of_stock { background: var(--ms-sale); color: #fff; }   /* soft coral, matches reference */
.ms-badge-coming_soon  { background: #1565c0; color: #fff; }
.ms-badge-pre_order    { background: var(--ms-gold); color: #1a1a1a; }

/* ── Price block (struck MRP + selling price + save) ─────────────────────── */
.ms-price {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1.1;
}
.ms-price-now {
    font-size: 1em;
    font-weight: 700;
    color: var(--ms-forest);
}
.ms-price-mrp {
    font-size: 0.74em;
    color: #9aa39c;
    text-decoration: line-through;
    font-weight: 500;
}
.ms-price-save {
    font-size: 0.66em;
    font-weight: 700;
    color: var(--ms-save);
    background: rgba(30, 123, 69, 0.10);
    border-radius: 5px;
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* ── Product labels (Organic, Single Estate, …) ──────────────────────────── */
.ms-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 4px 0 2px;
}
.ms-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #5b6b5f;
    background: var(--ms-cream);
    border: 1px solid #e4ddcf;
    border-radius: 20px;
    padding: 2px 9px;
    line-height: 1.4;
}

/* ── Flash-sale countdown ────────────────────────────────────────────────── */
.ms-flash {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #1a3a28, #0E2A1B);
    color: var(--ms-cream);
    border-radius: 10px;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 12px;
}
.ms-flash-label {
    font-weight: 600;
    letter-spacing: 0.03em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ms-flash-label i { color: var(--ms-gold); }
.ms-flash-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.06em;
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    padding: 3px 9px;
    border-radius: 6px;
}
.ms-flash.ms-flash--ended { display: none !important; }

/* Compact inline countdown (used on small cards) */
.ms-flash--mini {
    padding: 5px 9px;
    margin: 6px 0 0;
    font-size: 11px;
}
.ms-flash--mini .ms-flash-clock { font-size: 12.5px; padding: 2px 7px; }

/* ── Shop-card gram selector ─────────────────────────────────────────────── */
.ms-grams {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 6px 0 2px;
}
.ms-gram {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e0d8c8;
    background: #f7f3ee;
    color: #2d5016;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1.2;
    text-decoration: none;
}
.ms-gram:hover { border-color: var(--ms-gold); }
.ms-gram.active { background: var(--ms-forest); color: #fff; border-color: var(--ms-forest); }
.ms-card-img { transition: opacity 0.2s ease; }

/* ── PDP cross-product size selector (linked separate products) ──────────── */
.ms-size-pick { margin: 16px 0; }
.ms-size-opts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.ms-size-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 72px;
    padding: 9px 14px;
    border: 1.5px solid #e0d8c8;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ms-forest);
    background: #fff;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.ms-size-opt:hover { border-color: var(--ms-gold); }
.ms-size-opt.active { border-color: var(--ms-forest); background: var(--ms-forest); color: #fff; }
.ms-size-opt-w  { font-weight: 700; font-size: 13px; }
.ms-size-opt-pr { font-size: 12px; opacity: 0.85; }

/* ── Card-level helpers ──────────────────────────────────────────────────── */
.ms-card-soldout img { filter: grayscale(55%) opacity(0.85); }

/* On the homepage Popular rail the offer badge stays top-left (consistent
   everywhere) — push the "#N Popular" rank ribbon to the top-right instead. */
.ms-pop-card .ms-pop-rank { left: auto !important; right: 12px !important; }
.ms-pop-price .ms-price-mrp { margin-right: 4px; }

/* Recently Viewed rail — offer badge top-left on the thumbnail. */
.ms-rv-thumb { position: relative; }
.ms-rv-thumb .ms-badges { top: 8px; left: 8px; }
.ms-rv-thumb .ms-badge { font-size: 9px; padding: 3px 7px; }

/* ── Image safety net — responsive, never overflow on any device ─────────── */
.ms-card-img, .ms-rv-thumb img, .ms-fbt-thumb img { max-width: 100%; }
.ms-grams, .ms-size-opts, .ms-price { max-width: 100%; }

@media (max-width: 600px) {
    .ms-badge { font-size: 9.5px; padding: 3px 8px; }
    .ms-badges { top: 8px; left: 8px; gap: 5px; }
    .ms-flash { padding: 7px 10px; font-size: 11px; }
    /* keep gram pills + size options tappable but compact on small cards */
    .ms-gram { font-size: 11px; padding: 5px 11px; }
    .ms-size-opt { min-width: 64px; padding: 8px 12px; flex: 1 1 auto; }
}
@media (max-width: 400px) {
    .ms-grams { gap: 4px; }
    .ms-price-save { font-size: 0.6em; padding: 2px 5px; }
}
