/* rlhf.css — Reinforcement Learning & Feedback Aesthetics */

.rlhf-page {
  height: 100vh;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg, #0B0B0E);
  color: var(--color-text, #F5F5F7);
  padding: 30px max(24px, 4vw) 100px max(24px, 4vw);
  direction: rtl;
  font-family: 'Thmanyah Sans', 'Inter', -apple-system, sans-serif;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 185, 129, 0.4) rgba(15, 15, 18, 0.8);
}

/* Custom Scrollbar for RLHF Page */
.rlhf-page::-webkit-scrollbar {
  width: 8px;
}

.rlhf-page::-webkit-scrollbar-track {
  background: rgba(10, 10, 14, 0.6);
  border-radius: 4px;
}

.rlhf-page::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.6) 0%, rgba(5, 150, 105, 0.6) 100%);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.rlhf-page::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.9) 100%);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}

.rlhf-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-4, 1rem);
}

/* Header */
.rlhf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  background: var(--color-surface, #13131A);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-xl, 16px);
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.rlhf-header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.rlhf-header-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.05) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10B981;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.rlhf-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: #FFFFFF;
}

.rlhf-subtitle {
  font-size: 0.88rem;
  color: var(--color-text-muted, #8E8EA0);
  margin: 0;
}

.rlhf-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Stat Cards Grid */
.rlhf-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.rlhf-stat-card {
  background: var(--color-surface, #13131A);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.rlhf-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
}

.rlhf-stat-info .rlhf-stat-label {
  font-size: 0.82rem;
  color: var(--color-text-muted, #8E8EA0);
  margin-bottom: 0.35rem;
}

.rlhf-stat-info .rlhf-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
}

.rlhf-stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-icon-total {
  background: rgba(59, 130, 246, 0.12);
  color: #3B82F6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.stat-icon-likes {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.stat-icon-dislikes {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.stat-icon-corrected {
  background: rgba(139, 92, 246, 0.12);
  color: #8B5CF6;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.stat-icon-acc {
  background: rgba(245, 158, 11, 0.12);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Filter Bar */
.rlhf-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface, #13131A);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
}

.rlhf-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rlhf-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted, #8E8EA0);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rlhf-tab-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.04);
}

.rlhf-tab-btn.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #10B981;
  font-weight: 600;
}

.rlhf-tab-btn.active.tab-corrected {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.35);
  color: #A78BFA;
}

/* Items List */
.rlhf-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rlhf-card {
  background: var(--color-surface, #13131A);
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 14px);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s ease;
}

.rlhf-card.card-like {
  border-right: 4px solid #10B981;
}

.rlhf-card.card-dislike {
  border-right: 4px solid #EF4444;
}

.rlhf-card.card-corrected {
  border-right: 4px solid #8B5CF6;
}

.rlhf-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1rem;
}

.rlhf-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rlhf-badge {
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-like {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-dislike {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-corrected {
  background: rgba(139, 92, 246, 0.15);
  color: #A78BFA;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge-meta {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted, #8E8EA0);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Card Body */
.rlhf-section-block {
  margin-bottom: 1rem;
}

.rlhf-section-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted, #8E8EA0);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rlhf-q-text {
  font-size: 0.98rem;
  font-weight: 600;
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.65rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.rlhf-reason-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #FCA5A5;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.rlhf-correction-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: #DDD6FE;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.rlhf-sql-box {
  background: #0D1117;
  border: 1px solid #30363D;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: #58A6FF;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  max-height: 180px;
  margin-bottom: 1rem;
}

.rlhf-sql-box.sql-corrected {
  border-color: rgba(139, 92, 246, 0.4);
  color: #A78BFA;
  background: #110E1E;
}

.rlhf-answer-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #D1D5DB;
  max-height: 150px;
  overflow-y: auto;
  line-height: 1.6;
}

/* Card Actions */
.rlhf-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-fix-rlhf {
  background: linear-gradient(135deg, #E50914 0%, #B20710 100%);
  color: #FFFFFF;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.35);
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-fix-rlhf:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(229, 9, 20, 0.5);
}

.btn-fix-rlhf.btn-repaired {
  background: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%) !important;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35) !important;
  cursor: default;
}

/* Empty State */
.rlhf-empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--color-surface, #13131A);
  border: 1px dashed var(--color-border, rgba(255, 255, 255, 0.12));
  border-radius: 16px;
  color: var(--color-text-muted, #8E8EA0);
}

.rlhf-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: #10B981;
  opacity: 0.7;
}

/* Tag Chips */
.rlhf-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 16px 0;
}

.rlhf-tag-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #A3A3A3;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.rlhf-tag-chip:hover, .rlhf-tag-chip.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #EF4444;
  color: #FFFFFF;
}

.msg-toolbar-btn.liked {
  color: #10b981 !important;
  background: rgba(16, 185, 129, 0.15) !important;
  border-radius: 4px;
}

.msg-toolbar-btn.disliked {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.15) !important;
  border-radius: 4px;
}
