/**
 * reviews.css — Стили блока отзывов на странице товара
 *
 * Использует CSS-переменные темы:
 *   --c-dark, --c-gray, --c-light, --c-border
 *
 * Структура:
 *   1. Общие классы звёзд (.rt-star)
 *   2. Блок отзывов (.rt-reviews)
 *      - Сводка (avg + distribution + CTA)
 *      - Список карточек
 *      - Empty state
 *   3. Карточка отзыва (.rt-review-card)
 *      - Шапка (автор + рейтинг)
 *      - Текст
 *      - Ответ компании
 *   4. Форма отзыва (.rt-review-form)
 *   5. Адаптив
 *
 * @package Ural-RTI
 */


/* ═══════════════════════════════════════════════════════════
   1. ЗВЁЗДЫ (общие)
   ═══════════════════════════════════════════════════════════ */

.rt-star {
    color: #ddd;
    font-size: 18px;
    line-height: 1;
    display: inline-block;
}

.rt-star--full {
    color: #f39c12;
}

.rt-star--half {
    background: linear-gradient(90deg, #f39c12 50%, #ddd 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ═══════════════════════════════════════════════════════════
   2. БЛОК ОТЗЫВОВ
   ═══════════════════════════════════════════════════════════ */

.rt-reviews {
    padding: 8px 0;
}


/* ── СВОДКА ── */

.rt-reviews__summary {
    display: grid;
    grid-template-columns: 220px 1fr auto;
    align-items: center;
    gap: 32px;
    padding: 24px;
    background: #fafbfc;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 24px;
}

.rt-reviews__avg {
    text-align: center;
    border-right: 1px solid var(--c-border, #e5e7eb);
    padding-right: 24px;
}

.rt-reviews__avg-number {
    font-size: 48px;
    font-weight: 800;
    color: var(--c-dark, #1f2937);
    line-height: 1;
    margin-bottom: 8px;
}

.rt-reviews__avg-stars {
    margin-bottom: 6px;
    font-size: 22px;
}

.rt-reviews__avg-stars .rt-star {
    font-size: 22px;
}

.rt-reviews__avg-count {
    font-size: 13px;
    color: var(--c-gray, #6b7280);
}

.rt-reviews__dist {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rt-reviews__dist-row {
    display: grid;
    grid-template-columns: 36px 1fr 32px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.rt-reviews__dist-label {
    color: var(--c-gray, #6b7280);
    font-weight: 600;
}

.rt-reviews__dist-bar {
    height: 8px;
    background: #ececec;
    border-radius: 4px;
    overflow: hidden;
}

.rt-reviews__dist-fill {
    height: 100%;
    background: #f39c12;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.rt-reviews__dist-count {
    color: var(--c-gray, #6b7280);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rt-reviews__cta {
    display: flex;
    align-items: center;
}


/* Кнопка "Оставить отзыв" */
.rt-reviews__btn {
    background: #f39c12;
    color: #fff;
    border: none;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
    white-space: nowrap;
}

.rt-reviews__btn:hover {
    background: #e08e0b;
}

.rt-reviews__btn:active {
    transform: translateY(1px);
}


/* ── EMPTY STATE ── */

.rt-reviews__empty {
    text-align: center;
    padding: 48px 24px;
    background: #fafbfc;
    border: 1px dashed var(--c-border, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 24px;
}

.rt-reviews__empty-icon {
    font-size: 56px;
    color: #ddd;
    line-height: 1;
    margin-bottom: 16px;
}

.rt-reviews__empty-title {
    font-size: 20px;
    color: var(--c-dark, #1f2937);
    margin: 0 0 12px;
}

.rt-reviews__empty-text {
    color: var(--c-gray, #6b7280);
    margin: 0 0 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}


/* ── СПИСОК ── */

.rt-reviews__list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rt-reviews__more-info {
    text-align: center;
    margin-top: 20px;
    padding: 12px;
    color: var(--c-gray, #6b7280);
    font-size: 13px;
}


/* ═══════════════════════════════════════════════════════════
   3. КАРТОЧКА ОТЗЫВА
   ═══════════════════════════════════════════════════════════ */

.rt-review-card {
    padding: 20px 24px;
    background: #fff;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 10px;
    transition: border-color 0.15s;
}

.rt-review-card:hover {
    border-color: #d1d5db;
}

.rt-review-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--c-border, #e5e7eb);
}

.rt-review-card__author {
    display: flex;
    gap: 12px;
    align-items: center;
}

.rt-review-card__avatar {
    width: 40px;
    height: 40px;
    background: #f39c12;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.rt-review-card__info {
    min-width: 0;
}

.rt-review-card__name {
    font-weight: 600;
    color: var(--c-dark, #1f2937);
    margin-bottom: 2px;
}

.rt-review-card__meta {
    font-size: 13px;
    color: var(--c-gray, #6b7280);
    line-height: 1.4;
}

.rt-review-card__sep {
    margin: 0 6px;
    opacity: 0.5;
}

.rt-review-card__rating-row {
    text-align: right;
    flex-shrink: 0;
}

.rt-review-card__stars {
    margin-bottom: 4px;
    font-size: 16px;
}

.rt-review-card__date {
    font-size: 12px;
    color: var(--c-gray, #6b7280);
}

.rt-review-card__body {
    color: var(--c-dark, #1f2937);
    line-height: 1.6;
    font-size: 15px;
}

.rt-review-card__body p {
    margin: 0 0 10px;
}

.rt-review-card__body p:last-child {
    margin-bottom: 0;
}


/* ── ОТВЕТ КОМПАНИИ ── */

.rt-review-card__reply {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f0f7ff;
    border-left: 3px solid #2271b1;
    border-radius: 6px;
}

.rt-review-card__reply-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--c-dark, #1f2937);
}

.rt-review-card__reply-header time {
    color: var(--c-gray, #6b7280);
    font-size: 12px;
}

.rt-review-card__reply-body {
    color: var(--c-dark, #1f2937);
    font-size: 14px;
    line-height: 1.5;
}

.rt-review-card__reply-body p {
    margin: 0 0 8px;
}

.rt-review-card__reply-body p:last-child {
    margin-bottom: 0;
}


/* ═══════════════════════════════════════════════════════════
   4. ФОРМА ОТЗЫВА
   ═══════════════════════════════════════════════════════════ */

.rt-review-form {
    margin: 24px 0;
    padding: 24px;
    background: #fff;
    border: 2px solid #f39c12;
    border-radius: 12px;
    animation: rt-review-form-in 0.25s ease;
}

@keyframes rt-review-form-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rt-review-form[hidden] {
    display: none;
}

.rt-review-form__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--c-border, #e5e7eb);
}

.rt-review-form__title {
    font-size: 20px;
    margin: 0;
    color: var(--c-dark, #1f2937);
}

.rt-review-form__close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: var(--c-gray, #6b7280);
    cursor: pointer;
    padding: 0 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.rt-review-form__close:hover {
    background: #f3f4f6;
    color: var(--c-dark, #1f2937);
}


/* ── ПОЛЯ ── */

.rt-review-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rt-review-form__field {
    margin-bottom: 16px;
}

.rt-review-form__field--rating {
    margin-bottom: 20px;
}

.rt-review-form__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-dark, #1f2937);
    margin-bottom: 6px;
}

.rt-review-form__req {
    color: #e74c3c;
}

.rt-review-form__input,
.rt-review-form__textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}

.rt-review-form__input:focus,
.rt-review-form__textarea:focus {
    outline: none;
    border-color: #f39c12;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.rt-review-form__textarea {
    resize: vertical;
    min-height: 100px;
}

.rt-review-form__hint {
    display: block;
    font-size: 12px;
    color: var(--c-gray, #6b7280);
    margin-top: 4px;
}

.rt-review-form__error {
    display: block;
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
}


/* ── ЗВЁЗДЫ ВВОДА ── */

.rt-review-form__stars {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rt-review-form__star {
    background: none;
    border: none;
    font-size: 32px;
    color: #ddd;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
}

.rt-review-form__star:hover,
.rt-review-form__star--active {
    color: #f39c12;
}

.rt-review-form__star:active {
    transform: scale(0.9);
}

.rt-review-form__rating-text {
    margin-left: 12px;
    font-size: 13px;
    color: var(--c-gray, #6b7280);
}


/* ── СОГЛАСИЕ ── */

.rt-review-form__field--agree {
    margin-top: 8px;
}

.rt-review-form__checkbox-label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
    font-size: 13px;
    color: var(--c-dark, #1f2937);
    line-height: 1.5;
}

.rt-review-form__checkbox-label input {
    margin-top: 3px;
    cursor: pointer;
    flex-shrink: 0;
}

.rt-review-form__checkbox-label a {
    color: #2271b1;
    text-decoration: underline;
}


/* ── РЕЗУЛЬТАТ И КНОПКА ── */

.rt-review-form__result {
    margin: 16px 0;
}

.rt-review-form__success {
    padding: 16px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.rt-review-form__error-msg {
    padding: 12px 16px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    font-size: 14px;
}

.rt-review-form__actions {
    margin-top: 20px;
    text-align: right;
}

.rt-review-form__submit {
    background: #f39c12;
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.rt-review-form__submit:hover {
    background: #e08e0b;
}

.rt-review-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* ═══════════════════════════════════════════════════════════
   5. АДАПТИВ
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

    /* Сводка — в колонку */
    .rt-reviews__summary {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }

    .rt-reviews__avg {
        border-right: none;
        border-bottom: 1px solid var(--c-border, #e5e7eb);
        padding-right: 0;
        padding-bottom: 16px;
    }

    .rt-reviews__cta {
        justify-content: center;
    }

    .rt-reviews__btn {
        width: 100%;
        max-width: 300px;
    }


    /* Карточка */
    .rt-review-card {
        padding: 16px;
    }

    .rt-review-card__header {
        flex-direction: column;
        gap: 10px;
    }

    .rt-review-card__rating-row {
        text-align: left;
    }


    /* Форма */
    .rt-review-form {
        padding: 16px;
    }

    .rt-review-form__row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .rt-review-form__star {
        font-size: 36px;
        padding: 6px;
    }

    .rt-review-form__actions {
        text-align: center;
    }

    .rt-review-form__submit {
        width: 100%;
    }
}
