/* ========================================
   RECENTLY VIEWED PRODUCTS POPUP
   Nhan Audio Brand Colors
   Gradient: Cyan (#00d4ff) → Purple (#8b5cf6)
======================================== */

/* Floating Button */
.rv-floating-btn {
    position: fixed;
    left: 24px;
    bottom: 24px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #00d4ff 0%, #8b5cf6 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
}

.rv-floating-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.rv-floating-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.3);
}

.rv-floating-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.rv-floating-btn svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.5;
    transition: transform 0.3s ease;
}

.rv-floating-btn:hover svg {
    transform: scale(1.1);
}

/* Badge counter */
.rv-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(238, 90, 90, 0.5);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Pulse animation */
.rv-floating-btn::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #8b5cf6 100%);
    animation: rv-pulse 2s ease-out infinite;
    opacity: 0;
}

@keyframes rv-pulse {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Overlay */
.rv-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.rv-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.rv-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 16px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

.rv-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Popup Header - Gradient matching logo */
.rv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #00d4ff 0%, #8b5cf6 100%);
    color: #ffffff;
}

.rv-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rv-header-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rv-header-icon svg {
    width: 22px;
    height: 22px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 1.5;
}

.rv-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.rv-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.rv-close-btn svg {
    width: 18px;
    height: 18px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 2;
}

/* Products Grid */
.rv-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 24px;
    max-height: calc(85vh - 140px);
    overflow-y: auto;
}

.rv-products-grid::-webkit-scrollbar {
    width: 6px;
}

.rv-products-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.rv-products-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00d4ff 0%, #8b5cf6 100%);
    border-radius: 3px;
}

/* Product Card */
.rv-product-card {
    position: relative;
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid #eee;
}

.rv-product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.15);
    border-color: #00d4ff;
}

/* Product Image */
.rv-product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f5;
}

.rv-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.rv-product-card:hover .rv-product-image img {
    transform: scale(1.08);
}

/* Quick View Overlay */
.rv-quick-view {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.85) 0%, rgba(139, 92, 246, 0.85) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rv-product-card:hover .rv-quick-view {
    opacity: 1;
}

.rv-quick-view span {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.rv-product-card:hover .rv-quick-view span {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Product Info */
.rv-product-info {
    padding: 14px;
}

.rv-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rv-product-price {
    font-size: 14px;
    font-weight: 600;
    color: #8b5cf6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rv-product-price .rv-old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
    margin-left: 8px;
}

/* Remove Button */
.rv-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.rv-product-card:hover .rv-remove-btn {
    opacity: 1;
}

.rv-remove-btn:hover {
    background: #e74c3c;
    transform: scale(1.1);
}

.rv-remove-btn svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 2;
}

/* Empty State */
.rv-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.rv-empty-state svg {
    width: 64px;
    height: 64px;
    stroke: #ddd;
    fill: none;
    stroke-width: 1;
    margin-bottom: 16px;
}

.rv-empty-state p {
    margin: 0;
    font-size: 15px;
}

/* Footer */
.rv-footer {
    padding: 0px 24px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
    text-align: center;
}

.rv-clear-all {
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 0px 16px;
    transition: all 0.3s ease;
}

.rv-clear-all:hover {
    color: #e74c3c;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .rv-floating-btn {
        left: 16px;
        bottom: 16px;
        width: 50px;
        height: 50px;
    }

    .rv-popup {
        width: 95%;
        max-height: 80vh;
    }

    .rv-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .rv-header {
        padding: 16px 20px;
    }

    .rv-header h3 {
        font-size: 16px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .rv-floating-btn {
        left: 12px;
        bottom: 12px;
        width: 46px;
        height: 46px;
    }

    .rv-floating-btn svg {
        width: 20px;
        height: 20px;
    }

    .rv-badge {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .rv-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }

    .rv-product-info {
        padding: 10px;
    }

    .rv-product-name {
        font-size: 12px;
    }

    .rv-product-price {
        font-size: 13px;
    }
}

/* Animation for removing items */
.rv-product-card.removing {
    animation: rv-remove 0.4s ease forwards;
}

@keyframes rv-remove {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

/* ========================================
   CUSTOM CONFIRM DIALOG
======================================== */
.rv-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.rv-confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.rv-confirm-box {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.rv-confirm-overlay.active .rv-confirm-box {
    transform: scale(1) translateY(0);
}

.rv-confirm-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.rv-confirm-icon svg {
    width: 28px;
    height: 28px;
    stroke: #8b5cf6;
    fill: none;
    stroke-width: 1.5;
}

.rv-confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rv-confirm-message {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rv-confirm-buttons {
    display: flex;
    gap: 12px;
}

.rv-confirm-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: none;
}

.rv-confirm-btn.cancel {
    background: #f5f5f5;
    color: #666;
}

.rv-confirm-btn.cancel:hover {
    background: #eee;
    color: #333;
}

.rv-confirm-btn.confirm {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(238, 90, 90, 0.3);
}

.rv-confirm-btn.confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(238, 90, 90, 0.4);
}

.rv-confirm-btn.confirm:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    .rv-confirm-box {
        padding: 24px 20px;
        margin: 0 16px;
    }

    .rv-confirm-title {
        font-size: 16px;
    }

    .rv-confirm-message {
        font-size: 13px;
    }

    .rv-confirm-btn {
        padding: 11px 16px;
        font-size: 13px;
    }
}