/**
 * COMPLETE Flipkart-Style Reviews CSS - FIXED
 * Fixes: Modal visibility bug + Mobile full width
 */

/* ===== MAIN CONTAINER ===== */
.wrickx-flipkart-reviews {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ===== COMPACT HEADING ===== */
.flipkart-reviews-heading {
    font-size: 18px;
    font-weight: 500;
    color: #212121;
    margin: 0 0 20px 0;
    padding: 0;
}

/* ===== RATING SUMMARY ===== */
.flipkart-rating-summary-container {
    display: flex;
    gap: 40px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.flipkart-rating-left {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #f0f0f0;
    padding-right: 30px;
}

.rating-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 8px;
}

.rating-number {
    font-size: 48px;
    font-weight: 600;
    color: #212121;
    line-height: 1;
}

.rating-star {
    font-size: 20px;
    color: #26a541;
}

.rating-meta {
    font-size: 14px;
    color: #878787;
    text-align: center;
    line-height: 1.4;
}

.flipkart-rating-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.rating-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-star-label {
    font-size: 14px;
    color: #212121;
    min-width: 40px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.star-icon {
    font-size: 12px;
    color: #878787;
}

.bar-outer {
    flex: 1;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.bar-inner {
    height: 100%;
    transition: width 0.3s ease;
}

.bar-excellent { background: #26a541; }
.bar-good { background: #66bb6a; }
.bar-average { background: #ff9f00; }
.bar-below { background: #ff6161; }
.bar-poor { background: #ff6161; }

.bar-count-label {
    font-size: 14px;
    color: #878787;
    min-width: 50px;
    text-align: right;
}

/* ===== REVIEW PHOTOS SECTION ===== */
.flipkart-review-photos-section {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 20px;
}

.photos-section-title {
    font-size: 14px;
    font-weight: 500;
    color: #212121;
    margin: 0 0 12px 0;
}

.photos-gallery-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.photos-gallery-container::-webkit-scrollbar {
    height: 4px;
}

.photos-gallery-container::-webkit-scrollbar-thumb {
    background: #c2c2c2;
    border-radius: 2px;
}

.photo-gallery-item {
    flex: 0 0 100px;
    width: 100px;
    height: 100px;
    border: 1px solid #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.photo-gallery-item:hover {
    transform: scale(1.05);
    border-color: #2874f0;
    box-shadow: 0 2px 8px rgba(40, 116, 240, 0.2);
}

.photo-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photos-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.photos-gallery-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-message {
    font-size: 14px;
    color: #212121;
    margin: 0 0 4px 0;
    font-weight: 500;
}

.empty-submessage {
    font-size: 13px;
    color: #878787;
    margin: 0;
}

/* ===== REVIEWS LIST ===== */
.flipkart-reviews-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.flipkart-review-card {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.flipkart-review-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.flipkart-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}

.badge-5 { background: #26a541; }
.badge-4 { background: #66bb6a; }
.badge-3 { background: #ff9f00; }
.badge-2 { background: #ff9f00; }
.badge-1 { background: #ff6161; }

.badge-star {
    font-size: 10px;
}

.review-text-content {
    font-size: 14px;
    line-height: 1.6;
    color: #212121;
    margin-bottom: 12px;
}

.review-text-content p {
    margin: 0 0 8px 0;
}

.review-text-content p:last-child {
    margin-bottom: 0;
}

.review-inline-images {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.review-inline-image-item {
    width: 80px;
    height: 80px;
    border: 1px solid #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.review-inline-image-item:hover {
    transform: scale(1.05);
    border-color: #2874f0;
    box-shadow: 0 2px 8px rgba(40, 116, 240, 0.2);
}

.review-inline-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.flipkart-reviewer-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #878787;
    flex-wrap: wrap;
}

.reviewer-name {
    font-weight: 500;
    color: #212121;
}

.verified-purchase-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #26a541;
    font-weight: 500;
}

.verified-purchase-badge svg {
    width: 12px;
    height: 12px;
}

.review-date-posted {
    color: #878787;
}

/* ===== FULL-SCREEN IMAGE MODAL (FIXED) ===== */
.flipkart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: none; /* Hidden by default */
}

/* CRITICAL FIX: When active, show modal */
.flipkart-modal-overlay.active {
    display: block !important; /* Override inline styles */
    opacity: 1;
    visibility: visible;
}

.flipkart-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: background 0.2s;
}

.flipkart-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.flipkart-modal-prev,
.flipkart-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.flipkart-modal-prev:hover,
.flipkart-modal-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.flipkart-modal-prev {
    left: 20px;
}

.flipkart-modal-next {
    right: 20px;
}

.flipkart-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flipkart-modal-image {
    max-width: 100%;
    max-height: calc(100vh - 250px);
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.flipkart-modal-info {
    margin-top: 16px;
    text-align: center;
}

.modal-reviewer-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.flipkart-modal-thumbs {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    max-width: 90%;
    overflow-x: auto;
}

.flipkart-modal-thumbs::-webkit-scrollbar {
    height: 4px;
}

.flipkart-modal-thumbs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.modal-thumb-item {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
}

.modal-thumb-item:hover,
.modal-thumb-item.active {
    opacity: 1;
    border-color: #2874f0;
}

.modal-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== MOBILE RESPONSIVE (FULL WIDTH + FIXES) ===== */
@media (max-width: 768px) {
    /* FULL WIDTH ON MOBILE */
    .wrickx-flipkart-reviews {
        max-width: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .flipkart-reviews-heading {
        font-size: 16px;
        margin-bottom: 16px;
        padding: 0 12px;
    }
    
    .flipkart-rating-summary-container {
        flex-direction: column;
        gap: 20px;
        padding: 16px 12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .flipkart-rating-left {
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
        padding-right: 0;
        padding-bottom: 20px;
    }
    
    .rating-number {
        font-size: 40px;
    }
    
    .flipkart-review-photos-section {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 16px 12px;
    }
    
    .photo-gallery-item {
        flex: 0 0 80px;
        width: 80px;
        height: 80px;
    }
    
    .flipkart-reviews-list-container {
        padding: 0;
    }
    
    .flipkart-review-card {
        padding: 16px 12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .flipkart-modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
    
    .flipkart-modal-prev,
    .flipkart-modal-next {
        width: 40px;
        height: 40px;
    }
    
    .flipkart-modal-prev {
        left: 10px;
    }
    
    .flipkart-modal-next {
        right: 10px;
    }
    
    .flipkart-modal-thumbs {
        bottom: 10px;
        padding: 8px;
    }
    
    .modal-thumb-item {
        flex: 0 0 50px;
        width: 50px;
        height: 50px;
    }
}

/* Hide default WooCommerce styles */
.wrickx-flipkart-reviews .star-rating {
    display: none !important;
}