/*
 * Extra home components (views/site/_home-extra.php), shared by every theme.
 * Colours, corners and font come from the theme tokens, so each component
 * takes the look of the active theme (Tekno yellow, Glow pink, Moda blue...)
 * and follows the store editor's colour pickers.
 * Every selector starts with html[data-theme] so it wins over the global
 * theme link colours.
 */

html[data-theme] .sx-block {
    --sx-accent: var(--theme-color-primary, #2563eb);
    --sx-on-accent: var(--theme-color-text-inverse, #fff);
    --sx-dark: color-mix(in srgb, var(--theme-color-secondary, #1f2937) 38%, #0f1115);
    --sx-ink: var(--theme-color-text, #111827);
    --sx-muted: var(--theme-color-text-muted, #6b7280);
    --sx-line: var(--theme-color-border, #e5e7eb);
    --sx-soft: var(--theme-color-surface, #f5f6f8);
    --sx-card: var(--theme-color-surface-raised, #fff);
    --sx-r: var(--theme-radius-lg, 16px);
    --sx-r-sm: var(--theme-radius-md, 10px);
}
html[data-theme] .sx-block.sf-block { margin-top: 40px; }
/* Moda's secondary is orange: its dark panels use a deep navy from the primary instead */
html[data-theme="moda"] .sx-block { --sx-dark: color-mix(in srgb, var(--theme-color-primary, #0a69d8) 30%, #08101f); }
html[data-theme="moda"] .sx-grid.md-grid { --md-cols: 4; }

/* Heading extras */
html[data-theme] .sx-head { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
html[data-theme] .sx-more { margin-inline-start: auto; color: var(--sx-ink); text-decoration: none; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
html[data-theme] .sx-more:hover { color: var(--sx-accent); }
html[dir="ltr"][data-theme] .sx-flip { transform: scaleX(-1); }
html[data-theme] .sx-sub { margin: -8px 0 20px; color: var(--sx-muted); }
html[data-theme] .sx-grid { margin-top: 8px; }
/* Themes without their own grid: 4 per row on desktop, so 8 products fill two rows */
@media (min-width: 992px) { html[data-theme] .sx-grid.sf-rail--grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
html[data-theme] .sx-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; letter-spacing: 0.02em; color: var(--sx-accent); }

/* Buttons */
html[data-theme] .sx-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 24px; border: 2px solid var(--sx-accent); border-radius: var(--theme-button-radius, 999px); background: var(--sx-accent); color: var(--sx-on-accent); font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform 0.15s, filter 0.15s, background 0.15s, color 0.15s; }
html[data-theme] .sx-btn:hover { filter: brightness(0.94); transform: translateY(-1px); color: var(--sx-on-accent); }
html[data-theme] .sx-btn.is-ghost { background: transparent; color: var(--sx-ink); border-color: var(--sx-line); }
html[data-theme] .sx-btn.is-ghost:hover { border-color: var(--sx-ink); color: var(--sx-ink); }
html[data-theme] .sx-btn.is-light { background: #fff; border-color: #fff; color: var(--sx-dark); }
html[data-theme] .sx-btn.is-light:hover { color: var(--sx-dark); }
html[data-theme] .sx-btn.is-wa { background: #25d366; border-color: #25d366; color: #fff; }
html[data-theme] .sx-btn.is-wa:hover { color: #fff; }

/* 1. Countdown offer */
html[data-theme] .sx-countdown { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: center; padding: 40px; border-radius: var(--sx-r); background: var(--sx-dark); color: #fff; position: relative; overflow: hidden; }
html[data-theme] .sx-countdown::before { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: var(--sx-accent); opacity: 0.22; inset-inline-start: -140px; top: -180px; }
html[data-theme] .sx-countdown-text { position: relative; }
html[data-theme] .sx-countdown h2 { color: #fff; font-size: clamp(26px, 3vw, 40px); font-weight: 800; line-height: 1.15; margin: 10px 0 8px; }
html[data-theme] .sx-countdown p { color: rgba(255, 255, 255, 0.78); margin-bottom: 20px; }
html[data-theme] .sx-countdown .sx-eyebrow { color: var(--sx-on-accent); background: var(--sx-accent); padding: 5px 12px; border-radius: 999px; }
html[data-theme] .sx-count { display: flex; gap: 10px; margin-bottom: 24px; direction: ltr; justify-content: flex-end; }
html[dir="ltr"][data-theme] .sx-count { justify-content: flex-start; }
html[data-theme] .sx-count span { min-width: 64px; padding: 10px 6px; border-radius: var(--sx-r-sm); background: rgba(255, 255, 255, 0.1); text-align: center; display: flex; flex-direction: column; }
html[data-theme] .sx-count b { font-size: 26px; font-weight: 800; line-height: 1.1; color: #fff; font-variant-numeric: tabular-nums; }
html[data-theme] .sx-count small { font-size: 11px; color: rgba(255, 255, 255, 0.7); }
html[data-theme] .sx-countdown-items { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
html[data-theme] .sx-mini { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: var(--sx-r-sm); background: #fff; color: var(--sx-ink); text-decoration: none; transition: transform 0.2s; }
html[data-theme] .sx-mini:hover { transform: translateY(-4px); color: var(--sx-ink); }
html[data-theme] .sx-mini-img { aspect-ratio: 1; border-radius: calc(var(--sx-r-sm) - 4px); background: var(--sx-soft); display: grid; place-items: center; overflow: hidden; }
html[data-theme] .sx-mini-img img { width: 82%; height: 82%; object-fit: contain; }
html[data-theme] .sx-mini-name { font-size: 14px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
html[data-theme] .sx-mini-price { font-weight: 800; color: var(--theme-color-danger, #dc2626); }
html[data-theme] .sx-mini-price s { color: var(--sx-muted); font-weight: 400; font-size: 12px; }
@media (max-width: 991.98px) {
    html[data-theme] .sx-countdown { grid-template-columns: 1fr; padding: 28px 20px; }
    html[data-theme] .sx-count { justify-content: flex-start; }
}
@media (max-width: 575.98px) {
    html[data-theme] .sx-countdown-items { grid-template-columns: repeat(3, 132px); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
    html[data-theme] .sx-count span { min-width: 56px; }
}

/* 3. Product tabs */
html[data-theme] .sx-tabs-head { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 22px; }
html[data-theme] .sx-tabs-head > h2 { margin: 0; }
html[data-theme] .sx-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }
html[data-theme] .sx-tab { border: 1px solid var(--sx-line); background: var(--sx-card); color: var(--sx-ink); border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 14px; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
html[data-theme] .sx-tab:hover { border-color: var(--sx-accent); }
html[data-theme] .sx-tab.is-active { background: var(--sx-accent); border-color: var(--sx-accent); color: var(--sx-on-accent); }
@media (max-width: 575.98px) { html[data-theme] .sx-tabs { margin-inline-start: 0; } }

/* 4. Product of the week */
html[data-theme] .sx-feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 36px; border-radius: var(--sx-r); background: var(--sx-soft); }
html[data-theme] .sx-feature-media { position: relative; display: grid; place-items: center; aspect-ratio: 1; max-height: 440px; border-radius: var(--sx-r); background: var(--sx-card); }
html[data-theme] .sx-feature-media img { width: 78%; height: 78%; object-fit: contain; transition: transform 0.4s; }
html[data-theme] .sx-feature-media:hover img { transform: scale(1.05); }
html[data-theme] .sx-feature-off { position: absolute; top: 18px; inset-inline-start: 18px; padding: 6px 12px; border-radius: 999px; background: var(--theme-color-danger, #dc2626); color: #fff; font-weight: 800; }
html[data-theme] .sx-feature-body h2 { font-size: clamp(24px, 2.6vw, 36px); font-weight: 800; margin: 10px 0 10px; line-height: 1.2; }
html[data-theme] .sx-feature-body h2 a { color: var(--sx-ink); text-decoration: none; }
html[data-theme] .sx-feature-body h2 a:hover { color: var(--sx-accent); }
html[data-theme] .sx-feature-body .sx-sub { margin: 0 0 16px; }
html[data-theme] .sx-feature-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
html[data-theme] .sx-feature-price strong { font-size: 32px; font-weight: 800; color: var(--sx-ink); }
html[data-theme] .sx-feature-price s { color: var(--sx-muted); font-size: 18px; }
html[data-theme] .sx-save { padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--theme-color-success, #16a34a) 14%, transparent); color: var(--theme-color-success, #16a34a); font-weight: 700; font-size: 13px; }
html[data-theme] .sx-feature-sold { display: grid; gap: 8px; margin-bottom: 24px; color: var(--sx-muted); font-size: 14px; max-width: 420px; }
html[data-theme] .sx-feature-sold .bi { color: #f97316; }
html[data-theme] .sx-bar { display: block; height: 8px; border-radius: 99px; background: var(--sx-line); overflow: hidden; }
html[data-theme] .sx-bar i { display: block; height: 100%; border-radius: inherit; background: var(--sx-accent); }
html[data-theme] .sx-feature-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 767.98px) {
    html[data-theme] .sx-feature { grid-template-columns: 1fr; padding: 18px; gap: 18px; }
    html[data-theme] .sx-feature-actions .sx-btn { flex: 1 1 140px; }
}

/* 5. Category mosaic */
html[data-theme] .sx-mosaic { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 210px; gap: 16px; }
html[data-theme] .sx-mosaic.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html[data-theme] .sx-tile { position: relative; overflow: hidden; border-radius: var(--sx-r); background: var(--sx-soft); display: flex; align-items: flex-end; padding: 18px; text-decoration: none; color: var(--sx-ink); isolation: isolate; }
html[data-theme] .sx-mosaic:not(.is-3) .sx-tile.is-big { grid-column: span 2; grid-row: span 2; }
html[data-theme] .sx-tile img { position: absolute; inset: 12% 10% 26%; width: 80%; height: 62%; object-fit: contain; z-index: -1; transition: transform 0.45s; }
html[data-theme] .sx-tile.is-big img { inset: 10% 14% 22%; width: 72%; height: 68%; }
html[data-theme] .sx-tile:hover img { transform: scale(1.07); }
html[data-theme] .sx-tile-text { display: flex; flex-direction: column; padding: 8px 14px; border-radius: var(--sx-r-sm); background: var(--sx-card); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07); }
html[data-theme] .sx-tile-text strong { font-size: 16px; }
html[data-theme] .sx-tile.is-big .sx-tile-text strong { font-size: 22px; }
html[data-theme] .sx-tile-text small { color: var(--sx-muted); }
html[data-theme] .sx-tile:hover .sx-tile-text { background: var(--sx-accent); color: var(--sx-on-accent); }
html[data-theme] .sx-tile:hover .sx-tile-text small { color: inherit; opacity: 0.85; }
@media (max-width: 767.98px) {
    html[data-theme] .sx-mosaic, html[data-theme] .sx-mosaic.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 170px; gap: 10px; }
    html[data-theme] .sx-mosaic .sx-tile.is-big { grid-column: span 2; grid-row: span 1; }
    html[data-theme] .sx-tile { padding: 10px; }
    html[data-theme] .sx-tile-text strong, html[data-theme] .sx-tile.is-big .sx-tile-text strong { font-size: 14px; }
}

/* 6. Top 10 list */
html[data-theme] .sx-rank { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; counter-reset: none; }
html[data-theme] .sx-rank a { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-radius: var(--sx-r-sm); background: var(--sx-card); border: 1px solid var(--sx-line); color: var(--sx-ink); text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
html[data-theme] .sx-rank a:hover { border-color: var(--sx-accent); transform: translateY(-2px); color: var(--sx-ink); }
html[data-theme] .sx-rank-n { flex: 0 0 auto; width: 44px; font-size: 34px; font-weight: 900; line-height: 1; text-align: center; color: transparent; -webkit-text-stroke: 1.5px var(--sx-ink); }
html[data-theme] .sx-rank li:nth-child(-n+3) .sx-rank-n { color: var(--sx-accent); -webkit-text-stroke: 0; }
html[data-theme] .sx-rank-img { flex: 0 0 64px; height: 64px; border-radius: calc(var(--sx-r-sm) - 2px); background: var(--sx-soft); display: grid; place-items: center; }
html[data-theme] .sx-rank-img img { width: 80%; height: 80%; object-fit: contain; }
html[data-theme] .sx-rank-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
html[data-theme] .sx-rank-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-theme] .sx-rank-meta { font-size: 13px; color: var(--sx-muted); }
html[data-theme] .sx-rank-meta b { color: var(--sx-ink); font-size: 15px; }
@media (max-width: 767.98px) { html[data-theme] .sx-rank { grid-template-columns: 1fr; } }

/* 8. Quick category links */
html[data-theme] .sx-chips { display: flex; flex-wrap: wrap; gap: 10px; }
html[data-theme] .sx-chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--sx-line); background: var(--sx-card); color: var(--sx-ink); text-decoration: none; font-weight: 600; font-size: 14px; transition: background 0.15s, color 0.15s, border-color 0.15s; }
html[data-theme] .sx-chip small { min-width: 24px; padding: 1px 7px; border-radius: 99px; background: var(--sx-soft); color: var(--sx-muted); font-size: 12px; text-align: center; }
html[data-theme] .sx-chip:hover { background: var(--sx-accent); border-color: var(--sx-accent); color: var(--sx-on-accent); }
html[data-theme] .sx-chip:hover small { background: rgba(255, 255, 255, 0.25); color: inherit; }
@media (max-width: 575.98px) { html[data-theme] .sx-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; } html[data-theme] .sx-chip { flex: 0 0 auto; } }

/* 9. How to order */
html[data-theme] .sx-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; position: relative; }
html[data-theme] .sx-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 18px; border-radius: var(--sx-r); background: var(--sx-soft); }
html[data-theme] .sx-step:not(:last-child)::after { content: ""; position: absolute; top: 62px; inset-inline-end: -20px; width: 20px; border-top: 2px dashed var(--sx-line); }
html[data-theme] .sx-step-icon { position: relative; width: 68px; height: 68px; border-radius: 50%; background: var(--sx-card); display: grid; place-items: center; font-size: 28px; color: var(--sx-accent); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06); margin-bottom: 6px; }
html[data-theme] .sx-step-icon .bi { font-size: 28px; line-height: 1; }
html[data-theme] .sx-step-icon b { position: absolute; top: -4px; inset-inline-end: -4px; width: 26px; height: 26px; border-radius: 50%; background: var(--sx-dark); color: #fff; font-size: 13px; display: grid; place-items: center; }
html[data-theme] .sx-step strong { font-size: 17px; color: var(--sx-ink); }
html[data-theme] .sx-step span { color: var(--sx-muted); font-size: 14px; line-height: 1.6; }
@media (max-width: 991.98px) { html[data-theme] .sx-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } html[data-theme] .sx-step::after { display: none; } }
@media (max-width: 575.98px) { html[data-theme] .sx-steps { gap: 10px; } html[data-theme] .sx-step { padding: 18px 10px; } html[data-theme] .sx-step strong { font-size: 15px; } }

/* 10. Store in numbers */
html[data-theme] .sx-stats { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: 28px; align-items: center; padding: 36px 40px; border-radius: var(--sx-r); background: var(--sx-accent); color: var(--sx-on-accent); }
html[data-theme] .sx-stats-head h2 { color: inherit; font-size: clamp(24px, 2.4vw, 32px); font-weight: 800; margin-bottom: 8px; }
html[data-theme] .sx-stats-head p { margin: 0; opacity: 0.85; }
html[data-theme] .sx-stats ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
html[data-theme] .sx-stats li { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 8px; border-radius: var(--sx-r-sm); background: rgba(255, 255, 255, 0.16); text-align: center; }
html[data-theme] .sx-stats li .bi { font-size: 22px; opacity: 0.85; }
html[data-theme] .sx-stats li b { font-size: 30px; font-weight: 900; line-height: 1.1; }
html[data-theme] .sx-stats li span { font-size: 13px; opacity: 0.9; }
@media (max-width: 991.98px) { html[data-theme] .sx-stats { grid-template-columns: 1fr; padding: 26px 20px; } }
@media (max-width: 575.98px) { html[data-theme] .sx-stats ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 11. Text banner */
html[data-theme] .sx-text-banner { display: flex; align-items: center; gap: 22px; padding: 26px 32px; border-radius: var(--sx-r); background: linear-gradient(110deg, var(--sx-dark), color-mix(in srgb, var(--sx-dark) 70%, var(--sx-accent))); color: #fff; }
html[data-theme] .sx-text-banner > .bi { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 50%; background: var(--sx-accent); color: var(--sx-on-accent); display: grid; place-items: center; font-size: 26px; }
html[data-theme] .sx-text-banner > div { flex: 1; min-width: 0; }
html[data-theme] .sx-text-banner h2 { color: #fff; font-size: clamp(20px, 2vw, 26px); font-weight: 800; margin: 0 0 4px; }
html[data-theme] .sx-text-banner p { margin: 0; color: rgba(255, 255, 255, 0.8); }
@media (max-width: 767.98px) { html[data-theme] .sx-text-banner { flex-direction: column; text-align: center; padding: 24px 18px; } }

/* 12. Help & WhatsApp */
html[data-theme] .sx-contact { display: flex; align-items: center; gap: 22px; padding: 28px 32px; border-radius: var(--sx-r); border: 1px solid var(--sx-line); background: var(--sx-card); }
html[data-theme] .sx-contact-icon { flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; background: var(--sx-soft); color: var(--sx-accent); display: grid; place-items: center; font-size: 30px; }
html[data-theme] .sx-contact-icon .bi { font-size: 30px; line-height: 1; }
html[data-theme] .sx-contact-text { flex: 1; min-width: 0; }
html[data-theme] .sx-contact-text h2 { font-size: clamp(20px, 2vw, 26px); font-weight: 800; margin: 0 0 4px; color: var(--sx-ink); }
html[data-theme] .sx-contact-text p { margin: 0; color: var(--sx-muted); }
html[data-theme] .sx-contact-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 767.98px) { html[data-theme] .sx-contact { flex-direction: column; text-align: center; padding: 24px 18px; } html[data-theme] .sx-contact-actions { justify-content: center; } }

/* 13. Follow us */
html[data-theme] .sx-social { display: flex; align-items: center; gap: 20px 32px; flex-wrap: wrap; padding: 28px 32px; border-radius: var(--sx-r); background: var(--sx-soft); }
html[data-theme] .sx-social > div:first-child { flex: 1 1 260px; }
html[data-theme] .sx-social h2 { font-size: clamp(20px, 2vw, 26px); font-weight: 800; margin: 0 0 4px; color: var(--sx-ink); }
html[data-theme] .sx-social p { margin: 0; color: var(--sx-muted); }
html[data-theme] .sx-social-links { display: flex; gap: 10px; flex-wrap: wrap; }
html[data-theme] .sx-social-link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; background: var(--sx-card); color: var(--sx-ink); text-decoration: none; font-weight: 600; border: 1px solid var(--sx-line); transition: transform 0.15s, background 0.15s, color 0.15s; }
html[data-theme] .sx-social-link .bi { font-size: 18px; }
html[data-theme] .sx-social-link:hover { transform: translateY(-2px); color: #fff; border-color: transparent; }
html[data-theme] .sx-social-link.is-facebook:hover { background: #1877f2; }
html[data-theme] .sx-social-link.is-instagram:hover { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); }
html[data-theme] .sx-social-link.is-tiktok:hover { background: #111; }
html[data-theme] .sx-social-link.is-snapchat:hover { background: #fffc00; color: #111; }
html[data-theme] .sx-social-link.is-youtube:hover { background: #ff0000; }

@media (prefers-reduced-motion: reduce) {
    html[data-theme] .sx-block * { transition: none !important; }
}
