/**
 * Medicabazaar - Premium Reviews and Ratings Stylesheet
 */

:root {
    --star-gold: #F59E0B;
    --star-gray: #D1D5DB;
    --verified-green-bg: #E6F4EA;
    --verified-green-text: #137333;
    
    /* Status Badge HSL Tailored Colors */
    --pending-bg: #FFFBEB;
    --pending-text: #B45309;
    --pending-border: #FDE68A;

    --approved-bg: #F0FDF4;
    --approved-text: #15803D;
    --approved-border: #BBF7D0;

    --rejected-bg: #FEF2F2;
    --rejected-text: #B91C1C;
    --rejected-border: #FECACA;
}

/* ==========================================================================
   1. PRODUCT DETAILS - SUMMARY SCORE & PROGRESS BARS
   ========================================================================== */

.reviews-section-container {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #334155;
}

.reviews-summary-wrapper {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.reviews-summary-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-right: 1px solid #F1F5F9;
    padding-right: 20px;
}

.average-rating-num {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    color: #0F172A;
    letter-spacing: -2px;
    margin-bottom: 8px;
}

.average-rating-stars {
    color: var(--star-gold);
    font-size: 1.1rem;
    display: flex;
    gap: 4px;
}

.total-reviews-count {
    font-size: 0.85rem;
    color: #64748B;
    font-weight: 600;
    margin-top: 4px;
}

/* Star Distribution Bars */
.reviews-stars-distribution {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.distribution-row {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.star-num {
    width: 65px;
    color: #475569;
    white-space: nowrap;
}

.progress-bar-container {
    flex: 1;
    height: 8px;
    background-color: #F1F5F9;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    background-color: var(--star-gold);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* Change fill color based on low star ratings for premium feel */
#bar1, #bar2 {
    background-color: #EF4444;
}
#bar3 {
    background-color: #F59E0B;
}

.distribution-pct {
    width: 40px;
    text-align: right;
    color: #64748B;
}

@media (max-width: 768px) {
    .reviews-summary-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 24px;
    }
    .reviews-summary-score {
        border-right: none;
        border-bottom: 1px solid #F1F5F9;
        padding-right: 0;
        padding-bottom: 20px;
    }
}

.unified-filter-pills {
    background: #f1f5f9;
    padding: 3px;
    border-radius: 20px;
}

.filter-pill-btn {
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    padding: 5px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-pill-btn:hover {
    color: #0f172a;
}

.filter-pill-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.reviews-slider-outer,
.qa-slider-outer {
    position: relative;
    width: 100%;
}

.reviews-list-wrapper.reviews-list-slider {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding: 8px 4px 16px 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.reviews-list-wrapper.reviews-list-slider::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   2. REVIEWS LIST CARDS
   ========================================================================== */

.review-card-item {
    flex: 0 0 380px;
    width: 380px;
    max-width: 88vw;
    scroll-snap-align: start;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 22px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
}

.review-card-item:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border-color: #CBD5E1;
}

.review-card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.35;
    word-break: break-word;
    margin-bottom: 2px;
}

.review-card-meta {
    font-size: 0.82rem;
    color: #64748B;
    font-weight: 400;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.review-card-item .review-stars-visual {
    color: var(--star-gold);
    font-size: 0.85rem;
    display: flex;
    gap: 2px;
}

.review-card-item .verified-purchase-tag {
    color: #00A859;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #F0FDF4;
    border: 1px solid #DCFCE7;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Seller Reply Bubble in Reviews */
.review-card-item .seller-reply-bubble {
    background: #F8FAFC;
    border: 1px solid #F1F5F9;
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: auto;
}

.review-card-item .seller-reply-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.review-card-item .seller-reply-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.review-card-item .seller-reply-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.review-card-item .seller-reply-logo span {
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
}

.review-card-item .seller-reply-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.review-card-item .seller-reply-author {
    font-size: 0.84rem;
    font-weight: 400;
    color: #1E293B;
    line-height: 1.25;
}

.review-card-item .seller-reply-author strong {
    font-weight: 700;
    color: #0F172A;
}

.review-card-item .seller-reply-time {
    font-size: 0.72rem;
    color: #94A3B8;
    font-weight: 400;
}

.review-card-item .seller-reply-body {
    font-size: 0.84rem;
    color: #334155;
    line-height: 1.55;
    word-break: break-word;
}

.review-card-item .read-more-toggle {
    font-weight: 700;
    color: #0F172A;
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    transition: color 0.15s ease;
}

.review-card-item .read-more-toggle:hover {
    color: #0D47A1;
    text-decoration: underline;
}

/* Initials Avatar */
.review-avatar-circle {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
    color: #1D4ED8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    border: 1.5px solid #BFDBFE;
}

.review-meta-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.review-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.review-user-row .user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1E293B;
}

/* Verified Badge */
.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    background-color: var(--verified-green-bg);
    color: var(--verified-green-text);
    border-radius: 9999px;
    letter-spacing: 0.2px;
}

.verified-badge i {
    font-size: 10px;
}

.stars-date-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.review-date-text {
    font-size: 0.75rem;
    color: #94A3B8;
    font-weight: 500;
}

.review-comment-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #475569;
    word-break: break-word;
}

/* Seller Reply Box */
.seller-reply-box {
    background: #F8FAFC;
    border-left: 4px solid #2563EB;
    border-radius: 8px;
    padding: 16px;
    position: relative;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 6px;
}

.reply-header i {
    color: #2563EB;
    font-size: 11px;
}

.reply-content {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #475569;
}

/* ==========================================================================
   3. INTERACTIVE STAR PICKER & FORM
   ========================================================================== */

.review-form {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 24px;
}

.interactive-star-rating {
    display: inline-flex;
    gap: 8px;
    font-size: 1.8rem;
    color: var(--star-gray);
}

.interactive-star-rating .star-btn {
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}

.interactive-star-rating .star-btn:hover {
    transform: scale(1.2);
}

.interactive-star-rating .star-btn.active,
.interactive-star-rating .star-btn:hover,
.interactive-star-rating .star-btn:hover ~ .star-btn {
    color: var(--star-gold);
}

/* Invert the hover selector chain for HTML flow direction */
.interactive-star-rating:hover .star-btn {
    color: var(--star-gray); /* Reset all to gray on hover */
}
.interactive-star-rating .star-btn:hover,
.interactive-star-rating .star-btn:hover ~ .star-btn {
    /* Set current + previous sibling (due to RTL hover hacks) to gold.
       Since we cannot target previous siblings in CSS easily without float tricks,
       we will handle the hover visual feedback efficiently via JavaScript mouseover/mouseleave
       event handlers in our script, which is cleaner and works perfectly with class toggling!
       Thus, the JS handles .active dynamically. */
}

.interactive-star-rating .star-btn.active {
    color: var(--star-gold);
}

.review-textarea {
    border-radius: 12px;
    border: 1px solid #CBD5E1;
    padding: 14px;
    font-size: 0.9rem;
    resize: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.review-textarea:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.login-prompt-box {
    border: 2px dashed #E2E8F0;
    border-radius: 16px;
    background: #FFFFFF;
}

/* ==========================================================================
   4. BUYER PANEL - MY REVIEWS CUSTOM CARD LAYOUT
   ========================================================================== */

.buyer-review-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.01);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.buyer-review-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
    border-color: #CBD5E1;
}

.buyer-review-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

.buyer-review-product-side {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border-right: 1px solid #F1F5F9;
    padding-right: 20px;
}

.product-image-box {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid #F1F5F9;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    flex-shrink: 0;
    overflow: hidden;
}

.product-image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-details-box {
    flex: 1;
    min-width: 0;
}

.product-title-link {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1E293B;
    text-decoration: none;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.15s ease;
}

.product-title-link:hover {
    color: #2563EB;
}

.buyer-review-content-side {
    display: flex;
    flex-direction: column;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 9999px;
    border: 1px solid;
    width: fit-content;
}

.badge-status.pending {
    background-color: var(--pending-bg);
    color: var(--pending-text);
    border-color: var(--pending-border);
}

.badge-status.approved {
    background-color: var(--approved-bg);
    color: var(--approved-text);
    border-color: var(--approved-border);
}

.badge-status.rejected {
    background-color: var(--rejected-bg);
    color: var(--rejected-text);
    border-color: var(--rejected-border);
}

@media (max-width: 991px) {
    .buyer-review-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .buyer-review-product-side {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px solid #F1F5F9;
        padding-bottom: 15px;
    }
}

/* ==========================================================================
   5. SKELETON ANIMATIONS & PERFORMANCE
   ========================================================================== */

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.placeholder-glow .placeholder {
    animation: pulse-glow 1.5s ease-in-out infinite;
}
