/* Refleczo Reviews — server-rendered widget (Task B5). Scoped to .refleczo-rev-* / .refleczo-reviews */

.refleczo-reviews { font-size: 14px; color: #222; line-height: 1.45; }

/* ---------------------------------------------------------------- shared stars */
.refleczo-rev-stars { display: inline-flex; gap: 2px; vertical-align: middle; line-height: 1; }
.refleczo-rev-stars svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- title-area badge
   Fills Stamped's badge span on our render — mirror the Stamped/optimizer badge it
   replaces: stars on top, count BELOW in small grey (was inline + 16px on ours). */
/* Whole badge is a click target that scrolls to the reviews section (reviews.js),
   mirroring Stamped's badge — flag it clickable. */
.refleczo-rev-badge { cursor: pointer; }
.refleczo-rev-badge-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    line-height: 1;
}
.refleczo-rev-badge-count {
    font-size: 12px;
    font-weight: 500;
    color: #5f6368;
    letter-spacing: 0.12px;
}

/* ---------------------------------------------------------------- summary header */
.refleczo-rev-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
    padding: 16px 0 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid #ececec;
}
.refleczo-rev-sum-avg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 120px;
}
.refleczo-rev-sum-num { font-size: 38px; font-weight: 700; line-height: 1; }
.refleczo-rev-sum-count { font-size: 12px; color: #777; }

.refleczo-rev-sum-bars { flex: 1 1 200px; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.refleczo-rev-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.refleczo-rev-bar-label { width: 12px; text-align: right; color: #555; }
.refleczo-rev-bar-track { position: relative; flex: 1; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; }
.refleczo-rev-bar-fill { position: absolute; left: 0; top: 0; height: 100%; background: #fbbc04; border-radius: 4px; }
.refleczo-rev-bar-count { width: 34px; text-align: right; color: #888; }

.refleczo-rev-sum-photos-wrap { width: 100%; }
/* Flex (not grid) + justify-center so an underfull row (<4 photos) is CENTERED
   instead of left-aligned. Each square is a fixed fraction so a full row still
   tiles edge-to-edge. 4 per row here; the top "photos near cart" block does 8
   per row on desktop (override below). */
.refleczo-rev-sum-photos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    width: 100%;
}
.refleczo-rev-sum-photo { flex: 0 0 calc((100% - 12px) / 4); }   /* 4 per row (3 gaps × 4px) */
/* "Vê as fotos de N clientes" — gallery entry button below the photo grid */
.refleczo-rev-seeall {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    margin-top: 6px;
    padding: 9px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.refleczo-rev-seeall:hover { background: #f7f7f7; border-color: #ccc; }
.refleczo-rev-seeall svg { width: 16px; height: 16px; flex: 0 0 auto; color: #666; }

/* ---------------------------------------------------------------- top "photos near cart" block (variation)
   Rendered below add-to-cart; reviews.js moves it under the product gallery on desktop. */
.refleczo-rev-top-photos { margin: 14px 0 4px; text-align: left; }
.refleczo-rev-top-photos-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #555;
    margin: 0 0 8px;
}
/* full width here (undo the reviews-summary right-column sizing) */
.refleczo-rev-top-photos .refleczo-rev-sum-photos-wrap { width: 100%; max-width: none; margin: 0; }
@media (min-width: 850px) {
    /* The WooThumbs gallery above uses a float/absolute layout; without clearing it,
       our block flows UP into that context (its title stretched to clear the float),
       sitting flush under the thumbs. clear:both drops it below the gallery, flow-root
       gives it its own formatting context, and padding-top is the actual gap. */
    .refleczo-rev-top-photos {
        clear: both;
        display: flow-root;
        margin: 0 0 6px;
        padding-top: 24px;
    }
    /* one neat row of 8 under the wide gallery column (centered when fewer) */
    .refleczo-rev-top-photos .refleczo-rev-sum-photo { flex-basis: calc((100% - 28px) / 8); }
}
.refleczo-rev-sum-photo { display: block; border-radius: 4px; overflow: hidden; }
.refleczo-rev-sum-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* ---------------------------------------------------------------- card masonry */
/* CSS-column fallback (used only if reviews.js never runs — no-JS). With JS,
   the list is upgraded to flex columns (.is-columns) so load-more appends to the
   bottom of the shortest column instead of rebalancing the whole grid. */
.refleczo-rev-list {
    column-count: 2;
    column-gap: 12px;
}
.refleczo-rev-list.is-columns {
    column-count: auto;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.refleczo-rev-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.refleczo-rev-list.is-columns .refleczo-rev-card {
    margin-bottom: 0;       /* the column gap handles vertical spacing in flex mode */
}
.refleczo-rev-card {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin-bottom: 12px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 12px;
    box-sizing: border-box;
}
.refleczo-rev-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.refleczo-rev-verified { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: #2e7d32; }
.refleczo-rev-check { flex: 0 0 auto; }

.refleczo-rev-title { display: block; font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.refleczo-rev-body { font-size: 13px; line-height: 1.45; color: #333; }

/* Long text-card bodies: pre-JS fallback clips to ~6 lines; reviews.js then truncates
   precisely and appends an inline "Ler mais" link (Stamped blue #2196f3) right after the
   ellipsis. Tapping anywhere on the body expands/collapses it. */
.refleczo-rev-clamp {
    overflow: hidden;
    max-height: 8.7em;          /* ~6 lines fallback before JS runs */
}
.refleczo-rev-clamp.is-clamped,
.refleczo-rev-clamp.is-expanded {
    max-height: none;
    overflow: visible;
}
.refleczo-rev-clamp.is-clamped { cursor: pointer; }
.refleczo-rev-readmore {
    color: #2196f3;             /* Stamped read-more link blue */
    cursor: pointer;
    white-space: nowrap;
}
.refleczo-rev-readmore:hover { text-decoration: underline; }

/* translated label + original */
.refleczo-rev-translabel {
    display: inline-block;
    margin-top: 6px;
    padding: 0;
    background: none;
    border: none;
    font-size: 11px;
    color: #999;
    text-decoration: underline dotted;
    cursor: pointer;
}
.refleczo-rev-original { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #e5e5e5; }

/* fit pills */
.refleczo-rev-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.refleczo-rev-pill {
    font-size: 11px;
    line-height: 1.4;
    background: #f3f3f3;
    color: #555;
    border-radius: 10px;
    padding: 2px 8px;
}
.refleczo-rev-pill b { font-weight: 600; color: #444; }

/* ---------------------------------------------------------------- photo overlay card (v0.8.0)
   Photo reviews ARE the lead image with review info overlaid on the lower third
   over a bottom gradient (compact: reclaims the vertical space the old text block
   used). The whole card (the <a>) is the lightbox click target.

   ASPECT / CROP DECISION (documented):
   - The image container is a single <a>; pure CSS can't branch on the image's
     intrinsic ratio, so we cap the rendered ratio at 4:5 (portrait) via
     aspect-ratio + object-fit:cover + object-position:top center. Net effect:
       · portrait/story photos (taller than 4:5) keep their TOP and are cropped at
         the BOTTOM — exactly where the overlay text sits, so nothing is lost.
       · landscape/wide photos are cropped to 4:5 keeping the TOP (face-safe) so
         there's always enough dark area at the bottom for legible overlay text.
     This is uniform, JS-free and robust; the masonry effect still comes from the
     variable-height text-only cards interleaved in the columns. The full photo
     (uncropped) is always shown in the lightbox. */
.refleczo-rev-lead {
    display: block;
    position: relative;
    margin: -12px -12px 10px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    line-height: 0;
    background: #f2f2f2;
    cursor: pointer;
}
.refleczo-rev-lead img {
    display: block;
    width: 100%;
    height: auto;       /* natural aspect — no crop, like Stamped (text cards' legacy lead, if any) */
    object-fit: cover;
}

/* Overlay card: image fills the card; content (padding, borders) collapses so the
   photo is edge-to-edge and the overlay text sits on the photo, not below it. */
.refleczo-rev-card--photo {
    padding: 0;
    overflow: hidden;
    line-height: 0;
}
.refleczo-rev-card--photo .refleczo-rev-lead {
    margin: 0;
    border-radius: 8px;
}
/* reply (rare on photo reviews) renders below the photo as a normal padded block */
.refleczo-rev-card--photo .refleczo-rev-reply {
    line-height: 1.4;
    margin: 8px;
}
.refleczo-rev-card--photo .refleczo-rev-lead img {
    aspect-ratio: 4 / 5;            /* cap to 4:5 portrait (see decision above) */
    height: auto;
    object-fit: cover;
    object-position: top center;    /* keep the TOP (faces) when cropping */
}

/* ----- split overlay (v0.9.2): rating+title at the TOP, body+author at the
   BOTTOM, with slim gradients top & bottom — keeps the centre of the photo
   (face/glasses) clear and covers far less of the image than the old 70% block. */

/* top gradient (light) behind the rating+title bar */
.refleczo-rev-gradtop {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 42%;
    pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.70) 0%,
        rgba(0, 0, 0, 0.30) 45%,
        transparent 100%);
}
/* bottom gradient (slim) behind the body+author */
.refleczo-rev-grad {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 46%;                    /* was 70%; slim enough to keep the centre clear, tall enough for the 2-line body */
    pointer-events: none;
    background: linear-gradient(to top,
        rgba(0, 0, 0, 0.80) 0%,
        rgba(0, 0, 0, 0.40) 45%,
        transparent 100%);
}

/* shared overlay box (positioned by the --top / --bottom variants) */
.refleczo-rev-overlay {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    color: #fff;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
    pointer-events: none;       /* clicks pass through to the <a> card target */
}
.refleczo-rev-overlay .refleczo-rev-stars svg { width: 14px; height: 14px; }
.refleczo-rev-overlay .refleczo-rev-stars { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }

/* TOP bar: stars (+ translate globe) on one row, title clamped to one line below */
.refleczo-rev-ov-top {
    top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 6px;
    padding: 8px 10px 9px;
}
/* BOTTOM bar: body (1 line) + author */
.refleczo-rev-ov-bottom {
    bottom: 0;
    padding: 9px 11px 9px;
}

.refleczo-rev-ov-globe {
    font-size: 12px;
    line-height: 1;
    opacity: 0.9;
}
.refleczo-rev-ov-title {
    flex: 1 1 100%;                 /* full width → wraps to its own line under the stars */
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.refleczo-rev-ov-body {
    display: -webkit-box;
    -webkit-line-clamp: 2;          /* restored — the top bar freed up the bottom space */
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.95);
}
.refleczo-rev-ov-author {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}
.refleczo-rev-ov-author .refleczo-rev-check { flex: 0 0 auto; }
/* verified check goes white-on-dark inside the overlay for visibility */
.refleczo-rev-ov-author .refleczo-rev-check path { fill: #7ee08a; }

/* full review text kept in DOM for SEO/crawlers, hidden from view */
.refleczo-rev-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* +N badge overlay for multi-photo reviews — top-right so it never clashes
   with the bottom overlay text. */
.refleczo-rev-more-badge {
    position: absolute;
    right: 8px;
    top: 8px;
    z-index: 2;                 /* sit above the top gradient/overlay */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

/* meta */
.refleczo-rev-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #888; }
.refleczo-rev-author { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: #555; }
.refleczo-rev-author .refleczo-rev-check { flex: 0 0 auto; }

/* location (PT flag + concelho) — credibility cue on cards, overlays and lightbox.
   One-line policy: the author name (FirstName + initial) is always short, so when
   the row is tight we keep the name + flag whole and TRUNCATE the concelho with an
   ellipsis (the variable-length part). */
.refleczo-rev-loc { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; min-width: 0; flex: 0 1 auto; }
.refleczo-rev-flag {
    display: inline-block;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.10);
    vertical-align: middle;
    flex: 0 0 auto;
    opacity: 0.8;            /* soften so it doesn't shout next to the text */
}
.refleczo-rev-loc-name {
    font-size: 12px;
    font-weight: 500;
    color: #6b7177;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;   /* concelho gets … when the line is tight */
}
/* keep the row on ONE line; the short name never shrinks, the concelho does */
.refleczo-rev-meta { flex-wrap: nowrap; }
.refleczo-rev-meta .refleczo-rev-author { flex: 0 0 auto; }
/* on the photo-card overlay (dark gradient) the concelho must read light */
.refleczo-rev-ov-author { max-width: 100%; flex-wrap: nowrap; }
.refleczo-rev-ov-author .refleczo-rev-loc { margin-left: 4px; }
.refleczo-rev-ov-author .refleczo-rev-loc-name { color: rgba(255, 255, 255, 0.92); }

/* reply */
.refleczo-rev-reply {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f7f7f7;
    border-left: 3px solid #ddd;
    border-radius: 0 4px 4px 0;
}
.refleczo-rev-reply-label { display: block; font-size: 11px; font-weight: 600; color: #777; margin-bottom: 2px; }
.refleczo-rev-reply-body { font-size: 12px; color: #555; line-height: 1.4; }

/* load more */
#refleczo-rev-more { text-align: center; margin-top: 16px; }
.refleczo-rev-more-btn {
    display: inline-block;
    padding: 10px 22px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}
.refleczo-rev-more-btn:hover { background: #f5f5f5; }

/* empty */
.refleczo-rev-empty { padding: 32px 0; text-align: center; color: #999; font-size: 14px; }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 600px) {
    .refleczo-rev-body { font-size: 14px; }
    .refleczo-rev-summary .refleczo-rev-sum-photos-wrap {
        flex: 0 0 auto;
        width: 360px;
        max-width: 100%;
        margin-left: auto;
    }
}
@media (max-width: 599px) {
    .refleczo-rev-list { column-count: 2; }
    .refleczo-rev-summary { gap: 14px; }
}
@media (min-width: 850px) {
    .refleczo-rev-list { column-count: 4; }
}
