/**
 * Modern Shop Theme — theme-v13.css (PATCH v1.3)
 * ------------------------------------------------------------------
 * New components in this patch:
 *   1) Dark/light toggle pill (header, before the user button)
 *   2) Flash-sale card rework — discount pill + BIG full-width countdown
 *      (with day support). No more diagonal ribbon over the timer.
 *   3) Categories showcase (icon bubbles under the feature boxes)
 *   4) Product-card upgrades — wishlist heart + star pill on the image +
 *      summary line under the title
 *   5) Reviews section on the product page (summary, distribution bars,
 *      review cards, star-picker form)
 *   6) Wishlist page (guest prompt + cards with remove buttons)
 *
 * Uses the theme design tokens (see style.css :root / dark.css .dark-mode)
 * so everything adapts to dark mode automatically.
 * ------------------------------------------------------------------ */

/* ==================================================================
 * 1) DARK / LIGHT TOGGLE (header)
 * ================================================================== */
.ms-theme-toggle {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    flex: 0 0 auto;
}
.ms-theme-toggle__track {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: 72px;
    height: 34px;
    border-radius: 40px;
    padding: 0 9px;
    background: linear-gradient(135deg, #FDB813 0%, #FF8C42 100%);
    box-shadow: 0 6px 16px rgba(251, 176, 19, 0.35);
    transition: background .35s ease, box-shadow .35s ease;
    box-sizing: border-box;
}
.ms-theme-toggle__icon {
    font-size: 0.8rem;
    color: #fff;
    z-index: 1;
    transition: opacity .3s ease, transform .3s ease;
}
.ms-theme-toggle__icon--sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.ms-theme-toggle__icon--moon { opacity: .45; transform: rotate(-30deg) scale(.82); }
.ms-theme-toggle__thumb {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    transition: right .35s cubic-bezier(.68,-0.55,.27,1.55);
}
/* dark state — moon active, cool palette, thumb slides to the other side */
body.dark-mode .ms-theme-toggle__track {
    background: linear-gradient(135deg, #3B82F6 0%, #1E293B 100%);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}
body.dark-mode .ms-theme-toggle__icon--sun  { opacity: .45; transform: rotate(30deg) scale(.82); }
body.dark-mode .ms-theme-toggle__icon--moon { opacity: 1; transform: rotate(0deg) scale(1); }
body.dark-mode .ms-theme-toggle__thumb { right: calc(100% - 31px); }

@media (max-width: 640px) {
    .ms-theme-toggle__track { width: 60px; height: 30px; }
    .ms-theme-toggle__thumb { width: 24px; height: 24px; }
    body.dark-mode .ms-theme-toggle__thumb { right: calc(100% - 27px); }
}

/* ==================================================================
 * 2) FLASH-SALE CARD REWORK
 * ================================================================== */
.ms-flash-card .ms-flash-ribbon { display: none !important; } /* legacy ribbon gone */

.ms-flash-toprow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.ms-flash-off {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 6px 16px rgba(255, 46, 99, 0.35);
    white-space: nowrap;
}

.ms-flash-timer-row {
    background: var(--thumb-bg, #F8FAFC);
    border: 1px dashed var(--card-border-strong, #E2E8F0);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.ms-flash-timer-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted, #64748B);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.ms-flash-timer { gap: 5px; }
.ms-flash-timer .timer-unit {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    color: #fff;
    min-width: 44px;
    padding: 9px 6px;
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 900;
    text-align: center;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.35), 0 4px 10px rgba(0,0,0,0.18);
    font-variant-numeric: tabular-nums;
}
.ms-flash-timer .timer-sep {
    color: var(--text-muted, #64748B);
    font-weight: 900;
    font-size: 1.05rem;
    align-self: center;
}
.ms-flash-timer-note {
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--primary, #FF2E63);
    white-space: nowrap;
}
/* hero-side-card legacy .timer-unit override keeps old markup intact */
.hero-side-card .timer-box .timer-unit { display: inline-block; }
/* when JS ticks below a day, hidden day-unit must not leave a gap */
.ms-flash-timer .timer-unit.timer-hidden,
.ms-flash-timer .timer-sep.timer-hidden { display: none; }

@media (max-width: 400px) {
    .ms-flash-timer .timer-unit { min-width: 38px; font-size: 1rem; padding: 7px 4px; }
}

/* ==================================================================
 * 3) CATEGORIES SHOWCASE
 * ================================================================== */
.ms-cat-showcase { margin: 34px 0 10px; }

.ms-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}
.ms-cat-card {
    --cat-grad: linear-gradient(135deg, #FF2E63 0%, #FF6B6B 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
    overflow: hidden;
}
.ms-cat-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--cat-grad);
    opacity: 0;
    transition: opacity .3s ease;
}
.ms-cat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover-card);
    border-color: var(--card-border-strong);
}
.ms-cat-card:hover::before { opacity: 1; }

.ms-cat-icon {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    background: var(--cat-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    box-shadow: 0 10px 22px rgba(255, 46, 99, 0.28);
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.ms-cat-card:hover .ms-cat-icon { transform: scale(1.1) rotate(-6deg); }

/* varied gradient per card — subtle, chic */
.ms-cat-card:nth-child(5n+2) { --cat-grad: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%); }
.ms-cat-card:nth-child(5n+2) .ms-cat-icon { box-shadow: 0 10px 22px rgba(124, 58, 237, 0.28); }
.ms-cat-card:nth-child(5n+3) { --cat-grad: linear-gradient(135deg, #08D9D6 0%, #0EA5E9 100%); }
.ms-cat-card:nth-child(5n+3) .ms-cat-icon { box-shadow: 0 10px 22px rgba(8, 217, 214, 0.28); }
.ms-cat-card:nth-child(5n+4) { --cat-grad: linear-gradient(135deg, #F59E0B 0%, #F97316 100%); }
.ms-cat-card:nth-child(5n+4) .ms-cat-icon { box-shadow: 0 10px 22px rgba(245, 158, 11, 0.28); }
.ms-cat-card:nth-child(5n+5) { --cat-grad: linear-gradient(135deg, #10B981 0%, #34D399 100%); }
.ms-cat-card:nth-child(5n+5) .ms-cat-icon { box-shadow: 0 10px 22px rgba(16, 185, 129, 0.28); }

.ms-cat-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-strong);
    text-align: center;
    line-height: 1.5;
}
.ms-cat-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--thumb-bg, #F8FAFC);
    padding: 3px 10px;
    border-radius: 20px;
}
.ms-cat-count--soon { color: #94A3B8; }

/* ==================================================================
 * 4) PRODUCT CARD — heart + stars + summary
 * ================================================================== */
.product-card .product-thumb { position: relative; }

.ms-wish-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.95);
    color: #94A3B8;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
    transition: transform .25s ease, color .25s ease, background .25s ease;
}
.ms-wish-btn:hover {
    transform: scale(1.12);
    color: var(--primary, #FF2E63);
}
.ms-wish-btn.is-active {
    color: #fff;
    background: var(--primary-gradient);
    animation: msHeartPop .45s cubic-bezier(.34,1.56,.64,1);
}
.ms-wish-btn.is-active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 46, 99, 0.35);
    animation: msHeartRing 1.6s ease-out infinite;
}
@keyframes msHeartPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.35); }
    100% { transform: scale(1); }
}
@keyframes msHeartRing {
    0% { transform: scale(.9); opacity: .8; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* bigger heart on the product page gallery */
.ms-wish-btn--lg {
    width: 46px;
    height: 46px;
    font-size: 1.25rem;
    top: 14px;
    left: 14px;
    z-index: 4;
}

/* star pill on the card image */
.ms-card-stars {
    position: absolute;
    bottom: 8px;
    right: 8px;
    left: 8px;
    z-index: 2;
    display: flex;
    justify-content: center;
    pointer-events: none;
}
.ms-card-stars .ms-stars {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    border-radius: 30px;
    padding: 4px 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    direction: ltr;
}
body.dark-mode .ms-card-stars .ms-stars {
    background: rgba(22, 28, 40, 0.92);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* generic star-rating widget */
.ms-stars { display: inline-flex; align-items: center; gap: 3px; color: #F59E0B; }
.ms-stars .fa-star, .ms-stars .fa-star-half-stroke { color: #F59E0B; }
.ms-stars .fa-regular.fa-star { color: #CBD5E1; }
body.dark-mode .ms-stars .fa-regular.fa-star { color: #475569; }
.ms-stars--card .fa-star, .ms-stars--card .fa-star-half-stroke { font-size: 0.7rem; }
.ms-stars--card .ms-stars__num { font-size: 0.7rem; font-weight: 900; color: var(--text-strong); margin-right: 2px; }
.ms-stars--product .fa-star, .ms-stars--product .fa-star-half-stroke { font-size: 1.05rem; }
.ms-stars--product .ms-stars__num { font-size: 0.95rem; font-weight: 900; color: var(--text-strong); }
.ms-stars--product .ms-stars__count { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.ms-stars--summary .fa-star, .ms-stars--summary .fa-star-half-stroke { font-size: 1rem; }

/* summary line under the card title */
.ms-card-excerpt {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.7;
    margin: -6px 0 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* rating row on the product page (under the h1) */
.ms-product-rating-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.ms-product-rating-link {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px dashed var(--text-muted);
    padding-bottom: 1px;
}
.ms-product-rating-link:hover { color: var(--primary); border-color: var(--primary); }

/* ==================================================================
 * 5) REVIEWS SECTION (product page)
 * ================================================================== */
.ms-reviews { margin-top: 48px; }
.ms-reviews__layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: start;
}
.ms-reviews__summary {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: sticky;
    top: 96px;
}
.ms-reviews__avg { text-align: center; padding-bottom: 14px; border-bottom: 1px dashed var(--card-border); }
.ms-reviews__avg-num {
    display: block;
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--text-strong);
    line-height: 1.1;
}
.ms-reviews__avg-max { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; display: block; margin-bottom: 6px; }
.ms-reviews__avg .ms-stars { justify-content: center; display: flex; margin-bottom: 6px; }
.ms-reviews__avg-count { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; }

.ms-reviews__dist { padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.ms-reviews__dist-row { display: flex; align-items: center; gap: 8px; }
.ms-reviews__dist-star {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 34px;
}
.ms-reviews__dist-star i { color: #F59E0B; font-size: 0.68rem; }
.ms-reviews__dist-bar {
    flex: 1;
    height: 8px;
    background: var(--thumb-bg, #F1F5F9);
    border-radius: 10px;
    overflow: hidden;
    display: block;
}
.ms-reviews__dist-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #F59E0B, #FBBF24);
    border-radius: 10px;
    transition: width .6s ease;
}
.ms-reviews__dist-count { font-size: 0.75rem; font-weight: 800; color: var(--text-muted); min-width: 20px; text-align: left; }

.ms-reviews__empty { text-align: center; padding: 26px 10px; color: var(--text-muted); }
.ms-reviews__empty i { font-size: 2.4rem; color: var(--primary); opacity: .6; margin-bottom: 12px; display: block; }
.ms-reviews__empty p { font-weight: 700; margin: 0 0 4px; }
.ms-reviews__empty-hint { font-size: 0.8rem; font-weight: 500; }

.ms-reviews__note { color: var(--text-muted); font-size: 0.88rem; }

.ms-reviews__list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.ms-review {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
}
.ms-review__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ms-review__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 900;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.ms-review__who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 120px; }
.ms-review__who strong { font-size: 0.9rem; color: var(--text-strong); }
.ms-review__date { font-size: 0.74rem; color: var(--text-muted); display: inline-flex; gap: 5px; align-items: center; }
.ms-review__stars { color: #F59E0B; font-size: 0.78rem; display: inline-flex; gap: 2px; direction: ltr; }
.ms-review__stars .fa-regular.fa-star { color: #CBD5E1; }
body.dark-mode .ms-review__stars .fa-regular.fa-star { color: #475569; }
.ms-review__title { font-size: 0.95rem; font-weight: 800; color: var(--text-strong); margin: 10px 0 6px; }
.ms-review__text { font-size: 0.88rem; color: var(--text-main); line-height: 1.9; margin: 0; }
.ms-review__verified {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.74rem;
    font-weight: 800;
    color: #059669;
    background: #ECFDF5;
    padding: 4px 10px;
    border-radius: 20px;
}
body.dark-mode .ms-review__verified { background: rgba(5, 150, 105, 0.15); }

/* review form */
.ms-review-form {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 22px;
}
.ms-review-form__title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-strong);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ms-review-form__title i { color: var(--primary); }
.ms-review-form__row { margin-bottom: 16px; }
.ms-review-form__label { display: block; font-size: 0.84rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.ms-review-form__label .required { color: var(--primary); }
.ms-review-form__input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    transition: all .25s;
    resize: vertical;
}
.ms-review-form__input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--input-bg-focus, var(--card-bg));
    box-shadow: var(--input-focus-ring);
}
.ms-review-form__row--submit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 0; }
.ms-review-form__submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-gradient);
    color: #fff;
    border: 0;
    border-radius: var(--radius-md);
    padding: 12px 26px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 46, 99, 0.3);
    transition: transform .25s, box-shadow .25s;
}
.ms-review-form__submit:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(255, 46, 99, 0.4); }
.ms-review-form__hint { font-size: 0.76rem; color: var(--text-muted); }

.ms-review-form--locked .ms-review-form__lock {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
}
.ms-review-form--locked i { font-size: 2rem; color: var(--primary); margin-bottom: 10px; display: block; }
.ms-review-form--locked p { font-weight: 700; margin: 0 0 14px; }
.ms-reviews__login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-gradient);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.88rem;
    padding: 11px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 20px rgba(255, 46, 99, 0.3);
}

/* interactive star picker */
.ms-star-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; direction: ltr; justify-content: flex-end; }
.ms-star-picker__star {
    border: 0;
    background: transparent;
    color: #CBD5E1;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 2px;
    transition: transform .18s ease, color .18s ease;
}
.ms-star-picker__star:hover { transform: scale(1.22); }
.ms-star-picker__star.is-on { color: #F59E0B; }
.ms-star-picker__hint { font-size: 0.78rem; color: var(--text-muted); font-weight: 700; width: 100%; text-align: right; }
body.dark-mode .ms-star-picker__star { color: #475569; }

@media (max-width: 900px) {
    .ms-reviews__layout { grid-template-columns: 1fr; }
    .ms-reviews__summary { position: static; }
}

/* ==================================================================
 * 6) WISHLIST PAGE
 * ================================================================== */
.ms-wishlist-page { margin: 10px 0 30px; }
.ms-wishlist-count {
    background: var(--primary-gradient);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 20px;
}
.ms-wishlist-guest {
    background: var(--card-bg);
    border: 1px dashed var(--card-border-strong);
    border-radius: var(--radius-xl);
    padding: 56px 24px;
    text-align: center;
    color: var(--text-muted);
}
.ms-wishlist-guest > i { font-size: 3rem; color: var(--primary); opacity: .65; margin-bottom: 16px; display: block; }
.ms-wishlist-guest h3 { color: var(--text-strong); font-size: 1.15rem; font-weight: 900; margin: 0 0 10px; }
.ms-wishlist-guest p { font-size: 0.9rem; line-height: 1.9; max-width: 520px; margin: 0 auto 20px; }
.ms-wishlist-guest__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-gradient);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    padding: 13px 30px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 24px rgba(255, 46, 99, 0.32);
    transition: transform .25s, box-shadow .25s;
}
.ms-wishlist-guest__btn:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(255, 46, 99, 0.42); }

.ms-wish-item { position: relative; }
.ms-wish-item .ms-wish-remove-form { position: absolute; top: -10px; left: -10px; z-index: 5; }
.ms-wish-remove {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--card-border-strong);
    background: var(--card-bg);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all .25s;
}
.ms-wish-remove:hover { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
body.dark-mode .ms-wish-remove:hover { background: rgba(220, 38, 38, 0.15); }

/* ==================================================================
 * DARK-MODE FINE-TUNING
 * ================================================================== */
body.dark-mode .ms-flash-timer-row { border-color: var(--card-border-strong); }
body.dark-mode .ms-flash-timer .timer-unit {
    background: linear-gradient(180deg, #232D3F 0%, #0F141C 100%);
}
body.dark-mode .ms-wish-btn { background: rgba(22, 28, 40, 0.95); }
body.dark-mode .ms-cat-card { border-color: var(--card-border); }
body.dark-mode .ms-cat-count { background: var(--thumb-bg); }
