/* Learning Loop Visibility UI Styles */

/* ============ Time Range Selector ============ */
.time-range-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.time-range-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #ddd;
  background: white;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.time-range-btn:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}

.time-range-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* ============ Summary Cards ============ */
.learning-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.summary-card {
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.accuracy-card {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  color: white;
}

.corrections-card {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
  color: white;
}

.improvement-card {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
}

.reviews-card {
  background: linear-gradient(135deg, #9C27B0 0%, #7B1FA2 100%);
  color: white;
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.card-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  line-height: 1;
}

.card-label {
  font-size: 0.95rem;
  opacity: 0.95;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.card-sublabel {
  font-size: 0.8rem;
  opacity: 0.75;
}

/* ============ Two Column Layout ============ */
.learning-two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (max-width: 1024px) {
  .learning-two-column {
    grid-template-columns: 1fr;
  }
}

.learning-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ============ Learning Sections ============ */
.learning-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.section-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
}

.section-subtitle {
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  color: #6b7280;
}

/* ============ Corrections by Category ============ */
.category-corrections-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-correction-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.category-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: #374151;
}

.category-bar-container {
  width: 100%;
  height: 32px;
  background: #f3f4f6;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.category-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  transition: width 0.3s ease;
  min-width: 40px;
}

.category-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}

/* ============ Recent Corrections ============ */
.recent-corrections-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
}

.correction-item {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  transition: background 0.2s ease;
}

.correction-item:hover {
  background: #f3f4f6;
}

.correction-subject {
  font-weight: 500;
  font-size: 0.9rem;
  color: #1f2937;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.correction-change {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.correction-original {
  padding: 0.25rem 0.5rem;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.correction-arrow {
  color: #6b7280;
  font-weight: 600;
}

.correction-new {
  padding: 0.25rem 0.5rem;
  background: #d1fae5;
  color: #065f46;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
}

.correction-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #6b7280;
}

.correction-undo-btn {
  padding: 0.25rem 0.75rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: background 0.2s ease;
}

.correction-undo-btn:hover {
  background: #dc2626;
}

.correction-undo-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* ============ Sender Patterns ============ */
.sender-patterns-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sender-pattern-item {
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pattern-sender {
  flex: 1;
  font-weight: 500;
  font-size: 0.875rem;
  color: #78350f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pattern-rule {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pattern-arrow {
  color: #92400e;
  font-weight: 600;
}

.pattern-category {
  padding: 0.25rem 0.5rem;
  background: white;
  color: #78350f;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid #fbbf24;
}

.pattern-count {
  font-size: 0.75rem;
  color: #92400e;
  font-weight: 500;
  white-space: nowrap;
}

/* ============ Training Timeline ============ */
.training-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 500px;
  overflow-y: auto;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.timeline-item:hover {
  background: #f9fafb;
}

.timeline-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.timeline-time {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ============ Learning Tips ============ */
.learning-tips {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border: 2px solid #3b82f6;
}

.learning-tips .section-title {
  color: #1e3a8a;
}

.learning-tips ul {
  margin: 0;
  padding-left: 1.25rem;
  color: #1e40af;
}

.learning-tips li {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.learning-tips li:last-child {
  margin-bottom: 0;
}

.learning-tips strong {
  color: #1e3a8a;
}

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  color: #9ca3af;
  padding: 2rem;
  font-size: 0.9rem;
  font-style: italic;
}

/* ============ Scrollbar Styling ============ */
.recent-corrections-list::-webkit-scrollbar,
.training-timeline::-webkit-scrollbar {
  width: 6px;
}

.recent-corrections-list::-webkit-scrollbar-track,
.training-timeline::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.recent-corrections-list::-webkit-scrollbar-thumb,
.training-timeline::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.recent-corrections-list::-webkit-scrollbar-thumb:hover,
.training-timeline::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
