/**
 * WooCommerce Gemini AI Auto Reviews - Frontend Styles V3
 * Enhanced review display with modern aesthetics
 *
 * @package WC_Gemini_Auto_Reviews
 * @since 3.0.0
 */

/* ==========================================================================
   Review Container
   ========================================================================== */

.woocommerce-Reviews {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ==========================================================================
   Sorting Controls
   ========================================================================== */

.wcgar-review-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.wcgar-review-count {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.wcgar-review-count span {
    color: #667eea;
}

.wcgar-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcgar-sort-wrapper label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

.wcgar-sort-select {
    padding: 8px 32px 8px 14px;
    font-size: 14px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    background-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.wcgar-sort-select:hover {
    border-color: #667eea;
}

.wcgar-sort-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ==========================================================================
   Review Cards - User Requested Vertical Layout
   ========================================================================== */

.woocommerce-Reviews .comment_container {
    display: flex !important;
    flex-direction: column !important;
    /* Stack everything vertically */
    align-items: flex-start !important;
    /* Align left */
    gap: 12px !important;
    padding: 24px;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Hover effect for the entire card */
.woocommerce-Reviews .comment_container:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* 1. Avatar (Top Left, Smaller) */
.woocommerce-Reviews .comment_container img.avatar {
    width: 48px !important;
    /* Smaller size as requested */
    height: 48px !important;
    border-radius: 50% !important;
    object-fit: cover;
    border: 2px solid #f1f3f4;
    position: static !important;
    margin: 0 !important;
    float: none !important;
}

/* Reset the comment-text container to be a wrapper for the rest */
.woocommerce-Reviews .comment-text {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
    /* Allow inline flow for stars/badge */
}

/* 2. Name/Date line */
.woocommerce-Reviews .meta {
    display: block !important;
    margin-bottom: 8px !important;
    color: #6c757d;
}

.woocommerce-Reviews .woocommerce-review__author {
    font-weight: 700;
    font-size: 16px;
    color: #1a1a2e;
}

.woocommerce-Reviews .woocommerce-review__published-date {
    color: #6c757d;
    font-size: 13px;
}

/* 3. Stars and Badge Line */
.woocommerce-Reviews .star-rating {
    float: none !important;
    display: inline-block !important;
    /* Sit next to badge */
    vertical-align: middle !important;
    margin-right: 8px !important;
    margin-bottom: 4px !important;
    /* Spacing */
}

.wcgar-verified-badge {
    display: inline-flex !important;
    /* Sit next to stars */
    align-items: center;
    vertical-align: middle !important;
    margin-bottom: 4px !important;

    /* Badge Style Refinement */
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 4px;
    /* More like a tag, or "badge" */
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcgar-verified-badge svg {
    margin-right: 4px;
    fill: currentColor;
    width: 12px;
    height: 12px;
}

/* 4. Text Review Area */
.woocommerce-Reviews .description {
    display: block !important;
    clear: both !important;
    margin-top: 12px !important;
    line-height: 1.6;
    color: #495057;
}

.woocommerce-Reviews .description p {
    margin: 0;
}

/* Yellow Stars Override (Keep from previous step) */
.woocommerce .star-rating::before,
.woocommerce-Reviews .star-rating::before,
#reviews .star-rating::before {
    color: #e0e0e0 !important;
}

.woocommerce .star-rating span::before,
.woocommerce-Reviews .star-rating span::before,
#reviews .star-rating span::before {
    color: #ffc107 !important;
}

.woocommerce .star-rating span,
.woocommerce-Reviews .star-rating span {
    color: #ffc107 !important;
}

/* Hide duplicate verified */
.woocommerce-review__verified,
.woocommerce-Reviews .woocommerce-review__verified,
.woocommerce-review__author em.woocommerce-review__verified,
#reviews em.woocommerce-review__verified {
    display: none !important;
}

/* ==========================================================================
   Star-Only Reviews (No Text)
   ========================================================================== */

.wcgar-star-only-review .description {
    display: none;
}

.wcgar-star-only-review .comment_container {
    padding: 16px 24px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.woocommerce-noreviews {
    text-align: center;
    padding: 48px 24px;
    background: #f8f9fa;
    border-radius: 16px;
    color: #6c757d;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .wcgar-review-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .woocommerce-Reviews .comment_container {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .woocommerce-Reviews .comment_container img.avatar {
        width: 48px;
        height: 48px;
    }
}

/* ==========================================================================
   Animation
   ========================================================================== */

@keyframes wcgar-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.woocommerce-Reviews .comment_container {
    animation: wcgar-fade-in 0.4s ease forwards;
}

.woocommerce-Reviews li:nth-child(1) .comment_container {
    animation-delay: 0s;
}

.woocommerce-Reviews li:nth-child(2) .comment_container {
    animation-delay: 0.05s;
}

.woocommerce-Reviews li:nth-child(3) .comment_container {
    animation-delay: 0.1s;
}

.woocommerce-Reviews li:nth-child(4) .comment_container {
    animation-delay: 0.15s;
}

.woocommerce-Reviews li:nth-child(5) .comment_container {
    animation-delay: 0.2s;
}

/* ==========================================================================
   Review Photos - Simple Side-by-Side
   Desktop: Fixed 140x140px thumbnails
   Mobile: 50/50 column layout
   ========================================================================== */

.wcgar-review-photos {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.wcgar-review-photo {
    flex: 0 0 auto;
    width: 140px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    background: #f8f9fa;
}


.wcgar-review-photo a {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wcgar-review-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.wcgar-review-photo:hover img {
    transform: scale(1.05);
}

/* Mobile: 50/50 columns */
@media (max-width: 600px) {
    .wcgar-review-photos {
        width: 100%;
    }

    .wcgar-review-photo {
        flex: 1 1 calc(50% - 5px);
        width: auto;
        height: auto;
        aspect-ratio: 1 / 1;
    }
}

/* ==========================================================================
   Reviews Pagination
   ========================================================================== */

.wcgar-reviews-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 24px 16px;
    margin-top: 24px;
    border-top: 1px solid #e9ecef;
}

.wcgar-pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    background: #fff;
    border: 2px solid #667eea;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.wcgar-pagination-btn:hover {
    background: #667eea;
    color: #fff;
}

.wcgar-pagination-info {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

@media (max-width: 480px) {
    .wcgar-reviews-pagination {
        flex-direction: column;
        gap: 12px;
    }

    .wcgar-pagination-btn {
        width: 100%;
        justify-content: center;
    }
}