/* ═══════════════════════════════════════════════════════════════════════════
   Compare Tray — persistent floating tray for Compare + Match actions.

   Mobile  : sticky strip at bottom of viewport, full width.
   Desktop : compact floating card bottom-right.
   ═══════════════════════════════════════════════════════════════════════════ */

.compare-tray {
    position: fixed;
    z-index: var(--z-sticky);

    /* Mobile default: full-width bottom strip */
    left: 0;
    right: 0;
    bottom: 0;
    padding: var(--space-3) var(--space-4);
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

@media (min-width: 640px) {
    .compare-tray {
        left:    auto;
        right:   var(--space-6);
        bottom:  var(--space-6);
        width:   360px;
        padding: var(--space-4) var(--space-5);
        border:  1px solid var(--border-light);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
    }
}

/* ─── Inner layout ───────────────────────────────────────────────────────── */

.compare-tray__inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.compare-tray__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.compare-tray__count {
    color: var(--accent-gold);
}

.compare-tray__clear {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition:
        color            var(--duration-fast) var(--ease),
        text-decoration-color var(--duration-fast) var(--ease);
}

.compare-tray__clear:hover {
    color: var(--text-secondary);
    text-decoration-color: var(--text-muted);
}

/* ─── Fabric thumbnails row ──────────────────────────────────────────────── */

.compare-tray__fabrics {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: flex-start;
}

.compare-tray__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    width: 52px;
}

.compare-tray__thumb {
    width: 52px;
    height: 65px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--bg-tertiary);
    flex-shrink: 0;
}

.compare-tray__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.compare-tray__thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--text-muted);
}

.compare-tray__item-name {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    margin: 0;
}

/* ×-remove button: sits top-right of the thumbnail */
.compare-tray__remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        color            var(--duration-fast) var(--ease),
        background-color var(--duration-fast) var(--ease);
}

.compare-tray__remove:hover {
    color: var(--text-primary);
    background-color: var(--surface-hover);
}

.compare-tray__remove:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 1px;
}

/* ─── Min-2 hint ─────────────────────────────────────────────────────────── */

.compare-tray__hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin: 0;
}

/* ─── CTA buttons ────────────────────────────────────────────────────────── */

.compare-tray__actions {
    display: flex;
    gap: var(--space-2);
}

.compare-tray__cta {
    flex: 1;
    justify-content: center;
}

.compare-tray__cta--primary {
    background-color: var(--accent-dark);
    color: var(--bg-secondary);
    border-color: var(--accent-dark);
}

.compare-tray__cta--primary:not(:disabled):hover {
    background-color: var(--text-primary);
    border-color: var(--text-primary);
}

.compare-tray__cta:disabled {
    opacity: 0.40;
    cursor: not-allowed;
}

/* ─── Card indicator when fabric is in tray ──────────────────────────────── */

.fabric-card--in-tray {
    outline: 2px solid var(--accent-gold);
}
