/*
 * №72. Отзывы: окно «Отзыв о товаре» (front/templates/pp-review-form.blade.php, js/product-review.js) и новые части
 * отзыва в списке: «Проверенная покупка», срок использования, оценки параметров, достоинства и недостатки.
 * Окно в стиле окон сайта: жёлтая шапка, кнопка «Отправить отзыв» — жёлтая, поля со скруглением 8 px.
 * На телефоне — во весь экран и выезжает снизу, как окно фильтра.
 */

/* ── окно ── */
.rv-pop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 3000; display: flex; align-items: center; justify-content: center;
    padding: 24px; }
.rv-pop[hidden] { display: none; }
.rv-pop-bg { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(20, 24, 32, .45); }
.rv-pop-dialog { position: relative; display: flex; flex-direction: column; width: 640px; max-width: 100%; max-height: calc(100vh - 48px);
    border-radius: 12px; background: #fff; box-shadow: 0 20px 60px rgba(20, 24, 32, .25); overflow: hidden; color: #303030; }
.rv-pop-dialog:focus { outline: none; }
.rv-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 auto; padding: 16px 16px 14px 24px;
    background: #FEDC29; }
.rv-pop-head h2 { margin: 0; font-size: 20px; line-height: 26px; font-weight: 800; color: #303030; }
.rv-pop-x { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0;
    border: 0; border-radius: 8px; background: transparent; cursor: pointer; transition: background-color .15s; }
.rv-pop-x svg { width: 14px; height: 14px; fill: none; stroke: #303030; stroke-width: 2; stroke-linecap: round; }
@media (hover: hover) {
    .rv-pop-x:hover { background: rgba(255, 255, 255, .45); }
}
.rv-pop-x:focus { outline: none; }
.rv-pop-x:focus-visible { box-shadow: 0 0 0 2px #303030; }
.rv-form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.rv-form[hidden] { display: none; }
.rv-pop-body { flex: 1 1 auto; min-height: 0; padding: 18px 24px 8px; overflow-y: auto; overscroll-behavior: contain; }
html.rv-lock, html.rv-lock body { overflow: hidden; }

/* товар */
.rv-item { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 0 0 16px; border-bottom: 1px solid #F0F0F0; }
.rv-item img { flex: 0 0 56px; width: 56px; height: 56px; object-fit: contain; }
.rv-item span { font-size: 14px; line-height: 20px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; }

/* поля */
.rv-block { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.rv-label { display: block; margin: 0 0 8px; padding: 0; font-size: 15px; line-height: 20px; font-weight: 700; color: #303030; }
.rv-label span { margin-left: 4px; font-size: 13px; font-weight: 400; color: #9A9A9A; }
.rv-form textarea, .rv-form input[type=text], .rv-form input[type=email] { display: block; width: 100%; margin: 0; padding: 10px 14px;
    border: 1px solid #DADDE1; border-radius: 8px; background: #fff; color: #303030; font: inherit; font-size: 14px; line-height: 20px;
    resize: vertical; -webkit-appearance: none; transition: border-color .15s; }
.rv-form textarea { min-height: 64px; }
.rv-form textarea#rv-comment { min-height: 104px; }
.rv-form textarea::placeholder, .rv-form input::placeholder { color: #A6ABB2; }
.rv-form textarea:focus, .rv-form input[type=text]:focus, .rv-form input[type=email]:focus { border-color: #FEDC29; outline: none;
    box-shadow: 0 0 0 3px rgba(254, 220, 41, .35); }
.rv-block.is-error textarea, .rv-block.is-error input[type=text], .rv-block.is-error input[type=email] { border-color: #DD2C01; }
.rv-err { display: block; margin: 6px 0 0; font-size: 13px; line-height: 18px; color: #DD2C01; }
.rv-err[hidden] { display: none; }
.rv-note { display: block; margin: 6px 0 0; font-size: 12px; line-height: 16px; color: #9A9A9A; }
.rv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* звёзды — переключатели: сам кружок не виден, но работает с клавиатуры */
.rv-stars { display: inline-flex; gap: 4px; line-height: 0; }
.rv-star { position: relative; display: inline-flex; margin: 0; padding: 2px; border-radius: 6px; cursor: pointer; }
.rv-star input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0; }
.rv-star svg { display: block; width: 26px; height: 26px; fill: #DCDFE3; transition: fill .12s, transform .12s; }
.rv-stars.is-big .rv-star svg { width: 36px; height: 36px; }
.rv-star.is-on svg { fill: #FEDC29; }
.rv-stars.is-hover .rv-star svg { fill: #DCDFE3; }
.rv-stars.is-hover .rv-star.is-hover-on svg { fill: #FFE66B; }
.rv-star input:focus-visible + svg { outline: 2px solid #303030; outline-offset: 2px; border-radius: 4px; }
@media (hover: hover) {
    .rv-star:hover svg { transform: scale(1.08); }
}
.rv-overall-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.rv-star-text { font-size: 14px; line-height: 20px; color: #9A9A9A; }
.rv-star-text.is-set { color: #303030; font-weight: 600; }
.rv-overall.is-error .rv-star svg { fill: #F6C9BE; }

/* оценки параметров: название слева, звёзды справа */
.rv-crit { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid #F3F3F3; }
.rv-crit:first-of-type { border-top: 0; }
.rv-crit-name { font-size: 14px; line-height: 20px; color: #4F4F4F; }

/* срок использования — «таблетки» */
.rv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-chip { position: relative; margin: 0; cursor: pointer; }
.rv-chip input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.rv-chip span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid #DADDE1; border-radius: 18px;
    background: #fff; font-size: 14px; line-height: 18px; color: #303030; transition: border-color .15s, background-color .15s; }
@media (hover: hover) {
    .rv-chip:hover span { border-color: #FEDC29; }
}
.rv-chip input:checked + span { border-color: #FEDC29; background: #FFF7D1; font-weight: 600; }
.rv-chip input:focus-visible + span { box-shadow: 0 0 0 2px #303030; }

/* правила публикации */
.rv-rules { margin: 4px 0 6px; font-size: 13px; line-height: 19px; color: #4F4F4F; }
.rv-rules summary { display: inline-flex; align-items: center; gap: 6px; color: #303030; font-weight: 600; cursor: pointer; list-style: none; }
.rv-rules summary::-webkit-details-marker { display: none; }
.rv-rules summary::after { content: ''; width: 7px; height: 7px; margin-top: -3px; border-right: 1.6px solid #303030;
    border-bottom: 1.6px solid #303030; transform: rotate(45deg); transition: transform .15s; }
.rv-rules[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.rv-rules summary:focus { outline: none; }
.rv-rules summary:focus-visible { box-shadow: 0 0 0 2px #303030; border-radius: 4px; }
.rv-rules p { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: #F7F7F8; }

/* низ окна: «заполнен на N %», кнопка, согласие */
.rv-pop-foot { flex: 0 0 auto; padding: 12px 24px 16px; border-top: 1px solid #F0F0F0; background: #fff; }
.rv-progress { margin: 0 0 12px; }
.rv-progress-bar { height: 6px; border-radius: 3px; background: #EEF0F2; overflow: hidden; }
.rv-progress-bar i { display: block; width: 0; height: 100%; border-radius: 3px; background: #FEDC29; transition: width .3s ease; }
.rv-progress.is-full .rv-progress-bar i { background: #1E9E4A; }
.rv-progress-text { margin: 6px 0 0; font-size: 12px; line-height: 16px; color: #9A9A9A; }
.rv-progress-text b { margin-right: 6px; color: #303030; font-weight: 700; }
.rv-progress.is-full .rv-progress-text span { color: #1E9E4A; }
.rv-send.def-yellow-btn { width: 100%; min-height: 48px; font-size: 15px; line-height: 20px; color: #303030 !important; cursor: pointer; }
.rv-send[disabled] { opacity: .6; cursor: default; }
@media (hover: none) {
    .rv-send.def-yellow-btn:not([disabled]) { opacity: 1; }
}
.rv-agree { margin: 8px 0 0; font-size: 12px; line-height: 16px; color: #9A9A9A; text-align: center; }
.rv-msg { margin: 8px 0 0; font-size: 13px; line-height: 18px; color: #303030; text-align: center; }
.rv-msg:empty { display: none; }
.rv-msg.is-error { color: #DD2C01; }

/* «Спасибо за отзыв!» */
.rv-done { display: flex; flex-direction: column; align-items: center; padding: 36px 28px 30px; text-align: center; }
.rv-done[hidden] { display: none; }
.rv-done-ico { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin: 0 0 14px; border-radius: 50%;
    background: #FEDC29; }
.rv-done-ico svg { width: 30px; height: 30px; fill: none; stroke: #303030; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rv-done h3 { margin: 0 0 6px; font-size: 20px; line-height: 26px; font-weight: 800; color: #303030; }
.rv-done p { margin: 0 0 20px; font-size: 15px; line-height: 21px; color: #4F4F4F; }
.rv-done-btn.def-yellow-btn { min-width: 200px; padding: 13px 26px; color: #303030 !important; cursor: pointer; }

/* ── отзыв в списке ── */
.rv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 6px 0 0; font-size: 13px; line-height: 18px; color: #787878; }
.rv-verified { display: inline-flex; align-items: center; gap: 5px; color: #1E9E4A; font-weight: 600; }
.rv-verified svg { width: 14px; height: 14px; fill: none; stroke: #1E9E4A; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rv-crit-list { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.rv-crit-list li { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 14px; background: #F5F6F7;
    font-size: 13px; line-height: 18px; color: #4F4F4F; }
.rv-crit-list b { margin-left: 2px; color: #303030; }
.rv-crit-list svg { width: 12px; height: 12px; fill: #FEDC29; }
.rv-part { margin: 10px 0 0; font-size: 14px; line-height: 22px; }
.rv-part b { display: block; font-weight: 700; color: #303030; }
.rv-part p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* средние оценки параметров — под полосками оценок справа */
.rv-avg { margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid #F0F0F0; }
.rv-avg-title { display: block; margin: 0 0 10px; font-size: 14px; line-height: 20px; font-weight: 700; }
.rv-avg ul { margin: 0; padding: 0; list-style: none; }
.rv-avg li { display: grid; grid-template-columns: minmax(0, 1fr) 70px 28px; align-items: center; gap: 10px; margin: 0 0 8px;
    font-size: 13px; line-height: 18px; color: #4F4F4F; }
.rv-avg-line { height: 6px; border-radius: 3px; background: #EEF0F2; overflow: hidden; }
.rv-avg-line i { display: block; height: 100%; border-radius: 3px; background: #FEDC29; }
.rv-avg-n { text-align: right; color: #303030; }

/* ── телефон: окно во весь экран, выезжает снизу; кнопка — внизу экрана ── */
@media (max-width: 1000px) {
    .rv-pop { padding: 0; align-items: stretch; }
    .rv-pop-dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; animation: rv-up .25s ease-out; }
    .rv-pop-head { padding: 10px 8px 10px 15px; }
    .rv-pop-head h2 { font-size: 16px; line-height: 22px; font-weight: 700; }
    .rv-pop-body { padding: 14px 15px 6px; }
    .rv-pop-foot { padding: 10px 15px calc(12px + env(safe-area-inset-bottom, 0px)); }
    .rv-row { grid-template-columns: 1fr; }
    .rv-star svg { width: 28px; height: 28px; }
    .rv-stars.is-big .rv-star svg { width: 38px; height: 38px; }
    .rv-done { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 1000px), (pointer: coarse) {
    /* iPhone приближает страницу на полях со шрифтом меньше 16 px */
    .rv-form textarea, .rv-form input[type=text], .rv-form input[type=email] { font-size: 16px; }
}
@keyframes rv-up {
    from { transform: translateY(48px); opacity: .4; }
    to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .rv-pop-dialog { animation: none; }
}
