/**
 * MyPodDesign — Single Product Reviews styles.
 *
 * Covers:
 *  - SVG-based star rendering for the review list, summary, and comment-form
 *    rating selector (replacing WooCommerce's font-icon stars).
 *  - The customer photo-upload control on the review form.
 *  - The photo grid rendered inside each review.
 */

/* ---------- SVG stars (used in review list + review form summary) ---------- */
.mypod-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
    color: var(--mypod-color-bgTertiary, #e2e8f0);
    vertical-align: middle;
}

.mypod-stars__star {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    width: 16px;
    height: 16px;
}

.mypod-stars__star svg {
    width: 16px;
    height: 16px;
    display: block;
}

.mypod-stars__star.is-filled {
    color: var(--mypod-color-accent, #ff6f3c);
}

/* Larger summary stars at the top of the reviews tab. */
.mypod-stars--summary .mypod-stars__star,
.mypod-stars--summary .mypod-stars__star svg {
    width: 20px;
    height: 20px;
}

/* ---------- Comment-form rating selector (WC's p.stars) ----------
   WooCommerce outputs <p class="stars"><span><a class="star-1">1</a>…</span></p>
   when ratings are enabled. With the WC stylesheet dequeued the links render
   as plain text, so we re-skin them as clickable star icons here. */
.comment-form-rating {
    margin: 0 0 12px 0;
}

.comment-form-rating label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

p.stars {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
}

p.stars > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

p.stars a {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
    /* Hide the link text but keep it accessible. */
    text-indent: -9999px;
    overflow: hidden;
    color: var(--mypod-color-bgTertiary, #e2e8f0);
    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 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/></svg>") no-repeat center / contain;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/></svg>") no-repeat center / contain;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

p.stars a:hover {
    transform: scale(1.05);
}

/* Hover preview: fill all stars up to and including the hovered one. The
   sibling combinator empties stars *after* the hovered anchor. */
p.stars:hover a {
    color: var(--mypod-color-accent, #ff6f3c);
}

p.stars:hover a:hover ~ a {
    color: var(--mypod-color-bgTertiary, #e2e8f0);
}

/* Selected state: WooCommerce adds .active to the clicked anchor only and
   tags the parent .selected. We mirror WC's default fill logic — fill every
   non-active anchor (the ones before the chosen star), fill the active one
   itself, and empty the anchors that follow. */
p.stars.selected a:not(.active),
p.stars.selected a.active {
    color: var(--mypod-color-accent, #ff6f3c);
}

p.stars.selected a.active ~ a {
    color: var(--mypod-color-bgTertiary, #e2e8f0);
}

/* ---------- Photo-upload control ---------- */
.mypod-review-upload {
    margin: 12px 0;
}

.mypod-review-upload__label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px dashed var(--mypod-color-border, #d1d5db);
    border-radius: var(--mypod-radius-md, 10px);
    background: var(--mypod-color-bgSecondary, #f8fafc);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mypod-review-upload__label:hover,
.mypod-review-upload__label:focus-within {
    border-color: var(--mypod-color-accent, #ff6f3c);
    background: var(--mypod-color-bgTertiary, #f1f5f9);
}

.mypod-review-upload__title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--mypod-color-text, #111827);
}

.mypod-review-upload__hint {
    font-size: 0.85rem;
    color: var(--mypod-color-textSecondary, #6b7280);
}

.mypod-review-upload__input {
    /* Visually hidden but still focusable. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mypod-review-upload__preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.mypod-review-upload__preview[hidden] {
    display: none;
}

.mypod-review-upload__thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: var(--mypod-radius-sm, 8px);
    overflow: hidden;
    background: var(--mypod-color-bgTertiary, #f1f5f9);
}

.mypod-review-upload__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mypod-review-upload__remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(17, 24, 39, 0.75);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mypod-review-upload__remove:hover {
    background: rgba(17, 24, 39, 0.95);
}

.mypod-review-upload__error {
    margin: 8px 0 0 0;
    color: #c0392b;
    font-size: 0.85rem;
}

/* ---------- Review images grid (in submitted reviews) ---------- */
.mypod-review-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
    max-width: 320px;
}

.mypod-review-images__item {
    display: block;
    border-radius: var(--mypod-radius-sm, 8px);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--mypod-color-bgTertiary, #f1f5f9);
    transition: transform 0.15s ease;
}

.mypod-review-images__item:hover,
.mypod-review-images__item:focus-visible {
    transform: scale(1.04);
}

.mypod-review-images__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
