/* ==========================================
   Review Modal — shared component
   Used by messages.html and trade_history.html
   ========================================== */

.rv-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 14, 26, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: rvFadeIn 0.18s ease-out;
}

[data-theme="light"] .rv-modal {
    background: rgba(15, 23, 42, 0.45);
}

.rv-modal.open { display: flex; }

@keyframes rvFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes rvSlideIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.rv-card {
    width: 100%;
    max-width: 460px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-2xl);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), var(--glass-shadow);
    color: var(--text-primary);
    animation: rvSlideIn 0.22s var(--ease-out);
    overflow: hidden;
    position: relative;
}

[data-theme="light"] .rv-card {
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
}

.rv-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--border-primary);
}

.rv-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border-primary);
}

.rv-avatar-fallback {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.rv-header-text { flex: 1; min-width: 0; }
.rv-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}
.rv-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 2px 0 0;
}

.rv-close {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.rv-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.rv-close .material-symbols-outlined { font-size: 22px; }

.rv-body { padding: 22px; }

.rv-stars-label {
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.rv-stars {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 0 0 4px;
}

.rv-star {
    appearance: none;
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.45;
    transition: color 0.12s ease, transform 0.12s ease, opacity 0.12s ease;
    border-radius: 50%;
    line-height: 0;
}
.rv-star .material-symbols-outlined {
    font-size: 40px;
    font-variation-settings: 'FILL' 1, 'wght' 500;
}
.rv-star:hover { transform: scale(1.12); }
.rv-star:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
}
.rv-star.is-active {
    color: var(--blue-500);
    opacity: 1;
}
.rv-stars[data-hover] .rv-star { color: var(--text-muted); opacity: 0.45; }
.rv-stars[data-hover="1"] .rv-star[data-value="1"],
.rv-stars[data-hover="2"] .rv-star[data-value="1"],
.rv-stars[data-hover="2"] .rv-star[data-value="2"],
.rv-stars[data-hover="3"] .rv-star[data-value="1"],
.rv-stars[data-hover="3"] .rv-star[data-value="2"],
.rv-stars[data-hover="3"] .rv-star[data-value="3"],
.rv-stars[data-hover="4"] .rv-star[data-value="1"],
.rv-stars[data-hover="4"] .rv-star[data-value="2"],
.rv-stars[data-hover="4"] .rv-star[data-value="3"],
.rv-stars[data-hover="4"] .rv-star[data-value="4"],
.rv-stars[data-hover="5"] .rv-star {
    color: var(--blue-500);
    opacity: 1;
}

.rv-rating-caption {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    height: 18px;
    margin: 4px 0 18px;
}

.rv-textarea-wrap { position: relative; }
.rv-textarea {
    width: 100%;
    min-height: 96px;
    max-height: 200px;
    resize: vertical;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rv-textarea:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.rv-textarea::placeholder { color: var(--text-muted); }

.rv-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    pointer-events: none;
}
.rv-counter.is-warning { color: #ef4444; }

.rv-error {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: var(--radius-md);
    font-size: 13px;
    display: none;
}
.rv-error.is-visible { display: block; }
[data-theme="light"] .rv-error { color: #b91c1c; }

.rv-actions {
    display: flex;
    gap: 10px;
    padding: 6px 22px 22px;
}

.rv-btn {
    flex: 1;
    appearance: none;
    border: none;
    border-radius: var(--radius-full);
    padding: 12px 18px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.rv-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}
.rv-btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.rv-btn-primary {
    background: linear-gradient(135deg, #0058c3 0%, #3b82f6 50%, #38bdf8 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.32);
}
.rv-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.42);
}
.rv-btn-primary:active:not(:disabled) { transform: translateY(0); }
.rv-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* Success state */
.rv-success {
    text-align: center;
    padding: 36px 22px 30px;
    animation: rvFadeIn 0.2s ease-out;
}
.rv-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    margin: 0 auto 14px;
    animation: rvPop 0.32s var(--ease-bounce);
}
.rv-success-icon .material-symbols-outlined {
    font-size: 38px;
    font-variation-settings: 'FILL' 1, 'wght' 600;
}
@keyframes rvPop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}
.rv-success-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.rv-success-sub {
    font-size: 13px;
    color: var(--text-tertiary);
    margin: 0;
}

/* Toast (lightweight, lives at body root) */
.rv-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%) translateY(8px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    padding: 10px 18px;
    font-size: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.rv-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.rv-toast.is-error {
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* Mobile */
@media (max-width: 480px) {
    .rv-modal { padding: 0; align-items: flex-end; }
    .rv-card {
        max-width: none;
        border-radius: 1.25rem 1.25rem 0 0;
        animation: rvSlideUp 0.22s var(--ease-out);
    }
    @keyframes rvSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    .rv-star .material-symbols-outlined { font-size: 36px; }
}
