/**
 * Reviews Styles v2.0
 * css/reviews.css
 * С поддержкой фото и видео
 */

/* ========================================
   СЕКЦИЯ ОТЗЫВОВ В КАРТОЧКЕ ТОВАРА
   ======================================== */

.domleks__reviews-section {
    padding: 40px 0;
    background: #f9f9f9;
    margin-top: 30px;
}

.domleks__reviews-header {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e5e5e5;
}

.domleks__reviews-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex-basis: 100%;
}

/* Сводка по рейтингу */
.domleks__reviews-summary {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.reviews-rating-big {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.reviews-rating-big .rating-number {
    font-size: 48px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.reviews-rating-big .review-stars {
    display: flex;
    gap: 2px;
}

.reviews-rating-big .review-stars .icon-star-yellow {
    color: #ffc107;
}

.reviews-rating-big .review-stars .icon-star-gray {
    color: #ddd;
}

.reviews-count {
    color: #777;
    font-size: 14px;
}

/* Распределение оценок */
.reviews-distribution {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 200px;
}

.distribution-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.stars-label {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 35px;
    color: #666;
}

.stars-label .icon-star-yellow {
    color: #ffc107;
    font-size: 12px;
}

.distribution-bar {
    flex: 1;
    height: 8px;
    background: #e5e5e5;
    border-radius: 4px;
    overflow: hidden;
}

.distribution-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffc107, #ffca2c);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.distribution-count {
    min-width: 25px;
    text-align: right;
    color: #777;
}

/* Статистика медиа */
.reviews-media-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.media-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.media-stat span[class^="icon-"] {
    color: #2980b9;
}

/* Кнопка добавления отзыва */
.domleks__reviews-actions {
    margin-left: auto;
    text-align: right;
}

.btn-add-review {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2980b9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-review:hover:not(:disabled) {
    background: #2471a3;
    transform: translateY(-1px);
}

.btn-add-review:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.btn-add-review .icon-check {
    color: #2ecc71;
}

.login-hint {
    margin-top: 10px;
    font-size: 13px;
    color: #777;
}

.login-hint a {
    color: #2980b9;
    text-decoration: underline;
}

/* ========================================
   ФОРМА ДОБАВЛЕНИЯ ОТЗЫВА
   ======================================== */

.domleks__review-form-wrapper {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.domleks__review-form .form-group {
    margin-bottom: 20px;
}

.domleks__review-form label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.domleks__review-form label .required {
    color: #e74c3c;
}

.domleks__review-form label span[class^="icon-"] {
    color: #2980b9;
}

.domleks__review-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.domleks__review-form textarea:focus {
    outline: none;
    border-color: #2980b9;
}

#review-text {
    min-height: 120px;
}

#review-advantages,
#review-disadvantages {
    min-height: 80px;
}

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

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

.char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

/* Выбор рейтинга */
.rating-select {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating-select span[data-rating] {
    font-size: 28px;
    color: #ddd;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rating-select span[data-rating]:hover,
.rating-select span[data-rating].icon-star-yellow {
    color: #ffc107;
    transform: scale(1.1);
}

.rating-select.has-error {
    animation: shake 0.3s ease;
}

.rating-text {
    margin-left: 10px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========================================
   ЗОНА ЗАГРУЗКИ МЕДИА
   ======================================== */

.media-upload-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    background: #fafafa;
}

.media-upload-zone.drag-over {
    border-color: #2980b9;
    background: #e8f4fd;
}

.upload-placeholder {
    text-align: center;
    padding: 20px;
    cursor: pointer;
}

.upload-placeholder span[class^="icon-"] {
    font-size: 40px;
    color: #bbb;
    display: block;
    margin-bottom: 10px;
}

.upload-placeholder p {
    margin: 0 0 5px;
    color: #666;
}

.upload-placeholder .upload-link {
    color: #2980b9;
    text-decoration: underline;
    cursor: pointer;
}

.upload-placeholder small {
    color: #999;
    font-size: 12px;
}

/* Превью загруженных файлов */
.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.preview-item {
    position: relative;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Превью фото */
.photo-preview-item {
    width: 100px;
    height: 100px;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .preview-name,
.photo-preview-item .preview-size {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 10px;
    padding: 3px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-preview-item .preview-size {
    display: none;
}

/* Превью видео */
.video-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    min-width: 200px;
}

.video-preview-item .video-thumb {
    width: 80px;
    height: 60px;
    background: #333;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.video-preview-item .video-thumb span {
    font-size: 24px;
    color: #fff;
}

.video-preview-item .video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-preview-item .video-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.video-preview-item .preview-name {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-preview-item .preview-size {
    font-size: 11px;
    color: #999;
}

.video-preview-item .video-duration {
    font-size: 11px;
    color: #2980b9;
    font-weight: 500;
}

/* Кнопка удаления */
.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.preview-item:hover .preview-remove {
    opacity: 1;
}

.preview-remove:hover {
    background: #e74c3c;
}

/* Кнопки формы */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn-submit-review {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit-review:hover:not(:disabled) {
    background: #219a52;
}

.btn-submit-review:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.btn-cancel-review {
    padding: 12px 24px;
    background: transparent;
    color: #777;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel-review:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.form-note {
    margin-top: 15px;
    font-size: 13px;
    color: #777;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-note .icon-info-circle {
    color: #3498db;
}

/* ========================================
   СПИСОК ОТЗЫВОВ
   ======================================== */

.domleks__reviews-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.domleks__review-item {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

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

.author-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
}

.author-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.author-name {
    font-weight: 600;
    color: #333;
}

.review-date {
    font-size: 13px;
    color: #999;
}

.review-rating .review-stars {
    display: flex;
    gap: 2px;
}

.review-stars .icon-star-yellow {
    color: #ffc107;
}

.review-stars .icon-star-gray {
    color: #ddd;
}

/* Достоинства / Недостатки */
.review-pros-cons {
    display: flex;
    gap: 30px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.review-pros,
.review-cons {
    flex: 1;
}

.review-pros .label,
.review-cons .label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.review-pros .label {
    color: #27ae60;
}

.review-cons .label {
    color: #e74c3c;
}

.review-pros p,
.review-cons p {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

/* Текст отзыва */
.review-text {
    margin-bottom: 15px;
}

.review-text p {
    margin: 0;
    color: #444;
    line-height: 1.6;
}

/* ========================================
   МЕДИА В ОТЗЫВЕ
   ======================================== */

.review-media {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.review-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.review-photos:last-child {
    margin-bottom: 0;
}

.review-photo-item {
    display: block;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.review-photo-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

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

.review-videos {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.review-video-item {
    position: relative;
    max-width: 400px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.review-video-item video {
    display: block;
    width: 100%;
    max-height: 300px;
    background: #000;
}

.video-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
}

/* Ответ администратора */
.review-admin-reply {
    background: #e8f4fd;
    border-left: 3px solid #3498db;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 6px 6px 0;
}

.admin-reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #2980b9;
    margin-bottom: 10px;
    font-size: 14px;
}

.admin-reply-header .reply-date {
    font-weight: 400;
    color: #999;
    margin-left: auto;
    font-size: 12px;
}

.review-admin-reply p {
    margin: 0;
    color: #444;
    font-size: 14px;
    line-height: 1.5;
}

/* Футер отзыва */
.review-footer {
    display: flex;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.btn-helpful {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 20px;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-helpful:hover:not(.voted) {
    border-color: #27ae60;
    color: #27ae60;
}

.btn-helpful.voted {
    background: #e8f8ef;
    border-color: #27ae60;
    color: #27ae60;
    cursor: default;
}

.btn-helpful .icon-thumbs-up {
    color: #27ae60;
}

/* Нет отзывов */
.no-reviews {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
}

.no-reviews .icon-comment-o {
    font-size: 48px;
    color: #ddd;
    display: block;
    margin-bottom: 15px;
}

.no-reviews p {
    color: #999;
    font-size: 16px;
    margin: 0;
}

/* Кнопка загрузки ещё */
.reviews-load-more {
    text-align: center;
    padding-top: 20px;
}

.btn-load-more {
    padding: 12px 30px;
    background: #fff;
    border: 2px solid #2980b9;
    color: #2980b9;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load-more:hover:not(:disabled) {
    background: #2980b9;
    color: #fff;
}

.btn-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   СООБЩЕНИЯ
   ======================================== */

.reviews-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.reviews-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.reviews-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.reviews-message-notice {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.reviews-message .close-message {
    margin-left: auto;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.reviews-message .close-message:hover {
    opacity: 1;
}

/* ========================================
   ОТЗЫВЫ НА ГЛАВНОЙ СТРАНИЦЕ
   ======================================== */

.domleks__reviews-main-section {
    background: #f5f7fa;
    padding: 60px 0;
}

.domleks__reviews-main-section .domleks__heading {
    text-align: center;
    margin-bottom: 40px;
}

.domleks__reviews-main-section .domleks__heading h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 10px;
}

.domleks__reviews-main-section .domleks__heading p {
    color: #777;
    font-size: 16px;
}

.reviews-main-slider .domleks__reviews-item {
    background: #fff;
    border-radius: 12px;
    padding: 15px;
    margin: 5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    height: auto;
    display: flex;
    flex-direction: column;
}

.reviews-main-slider .domleks__reviews-star {
    margin-bottom: 0;
}

.reviews-main-slider .domleks__reviews-star .icon-star-yellow {
    color: #ffc107;
}

.reviews-main-slider .domleks__reviews-star .icon-star-gray {
    color: #ddd;
}

/* Превью фото в слайдере на главной */
.review-photos-preview {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.review-photos-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.review-photos-preview .more-photos {
    width: 60px;
    height: 60px;
    background: #e5e5e5;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #666;
}

/* Продукт в отзыве */
.domleks__reviews-product {
    margin-bottom: 15px;
}

.review-product-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.review-product-link:hover {
    background: #eef1f4;
}

.review-product-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
}

.review-product-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    line-height: 1.1;
}

.domleks__reviews-text {
    flex: 1;
    margin-bottom: 0;
}

.domleks__reviews-text p {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.1;
}

.domleks__reviews-pros {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px;
    background: #e8f8ef;
    border-radius: 6px;
    margin-bottom: 0;
    font-size: 13px;
    color: #27ae60;
}

.domleks__reviews-pros .icon-plus-circle {
    flex-shrink: 0;
    margin-top: 2px;
}

/* Автор на главной */
.domleks__reviews-author {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 5px;
    border-top: 1px dotted #ccc;
    margin-top: auto;
}

.author-avatar-small {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.author-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.author-details .author-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.review-date-small {
    font-size: 12px;
    color: #999;
    margin: 0;
}

.review-link-full {
    display: inline-block;
    margin-top: 12px;
    color: #2980b9;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.review-link-full:hover {
    text-decoration: underline;
}

/* Slick slider */
.reviews-main-slider .slick-prev,
.reviews-main-slider .slick-next {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 10;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.reviews-main-slider .slick-prev:hover,
.reviews-main-slider .slick-next:hover {
    background: #2980b9;
    color: #fff;
}

.reviews-main-slider .slick-prev { left: -20px; }
.reviews-main-slider .slick-next { right: -20px; }

.reviews-main-slider .slick-dots {
    bottom: -40px;
}

.reviews-main-slider .slick-dots li button:before {
    font-size: 10px;
    color: #ccc;
}

.reviews-main-slider .slick-dots li.slick-active button:before {
    color: #2980b9;
}

/* ========================================
   АДАПТИВНОСТЬ
   ======================================== */

@media (max-width: 992px) {
    .domleks__reviews-header {
        flex-direction: column;
    }

    .domleks__reviews-actions {
        margin-left: 0;
        text-align: left;
    }

    .reviews-main-slider .slick-prev,
    .reviews-main-slider .slick-next {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .domleks__reviews-section {
        padding: 30px 0;
    }

    .domleks__reviews-summary {
        flex-direction: column;
        gap: 20px;
    }

    .reviews-rating-big {
        flex-direction: row;
        gap: 15px;
    }

    .reviews-rating-big .rating-number {
        font-size: 36px;
    }

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

    .review-pros-cons {
        flex-direction: column;
        gap: 15px;
    }

    .domleks__review-form-wrapper {
        padding: 20px;
    }

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

    .domleks__reviews-main-section {
        padding: 40px 0;
    }

    /* Медиа на мобильных */
    .review-photo-item {
        width: 100px;
        height: 100px;
    }

    .review-video-item {
        max-width: 100%;
    }

    .review-video-item video {
        max-height: 250px;
    }

    .photo-preview-item {
        width: 80px;
        height: 80px;
    }

    .video-preview-item {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .domleks__reviews-title {
        font-size: 20px;
    }

    .rating-select span[data-rating] {
        font-size: 24px;
    }

    .btn-add-review {
        width: 100%;
        justify-content: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-submit-review,
    .btn-cancel-review {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .review-photo-item {
        width: 80px;
        height: 80px;
    }

    .upload-placeholder span[class^="icon-"] {
        font-size: 30px;
    }
}

/* Спиннер загрузки */
.icon-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   FANCYBOX КАСТОМИЗАЦИЯ ДЛЯ ОТЗЫВОВ
   ======================================== */

.fancybox-container .fancybox-bg {
    background: rgba(0, 0, 0, 0.9);
}

.fancybox-is-open .fancybox-bg {
    opacity: 1;
}
