/* --- БАЗОВЫЕ НАСТРОЙКИ И ПЕРЕМЕННЫЕ --- */
:root {
    --bg-page: #121212;
    --bg-panel: #181818;
    --bg-card: #1e1e1e;
    --bg-input: #141414;
    
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --text-dark: #666666;

    --color-primary: #3ea6ff;
    --color-primary-hover: #5cb3ff;
    --color-error: #ef5350;
    --color-success: #66bb6a;
    --color-warning: #ff9100;
    --color-star: #ffd700;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(62, 166, 255, 0.15);
}

/* ==========================================================================
   1. ОБЩИЙ ЛЕЙАУТ СТРАНИЦЫ
   ========================================================================== */

.my-review-card.review-hash-highlight {
    box-shadow: 0 0 0 2px var(--color-primary), var(--shadow-card);
    border-radius: var(--radius-md);
    transition: box-shadow 0.35s ease;
}

.reviews-page-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
}

.reviews-page-content {
    background-color: var(--bg-panel);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    min-height: 600px;
    box-shadow: var(--shadow-card);
    border: 1px solid #2a2a2a;
}

.reviews-page-content a:not(.btn):not(.sort-option):not(.text-toggle-btn) {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.reviews-page-content a:hover {
    opacity: 0.8;
}

/* ==========================================================================
   2. НАВИГАЦИЯ (ВКЛАДКИ / TABS) 
   ========================================================================== */

   .tabs-navigation {
    display: flex;
    gap: 24px;
    border-bottom: 2px solid #2a2a2a;
    margin-bottom: 40px;
    overflow-x: auto;     
    overflow-y: hidden;   
    scrollbar-width: none; 
    -ms-overflow-style: none; 
    padding-bottom: 0;  
    position: relative; 
}

.tabs-navigation::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 4px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
    white-space: nowrap; 
    flex-shrink: 0;   
}

/* Линия подчеркивания */
.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--color-primary);
    transform: scaleX(0);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 3px 3px 0 0;
    z-index: 2; 
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--color-primary);
}

.tab-btn.active::after {
    transform: scaleX(1);
}

/* Анимация появления контента */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.tab-content.active {
    display: block;
}

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

/* ==========================================================================
   3. ФОРМА "ОСТАВИТЬ ОТЗЫВ" (КРАСИВАЯ КАРТОЧКА)
   ========================================================================== */

.review-form-container {
    max-width: 580px;
    margin: 20px auto;
    text-align: center;
    background: var(--bg-card);
    padding: 48px;
    border-radius: var(--radius-xl);
    border: 1px solid #333;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    position: relative;
}

.review-form-container h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 26px;
    font-weight: 700;
}

.step-description {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 auto 32px auto;
    max-width: 440px;
}

.review-form-container .form-step {
    display: none;
}
.review-form-container .form-step.active {
    display: block;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.star-rating {
    display: flex;
    flex-direction: row-reverse; 
    justify-content: center;
    gap: 12px;
    margin: 20px 0 40px 0;
}

.star-rating input {
    display: none;
}

.star-rating label {
    font-size: 64px; 
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s, text-shadow 0.2s;
}

/* Эффект увеличения при наведении */
.star-rating label:hover {
    transform: scale(1.15);
}

/* Закрашивание звезд (активные и при наведении) */
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: var(--color-star);
    text-shadow: 0 0 25px rgba(255, 215, 0, 0.4), 0 0 10px rgba(255, 215, 0, 0.2);
}

/* Сообщение об ошибке (если не выбрана звезда) */
#rating-error {
    color: var(--color-error);
    margin-top: -20px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.form-group {
    text-align: left;
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ddd;
    font-size: 14px;
    font-weight: 600;
    margin-left: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 16px 20px;
    background: var(--bg-input);
    border: 1px solid #333;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #555;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #1b1b1b;
    box-shadow: 0 0 0 4px rgba(62, 166, 255, 0.15);
    transform: translateY(-1px);
}

.form-group textarea {
    resize: none;
    min-height: 140px;
}

/* Валидация: Ошибка */
.form-group input.input-error,
.form-group textarea.input-error {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 4px rgba(239, 83, 80, 0.15) !important;
    animation: shake 0.3s ease-in-out;
}

.validation-message {
    color: var(--color-error);
    font-size: 13px;
    margin-top: 6px;
    margin-left: 4px;
    display: none;
    font-weight: 500;
}
.validation-message.active { display: block; }

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

/* Счетчики символов */
.char-counter {
    position: absolute;
    bottom: -22px;
    right: 4px;
    font-size: 12px;
    color: var(--text-dark);
    font-family: monospace;
}
.char-counter.limit-reached { color: var(--color-error); }

/* Чекбокс */
.checkbox-group {
    margin-top: 10px;
    margin-bottom: 30px;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 400;
    color: var(--text-muted);
    font-size: 14px;
    justify-content: center;
}
.checkbox-group input {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

/* --- КНОПКИ --- */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, #308dd6 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(62, 166, 255, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #5cb3ff 0%, var(--color-primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(62, 166, 255, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); }

.btn-full-width { width: 100%; }

/* Лоадер внутри кнопки */
.btn-loader {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    margin-right: 10px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Экран успеха */
.review-success-screen { padding: 20px; }
.success-icon {
    font-size: 48px; color: var(--color-success); margin-bottom: 20px;
    display: inline-block; width: 80px; height: 80px; line-height: 80px;
    border-radius: 50%; background: rgba(102, 187, 106, 0.1);
    border: 2px solid rgba(102, 187, 106, 0.2);
}

/* ==========================================================================
   4. СЕКЦИЯ "МОИ ОТЗЫВЫ" (СПИСОК)
   ========================================================================== */

.reviews-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.reviews-toolbar h2 { margin: 0; font-size: 22px; color: #fff; }

.my-review-card {
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    transition: border-color 0.2s, transform 0.2s;
}
.my-review-card:hover {
    border-color: #444;
    transform: translateY(-2px);
}

/* Мета-информация (ID, Автор) */
.my-review-meta-top {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-dark);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #2a2a2a;
}
.meta-id {
    color: var(--color-primary);
    font-family: monospace;
    font-weight: 700;
    font-size: 14px;
    background: rgba(62, 166, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}
.meta-divider { color: #333; }

/* Хедер карточки */
.my-review-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.review-subject-block { flex: 1; padding-right: 20px; }

.review-detail-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    margin-bottom: 4px;
    font-weight: 700;
}

.review-detail-value.subject {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

/* Статусы */
.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.status-wait { background: rgba(255, 145, 0, 0.15); color: var(--color-warning); border: 1px solid rgba(255, 145, 0, 0.3); }
.status-ok { background: rgba(76, 175, 80, 0.15); color: var(--color-success); border: 1px solid rgba(76, 175, 80, 0.3); }
.status-bad { background: rgba(239, 83, 80, 0.15); color: var(--color-error); border: 1px solid rgba(239, 83, 80, 0.3); }

/* Тело отзыва */
.review-detail-value.body {
    font-size: 15px;
    color: #ddd;
    line-height: 1.6;
    word-wrap: break-word;
}

.text-toggle-btn {
    background: none;
    border: none;
    color: #777;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
    font-weight: 600;
}
.text-toggle-btn:hover { color: var(--color-primary); }

.text-rest { display: none; }
.text-rest.visible { display: inline; }

/* Ответ администратора */
.admin-response {
    background: #252525;
    border-left: 3px solid var(--color-primary);
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin-top: 16px;
}
.admin-response p {
    color: #ccc;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}
.admin-response strong { color: var(--color-primary); display: block; margin-bottom: 4px; }

.public-admin-response {
    margin-top: 14px;
    background: rgba(62, 166, 255, 0.08);
    border: 1px solid rgba(62, 166, 255, 0.2);
    border-left: 3px solid var(--color-primary);
}

.my-review-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}
.edit-review-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #444;
    color: #aaa;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.edit-review-btn:hover {
    background: #333;
    border-color: #666;
    color: #fff;
}
.edit-review-btn img {
    width: 14px; height: 14px; opacity: 0.7; filter: invert(1);
}

/* ==========================================================================
   5. СЕКЦИЯ "ПУБЛИЧНЫЕ ОТЗЫВЫ"
   ========================================================================== */

/* Сортировка */
.sort-menu-container { position: relative; }
.sort-menu-button {
    background: #2a2a2a;
    border: 1px solid #333;
    color: #ddd;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}
.sort-menu-button:hover { background: #333; }
.sort-arrow-icon { width: 10px; opacity: 0.7; filter: invert(1); transition: transform 0.2s; }
.sort-menu-container.open .sort-arrow-icon { transform: rotate(180deg); }

.sort-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #252525;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    z-index: 50;
    width: 200px;
    overflow: hidden;
}
.sort-menu-container.open .sort-menu-dropdown { display: block; animation: fadeIn 0.2s; }

.sort-option {
    display: block;
    padding: 12px 16px;
    color: #ccc;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s;
}
.sort-option:hover { background: #333; color: #fff; }

/* Публичная карточка */
.review-card {
    background: #222;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.user-info { display: flex; gap: 14px; align-items: center; }
.user-info img {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #333;
}
.username { color: #fff; font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.date { color: #666; font-size: 12px; }

.stars-display { display: flex; gap: 2px; }
.stars-display .star { color: #444; font-size: 18px; }
.stars-display .star.filled { color: var(--color-star); }

.review-body strong {
    display: block;
    color: #fff;
    font-size: 17px;
    margin-bottom: 8px;
}
.review-body p {
    color: #ccc;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

.review-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #333;
}
.reactions { display: flex; gap: 12px; }
.reaction-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: #aaa;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    gap: 8px;
    align-items: center;
    transition: all 0.2s;
}
.reaction-btn img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 1;
    filter: invert(1);
    transition: opacity 0.2s, filter 0.2s;
}
.reaction-btn:hover:not(:disabled) img {
    opacity: 1;
    filter: invert(1);
}
.reaction-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: translateY(-1px);
}
.reaction-btn:disabled {
    opacity: 1;
    cursor: default;
    background: rgba(62, 166, 255, 0.12);
    color: var(--color-primary);
    border: 1px solid rgba(62, 166, 255, 0.25);
}
.reaction-btn:disabled img {
    opacity: 1;
    filter: invert(1);
}

.no-reviews-message {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-md);
    border: 1px dashed #333;
    color: #777;
    font-size: 16px;
}

/* ==========================================================================
   6. МОДАЛЬНОЕ ОКНО (EDIT)
   Модалка переносится в document.body (JS), чтобы не сжималась в flex-лейауте.
   ========================================================================== */

body.review-edit-modal-open {
    overflow: hidden;
}

#edit-review-modal.review-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.review-modal-content {
    background: var(--bg-card);
    width: min(560px, calc(100vw - 40px));
    max-width: 100%;
    max-height: min(90vh, 900px);
    padding: 28px 28px 24px;
    border-radius: var(--radius-xl);
    border: 1px solid #333;
    position: relative;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.review-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #888;
    font-size: 26px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    z-index: 1;
}
.review-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.review-modal-content h2 {
    margin: 0 40px 20px 0;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

#edit-review-form {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#edit-review-form .form-group {
    margin-bottom: 28px;
}

#edit-review-form .form-group:last-of-type {
    margin-bottom: 20px;
}

#edit-review-modal .form-group textarea,
#edit-content {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 200px;
    max-height: min(50vh, 420px);
    resize: vertical;
    line-height: 1.55;
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

#edit-review-modal .form-group input[type="text"] {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#edit-review-form .btn.btn-primary {
    align-self: flex-start;
    min-width: 140px;
}

/* ==========================================================================
   7. MOBILE POLISH
   ========================================================================== */
@media (max-width: 900px) {
    .reviews-page-container {
        margin: 24px auto;
        padding: 0 14px;
    }

    .reviews-page-content {
        padding: 20px 16px;
        border-radius: 14px;
        min-height: auto;
    }

    .tabs-navigation {
        gap: 14px;
        margin-bottom: 24px;
    }

    .tab-btn {
        padding: 10px 2px;
        font-size: 14px;
    }

    .reviews-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .reviews-toolbar h2 {
        font-size: 24px;
        line-height: 1.2;
    }

    .sort-menu-button {
        font-size: 13px;
        padding: 8px 12px;
    }

    .sort-menu-dropdown {
        width: min(220px, 86vw);
    }

    .my-review-card,
    .review-card {
        padding: 14px;
        border-radius: 12px;
        margin-bottom: 14px;
    }

    .my-review-meta-top {
        gap: 8px;
        font-size: 12px;
    }

    .my-review-card-header {
        gap: 10px;
        flex-wrap: wrap;
    }

    .review-subject-block {
        padding-right: 0;
        min-width: 0;
        width: 100%;
    }

    .review-detail-value.subject {
        font-size: 20px;
        line-height: 1.3;
    }

    .status-badge {
        font-size: 11px;
        padding: 5px 10px;
    }

    .review-detail-value.body {
        font-size: 15px;
        line-height: 1.55;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .admin-response {
        padding: 12px;
        margin-top: 12px;
    }

    .admin-response p {
        font-size: 13px;
        line-height: 1.45;
    }

    .edit-review-btn {
        width: 100%;
        justify-content: center;
        min-height: 40px;
    }

    .review-header {
        align-items: flex-start;
        gap: 8px;
    }

    .user-info {
        gap: 10px;
        min-width: 0;
    }

    .user-info img {
        width: 38px;
        height: 38px;
    }

    .username {
        font-size: 14px;
        overflow-wrap: anywhere;
    }

    .review-body strong {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .review-body p {
        font-size: 14px;
        line-height: 1.55;
        overflow-wrap: anywhere;
    }

    .review-footer {
        margin-top: 12px;
        padding-top: 12px;
    }

    .reactions {
        width: 100%;
        gap: 8px;
    }

    .reaction-btn {
        flex: 1 1 0;
        justify-content: center;
        min-height: 38px;
        padding: 8px 10px;
    }

    .review-form-container {
        margin: 10px auto;
        padding: 20px 14px;
        border-radius: 14px;
    }

    .review-form-container h2 {
        font-size: 20px;
    }

    .step-description {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .star-rating {
        gap: 8px;
        margin: 16px 0 24px;
    }

    .star-rating label {
        font-size: 46px;
    }

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

    .form-group input,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 15px;
    }

    .form-group textarea {
        min-height: 120px;
    }

    .checkbox-group label {
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
        line-height: 1.45;
    }

    #edit-review-modal.review-modal-overlay {
        padding: 10px;
    }

    .review-modal-content {
        width: min(560px, calc(100vw - 20px));
        padding: 20px 14px 16px;
        border-radius: 14px;
        max-height: min(92vh, 900px);
    }

    .review-modal-content h2 {
        font-size: 19px;
        margin-right: 34px;
    }

    .review-modal-close {
        width: 34px;
        height: 34px;
        font-size: 22px;
        top: 10px;
        right: 10px;
    }
}