/* CONTENT FOR: DollsDollhouse/css/reviews.css */

.reviews-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 60vh;
    width: 100%; /* Critical: Ensure it fits parent */
    overflow: hidden; /* Safety net: Cut off any internal overflow */
    box-sizing: border-box;
}

/* Header Stats */
.reviews-header-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
}

.average-rating-container {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

#average-score {
    font-size: clamp(2.5rem, 5vw, 3.5rem); /* Responsive scaling */
    font-weight: bold;
    color: #4a1d2f;
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

/* Primary Button */
.primary-btn {
    background: linear-gradient(135deg, #ff69b4, #db2777);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(219, 39, 119, 0.3);
    font-family: 'Inter', sans-serif;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(219, 39, 119, 0.4);
}

.full-width { width: 100%; }

/* Stars Animation */
.stars-display {
    position: relative;
    display: inline-block;
    font-size: 1.6rem;
    letter-spacing: 3px;
    font-family: sans-serif; 
}

.star-layer {
    position: absolute;
    top: 0; left: 0;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1;
}

.star-layer.empty { position: relative; color: #e5e7eb; z-index: 1; }
.star-layer.filled {
    color: transparent;
    background: linear-gradient(135deg, #fbbf24, #f472b6); 
    -webkit-background-clip: text;
    background-clip: text;
    z-index: 2;
    width: 0;
    transition: width 1.5s cubic-bezier(0.34, 1.56, 0.64, 1); 
}

#total-reviews-count {
    color: #9ca3af;
    font-size: 1rem;
}

/* Review Cards Grid - FIXED */
.reviews-grid {
    display: grid;
    /* Start with a safe default for larger screens */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.review-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: transform 0.2s;
    border: 1px solid #fce7f3;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure card doesn't overflow grid cell */
    max-width: 100%; 
    box-sizing: border-box;
}

.review-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(219, 39, 119, 0.1);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    position: relative;
    flex-wrap: wrap; /* Wrap content inside header if needed */
}

.reviewer-avatar {
    width: 40px; height: 40px;
    background: #fdf2f8;
    color: #db2777;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.reviewer-info h4 {
    margin: 0;
    font-size: 1rem;
    color: #4a1d2f;
    word-break: break-word; /* Prevent long names pushing width */
}

.verified-badge {
    background: #dcfce7;
    color: #16a34a;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    text-transform: uppercase;
    font-weight: bold;
    vertical-align: middle;
    white-space: nowrap;
}

.review-stars-static { color: #fbbf24; letter-spacing: 1px; }

.review-date {
    margin-left: auto;
    font-size: 0.8rem;
    color: #9ca3af;
}

.review-body {
    color: #374151;
    line-height: 1.6;
    font-size: 0.95rem;
    word-wrap: break-word; /* Critical for long text */
}

/* Modal */
.modal {
    display: none;
    position: fixed; z-index: 10000; left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center; justify-content: center;
}

.modal-content {
    background: #ffffff;
    margin: 5% auto;
    padding: 3rem 2rem;
    text-align: center;
    border: 1px solid #fce7f3;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 60px rgba(219, 39, 119, 0.15);
    position: relative;
    animation: modalPop 0.3s ease-out forwards;
}

@keyframes modalPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-modal {
    color: #aaa;
    position: absolute; top: 15px; right: 20px;
    font-size: 28px; font-weight: bold;
    cursor: pointer; transition: color 0.3s;
    line-height: 1;
}
.close-modal:hover { color: #db2777; }

#review-modal h2 {
    color: #db2777; font-family: 'Lovelace', serif;
    font-size: 2.5rem; margin-bottom: 0.5rem;
}

.star-rating-input {
    display: flex; flex-direction: row-reverse;
    justify-content: center; gap: 0.5rem;
    margin: 2rem 0;
}
.star-rating-input input { display: none; }
.star-rating-input label {
    font-size: 2.5rem; color: #e5e7eb; cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.star-rating-input label:hover,
.star-rating-input label:hover ~ label,
.star-rating-input input:checked ~ label {
    color: #fbbf24; transform: scale(1.1);
}

#review-modal textarea {
    width: 100%; padding: 1rem;
    border: 2px solid #fdf2f8; border-radius: 10px;
    background: #fff; font-family: 'Inter', sans-serif;
    margin-bottom: 1.5rem; resize: vertical;
    transition: border 0.3s; font-size: 1rem;
}
#review-modal textarea:focus { border-color: #db2777; outline: none; }

/* --- MOBILE RESPONSIVENESS FIXES --- */
@media (max-width: 768px) {
    .reviews-container {
        padding: 1rem; /* Reduce side padding */
    }

    .reviews-header-stats {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
        gap: 1rem;
    }

    /* Force single column stack to prevent ANY slide */
    .reviews-grid {
        grid-template-columns: 1fr; 
    }

    .review-header {
        flex-wrap: wrap; /* Wrap date to next line if needed */
    }
    
    .review-date {
        margin-left: 0;
        width: 100%;
        margin-top: 5px;
        font-size: 0.75rem;
    }

    /* Modal Mobile Fixes */
    .modal-content {
        margin: 15% auto; /* More margin top */
        padding: 2rem 1.5rem;
        width: 90%;
    }
    
    /* Make button full width on mobile */
    .primary-btn {
        width: 100%;
        text-align: center;
    }
}