/**
 * FOMO Tier Ladder Styles
 *
 * @package PriceWidgetFC
 * @since 0.9.24
 */

.pwfc-fomo {
    /* Chain to shared --pwfc-* variables; fallbacks for FC native pages where widget.css doesn't load */
    --pwfc-fomo-border: var(--pwfc-border, #e5e7eb);
    --pwfc-fomo-active: var(--pwfc-active, #059669);
    --pwfc-fomo-active-bg: var(--pwfc-active-bg, #ecfdf5);
    --pwfc-fomo-sold-out: var(--pwfc-sold-out, #ef4444);
    --pwfc-fomo-muted-bg: #f9fafb;
    --pwfc-fomo-text: var(--pwfc-text, #111827);
    --pwfc-fomo-text-muted: var(--pwfc-text-muted, #9ca3af);
    --pwfc-fomo-text-secondary: var(--pwfc-text-secondary, #6b7280);

    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
    font-size: 14px;
}

.pwfc-fomo__tier {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--pwfc-fomo-border);
    transition: opacity 0.2s;
}

/* Active tier — the one customers can buy now */
.pwfc-fomo__tier--active {
    border-color: var(--pwfc-fomo-active);
    background: var(--pwfc-fomo-active-bg);
}

.pwfc-fomo__tier--active .pwfc-fomo__badge {
    color: var(--pwfc-fomo-active);
    font-weight: 600;
}

/* Sold out tier — grayed, proves scarcity */
.pwfc-fomo__tier--sold-out {
    opacity: 0.55;
    background: var(--pwfc-fomo-muted-bg);
}

.pwfc-fomo__tier--sold-out .pwfc-fomo__price span {
    text-decoration: line-through;
    color: var(--pwfc-fomo-text-muted);
}

.pwfc-fomo__tier--sold-out .pwfc-fomo__badge {
    color: var(--pwfc-fomo-sold-out);
    font-weight: 600;
}

/* Upcoming tier — visible but dimmed */
.pwfc-fomo__tier--upcoming {
    opacity: 0.7;
    background: var(--pwfc-fomo-muted-bg);
}

.pwfc-fomo__tier--upcoming .pwfc-fomo__badge {
    color: var(--pwfc-fomo-text-secondary);
}

/* Unlimited tier — always available, neutral appearance */
.pwfc-fomo__tier--in-stock {
    opacity: 0.7;
    background: var(--pwfc-fomo-muted-bg);
}

.pwfc-fomo__tier--in-stock .pwfc-fomo__badge {
    color: var(--pwfc-fomo-text-secondary);
}

/* Price display */
.pwfc-fomo__price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-shrink: 0;
}

.pwfc-fomo__price del {
    font-size: 12px;
    color: var(--pwfc-fomo-text-muted);
    text-decoration: line-through;
}

.pwfc-fomo__price span {
    font-weight: 700;
    color: var(--pwfc-fomo-text);
}

.pwfc-fomo__tier--active .pwfc-fomo__price span {
    color: var(--pwfc-fomo-active);
}

/* Badge */
.pwfc-fomo__badge {
    font-size: 12px;
    white-space: nowrap;
    text-align: right;
}

/* Hide FOMO panels by default — JS shows the matching one on variant selection */
.pwfc-fomo-row > .pwfc-fomo {
    display: none;
}

/* Side-by-side layout: quantity + fomo ladder */
.pwfc-fomo-row {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.pwfc-fomo-row .fct-product-quantity-container {
    flex-shrink: 0;
}

.pwfc-fomo-row .pwfc-fomo {
    margin-left: auto;
}

/* Compact widget — horizontal mini badges */
.pwfc-compact-fomo-wrap {
    margin: 8px 0;
}

.pwfc-compact-fomo .pwfc-fomo {
    flex-direction: row;
    gap: 4px;
    min-width: 0;
    font-size: 12px;
}

.pwfc-compact-fomo .pwfc-fomo__tier {
    flex: 1 1 0;
    padding: 4px 8px;
    gap: 4px;
    border-radius: 4px;
    justify-content: center;
    align-items: baseline;
}

.pwfc-compact-fomo .pwfc-fomo__price span {
    font-size: 12px;
}

.pwfc-compact-fomo .pwfc-fomo__badge {
    font-size: 11px;
}

.pwfc-compact-fomo-hidden {
    display: none;
}

/* Stock availability label — tighten FC's default 40px margin-top */
.fct-product-stock {
    margin-top: 12px;
    margin-bottom: 12px;
}

/* Modal stock label needs breathing room (no inherited page margins) */
[data-fluent-cart-shop-app-single-product-modal] .fct-product-stock {
    margin: 8px 0 12px;
}

/* Dark Mode — chain with dark-appropriate fallbacks for FC native pages */
html.dark .pwfc-fomo {
    --pwfc-fomo-border: var(--pwfc-border, #4b5563);
    --pwfc-fomo-active: var(--pwfc-active, #34d399);
    --pwfc-fomo-active-bg: var(--pwfc-active-bg, #064e3b);
    --pwfc-fomo-sold-out: var(--pwfc-sold-out, #f87171);
    --pwfc-fomo-muted-bg: #1f2937;
    --pwfc-fomo-text: var(--pwfc-text, #f3f4f6);
    --pwfc-fomo-text-muted: var(--pwfc-text-muted, #6b7280);
    --pwfc-fomo-text-secondary: var(--pwfc-text-secondary, #9ca3af);
}

/* Stack on narrow screens */
@media (max-width: 480px) {
    .pwfc-fomo-row {
        flex-direction: column;
        gap: 16px;
    }

    .pwfc-fomo-row .pwfc-fomo {
        margin-left: 0;
    }
}
