/* ==========================================================================
   PRODUCT PAGE - THE REVIEWS, DIGIKALA'S LAYOUT UNDER OUR OWN RATING SUMMARY
   --------------------------------------------------------------------------
   Views/Product/_PdpReviewCards.cshtml   the phone product page: the buyers' photos in a row,
                                          the reviews as cards that scroll sideways, the
                                          "write a review" row
   Views/Product/_PdpReviewList.cshtml    desktop and the all-reviews page: the photos, the sort
                                          bar and one row a review (_PdpReviewItem)
   Behaviour: pdp-review.js. The rating summary above them is pdp-rating.css, unchanged.

   Type: the page's ladder (base.less --tc-fs-* / --tc-fw-*). On the phone product page those
   are body.tc-pdpm's finer step (pdp-mobile.css), the same sizes the specification and
   description sections read in: running text 13 on a 2.05 line, labels 12.5, meta 11.5.
   Digits are the Persian face (yekanbakh), as in Digikala's lists.
   ========================================================================== */

.tc-rl,
.tc-rc,
.tc-rl-gallery,
.tc-rl-write,
.tc-rl-sec__all,
.tc-rl-page__foot,
.tc-rl-page__title {
    --tc-rl-ink: #0C0C0C;
    --tc-rl-text: #2A303A;
    --tc-rl-soft-ink: #424750;
    --tc-rl-muted: #81858B;
    --tc-rl-rule: #E0E0E2;
    --tc-rl-soft: #F0F0F1;
    --tc-rl-star: #F9A825;
    --tc-rl-star-off: #E0E0E2;
    --tc-rl-good: #00A049;
    --tc-rl-good-tint: #E8F7EE;
    --tc-rl-accent: rgb(var(--ryan-primary-rgb, 239, 64, 86));
    font-family: yekanbakh, tahoma, sans-serif;
    direction: rtl;
    text-align: right;
}

.tc-rl button,
.tc-rc button {
    font-family: inherit;
}

/* --------------------------------------------------------------------------
   Read-only stars (_PdpReviewStars)
   -------------------------------------------------------------------------- */

.tc-rl-stars {
    display: inline-flex;
    gap: 2px;
    direction: rtl;
}

.tc-rl-stars__star {
    width: 16px;
    height: 16px;
    fill: var(--tc-rl-star-off, #E0E0E2);
}

.tc-rl-stars__star.is-on {
    fill: var(--tc-rl-star, #F9A825);
}

/* the buyer's badge, in a card and in a row */
.tc-rl__buyer {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--tc-rl-good-tint);
    color: var(--tc-rl-good);
    font-size: var(--tc-fs-caption, 12px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 22px;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   The buyers' photos and videos (_PdpReviewGallery)
   -------------------------------------------------------------------------- */

.tc-rl-gallery {
    margin: 20px 0 0;
}

.tc-rl-gallery__title {
    margin: 0 0 12px;
    font-size: var(--tc-fs-h3, 15px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 1.7;
    color: var(--tc-rl-ink);
}

.tc-rl-gallery__row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.tc-rl-gallery__row::-webkit-scrollbar {
    display: none;
}

.tc-rl-gallery__tile {
    position: relative;
    flex: 0 0 auto;
    width: 88px;
    height: 88px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--tc-rl-soft);
    border-radius: 8px;
    background: var(--tc-rl-soft);
    cursor: pointer;
}

.tc-rl-gallery__tile img,
.tc-rl-gallery__tile video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.tc-rl-gallery__more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #FFF;
    font-size: var(--tc-fs-h3, 15px);
    font-weight: var(--tc-fw-title, 700);
    direction: ltr;
}

/* --------------------------------------------------------------------------
   The phone product page: the section's link, the cards, the "write" row
   -------------------------------------------------------------------------- */

/* "مشاهده ۴ دیدگاه ‹" - a line of words, as every section's "مشاهده همه" on this page */
.tc-rl-sec__all {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 4px 0;
    border: 0;
    background: none;
    font-size: var(--tc-fs-small, 13px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 17px;
    color: var(--tc-rl-ink);
    white-space: nowrap;
    cursor: pointer;
}

.tc-rc {
    display: flex;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0 0 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.tc-rc::-webkit-scrollbar {
    display: none;
}

.tc-rc__card {
    display: flex;
    flex: 0 0 76%;
    flex-direction: column;
    max-width: 300px;
    min-height: 232px;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--tc-rl-rule);
    border-radius: 12px;
    background: #FFF;
    scroll-snap-align: start;
    box-sizing: border-box;
}

.tc-rc__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 22px;
    margin-bottom: 10px;
}

.tc-rc__name {
    min-width: 0;
    overflow: hidden;
    font-size: var(--tc-fs-caption, 12px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 20px;
    color: var(--tc-rl-soft-ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* a dot between the name and the badge */
.tc-rc__dot {
    flex: 0 0 auto;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #C0C2C5;
}

.tc-rc__text {
    display: -webkit-box;
    flex: 0 0 auto;
    margin: 10px 0 0;
    overflow: hidden;
    font-size: var(--tc-fs-body, 14px);
    font-weight: var(--tc-fw-text, 400);
    line-height: 2.05;
    color: var(--tc-rl-text);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow-wrap: anywhere;
}

.tc-rc__more {
    align-self: flex-start;
    margin: 8px 0 0;
    padding: 4px 0;
    border: 0;
    background: none;
    font-size: var(--tc-fs-small, 13px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 20px;
    color: var(--tc-rl-ink);
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
    cursor: pointer;
}

.tc-rc__date {
    margin-top: auto;
    padding-top: 16px;
    font-size: var(--tc-fs-caption, 12px);
    line-height: 20px;
    color: var(--tc-rl-muted);
}

/* the last card: the whole list */
.tc-rc__all {
    flex-basis: 132px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: var(--tc-fs-small, 13px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 20px;
    color: var(--tc-rl-ink);
    text-align: center;
    cursor: pointer;
}

.tc-rc__all-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tc-rl-soft);
}

/* "دیدگاه خود را درباره این کالا بنویسید" - one row, its icon in a grey circle */
.tc-rl-write {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 0;
    padding: 16px 0 4px;
    border-top: 1px solid var(--tc-rl-soft);
    color: var(--tc-rl-ink);
    text-decoration: none;
}

.tc-rl-write:hover,
.tc-rl-write:focus {
    color: var(--tc-rl-ink);
    text-decoration: none;
}

.tc-rl-write__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tc-rl-soft);
    color: var(--tc-rl-soft-ink);
}

.tc-rl-write__text {
    flex: 1 1 auto;
    font-size: var(--tc-fs-h4, 14px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 22px;
}

.tc-rl-write__go {
    flex: 0 0 auto;
    color: var(--tc-rl-soft-ink);
}

/* the phone section: the gallery and the cards run to the screen's edge, under the page's 16px gutter.
   The cards are a direct child of the section, which theme-pdp zeroes the side margins of
   (body.page-product .comments-user.justMobileTablet > *) - hence the longer selector. */
.tc-rl-sec .tc-rl-gallery__row,
body.page-product .comments-user.tc-rl-sec > .tc-rc,
.tc-rl-sec .tc-rc {
    margin-inline: -16px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
}

.tc-rl-sec .tc-rl-gallery {
    margin-top: 24px;
}

/* --------------------------------------------------------------------------
   The list: the sort bar and the rows (_PdpReviewList, _PdpReviewItem)
   -------------------------------------------------------------------------- */

.tc-rl {
    margin: 8px 0 0;
}

.tc-rl__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 0;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--tc-rl-soft);
}

.tc-rl__sort-label {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    font-size: var(--tc-fs-small, 13px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 20px;
    color: var(--tc-rl-ink);
}

.tc-rl__sorts {
    display: flex;
    flex: 1 1 auto;
    gap: 16px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tc-rl__sorts::-webkit-scrollbar {
    display: none;
}

.tc-rl__sort {
    flex: 0 0 auto;
    margin: 0;
    padding: 4px 0;
    border: 0;
    background: none;
    font-size: var(--tc-fs-small, 13px);
    font-weight: var(--tc-fw-text, 400);
    line-height: 20px;
    color: var(--tc-rl-muted);
    white-space: nowrap;
    cursor: pointer;
}

.tc-rl__sort.is-on {
    font-weight: var(--tc-fw-label, 600);
    color: var(--tc-rl-accent);
}

.tc-rl__count {
    flex: 0 0 auto;
    font-size: var(--tc-fs-caption, 12px);
    line-height: 20px;
    color: var(--tc-rl-muted);
}

.tc-rl__item {
    padding: 20px 0;
    border-bottom: 1px solid var(--tc-rl-soft);
}

.tc-rl__item[hidden] {
    display: none;
}

.tc-rl__item.is-focus {
    animation: tc-rl-focus 1.6s ease-out;
}

@keyframes tc-rl-focus {
    from { background: #FFF8E1; }
    to { background: transparent; }
}

.tc-rl__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* the review's own score, in its band's colour - the rating summary's palette (pdp-rating.css) */
.tc-rl__score {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 24px;
    margin-top: 1px;
    padding: 0 6px;
    border-radius: 6px;
    color: #FFF;
    font-size: var(--tc-fs-caption, 12px);
    font-weight: var(--tc-fw-title, 700);
    line-height: 24px;
    box-sizing: border-box;
}

.tc-rl__score--band5 { background: #17884A; }
.tc-rl__score--band4 { background: #4CAF3F; }
.tc-rl__score--band3 { background: #A4C639; }
.tc-rl__score--band2 { background: #F0B323; }
.tc-rl__score--band1 { background: #F07C1E; }

.tc-rl__head-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tc-rl__title {
    margin: 0;
    font-size: var(--tc-fs-h4, 15px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 1.7;
    color: var(--tc-rl-ink);
}

.tc-rl__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    min-height: 24px;
    font-size: var(--tc-fs-caption, 12px);
    font-weight: var(--tc-fw-text, 400);
    line-height: 20px;
    color: var(--tc-rl-muted);
}

.tc-rl__meta-part + .tc-rl__meta-part::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    margin: 0 8px;
    border-radius: 50%;
    background: #C0C2C5;
    vertical-align: middle;
}

.tc-rl__meta .tc-rl__buyer {
    margin-inline-start: 8px;
}

.tc-rl__text {
    margin: 12px 0 0;
    font-size: var(--tc-fs-body, 15px);
    font-weight: var(--tc-fw-text, 400);
    line-height: 2.05;
    color: var(--tc-rl-text);
    overflow-wrap: anywhere;
}

.tc-rl__text p {
    margin: 0;
}

/* the review's own photos (_ProductReviewMedia, pdp-review.css) */
.tc-rl__main .tc-rvm {
    margin: 12px 0 0;
}

/* the store's answer */
.tc-rl__reply {
    margin: 12px 0 0;
    padding: 12px 16px;
    border-inline-start: 3px solid var(--tc-rl-rule);
    border-radius: 4px;
    background: #F7F8F9;
}

.tc-rl__reply-by {
    display: block;
    font-size: var(--tc-fs-small, 13px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 22px;
    color: var(--tc-rl-ink);
}

.tc-rl__reply-text {
    margin-top: 4px;
    font-size: var(--tc-fs-small, 13px);
    line-height: 2;
    color: var(--tc-rl-text);
}

/* "آیا این دیدگاه مفید بود؟" and the two votes, on the left */
.tc-rl__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin: 12px 0 0;
}

.tc-rl__ask {
    margin-inline-end: 8px;
    font-size: var(--tc-fs-caption, 12px);
    line-height: 20px;
    color: var(--tc-rl-muted);
}

.tc-rl__vote {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--tc-rl-muted);
    font-size: var(--tc-fs-caption, 12px);
    font-weight: var(--tc-fw-label, 600);
    line-height: 20px;
    cursor: pointer;
}

.tc-rl__vote[aria-pressed="true"][data-tc-rl-vote="true"] {
    color: var(--tc-rl-good);
}

.tc-rl__vote[aria-pressed="true"][data-tc-rl-vote="false"] {
    color: #D32F2F;
}

.tc-rl__vote[aria-pressed="true"] svg {
    fill: currentColor;
    fill-opacity: 0.15;
}

.tc-rl__vote:disabled {
    opacity: 0.6;
    cursor: default;
}

.tc-rl__more-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 48px;
    margin: 8px 0 0;
    border: 0;
    background: none;
    font-size: var(--tc-fs-small, 14px);
    font-weight: var(--tc-fw-label, 600);
    color: var(--tc-rl-accent);
    cursor: pointer;
}

.tc-rl__more-btn[hidden] {
    display: none;
}

.tc-rl__empty {
    margin: 24px 0;
    font-size: var(--tc-fs-small, 13px);
    color: var(--tc-rl-muted);
    text-align: center;
}

/* --------------------------------------------------------------------------
   The all-reviews page (the "comment-user" lightbox): our summary at the
   top, the list, and the add button pinned to the bottom
   -------------------------------------------------------------------------- */

.tc-rl-page {
    background: #FFF;
}

.tc-rl-page__summary {
    padding: 20px 16px 4px;
}

.tc-rl-page__list {
    padding: 0 16px 96px;
}

.tc-rl-page__list .tc-rl-gallery__row {
    margin-inline: -16px;
    padding-inline: 16px;
}

/* Digikala's header: "۸ دیدگاه" on the page's title size, not the lightbox's 20px */
.km-lightbox[km-id="comment-user"] .km-lightbox-header .km-title.tc-rl-page__title {
    color: var(--tc-rl-ink);
    font-size: var(--tc-fs-page, 16px);
    font-weight: var(--tc-fw-title, 700);
    line-height: 1.6;
}

.km-lightbox[km-id="comment-user"] .km-lightbox-header .tc-rl-page__close {
    color: var(--tc-rl-ink, #0C0C0C);
    font-size: 20px;
}

/* Digikala's floating "ثبت دیدگاه": a pill at the bottom left, over the list */
.tc-rl-page__foot {
    position: fixed;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 2;
}

.tc-rl-page__add,
.tc-rl-page__add:hover,
.tc-rl-page__add:focus {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    background: var(--tc-rl-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
    color: #FFF;
    font-size: var(--tc-fs-section, 15px);
    font-weight: var(--tc-fw-title, 700);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.tc-rl-page__add-icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 960px) {
    .tc-rl-gallery__tile {
        width: 96px;
        height: 96px;
    }

    .tc-rl__item {
        padding: 24px 0;
    }

    /* a line a reader can follow: the column is the page's full width */
    .tc-rl__text {
        max-width: 780px;
    }

    .tc-rl__text,
    .tc-rl__foot,
    .tc-rl__main .tc-rvm,
    .tc-rl__reply {
        margin-inline-start: 48px;
    }

    .tc-rl__vote:hover,
    .tc-rl__sort:hover {
        color: var(--tc-rl-ink);
    }

    .tc-rl__vote:hover {
        background: var(--tc-rl-soft);
    }

    /* in the desktop dialog the pill rides the bottom left of the list */
    .tc-rl-page__foot {
        position: sticky;
        left: auto;
        bottom: 24px;
        display: flex;
        justify-content: flex-end;
        padding: 0 24px;
        pointer-events: none;
    }

    .tc-rl-page__add {
        pointer-events: auto;
    }
}
