/* Reviews Plugin Styles — uses template CSS variables */

/* ============================================ */
/* Табы: Отзывы / Комментарии / В ролях       */
/* ============================================ */
.reviews-comms-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bdc);
    padding-bottom: 10px;
}

/* Reset button styles to avoid theme inheritance */
.rc-tab {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 4px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;

    color: var(--tt, #fff);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;

    margin: 0;
    text-decoration: none;
}

/* Hover state: Semi-transparent background */
.rc-tab:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--tt, #fff);
}

/* Active state: Accent text, subtle background */
.rc-tab.is-active {
    background-color: rgba(var(--accent-rgb, 255, 87, 34), 0.15);
    /* Very subtle tint */
    color: var(--accent);
}

.rc-tab i {
    font-size: 16px;
    opacity: 0.8;
}

.rc-tab.is-active i {
    opacity: 1;
    color: var(--accent);
}

.rc-tab-count {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    color: var(--tt-fade);
}

.rc-tab.is-active .rc-tab-count {
    background: var(--accent);
    color: #fff;
}

/* Generic Tab Content - Removed animation to prevent flickering */

/* ============================================ */
/* Тулбар (кнопка «Добавить отзыв»)            */
/* ============================================ */
.rc-toolbar {
    margin-bottom: 20px;
}

.rc-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: none;
    color: var(--tt);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rc-add-btn:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ============================================ */
/* Отзывы — стили как у комментариев              */
/* ============================================ */
.review-item {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bdc);
}

.review-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.review-info {
    flex: 1 1 auto;
}

.review-avatar {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.review-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-info {
    flex: 1;
}

.review-author {
    font-weight: 500;
}

.review-author a {
    color: inherit;
    text-decoration: none;
}

.review-author a:hover {
    color: var(--accent-2);
}

.review-date {
    color: var(--tt-fade);
    font-size: 13px;
    margin-top: 3px;
}

.review-text {
    margin: 10px 0 15px 0;
    line-height: 1.6;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Действия отзыва */
.review-actions {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    color: var(--tt-fade);
}

.review-actions a {
    color: var(--tt-fade);
    text-decoration: none;
    transition: color 0.2s;
}

.review-actions a:hover {
    color: var(--accent-2);
}

/* Навигация */
#reviews-navigation {
    margin-top: 10px;
}

/* Нет отзывов */
.reviews-no-reviews {
    text-align: center;
    padding: 30px;
    color: var(--tt-fade);
}

.reviews-no-reviews i {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    opacity: 0.5;
}

/* ============================================ */
/* Модальное окно — форма                       */
/* ============================================ */
.reviews-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.reviews-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.reviews-form-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    background: var(--bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.reviews-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--bdc);
}

.reviews-form-title {
    margin: 0;
    font-size: 17px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--tt);
}

.reviews-form-close {
    background: none;
    border: none;
    color: var(--tt-fade);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.reviews-form-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--tt);
}

.reviews-form-body {
    padding: 24px;
}

/* ============================================ */
/* Форма отзыва                                 */
/* ============================================ */
.review-form .form-group {
    margin-bottom: 14px;
}

.review-form .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--tt-fade);
    font-size: 13px;
}

.review-form .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--bdc);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
    background: var(--bg);
    color: var(--tt);
}

.review-form .form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 102, 126, 234), 0.1);
}

.review-form textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 18px;
}

.form-actions .btn {
    padding: 10px 22px;
    background: var(--accent-2);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.form-actions .btn:hover {
    opacity: 0.85;
}

.form-message {
    font-size: 13px;
}

.form-message.success {
    color: var(--green, #4caf50);
}

.form-message.error {
    color: var(--red, #f44336);
}

/* Секция seccode */
.seccode {
    display: flex;
    align-items: center;
    gap: 10px;
}

.seccode img {
    border-radius: 4px;
    cursor: pointer;
}

.question-text {
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--tt);
}

/* Загрузка */
.reviews-loading {
    text-align: center;
    padding: 25px;
    color: var(--tt-fade);
}

/* Древовидные отзывы */
.reviews-tree-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reviews-tree-list .reviews-tree-list {
    margin-left: 20px;
    padding-left: 15px;
    border-left: 2px solid var(--bdc);
}

/* ============================================ */
/* Footer / Rating                              */
/* ============================================ */
.review-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--bdc);
}

.review-rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.review-vote-up,
.review-vote-down {
    cursor: pointer;
    font-size: 16px;
    color: var(--tt-fade);
    transition: color 0.2s, transform 0.2s;
    padding: 3px;
}

.review-vote-up:hover {
    color: #4caf50;
    transform: translateY(-1px);
}

.review-vote-down:hover {
    color: #f44336;
    transform: translateY(1px);
}

.review-vote-up.voted {
    color: #4caf50;
}

.review-vote-down.voted {
    color: #f44336;
}

.review-rating-value {
    font-weight: 600;
    font-size: 14px;
    min-width: 16px;
    text-align: center;
    color: var(--tt);
}

.review-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1 1 auto;
}

.review-actions a {
    color: var(--tt-fade);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.review-actions a:hover {
    color: var(--accent);
}

.review-actions a i {
    margin-right: 4px;
}

/* ============================================ */
/* Адаптивность                                 */
/* ============================================ */
@media (max-width: 768px) {
    .reviews-form-dialog {
        width: 95%;
    }

    .reviews-form-body {
        padding: 18px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Адаптивность для табов - облако тегов */
    .reviews-comms-tabs {
        flex-wrap: wrap;
        height: auto;
        gap: 8px;
        /* Немного уменьшим отступ между элементами */
    }

    .rc-tab {
        padding: 8px 12px;
        /* Чуть меньше паддинги */
        font-size: 13px;
        flex: 0 1 auto;
        /* Чтобы не растягивались на всю ширину */
        margin-bottom: 0;
        /* Отступ регулируется через gap родителя */
        background-color: rgba(255, 255, 255, 0.05);
        /* Легкий фон для видимости границ кнопок */
    }

    /* Стили для кнопки "В подборках", если она отличается */
    .reviews-comms-tabs .btn,
    .reviews-comms-tabs>a,
    .reviews-comms-tabs>div {
        margin-bottom: 0;
    }

    .review-header {
        flex-wrap: wrap;
    }

    .review-item {
        padding-bottom: 8px;
        margin-bottom: 15px;
    }
}

/* ===== Review Rating / Votes ===== */
.review-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 6px;
    gap: 15px;
}

.review-bottom-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.review-rating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 3px 6px;
    z-index: 5;
    flex-shrink: 0;
}

/* Add padding to review item to prevent overlap */
.review-item {
    position: relative;
    padding-bottom: 10px;
}

.review-vote-up,
.review-vote-down {
    cursor: pointer;
    font-size: 12px;
    color: var(--tt-fade, #888);
    transition: color 0.2s;
    padding: 2px 3px;
    line-height: 1;
}

.review-vote-up:hover {
    color: #4caf50;
}

.review-vote-down:hover {
    color: #f44336;
}

.review-vote-up.voted {
    color: #4caf50;
}

.review-vote-down.voted {
    color: #f44336;
}

.review-likes-count,
.review-dislikes-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--tt, #fff);
    min-width: 10px;
    text-align: center;
    padding: 0 1px;
}

/* Pagination Buttons */
#reviews-pagination {
    margin: 20px 0;
    gap: 15px;
}

#reviews-pagination a {
    text-decoration: none;
    display: inline-block;
    width: auto;
}

.reviews-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #2b2b2b;
    /* Dark like screenshot */
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.2s;
    font-size: 14px;
}

.reviews-nav-btn:hover {
    background: #3a3a3a;
}

.reviews-nav-prev i {
    margin-right: 5px;
}

.reviews-nav-next i {
    margin-left: 5px;
}

/* Load More Button */
.reviews-load-more-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #393e46;
    /* Neutral dark */
    color: #fff;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid var(--bdc);
}


/* JS State Classes */
.reviews-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.reviews-toast.is-visible {
    opacity: 1;
}

.reviews-modal-open {
    overflow: hidden;
}

.reviews-form-modal.is-visible {
    display: block !important;
}

.reviews-hidden {
    display: none !important;
}

/* User Rating Stars */
.rating-mini {
    display: inline-block;
    width: 80px;
    /* 5 stars * 16px */
    height: 16px;
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='17' height='51' viewBox='0 0 17 51'%3E%3Cdefs%3E%3CclipPath id='clip-Web_1920_1'%3E%3Crect width='17' height='51'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg id='Web_1920_1' data-name='Web 1920 – 1' clip-path='url(%23clip-Web_1920_1)'%3E%3Cg id='rating'%3E%3Cpath id='star' d='M14.624,5.38l-4.618-.705L7.936.265a.489.489,0,0,0-.849,0L5.017,4.674.4,5.38a.469.469,0,0,0-.265.792L3.489,9.611,2.7,14.472a.47.47,0,0,0,.69.486l4.125-2.28,4.125,2.28a.47.47,0,0,0,.69-.486l-.793-4.862,3.355-3.439a.47.47,0,0,0-.265-.792Z' transform='translate(0.978 34.981)' fill='%23ffc107'/%3E%3Cpath id='star-2' data-name='star' d='M14.624,5.38l-4.618-.705L7.936.265a.489.489,0,0,0-.849,0L5.017,4.674.4,5.38a.469.469,0,0,0-.265.792L3.489,9.611,2.7,14.472a.47.47,0,0,0,.69.486l4.125-2.28,4.125,2.28a.47.47,0,0,0,.69-.486l-.793-4.862,3.355-3.439a.47.47,0,0,0-.265-.792Z' transform='translate(0.978 17.981)' fill='%23ff5a00'/%3E%3Cpath id='star-3' data-name='star' d='M14.624,5.38l-4.618-.705L7.936.265a.489.489,0,0,0-.849,0L5.017,4.674.4,5.38a.469.469,0,0,0-.265.792L3.489,9.611,2.7,14.472a.47.47,0,0,0,.69.486l4.125-2.28,4.125,2.28a.47.47,0,0,0,.69-.486l-.793-4.862,3.355-3.439a.47.47,0,0,0-.265-.792Z' transform='translate(0.978 0.981)' fill='%23ddd'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 0 0 repeat-x;
    background-size: 16px auto;
    position: relative;
    margin-right: 5px;
}

.rating-mini span {
    display: block;
    height: 100%;
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='17' height='51' viewBox='0 0 17 51'%3E%3Cdefs%3E%3CclipPath id='clip-Web_1920_1'%3E%3Crect width='17' height='51'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg id='Web_1920_1' data-name='Web 1920 – 1' clip-path='url(%23clip-Web_1920_1)'%3E%3Cg id='rating'%3E%3Cpath id='star' d='M14.624,5.38l-4.618-.705L7.936.265a.489.489,0,0,0-.849,0L5.017,4.674.4,5.38a.469.469,0,0,0-.265.792L3.489,9.611,2.7,14.472a.47.47,0,0,0,.69.486l4.125-2.28,4.125,2.28a.47.47,0,0,0,.69-.486l-.793-4.862,3.355-3.439a.47.47,0,0,0-.265-.792Z' transform='translate(0.978 34.981)' fill='%23ffc107'/%3E%3Cpath id='star-2' data-name='star' d='M14.624,5.38l-4.618-.705L7.936.265a.489.489,0,0,0-.849,0L5.017,4.674.4,5.38a.469.469,0,0,0-.265.792L3.489,9.611,2.7,14.472a.47.47,0,0,0,.69.486l4.125-2.28,4.125,2.28a.47.47,0,0,0,.69-.486l-.793-4.862,3.355-3.439a.47.47,0,0,0-.265-.792Z' transform='translate(0.978 17.981)' fill='%23ff5a00'/%3E%3Cpath id='star-3' data-name='star' d='M14.624,5.38l-4.618-.705L7.936.265a.489.489,0,0,0-.849,0L5.017,4.674.4,5.38a.469.469,0,0,0-.265.792L3.489,9.611,2.7,14.472a.47.47,0,0,0,.69.486l4.125-2.28,4.125,2.28a.47.47,0,0,0,.69-.486l-.793-4.862,3.355-3.439a.47.47,0,0,0-.265-.792Z' transform='translate(0.978 0.981)' fill='%23ddd'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 0 100% repeat-x;
    background-size: 16px auto;
}

/* Already Reviewed Modal */
.reviews-already-dialog {
    max-width: 400px;
    padding: 30px;
    text-align: center;
}

.reviews-already-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--tt, #fff);
}

.reviews-already-btn {
    background: var(--accent, #4caf50);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.reviews-already-btn:hover {
    opacity: 0.9;
}

/* Edit Stars */
.edit-stars {
    font-size: 24px;
    display: flex;
    gap: 5px;
}

.edit-star-icon {
    cursor: pointer;
    transition: color 0.1s;
    color: #ccc;
}

.edit-star-icon.filled {
    color: #ffc107;
}

.edit-star-icon:hover {
    color: #ffca28;
    transform: scale(1.15);
}

.review-user-rating {
    display: flex;
    align-items: center;
}

.review-user-rating-num {
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.review-form-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding-right: 5px;
}

.emoji-trigger,
.spoiler-trigger {
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    opacity: 0.6;
    color: var(--tt-fade, #888);
}

.emoji-trigger:hover,
.spoiler-trigger:hover {
    transform: scale(1.1);
    opacity: 1;
    color: var(--tt, #fff);
}

.emoji-trigger .fa-smile {
    color: #ffc107;
}

.spoiler-trigger .fa-eye-slash {
    color: #f44336;
}

.review-spoiler {
    background: rgba(255, 255, 255, 0.1);
    color: transparent !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 0 2px;
    user-select: none;
}

.review-spoiler.is-visible {
    color: inherit !important;
    text-shadow: none;
    background: transparent;
    cursor: default;
    user-select: text;
}

.emoji-picker {
    position: absolute;
    bottom: 35px;
    right: 0;
    width: 320px;
    height: 250px;
    background: var(--bg, #222);
    border: 1px solid var(--bdc, #444);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10001;
    display: none;
    overflow-y: auto;
    padding: 10px;
}

.emoji-picker.is-visible {
    display: block;
    animation: fadeIn 0.2s;
}

.emoji-category {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: bold;
    color: var(--tt-fade, #888);
    margin: 10px 0 5px 0;
    border-bottom: 1px solid var(--bdc, #333);
    padding-bottom: 2px;
}

.emoji-category:first-child {
    margin-top: 0;
}

.emoji-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.emoji-item {
    cursor: pointer;
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.1s;
    user-select: none;
}

.emoji-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

/* Scrollbar for picker */
.emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}