/*
 * inyou Bonus Program — mobile-first styles.
 *
 * Components:
 *   .bp-widget          — full cart-page widget
 *   .bp-mini            — compact mini-cart line (header dropdown)
 *   .bp-product-chip    — product-page chip reminder
 *   .bp-sticky          — mobile sticky bottom bar
 *   .bp-excluded-badge  — "бонус не діє" label under excluded cart items
 *
 * Tokens are kept under --bp-* to avoid collisions with other inyou modules.
 * Dark mode + prefers-reduced-motion respected.
 */

:root {
    --bp-accent:       #0d9488;
    --bp-accent-hover: #0f766e;
    --bp-accent-gold:  #d97706;
    --bp-accent-purp:  #7c3aed;
    --bp-accent-soft:  #ccfbf1;
    --bp-bg:           #f8fafc;
    --bp-surface:      #ffffff;
    --bp-border:       #e2e8f0;
    --bp-text:         #0f172a;
    --bp-muted:        #64748b;
    --bp-success:      #10b981;
    --bp-shadow:       0 1px 4px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(13, 148, 136, 0.08);
    --bp-radius:       10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bp-accent-soft:  #0f2d2a;
        --bp-bg:           #0f172a;
        --bp-surface:      #1e293b;
        --bp-border:       #334155;
        --bp-text:         #f1f5f9;
        --bp-muted:        #94a3b8;
    }
}

/* ===== Main cart widget ==================================================== */

.bp-widget {
    box-sizing: border-box;
    width: 100%;
    margin: 16px 0;
    padding: 16px;
    background: var(--bp-surface);
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    color: var(--bp-text);
    box-shadow: var(--bp-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.bp-widget * { box-sizing: inherit; }

.bp-widget__head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.bp-widget__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
}
.bp-widget__icon {
    flex-shrink: 0;
    color: var(--bp-accent);
}
.bp-widget__login-boost {
    font-size: 12.5px;
    line-height: 1.3;
    color: var(--bp-accent);
    padding: 4px 10px;
    background: var(--bp-accent-soft);
    border-radius: 999px;
}

.bp-widget__body { margin-top: 4px; }

/* Message lines */
.bp-widget__message {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--bp-text);
}
.bp-widget__message--primary {
    font-weight: 600;
    font-size: 15.5px;
}
.bp-widget__message--secondary {
    color: var(--bp-muted);
    font-size: 13px;
}
.bp-widget__message strong {
    color: var(--bp-accent);
}
.bp-widget__message--top {
    color: var(--bp-success);
    font-weight: 600;
}

/* Progress bar */
.bp-progress {
    position: relative;
    margin: 14px 0 10px;
    padding: 0;
}
.bp-progress__track {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: var(--bp-accent-soft);
    overflow: hidden;
}
.bp-progress__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: linear-gradient(90deg, var(--bp-accent) 0%, var(--bp-accent-purp) 100%);
    transform-origin: left center;
    transition: width 480ms cubic-bezier(0.22, 1, 0.36, 1);
}
.bp-progress__fill--top {
    background: linear-gradient(90deg, var(--bp-success) 0%, var(--bp-accent-purp) 100%);
}

/* Tier markers aligned along the bar */
.bp-progress__markers {
    position: absolute;
    inset: 0 0 0 0;
    display: grid;
    pointer-events: none;
}
.bp-progress__marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--bp-border);
    border-radius: 2px;
    transform: translateX(-50%);
}
.bp-progress__marker--reached {
    background: var(--bp-accent);
}
.bp-progress__legend {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--bp-muted);
}
.bp-progress__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.bp-progress__legend-item--reached {
    color: var(--bp-accent);
    font-weight: 600;
}
.bp-progress__legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* In-cart meta (субтотал / прогрес) */
.bp-widget__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 10px;
    font-size: 13px;
    color: var(--bp-muted);
}
.bp-widget__meta-value {
    color: var(--bp-text);
    font-weight: 600;
}
.bp-widget__excluded-note {
    margin-top: 6px;
    font-size: 12px;
    color: var(--bp-muted);
}

@media (min-width: 768px) {
    .bp-widget { padding: 20px 24px; }
    .bp-widget__title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .bp-progress__fill { transition: none; }
    .bp-widget { transition: none; }
}

/* ===== Toast on tier unlock =============================================== */

.bp-toast-portal {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 9999;
    transform: translateX(-50%);
    pointer-events: none;
}
.bp-toast {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bp-surface);
    color: var(--bp-text);
    border: 1px solid var(--bp-border);
    border-radius: 999px;
    box-shadow: var(--bp-shadow);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 240ms ease, transform 240ms ease;
}
.bp-toast--visible {
    opacity: 1;
    transform: translateY(0);
}
.bp-toast__icon {
    color: var(--bp-success);
    flex-shrink: 0;
}
@media (prefers-reduced-motion: reduce) {
    .bp-toast { transition: none; }
}

/* ===== Mini-cart rendering (header dropdown) ============================== */

.bp-mini {
    display: block;
    padding: 8px 12px;
    margin: 6px 0;
    background: var(--bp-accent-soft);
    color: var(--bp-accent);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.35;
    font-weight: 500;
}
.bp-mini__percent {
    font-weight: 700;
}

/* ===== Product page chip ================================================== */

.bp-product-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
    padding: 6px 12px;
    background: var(--bp-accent-soft);
    color: var(--bp-accent);
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 999px;
    line-height: 1.2;
}
.bp-product-chip__icon {
    flex-shrink: 0;
}

/* ===== Mobile sticky bottom bar =========================================== */

.bp-sticky {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 990;
    display: none; /* JS decides when to show */
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bp-surface);
    border-top: 1px solid var(--bp-border);
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
    font-size: 13.5px;
    line-height: 1.35;
}
.bp-sticky--visible { display: block; }
.bp-sticky__row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.bp-sticky__text {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--bp-text);
    font-weight: 500;
}
.bp-sticky__percent {
    color: var(--bp-accent);
    font-weight: 700;
}
.bp-sticky__bar {
    position: relative;
    width: 100%;
    height: 4px;
    margin-top: 6px;
    background: var(--bp-accent-soft);
    border-radius: 2px;
    overflow: hidden;
}
.bp-sticky__bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--bp-accent);
    transition: width 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Desktop: hide sticky (widget is visible in cart page instead) */
@media (min-width: 768px) {
    .bp-sticky { display: none !important; }
}

/* ===== Excluded item badge (cart table) =================================== */

.bp-excluded-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: rgba(148, 163, 184, 0.18);
    color: var(--bp-muted);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}
