/*
 * WC Reviews Revamp — styles
 * Scoped under .wcrr-wrap. Uses high-specificity rules to override
 * theme styles (including WoodMart).
 */

/* ---------- Reset within our wrap ---------- */
.wcrr-wrap,
.wcrr-wrap * {
    box-sizing: border-box;
}

.wcrr-wrap {
    --wcrr-star:        #f5b800;
    --wcrr-star-empty:  #e2e2e2;
    --wcrr-bar:         #9a9a9a;
    --wcrr-bar-track:   #ececec;
    --wcrr-text:        #1c1c1c;
    --wcrr-muted:       #6b6b6b;
    --wcrr-border:      #d9d9d9;
    --wcrr-radius:      10px;

    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 8px 0 32px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--wcrr-text);
}

/* ---------- Summary block (desktop: 2-column, mobile: stacked) ---------- */
.wcrr-wrap .wcrr-summary {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    grid-template-areas:
        "score    breakdown"
        "count    breakdown"
        "actions  actions";
    column-gap: 48px;
    row-gap: 16px;
    align-items: start;
    padding: 16px 0 24px;
    text-align: left;
}

.wcrr-wrap .wcrr-summary__score    { grid-area: score; }
.wcrr-wrap .wcrr-summary__count    { grid-area: count; }
.wcrr-wrap .wcrr-breakdown         { grid-area: breakdown; margin: 0; }
.wcrr-wrap .wcrr-actions           { grid-area: actions; }

.wcrr-wrap .wcrr-summary--empty {
    grid-template-columns: 1fr;
    grid-template-areas:
        "count"
        "actions";
    text-align: center;
}

@media (max-width: 768px) {
    .wcrr-wrap .wcrr-summary {
        grid-template-columns: 1fr;
        grid-template-areas:
            "score"
            "count"
            "breakdown"
            "actions";
        max-width: 480px;
        margin: 0 auto;
        text-align: center;
        column-gap: 0;
    }
    .wcrr-wrap .wcrr-summary__score {
        justify-content: center;
    }
}

.wcrr-wrap .wcrr-summary__score {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    line-height: 1;
    justify-content: flex-start;
}

.wcrr-wrap .wcrr-summary__star {
    color: var(--wcrr-star);
    display: inline-flex;
}

.wcrr-wrap .wcrr-summary__value {
    font-size: 38px;
    font-weight: 500;
    color: var(--wcrr-text);
    letter-spacing: -0.5px;
}

.wcrr-wrap .wcrr-summary__count {
    font-size: 17px;
    color: var(--wcrr-text);
    margin: 0;
}

.wcrr-wrap .wcrr-summary__count span {
    font-weight: 500;
}

/* ---------- Breakdown bars ---------- */
.wcrr-wrap .wcrr-breakdown {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wcrr-wrap .wcrr-breakdown__row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wcrr-wrap .wcrr-breakdown__stars {
    display: inline-flex;
    gap: 1px;
}

.wcrr-wrap .wcrr-star.is-on  { color: var(--wcrr-star); }
.wcrr-wrap .wcrr-star.is-off { color: var(--wcrr-star-empty); }

.wcrr-wrap .wcrr-breakdown__bar {
    position: relative;
    height: 8px;
    background: var(--wcrr-bar-track);
    border-radius: 999px;
    overflow: hidden;
    display: block;
}

.wcrr-wrap .wcrr-breakdown__bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--wcrr-bar);
    border-radius: 999px;
    display: block;
    transition: width .4s ease;
}

.wcrr-wrap .wcrr-breakdown__count {
    font-size: 14px;
    color: var(--wcrr-text);
    min-width: 36px;
    text-align: right;
}

/* ---------- Actions row (Write a review) ---------- */
.wcrr-wrap .wcrr-actions {
    display: flex;
    align-items: stretch;
    margin-top: 8px;
    max-width: 480px;
    width: 100%;
}

@media (max-width: 768px) {
    .wcrr-wrap .wcrr-actions {
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

.wcrr-wrap .wcrr-write-btn {
    flex: 1;
    background: #fff;
    color: var(--wcrr-text);
    border: 1px solid var(--wcrr-border);
    border-radius: var(--wcrr-radius);
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
    font-family: inherit;
    line-height: 1;
    text-align: center;
}

.wcrr-wrap .wcrr-write-btn:hover,
.wcrr-wrap .wcrr-write-btn:focus-visible {
    background: #f7f7f7;
    border-color: #bdbdbd;
    outline: none;
}

.wcrr-wrap .wcrr-write-btn[aria-expanded="true"] {
    background: #1c1c1c;
    color: #fff;
    border-color: #1c1c1c;
}

/* ---------- Form region ---------- */
.wcrr-wrap .wcrr-form-region {
    margin-top: 20px;
    padding: 20px 18px;
    border: 1px solid var(--wcrr-border);
    border-radius: var(--wcrr-radius);
    background: #fafafa;
    animation: wcrr-fade .25s ease both;
}

@keyframes wcrr-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wcrr-wrap .wcrr-form-region[hidden] {
    display: none;
}

/* Hide WC's default "Leave a review" title — we already have a button */
.wcrr-wrap #review_form .comment-reply-title {
    display: none;
}

.wcrr-wrap .wcrr-field {
    margin: 0 0 14px;
}

.wcrr-wrap .wcrr-field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--wcrr-text);
}

.wcrr-wrap .wcrr-field input[type="text"],
.wcrr-wrap .wcrr-field input[type="email"],
.wcrr-wrap .wcrr-field textarea {
    width: 100%;
    border: 1px solid var(--wcrr-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--wcrr-text);
    box-shadow: none;
    transition: border-color .15s ease;
}

.wcrr-wrap .wcrr-field input:focus,
.wcrr-wrap .wcrr-field textarea:focus {
    outline: none;
    border-color: #1c1c1c;
}

.wcrr-wrap .wcrr-field textarea {
    min-height: 110px;
    resize: vertical;
}

.wcrr-wrap .wcrr-field .required {
    color: #d11919;
}

/* Star rating widget (WC's built-in markup is <p class="stars"><span><a>...</a>x5</span></p>).
   WC's own JS adds .active to the chosen star and .selected to .stars on click.
   Strategy: every <a> is a star icon (SVG mask). All-yellow on hover; on rest,
   yellow up to .active. */
.wcrr-wrap .comment-form-rating .stars {
    margin: 4px 0 0;
}

.wcrr-wrap .comment-form-rating .stars a {
    color: var(--wcrr-star-empty);
    text-decoration: none;
    font-size: 0;
    line-height: 1;
    display: inline-block;
    width: 28px;
    height: 28px;
    margin-right: 2px;
    position: relative;
    transition: color .1s ease;
}

.wcrr-wrap .comment-form-rating .stars a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2.5l2.95 5.98 6.6.96-4.78 4.66 1.13 6.57L12 17.56l-5.9 3.1 1.13-6.56L2.45 9.44l6.6-.96L12 2.5z'/></svg>") center/contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2.5l2.95 5.98 6.6.96-4.78 4.66 1.13 6.57L12 17.56l-5.9 3.1 1.13-6.56L2.45 9.44l6.6-.96L12 2.5z'/></svg>") center/contain no-repeat;
}

/* Selected: yellow up to .active, grey after */
.wcrr-wrap .comment-form-rating .stars.selected a {
    color: var(--wcrr-star);
}
.wcrr-wrap .comment-form-rating .stars.selected a.active ~ a {
    color: var(--wcrr-star-empty);
}

/* Hover: yellow up to hovered, grey after */
.wcrr-wrap .comment-form-rating .stars:hover a {
    color: var(--wcrr-star);
}
.wcrr-wrap .comment-form-rating .stars a:hover ~ a {
    color: var(--wcrr-star-empty);
}

/* Rating error state */
.wcrr-wrap .comment-form-rating .stars.is-error a {
    color: #d11919;
}
.wcrr-wrap .comment-form-rating .stars.is-error:hover a {
    color: var(--wcrr-star);
}
.wcrr-wrap .comment-form-rating .stars.is-error a:hover ~ a {
    color: var(--wcrr-star-empty);
}
.wcrr-wrap .wcrr-rating-error {
    color: #d11919;
    font-size: 13px;
    margin: 6px 0 0;
}

/* Submit button */
.wcrr-wrap #review_form .form-submit {
    margin: 8px 0 0;
}

.wcrr-wrap #review_form .form-submit .submit,
.wcrr-wrap #review_form input[type="submit"] {
    background: #1c1c1c;
    color: #fff;
    border: 1px solid #1c1c1c;
    border-radius: var(--wcrr-radius);
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease;
    font-family: inherit;
}

.wcrr-wrap #review_form .form-submit .submit:hover,
.wcrr-wrap #review_form input[type="submit"]:hover {
    background: #000;
}

/* ---------- Reviews list ---------- */
.wcrr-wrap .wcrr-list {
    list-style: none;
    margin: 30px 0 0;
    padding: 0;
}

.wcrr-wrap .wcrr-list .comment_container {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--wcrr-border);
}

.wcrr-wrap .wcrr-list li:first-child .comment_container {
    border-top: none;
    padding-top: 4px;
}

.wcrr-wrap .wcrr-list .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex: 0 0 42px;
}

.wcrr-wrap .wcrr-list .comment-text {
    flex: 1;
    min-width: 0;
}

.wcrr-wrap .wcrr-list .meta {
    font-size: 13px;
    color: var(--wcrr-muted);
    margin: 4px 0 8px;
}

.wcrr-wrap .wcrr-list .meta strong {
    color: var(--wcrr-text);
    font-weight: 500;
    margin-right: 4px;
}

.wcrr-wrap .wcrr-list .description p {
    margin: 0 0 6px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--wcrr-text);
}

.wcrr-wrap .wcrr-list .star-rating {
    margin: 0 0 4px;
    color: var(--wcrr-star);
    font-size: 13px;
    width: 5.4em;
}

/* Pagination */
.wcrr-wrap .page-numbers {
    margin: 20px 0 0;
    display: flex;
    gap: 6px;
    list-style: none;
    padding: 0;
    justify-content: center;
}

.wcrr-wrap .page-numbers li a,
.wcrr-wrap .page-numbers li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--wcrr-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--wcrr-text);
    font-size: 14px;
}

.wcrr-wrap .page-numbers li .current {
    background: #1c1c1c;
    color: #fff;
    border-color: #1c1c1c;
}

/* ---------- WoodMart / generic theme overrides ----------
 * WoodMart wraps things in .wd-single-reviews, adds its own
 * .comment-form-rating styling, and sometimes pumps margins.
 * We force our look back on.
 */
.wcrr-wrap .commentlist .comment-text {
    padding: 0;
    border: 0;
    background: transparent;
}

.wcrr-wrap .commentlist > li.review,
.wcrr-wrap .commentlist > li.comment {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
}

.wcrr-wrap .star-rating::before,
.wcrr-wrap .star-rating span::before {
    color: var(--wcrr-star) !important;
}

/* ============================================================
   Image uploader (in review form)
   ============================================================ */

.wcrr-wrap .wcrr-field--images { margin-top: 4px; }

.wcrr-wrap .wcrr-uploader {
    position: relative;
}

.wcrr-wrap .wcrr-uploader__drop {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    border: 1px dashed var(--wcrr-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    color: var(--wcrr-muted);
    transition: border-color .15s ease, background .15s ease;
    position: relative;
}

.wcrr-wrap .wcrr-uploader__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    /* Allow click but not visible */
    z-index: 1;
}

.wcrr-wrap .wcrr-uploader__drop:hover {
    border-color: #1c1c1c;
    background: #fafafa;
    color: var(--wcrr-text);
}

.wcrr-wrap .wcrr-uploader__text {
    font-size: 13px;
    line-height: 1.4;
}

.wcrr-wrap .wcrr-uploader__previews {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wcrr-wrap .wcrr-uploader__preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

.wcrr-wrap .wcrr-uploader__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wcrr-wrap .wcrr-uploader__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.wcrr-wrap .wcrr-uploader__remove:hover {
    background: rgba(0, 0, 0, 0.85);
}

.wcrr-wrap .wcrr-uploader__error {
    color: #d11919;
    font-size: 13px;
    margin: 8px 0 0;
    min-height: 1em;
}

/* ============================================================
   Review images gallery (under each review's text)
   ============================================================ */

.wcrr-wrap .wcrr-review-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 4px;
}

.wcrr-wrap .wcrr-review-gallery__item {
    display: block;
    width: 84px;
    height: 84px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    transition: transform .15s ease;
}

.wcrr-wrap .wcrr-review-gallery__item:hover {
    transform: scale(1.03);
}

.wcrr-wrap .wcrr-review-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================
   Lightbox (global — outside .wcrr-wrap)
   ============================================================ */

.wcrr-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.wcrr-lightbox.is-open {
    display: flex;
    animation: wcrr-lb-in .15s ease both;
}

@keyframes wcrr-lb-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.wcrr-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.wcrr-lightbox__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcrr-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* ---------- Guest hint (encourage login for photo uploads) ---------- */
.wcrr-wrap .wcrr-guest-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin: 4px 0 14px;
    border: 1px dashed var(--wcrr-border);
    border-radius: 8px;
    background: #fafafa;
    color: var(--wcrr-muted);
    font-size: 13.5px;
    line-height: 1.5;
}

.wcrr-wrap .wcrr-guest-hint svg {
    flex: 0 0 18px;
    color: var(--wcrr-muted);
}

.wcrr-wrap .wcrr-guest-hint a {
    color: var(--wcrr-text);
    text-decoration: underline;
    font-weight: 500;
}

.wcrr-wrap .wcrr-guest-hint a:hover {
    color: #000;
}

/* ---------- Guest row: hint + Name + Email in one line on desktop ---------- */
.wcrr-wrap #review_form .wcrr-guest-row,
.wcrr-wrap .wcrr-guest-row {
    display: flex !important;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 14px !important;
    align-items: stretch !important;
    width: 100% !important;
    box-sizing: border-box;
}

.wcrr-wrap #review_form .wcrr-guest-row > p,
.wcrr-wrap #review_form .wcrr-guest-row > .wcrr-guest-hint,
.wcrr-wrap .wcrr-guest-row > p,
.wcrr-wrap .wcrr-guest-row > .wcrr-guest-hint {
    flex: 1 1 0 !important;
    margin: 0 !important;
    min-width: 0;
}

/* Stretch only the Name/Email paragraphs to row height — NOT the hint. */
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-author,
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-email,
.wcrr-wrap .wcrr-guest-row > p.comment-form-author,
.wcrr-wrap .wcrr-guest-row > p.comment-form-email {
    align-self: stretch !important;
}

/* Name/Email: keep default block layout (label on top, input below) */
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-author,
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-email {
    display: block !important;
}
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-author label,
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-email label {
    display: block;
    margin: 0 0 6px;
}
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-author input,
.wcrr-wrap #review_form .wcrr-guest-row > p.comment-form-email input {
    margin: 0;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

/* Hint box: positioned at the bottom of its column, matching the input
   height (42px) so its top and bottom edges align with the Name/Email
   input edges, not the label edges. */
.wcrr-wrap #review_form .wcrr-guest-row > .wcrr-guest-hint,
.wcrr-wrap .wcrr-guest-row > .wcrr-guest-hint {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    align-self: flex-end !important;
    flex: 1 1 0 !important;
    gap: 10px;
    padding: 0 12px !important;
    min-height: 42px;
    height: 42px;
    line-height: 1.35;
    font-size: 12.5px;
    box-sizing: border-box;
}

/* On mobile, stack everything normally */
@media (max-width: 768px) {
    .wcrr-wrap #review_form .wcrr-guest-row,
    .wcrr-wrap .wcrr-guest-row {
        flex-direction: column !important;
        gap: 0;
    }
    .wcrr-wrap #review_form .wcrr-guest-row > p,
    .wcrr-wrap #review_form .wcrr-guest-row > .wcrr-guest-hint {
        flex: 1 1 auto !important;
        width: 100%;
        margin-bottom: 14px !important;
    }
    .wcrr-wrap #review_form .wcrr-guest-row > .wcrr-guest-hint {
        padding: 12px 14px !important;
        font-size: 13.5px;
    }
}
