/* Product review photos — compatible with the existing AJAX-loaded review form. */
.coverlet-product-review-upload,
.coverlet-product-review-upload * {
    box-sizing: border-box;
}

.coverlet-product-review-upload {
    position: relative;
    direction: rtl;
    margin: 14px 0 18px;
    padding: 15px 16px;
    border: 1px solid #e1e1e1;
    background: #f7f7f7;
    color: #171717;
    text-align: right;
    overflow: hidden;
}

.coverlet-product-review-upload__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.coverlet-product-review-upload__head strong,
.coverlet-product-review-upload__head span {
    display: block;
}

.coverlet-product-review-upload__head strong {
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
}

.coverlet-product-review-upload__head span {
    color: #777;
    font-size: 10.5px;
    line-height: 1.8;
}

.coverlet-product-review-upload__choose {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 116px;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid #1b1b1b;
    background: #fff;
    color: #1b1b1b;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.coverlet-product-review-upload__choose:hover {
    background: #1b1b1b;
    color: #fff;
}

.coverlet-product-review-upload__choose input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.coverlet-product-review-upload__previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.coverlet-product-review-upload__previews:empty {
    display: none;
}

.coverlet-product-review-upload__preview {
    position: relative;
    width: 82px;
    height: 82px;
    margin: 0;
    border: 1px solid #d8d8d8;
    background: #ececec;
    overflow: hidden;
}

.coverlet-product-review-upload__preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coverlet-product-review-upload__remove {
    appearance: none;
    position: absolute;
    top: 5px;
    left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 23px;
    height: 23px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(15,15,15,.84);
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.coverlet-product-review-upload__message {
    min-height: 0;
    margin: 9px 0 0;
    color: #666;
    font-size: 10.5px;
    line-height: 1.8;
}

.coverlet-product-review-upload__message:empty {
    display: none;
}

.coverlet-product-review-upload__message.is-error { color: #a13731; }
.coverlet-product-review-upload__message.is-success { color: #39704a; }
.coverlet-product-review-upload__message.is-loading { color: #6c5b35; }

.coverlet-product-review-upload__loading {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: rgba(247,247,247,.97);
    color: #222;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, visibility .15s ease;
}

.coverlet-product-review-upload__loading strong {
    font-size: 12px;
    font-weight: 700;
}

.coverlet-product-review-upload__spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #c9c9c9;
    border-top-color: #161616;
    border-radius: 50%;
    animation: coverlet-review-upload-spin .7s linear infinite;
}

.coverlet-product-review-upload.is-uploading .coverlet-product-review-upload__loading {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@keyframes coverlet-review-upload-spin {
    to { transform: rotate(360deg); }
}

.coverlet-review-comment-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.coverlet-review-photo,
.coverlet-review-gallery__item {
    appearance: none;
    position: relative;
    display: block;
    padding: 0;
    border: 1px solid #e1e1e1;
    background: #f3f3f3;
    cursor: zoom-in;
    overflow: hidden;
}

.coverlet-review-photo {
    width: 82px;
    height: 82px;
}

.coverlet-review-photo img,
.coverlet-review-gallery__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}

.coverlet-review-photo:hover img,
.coverlet-review-gallery__item:hover img {
    transform: scale(1.035);
}

.coverlet-review-gallery {
    direction: rtl;
    margin: 0 0 28px;
    padding: 18px 0 22px;
    border-bottom: 1px solid #e8e8e8;
    color: #171717;
    text-align: right;
}

.coverlet-review-gallery > header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 13px;
}

.coverlet-review-gallery > header span,
.coverlet-review-gallery > header h3,
.coverlet-review-gallery > header strong {
    display: block;
    margin: 0;
}

.coverlet-review-gallery > header span {
    margin-bottom: 2px;
    color: #888;
    font-size: 10px;
}

.coverlet-review-gallery > header h3 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.65;
}

.coverlet-review-gallery > header > strong {
    color: #777;
    font-size: 10px;
    font-weight: 500;
}

.coverlet-review-gallery__rail {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 9px;
}

.coverlet-review-gallery__item {
    width: 100%;
    aspect-ratio: 1 / 1;
}

.coverlet-review-gallery__item--more > span {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: rgba(14,14,14,.68);
    color: #fff;
    text-align: center;
}

.coverlet-review-gallery__item--more strong {
    font-size: 20px;
    line-height: 1.2;
}

.coverlet-review-gallery__item--more small {
    margin-top: 4px;
    font-size: 9px;
    line-height: 1.55;
}

html.coverlet-review-lightbox-open {
    overflow: hidden !important;
}

body.coverlet-review-lightbox-body-locked {
    overflow: hidden !important;
}

.coverlet-review-lightbox-hidden-fixed {
    display: none !important;
}

.coverlet-review-lightbox[hidden] {
    display: none !important;
}

.coverlet-review-lightbox {
    position: fixed;
    z-index: 2147483000;
    inset: 0;
    width: 100vw;
    height: var(--coverlet-review-viewport-height, 100dvh);
    min-height: -webkit-fill-available;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    opacity: 0;
    transition: opacity .18s ease;
}

.coverlet-review-lightbox.is-open { opacity: 1; }

.coverlet-review-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.82);
    backdrop-filter: blur(3px);
}

.coverlet-review-lightbox__dialog {
    direction: rtl;
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    width: min(920px, 96vw);
    height: min(840px, 92vh);
    background: #fff;
    color: #181818;
    overflow: hidden;
    transform: translateY(8px) scale(.992);
    transition: transform .18s ease;
}

.coverlet-review-lightbox.is-open .coverlet-review-lightbox__dialog {
    transform: translateY(0) scale(1);
}

.coverlet-review-lightbox__close {
    appearance: none;
    position: absolute;
    z-index: 4;
    top: 14px;
    left: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.68);
    color: #fff;
    font: 28px/1 Arial, sans-serif;
    cursor: pointer;
}

.coverlet-review-lightbox__visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding: 28px;
    background: #111;
}

.coverlet-review-lightbox__visual > img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.coverlet-review-lightbox__nav {
    appearance: none;
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 54px;
    padding: 0;
    border: 0;
    background: rgba(0,0,0,.48);
    color: #fff;
    font: 35px/1 Arial, sans-serif;
    cursor: pointer;
    transform: translateY(-50%);
}

.coverlet-review-lightbox__nav--prev { right: 12px; }
.coverlet-review-lightbox__nav--next { left: 12px; }

.coverlet-review-lightbox__counter {
    position: absolute;
    right: 18px;
    bottom: 15px;
    padding: 5px 9px;
    background: rgba(0,0,0,.62);
    color: #fff;
    font-size: 10px;
}

.coverlet-review-lightbox__review {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-height: 245px;
    padding: 22px 28px 20px;
    background: #fff;
    text-align: right;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.coverlet-review-lightbox__author {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid #ececec;
}

.coverlet-review-lightbox__author strong,
.coverlet-review-lightbox__author span {
    display: block;
}

.coverlet-review-lightbox__author strong {
    font-size: 15px;
    line-height: 1.65;
}

.coverlet-review-lightbox__author span {
    margin-top: 4px;
    color: #55715d;
    font-size: 10px;
    font-weight: 700;
}

.coverlet-review-lightbox__stars {
    direction: ltr;
    display: flex;
    gap: 2px;
    color: #d3d3d3;
    font-size: 17px;
}

.coverlet-review-lightbox__stars .is-filled { color: #ff7b86; }

.coverlet-review-lightbox__review > p {
    margin: 16px 0 0;
    color: #3e3e3e;
    font-size: 13px;
    line-height: 2.15;
    white-space: pre-line;
}

.coverlet-review-lightbox__review > time {
    display: block;
    margin-top: 14px;
    padding-top: 0;
    color: #909090;
    font-size: 10px;
}

@media (max-width: 767px) {
    .coverlet-product-review-upload {
        margin-top: 12px;
        padding: 13px;
    }

    .coverlet-product-review-upload__head {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .coverlet-product-review-upload__choose {
        width: 100%;
    }

    .coverlet-product-review-upload__previews {
        display: grid;
        grid-template-columns: repeat(2, 82px);
    }

    .coverlet-review-gallery {
        margin-bottom: 22px;
        padding: 16px 0 18px;
    }

    .coverlet-review-gallery__rail {
        display: flex;
        gap: 8px;
        margin-left: -8px;
        padding-left: 8px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .coverlet-review-gallery__rail::-webkit-scrollbar { display: none; }

    .coverlet-review-gallery__item {
        flex: 0 0 88px;
        width: 88px;
        height: 88px;
    }

    .coverlet-review-lightbox {
        align-items: stretch;
        padding: 0;
        height: var(--coverlet-review-viewport-height, 100dvh);
        max-height: var(--coverlet-review-viewport-height, 100dvh);
        overflow: hidden;
    }

    .coverlet-review-lightbox__dialog {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 56%) minmax(0, 44%);
        width: 100%;
        height: var(--coverlet-review-viewport-height, 100dvh);
        max-height: var(--coverlet-review-viewport-height, 100dvh);
    }

    .coverlet-review-lightbox__visual {
        padding: 46px 14px 18px;
    }

    .coverlet-review-lightbox__close {
        top: 10px;
        left: 10px;
        width: 36px;
        height: 36px;
    }

    .coverlet-review-lightbox__nav {
        width: 36px;
        height: 48px;
    }

    .coverlet-review-lightbox__nav--prev { right: 6px; }
    .coverlet-review-lightbox__nav--next { left: 6px; }

    .coverlet-review-lightbox__review {
        padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
    }

    .coverlet-review-lightbox__review > p {
        margin-top: 16px;
        font-size: 12px;
        line-height: 2;
    }

    .coverlet-review-lightbox__review > time {
        margin-top: 18px;
        padding-top: 0;
    }
}

/* 3.17 — optional reward copy and stable lightbox loading/swipe states. */
.coverlet-product-review-upload__head strong em {
    color: #777;
    font-size: .86em;
    font-style: normal;
    font-weight: 500;
}

.coverlet-product-review-upload__reward {
    display: block;
    width: fit-content;
    margin-top: 8px;
    padding: 6px 9px;
    border: 1px solid #e2ddd2;
    background: #fffdf8;
    color: #66563d;
    font-size: 10px;
    line-height: 1.8;
}

.coverlet-review-lightbox__visual {
    touch-action: pan-y;
}

.coverlet-review-lightbox__visual > img {
    opacity: 0;
    transition: opacity .18s ease;
}

.coverlet-review-lightbox__visual > img.is-ready {
    opacity: 1;
}

.coverlet-review-lightbox__loader {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #111;
}

.coverlet-review-lightbox__visual.is-loading .coverlet-review-lightbox__loader {
    display: flex;
}

.coverlet-review-lightbox__loader span {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255,255,255,.22);
    border-top-color: #fff;
    border-radius: 50%;
    animation: coverlet-review-lightbox-spin .7s linear infinite;
}

@keyframes coverlet-review-lightbox-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .coverlet-review-lightbox__nav {
        opacity: .58;
        width: 36px;
        height: 48px;
    }

    .coverlet-review-lightbox__visual::after {
        content: 'برای دیدن عکس بعدی بکشید';
        position: absolute;
        left: 50%;
        bottom: 14px;
        z-index: 3;
        padding: 4px 8px;
        background: rgba(0,0,0,.52);
        color: rgba(255,255,255,.88);
        font-size: 9px;
        transform: translateX(-50%);
        pointer-events: none;
    }

    .coverlet-review-lightbox__counter {
        right: 12px;
        bottom: 44px;
    }
}
