/* ============================================
   FDA Enforcement Trends Dashboard
   ============================================ */

.trends-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

/* Header */
.trends-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.trends-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 1rem;
}

.trends-intro {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  max-width: 48rem;
  margin: 0 auto 1rem;
}

.trends-updated {
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
}

/* Loading */
.trends-loading {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-secondary);
}

.trends-loading .skeleton-grid {
  max-width: 32rem;
  margin: 0 auto 1.5rem;
}

.trends-loading .skeleton-row {
  height: 12px;
  background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.trends-loading .skeleton-short {
  width: 60%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Insight Cards */
.insights-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 0.25rem;
  position: relative;
  mask-image: linear-gradient(to right, black calc(100% - 2rem), transparent);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 2rem), transparent);
}

.insights-row:not(.insights-scrolled-end) {
  mask-image: linear-gradient(to right, black calc(100% - 2rem), transparent);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 2rem), transparent);
}

.insights-row.insights-no-scroll,
.insights-row.insights-scrolled-end {
  mask-image: none;
  -webkit-mask-image: none;
}

.insight-card {
  flex: 1 0 200px;
  min-width: 200px;
  background: white;
  border: 1px solid var(--color-border);
  border-left: 4px solid #3B82F6;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.insight-card.insight-up {
  border-left-color: #DC2626;
}

.insight-card.insight-down {
  border-left-color: #059669;
}

.insight-card.insight-neutral {
  border-left-color: #3B82F6;
}

.insight-icon {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  display: block;
  line-height: 1;
}

.insight-stat {
  display: block;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 0.25rem;
}

.insight-desc {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* Time Range Selector */
.trends-range-bar {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.trends-range-pill {
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: white;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: Inter, sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
}

.trends-range-pill:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

/* Counters */
.trends-counters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.trends-counter {
  text-align: center;
  padding: 1.5rem;
  background: var(--color-bg-light-blue);
  border: 1px solid var(--color-border-blue);
  border-radius: 8px;
}

.trends-counter-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.trends-counter-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sections */
.trends-section {
  margin-bottom: 4rem;
}

.trends-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.trends-section-header > div:first-child {
  flex: 1;
}

.trends-section-header .trends-section-title {
  margin-bottom: 0.5rem;
}

.trends-section-header .trends-section-desc {
  margin-bottom: 0;
}

.trends-section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 0.5rem;
}

.trends-section-desc {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.trends-section-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: flex-start;
  padding-top: 0.25rem;
}

/* Action Buttons (Export, YoY) */
.trends-action-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: white;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: Inter, sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.trends-action-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

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

/* Chart containers */
.trends-chart {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
}

/* Chart loading placeholder — shown until ECharts renders */
.trends-chart:empty::before {
  content: 'Loading chart\2026';
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-tertiary, #6B7280);
  font-size: 0.875rem;
}

.trends-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.trends-chart-subtitle {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

/* Escalation Cards */
.escalation-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.escalation-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.escalation-number {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

.escalation-label {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Category Stats Table */
.trends-table-wrapper {
  overflow-x: auto;
}

.trends-table {
  width: 100%;
  border-collapse: collapse;
}

.trends-table thead th {
  padding: 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-dark);
  text-align: left;
  border-bottom: 2px solid var(--color-border);
}

.trends-table thead th:not(:first-child) {
  text-align: right;
}

.trends-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9375rem;
  color: var(--color-text-dark);
}

.trends-table td:not(:first-child) {
  text-align: right;
}

.trends-table tbody tr:hover {
  background: var(--color-bg-light);
}

.trends-table .cat-name a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.trends-table .cat-name a:hover {
  text-decoration: underline;
}

.trend-up {
  color: #DC2626;
  font-weight: 600;
}

.trend-down {
  color: #059669;
  font-weight: 600;
}

.trend-neutral {
  color: var(--color-text-tertiary);
}

/* Toast Notification */
.trends-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1A1A1A;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1100;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.trends-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .trends-title {
    font-size: 1.75rem;
  }

  .trends-counters {
    grid-template-columns: repeat(2, 1fr);
  }

  .trends-chart-row {
    grid-template-columns: 1fr;
  }

  .escalation-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .trends-section-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .trends-section-actions {
    align-self: flex-start;
  }

  .insights-row {
    gap: 0.75rem;
  }

  .insight-card {
    flex: 0 0 180px;
    min-width: 180px;
  }

  .trends-range-bar {
    gap: 0.375rem;
  }
}

@media (max-width: 480px) {
  .escalation-cards {
    grid-template-columns: 1fr;
  }

  .insight-card {
    flex: 0 0 160px;
    min-width: 160px;
  }
}
