/* =========================================
   Trade Bargains Growth Engine — Recently Viewed (Module 6)
   v1.0.0
   ========================================= */

/* ── CSS Variables (set inline by PHP) ── */
#tbge-rv-bar {
    --rv-bg:     #1a1a2e;
    --rv-text:   #ffffff;
    --rv-accent: #ff6b35;
    --rv-radius: 6px;
    --rv-img:    56px;
}

/* ── Bar Container ── */
#tbge-rv-bar {
    width: 100%;
    background: var(--rv-bg);
    color: var(--rv-text);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.3;
    border-top: 3px solid var(--rv-accent);
    position: relative;
    z-index: 9990;
    box-sizing: border-box;
    /* Smooth entrance */
    animation: tbgeRvSlideUp 0.35s ease both;
}

@keyframes tbgeRvSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}

#tbge-rv-bar.tbge-rv-hidden {
    display: none !important;
}

/* ── Inner wrapper ── */
.tbge-rv-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Section title ── */
.fgrvp-title {
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--rv-accent);
    flex-shrink: 0;
    padding-right: 8px;
    border-right: 1px solid rgba(255,255,255,0.15);
}

/* ── Track wrapper (scroll container + arrows) ── */
.tbge-rv-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    position: relative;
}

/* ── Scrollable track ── */
.tbge-rv-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    scrollbar-width: none;
}
.tbge-rv-track::-webkit-scrollbar { display: none; }

/* ── Arrow buttons ── */
.tbge-rv-arrow {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--rv-text);
    cursor: pointer;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.2s, opacity 0.2s;
    padding: 0;
}
.tbge-rv-arrow:hover {
    background: var(--rv-accent);
    border-color: var(--rv-accent);
}
.tbge-rv-arrow:disabled,
.tbge-rv-arrow.tbge-rv-arrow--hidden {
    opacity: 0.2;
    pointer-events: none;
}

/* ── Individual product item ── */
.tbge-rv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    max-width: 180px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--rv-radius);
    padding: 6px 8px;
    transition: background 0.2s;
    cursor: pointer;
}
.tbge-rv-item:hover {
    background: rgba(255,255,255,0.10);
}

/* ── Product thumbnail link ── */
.tbge-rv-thumb {
    display: block;
    flex-shrink: 0;
    width: var(--rv-img);
    height: var(--rv-img);
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255,255,255,0.08);
}
.tbge-rv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.tbge-rv-item:hover .tbge-rv-thumb img {
    transform: scale(1.06);
}

/* ── Product info ── */
.tbge-rv-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.tbge-rv-name {
    color: var(--rv-text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}
.tbge-rv-name:hover {
    color: var(--rv-accent);
    text-decoration: underline;
}

.tbge-rv-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--rv-accent);
}
.tbge-rv-price del {
    opacity: 0.5;
    font-weight: 400;
    font-size: 11px;
    color: var(--rv-text);
}
.tbge-rv-price ins {
    text-decoration: none;
}

/* ── Add to cart button ── */
.tbge-rv-atc {
    display: inline-block;
    background: var(--rv-accent);
    color: #fff;
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 3px;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 2px;
}
.tbge-rv-atc:hover { opacity: 0.85; color: #fff; }
.tbge-rv-atc--select { background: transparent; border: 1px solid var(--rv-accent); color: var(--rv-accent); }
.tbge-rv-atc--select:hover { background: var(--rv-accent); color: #fff; }

/* ── Close button ── */
.tbge-rv-close {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.2s, color 0.2s;
}
.tbge-rv-close:hover {
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

/* ════════════════════════════════════════
   SIDEBAR WIDGET
   ════════════════════════════════════════ */

.tbge-rv-sidebar-list {
    --rv-accent: #ff6b35;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tbge-rv-sidebar-list li { margin-bottom: 12px; }
.tbge-rv-sidebar-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}
.tbge-rv-sidebar-list li a:hover { color: var(--rv-accent); }
.tbge-rv-sidebar-list img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.tbge-rv-sb-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}
.tbge-rv-sb-price {
    display: block;
    font-size: 12px;
    color: var(--rv-accent);
    font-weight: 700;
    margin-top: 2px;
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */

@media ( max-width: 600px ) {
    .fgrvp-title {
        display: none;
    }
    .tbge-rv-inner {
        padding: 8px 10px;
    }
    #tbge-rv-bar {
        --rv-img: 44px;
        font-size: 12px;
    }
    .tbge-rv-item {
        max-width: 140px;
    }
}

/* ── Respect reduced motion ── */
@media ( prefers-reduced-motion: reduce ) {
    #tbge-rv-bar         { animation: none; }
    .tbge-rv-thumb img   { transition: none; }
}
