/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Grid */
.rp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.rp-item {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.rp-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
}

.rp-item.out-of-stock {
    opacity: 0.75;
    background: #fafafa;
    filter: grayscale(0.3);
}

.rp-item.out-of-stock .rp-view-details {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: #ccc;
}

.rp-item.out-of-stock::after {
    content: "OUT OF STOCK";
    position: absolute;
    top: 20px;
    right: -35px;
    background: #e53e3e;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 40px;
    transform: rotate(45deg);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
    z-index: 10;
}

.rp-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f5f5f5;
}

.rp-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.rp-item:hover .rp-thumbnail img {
    transform: scale(1.05);
}

.rp-item h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 20px 20px 10px;
    color: #1a1a1a;
    line-height: 1.3;
}

/* NEW: Categories aligned + styled */
.rp-categories {
    margin: 0 20px 12px; /* same lateral spacing as title/meta */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.2;
}

/* Badge style for categories */
.rp-cat-badge {
    background: #eef2ff;
    color: #3c366b;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
    border: 1px solid rgba(102, 126, 234, 0.35);
}

.rp-meta {
    margin: 0 20px 15px;
}

.rp-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.rp-quantity {
    font-size: 0.95rem;
    font-weight: 500;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rp-quantity span {
    background: #e6f7e6;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rp-quantity .out-of-stock-badge {
    background: #fee;
    color: #c62828;
}

.rp-view-details {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 0 20px 25px 20px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255,255,255,0.2);
    align-self: center;
}

.rp-view-details:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a0 100%);
    box-shadow: 0 7px 20px rgba(102, 126, 234, 0.4);
    transform: scale(1.02);
}

/* Popup - Perfectly centered */
#rp-popup {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    font-family: 'Inter', sans-serif;
}

.rp-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.rp-popup-container {
    background: #fff;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.3s ease;
    margin: 0 auto !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rp-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    font-weight: 400;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
    line-height: 1;
    background: rgba(0,0,0,0.05);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
}

.rp-close:hover {
    color: #333;
    background: rgba(0,0,0,0.1);
}

#rp-popup-details h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 15px;
    color: #1a1a1a;
    padding-right: 40px;
}

.rp-main-content {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 1rem;
}

.rp-long-description {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 4px solid #667eea;
}

.rp-long-description strong {
    color: #2d3748;
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.rp-price-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin: 15px 0;
}

.rp-availability {
    margin-top: 20px;
    font-weight: 500;
}

.out-of-stock-text {
    background: #fee;
    color: #c62828;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
}

/* Gallery inside popup */
.rp-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.rp-gallery-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.rp-gallery-item img:hover {
    transform: scale(1.03);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-color: #667eea;
}

/* Lightbox - Perfectly centered */
#rp-lightbox {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000000 !important;
    font-family: 'Inter', sans-serif;
}

.rp-lightbox-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.9);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
}

.rp-lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.rp-lightbox-close {
    position: absolute;
    top: -40px;
    right: -40px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    background: rgba(0,0,0,0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.rp-lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

#rp-lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .rp-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .rp-popup-container {
        padding: 20px;
        width: 95%;
    }

    .rp-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .rp-item.out-of-stock::after {
        font-size: 10px;
        padding: 4px 30px;
        top: 15px;
        right: -30px;
    }

    .rp-lightbox-close {
        top: -30px;
        right: 0;
    }

    /* NEW: Smaller category badges in mobile */
    .rp-categories {
        margin: 0 20px 10px;
        gap: 6px;
        font-size: 0.85rem;
    }

    .rp-cat-badge {
        padding: 5px 9px;
        font-size: 0.78rem;
    }
}

.rp-login-message,
.rp-no-rewards {
    text-align: center;
    font-family: system-ui;
    padding: 40px;
}