/* === CFA Feedback Panel (clean design to match screenshot) ===================================== */

/* Button next to the CFA title */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

#cfa-feedback-btn.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s;
  font-weight: 500;
}

#cfa-feedback-btn.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color, #e5e7eb);
  color: var(--text-secondary, #374151);
}

#cfa-feedback-btn.btn-ghost:hover {
  background: var(--hover-bg, #f3f4f6);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Layout shifts when the panel is open */
.layout { transition: margin-right 0.3s ease; }
.layout.feedback-open { margin-right: 380px; }

/* Right slide-out panel */
.cfa-feedback-panel {
  --panel-xpad: 20px;
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100vh;
  background: var(--panel-bg, #ffffff);
  border-left: 1px solid var(--border-color, #e5e7eb);
  box-shadow: -2px 0 15px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: right 0.3s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.cfa-feedback-panel * { box-sizing: border-box; }
.cfa-feedback-panel.open { right: 0; }

/* Header */
.cfa-feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--panel-xpad);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  font-weight: 600;
  color: #1e3a8a;
  flex-shrink: 0;
  font-size: 16px;
}

/* Prompt text directly below header */
.cfa-feedback-prompt {
  display: block !important;
  padding: 12px var(--panel-xpad);
  background: #f0f9ff;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin: 0 !important;
  flex-shrink: 0;
}

.cfa-feedback-header h1,
.cfa-feedback-header h2,
.cfa-feedback-header h3,
.cfa-feedback-header .title { margin: 0; padding: 0; }

.icon-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s ease;
}
.icon-btn:hover { color: var(--text-primary, #111827); background: rgba(0,0,0,0.05); }

/* Content */
.cfa-feedback-content {
  flex: 1;
  overflow: auto;
  padding: 16px var(--panel-xpad);
  background: #f8fafc;
}

.cfa-feedback-content > *:not(.cfa-feedback-prompt) {
  margin-left: 0 !important;
  padding-left: 0 !important;
}

/* CFA items - clean design matching screenshot with better alignment */
.cfa-item {
  display: flex;
  align-items: center; /* Changed from flex-start to center for better alignment */
  justify-content: space-between;
  gap: 12px; /* Reduced gap */
  padding: 12px 16px; /* Reduced padding to match original */
  border-radius: 10px; /* Reduced border radius */
  border: 1px solid var(--border-color, #e5e7eb);
  background: var(--panel-bg, #fff);
  margin-bottom: 12px; /* Reduced margin */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.cfa-item:hover { 
  border-color: #cbd5e1; 
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* Reduced shadow */
}

.cfa-item .meta { 
  display: flex; 
  flex-direction: column; 
  flex: 1; 
  min-width: 0;
  margin-left: 20px; /* Keep the original left margin from your screenshot */
}

.cfa-item .title { 
  font-weight: 500; /* Reduced from 600 to match original */
  font-size: 14px; /* Reduced from 15px */
  color: var(--text-primary, #111827); 
  word-wrap: break-word;
  margin-bottom: 2px; /* Reduced margin */
}

.cfa-item .subtitle { 
  font-size: 12px; /* Reduced from 13px */
  color: var(--text-secondary, #6b7280); 
  margin-top: 2px;
  font-weight: 500;
}

/* Clean rationale styling - matching screenshot exactly */
.cfa-item .rationale {
  font-size: 12px; /* Reduced from 13px to match original */
  color: #6b7280; 
  margin-top: 6px; /* Reduced margin */
  line-height: 1.4;
  background: transparent;
  padding: 0;
  border-left: 3px solid #3b82f6;
  padding-left: 10px; /* Reduced padding */
  border-radius: 0;
  font-style: italic;
}

/* Hide the "Rationale:" heading */
.cfa-item .rationale strong {
  display: none;
}

.cfa-actions { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
  flex-shrink: 0;
  margin-top: 0; /* Removed margin for better center alignment */
}

/* Clean thumb buttons - smaller to match original */
.react-btn {
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  width: 36px; /* Reduced from 40px to match original */
  height: 36px; /* Reduced from 40px to match original */
  border-radius: 8px; /* Reduced border radius */
  border: 1px solid var(--border-color, #e5e7eb); /* Thinner border */
  background: #fff; 
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px; /* Reduced font size */
  color: #6b7280;
}

.react-btn svg { 
  width: 18px; 
  height: 18px; 
  stroke: currentColor; 
  fill: none;
  stroke-width: 2;
}

.react-btn:hover { 
  transform: translateY(-1px); 
  box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
}

.react-btn:active { 
  transform: translateY(0); 
}

.react-btn.up:hover { 
  background: #ecfdf5; 
  border-color: #10b981; 
  color: #059669;
}

.react-btn.down:hover { 
  background: #fef2f2; 
  border-color: #ef4444; 
  color: #dc2626;
}

/* Clean selected states - no fills, just colored borders */
.react-btn.selected { 
  outline: none; 
  transform: none;
  box-shadow: none;
}

.react-btn.up.selected { 
  background: #fff; /* Keep white background - no fill */
  border-color: #10b981; /* Green border */
  color: #10b981; /* Green icon */
}

.react-btn.down.selected { 
  background: #fff; /* Keep white background - no fill */
  border-color: #ef4444; /* Red border */
  color: #ef4444; /* Red icon */
}

.react-btn[aria-pressed="true"] { 
  background: #fff; /* Keep clean */
}

/* Footer */
.cfa-feedback-footer {
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 12px;
  padding: 16px var(--panel-xpad);
  border-top: 1px solid var(--border-color, #e5e7eb);
  background: #f8fafc; 
  flex-shrink: 0;
}
.footer-left { flex: 1; min-width: 0; }
.footer-right { flex-shrink: 0; }

#cfa-submit-btn.btn.btn-primary { 
  padding: 10px 20px; 
  border-radius: 8px; 
  font-weight: 600; 
  font-size: 14px;
  background: #3b82f6;
  border: none;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

#cfa-submit-btn.btn.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#cfa-submit-btn.btn.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#cfa-feedback-status { 
  min-height: 20px; 
  font-size: 13px;
  line-height: 1.4; 
  font-weight: 500;
}
#cfa-feedback-status.success { color: #059669; }
#cfa-feedback-status.error { color: #dc2626; }
#cfa-feedback-status.muted { color: var(--text-secondary, #6b7280); }

.empty-state {
  color: var(--text-secondary, #6b7280);
  padding: 60px 20px; 
  text-align: center; 
  font-size: 14px;
  line-height: 1.6;
  background: #f9fafb;
  border-radius: 12px;
  border: 2px dashed #d1d5db;
}

.empty-state::before {
  content: "📝";
  display: block;
  font-size: 32px;
  margin-bottom: 12px;
}

/* Clean animation for just-rated feedback */
.cfa-item.just-rated { 
  background: #eff6ff; 
  border-color: #3b82f6; 
  transform: scale(1.02); 
  transition: all 0.4s ease; 
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

/* Mobile responsiveness */
@media (max-width: 960px) {
  .layout.feedback-open { margin-right: 0; }
  .cfa-feedback-panel { width: 100vw; right: -100vw; }
  .cfa-feedback-panel.open { right: 0; }
  .cfa-feedback-header, .cfa-feedback-content, .cfa-feedback-footer { 
    padding-left: 16px; 
    padding-right: 16px; 
  }
  .cfa-item { 
    padding: 12px; 
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .cfa-actions {
    justify-content: center;
    margin-top: 8px;
  }
  .react-btn { 
    width: 44px; 
    height: 44px; 
    font-size: 16px;
  }
  .cfa-item .rationale {
    font-size: 12px;
    padding-left: 10px;
  }
}

/* Custom scrollbar */
.cfa-feedback-content::-webkit-scrollbar {
  width: 6px;
}

.cfa-feedback-content::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.cfa-feedback-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.cfa-feedback-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}