/*
 * Fungiverse — Tripack Widget CSS
 * =====================================================
 * Floating sticky widget for building a 3-product tripack
 * from individual product pages.
 * Premium glassmorphism aesthetic aligned with design system.
 */

/* ═══════════════════════════════════════════════
   BASE WIDGET (Fixed bottom-right)
   ═══════════════════════════════════════════════ */
.fv-tripack-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: var(--fv-font-body, 'Inter', sans-serif);
}

@media (max-width: 600px) {
    .fv-tripack-widget {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
}

/* ─── Toggle Button (collapsed) ─── */
.fv-tripack-widget__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #0d0d0d;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    margin-left: auto;
}

.fv-tripack-widget__toggle:hover {
    background: #1a1a1a;
    border-color: var(--fv-primary, #e84d44);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(232, 77, 68, 0.15);
    transform: translateY(-2px);
}

.fv-tripack-widget__toggle-icon {
    display: flex;
    color: var(--fv-primary, #e84d44);
}

.fv-tripack-widget__toggle-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: var(--fv-primary, #e84d44);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
}

/* ─── Collapsed state ─── */
.fv-tripack-widget--collapsed .fv-tripack-widget__panel {
    display: none;
}

.fv-tripack-widget:not(.fv-tripack-widget--collapsed) .fv-tripack-widget__toggle {
    display: none;
}

/* ─── Expanded Panel ─── */
.fv-tripack-widget__panel {
    background: #0d0d0d;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.25rem;
    min-width: 320px;
    max-width: 360px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fv-tripack-slide-up 0.3s ease;
}

@keyframes fv-tripack-slide-up {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 600px) {
    .fv-tripack-widget__panel {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
}

/* ─── Header ─── */
.fv-tripack-widget__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
    position: relative;
    padding-right: 2rem;
}

.fv-tripack-widget__title {
    font-family: var(--fv-font-heading, 'Outfit', sans-serif);
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    width: 100%;
}

.fv-tripack-widget__subtitle {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 500;
}

.fv-tripack-widget__close {
    position: absolute;
    top: -4px;
    right: -4px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.fv-tripack-widget__close:hover {
    color: #fff;
}

/* ═══════════════════════════════════════════════
   SLOTS (3 Product Casilleros)
   ═══════════════════════════════════════════════ */
.fv-tripack-widget__slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.fv-tripack-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

/* Empty slot */
.fv-tripack-slot__placeholder {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease;
}

.fv-tripack-slot--empty:hover .fv-tripack-slot__placeholder {
    border-color: rgba(255, 255, 255, 0.3);
}

.fv-tripack-slot__num {
    font-size: 1.4rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.12);
    font-family: var(--fv-font-heading, 'Outfit', sans-serif);
}

/* Filled slot */
.fv-tripack-slot__product {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: #1a1a1a;
}

.fv-tripack-slot__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fv-tripack-slot__remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--fv-primary, #e84d44);
    color: #fff;
    border: 2px solid #0d0d0d;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.2s ease;
}

.fv-tripack-slot__remove:hover {
    transform: scale(1.15);
}

.fv-tripack-slot__name {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    line-height: 1.2;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Pop animation for newly filled slot */
.fv-tripack-slot--pop .fv-tripack-slot__product {
    animation: fv-slot-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fv-slot-pop {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════
   DISCOUNT BANNER
   ═══════════════════════════════════════════════ */
.fv-tripack-widget__discount {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(232, 77, 68, 0.12);
    border: 1px solid rgba(232, 77, 68, 0.3);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    animation: fv-discount-pulse 0.6s ease;
}

@keyframes fv-discount-pulse {
    0% { transform: scale(0.95); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

.fv-tripack-widget__discount-icon {
    font-size: 1.2rem;
}

.fv-tripack-widget__discount-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--fv-primary, #e84d44);
}

/* ═══════════════════════════════════════════════
   ACTIONS
   ═══════════════════════════════════════════════ */
.fv-tripack-widget__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fv-tripack-widget__checkout-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--fv-primary, #e84d44);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: var(--fv-font-heading, 'Outfit', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fv-tripack-widget__checkout-btn:hover:not(:disabled) {
    background: #d43a32;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 77, 68, 0.35);
}

.fv-tripack-widget__checkout-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #333;
    color: rgba(255, 255, 255, 0.5);
}

.fv-tripack-widget__clear-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 0.25rem;
    text-align: center;
    transition: color 0.2s;
}

.fv-tripack-widget__clear-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ═══════════════════════════════════════════════
   SHAKE ANIMATION (full / duplicate)
   ═══════════════════════════════════════════════ */
.fv-tripack-widget--shake {
    animation: fv-widget-shake 0.5s ease;
}

@keyframes fv-widget-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ═══════════════════════════════════════════════
   "SUMAR AL TRIPACK" BUTTON (in product page)
   ═══════════════════════════════════════════════ */
.fv-tripack-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: transparent;
    border: 1.5px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

.fv-tripack-add-btn:hover:not(:disabled) {
    border-color: var(--fv-primary, #e84d44);
    color: var(--fv-primary, #e84d44);
    background: rgba(232, 77, 68, 0.06);
}

.fv-tripack-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fv-tripack-add-btn--added {
    border-color: rgba(102, 174, 76, 0.4);
    color: rgba(102, 174, 76, 0.8);
    background: rgba(102, 174, 76, 0.06);
}

.fv-tripack-add-btn__icon {
    display: flex;
    flex-shrink: 0;
}

.fv-tripack-add-btn__text {
    /* text content controlled by JS */
}

/* ─── Tripack hint text under add button ─── */
.fv-tripack-hint {
    text-align: center;
    font-size: 0.72rem;
    color: rgba(0, 0, 0, 0.35);
    margin-top: 0.3rem;
}
