/* ==========================================================================
   Dynamic Product Stats — Frontend Styles
   By Harmon's Creations
   ========================================================================== */

/* ── Stats Bar ──────────────────────────────────────────────────────────── */
.dps-stats-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    vertical-align: middle;
    position: relative;
    white-space: nowrap;
}

/* Allow wrap on very narrow screens */
@media (max-width: 480px) {
    .dps-stats-bar {
        flex-wrap: wrap;
        white-space: normal;
    }
}

/* ── Divider ────────────────────────────────────────────────────────────── */
.dps-divider {
    color: #ccc;
    user-select: none;
}

/* ── Review section ─────────────────────────────────────────────────────── */
.dps-review-trigger {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #f5a623;
    font-weight: 600;
    cursor: default;
}

.dps-review-trigger.dps-has-popup {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}

.dps-review-trigger.dps-has-popup:focus {
    outline: 2px solid #f5a623;
    outline-offset: 2px;
    border-radius: 2px;
}

.dps-star-icon {
    font-size: 1em;
}

.dps-review-count {
    color: #555;
    font-weight: 400;
}

.dps-popup-hint {
    font-size: 0.65em;
    opacity: 0.7;
    margin-left: 1px;
    transition: transform 0.2s ease;
}

.dps-review-trigger[aria-expanded="true"] .dps-popup-hint {
    transform: rotate(180deg);
}

/* ── Hype section ───────────────────────────────────────────────────────── */
.dps-hype {
    display: inline-flex;
    align-items: center;
    gap: 0;
    color: #e44c4c;
    font-weight: 600;
}

.dps-hype-sep {
    color: #aaa;
    font-weight: 400;
}

.dps-product-sales,
.dps-category-sales,
.dps-urgency-label {
    display: inline;
}

.dps-category-sales {
    font-weight: 400;
    color: #666;
}

/* ── Low stock warning ──────────────────────────────────────────────────── */
.dps-stock-warning {
    color: #c0392b;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* ── Review Popup Card ──────────────────────────────────────────────────── */
.dps-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    z-index: 9999;
    min-width: 260px;
    max-width: 320px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16);
    border: 1px solid #e8e8e8;
    animation: dps-popup-in 0.18s ease;
}

.dps-popup.dps-popup-visible {
    display: block;
}

@keyframes dps-popup-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Arrow pointing down toward the trigger */
.dps-popup-arrow {
    position: absolute;
    bottom: -7px;
    left: 20px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    border-bottom: 1px solid #e8e8e8;
    transform: rotate(45deg);
}

.dps-popup-inner {
    padding: 16px;
}

a.dps-popup-linked {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.dps-popup-linked:hover {
    opacity: 0.85;
}

.dps-popup-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.dps-popup-logo {
    max-height: 22px;
    width: auto;
    object-fit: contain;
}

.dps-popup-source-name {
    font-size: 0.8rem;
    color: #888;
    font-weight: 500;
}

.dps-popup-stars {
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.dps-popup-star {
    font-size: 1rem;
}

.dps-star-filled  { color: #f5a623; }
.dps-star-empty   { color: #ddd; }

.dps-popup-quote {
    margin: 0 0 8px;
    padding: 0;
    border: none;
}

.dps-popup-quote p {
    font-size: 0.875rem;
    color: #333;
    line-height: 1.5;
    font-style: italic;
    margin: 0;
}

.dps-popup-reviewer {
    font-size: 0.8rem;
    color: #777;
    margin: 0;
    font-weight: 500;
}

/* ── Recently Purchased Ticker Toast ────────────────────────────────────── */
#dps-ticker-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    display: none; /* shown by JS */
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.13);
    border: 1px solid #e8e8e8;
    padding: 12px 18px;
    max-width: 280px;
    font-size: 0.85rem;
    color: #333;
    line-height: 1.4;
    pointer-events: none;
    user-select: none;
}

#dps-ticker-toast.dps-ticker-visible {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dps-ticker-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dps-ticker-text {
    opacity: 1;
    transition: opacity 0.4s ease;
}

.dps-ticker-text.dps-fade-out {
    opacity: 0;
}

.dps-ticker-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

@media (max-width: 480px) {
    #dps-ticker-toast {
        bottom: 12px;
        left: 12px;
        right: 12px;
        max-width: none;
    }
}
