/**
 * Freshness Indicators - TASK 4.3
 * ============================================================
 * Stili per indicatori di freshness dati
 *
 * Classes:
 * - .freshness-indicator: Container base
 * - .freshness-fresh: < 5 min (green)
 * - .freshness-recent: 5min - 1h (blue)
 * - .freshness-stale: 1h - 24h (yellow/orange)
 * - .freshness-old: > 24h (red)
 *
 * Created: 2026-01-19
 */

/* ============================================================
   BASE INDICATOR
   ============================================================ */

.freshness-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.freshness-indicator i {
  font-size: 0.875rem;
}

/* ============================================================
   FRESHNESS STATES
   ============================================================ */

/* Fresh: < 5 minutes (Green) */
.freshness-fresh {
  color: #198754;
  background-color: rgba(25, 135, 84, 0.1);
  border: 1px solid rgba(25, 135, 84, 0.2);
}

.freshness-fresh i {
  color: #198754;
}

/* Recent: 5min - 1h (Blue) */
.freshness-recent {
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.1);
  border: 1px solid rgba(13, 110, 253, 0.2);
}

.freshness-recent i {
  color: #0d6efd;
}

/* Stale: 1h - 24h (Yellow/Orange) */
.freshness-stale {
  color: #fd7e14;
  background-color: rgba(253, 126, 20, 0.1);
  border: 1px solid rgba(253, 126, 20, 0.2);
}

.freshness-stale i {
  color: #fd7e14;
}

/* Old: > 24h (Red) */
.freshness-old {
  color: #dc3545;
  background-color: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.freshness-old i {
  color: #dc3545;
}

/* ============================================================
   DARK MODE
   ============================================================ */

@media (prefers-color-scheme: dark) {
  .freshness-indicator {
    background-color: rgba(255, 255, 255, 0.05);
  }

  .freshness-fresh {
    color: #75b798;
    background-color: rgba(117, 183, 152, 0.15);
    border-color: rgba(117, 183, 152, 0.3);
  }

  .freshness-recent {
    color: #6ea8fe;
    background-color: rgba(110, 168, 254, 0.15);
    border-color: rgba(110, 168, 254, 0.3);
  }

  .freshness-stale {
    color: #ffa94d;
    background-color: rgba(255, 169, 77, 0.15);
    border-color: rgba(255, 169, 77, 0.3);
  }

  .freshness-old {
    color: #ea868f;
    background-color: rgba(234, 134, 143, 0.15);
    border-color: rgba(234, 134, 143, 0.3);
  }
}

/* ============================================================
   SECTION HEADER INTEGRATION
   ============================================================ */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-header h2,
.section-header h3 {
  margin: 0;
  flex: 1;
}

.section-header .freshness-indicator {
  margin-left: auto;
}

/* Mobile: Stack on small screens */
@media (max-width: 576px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header .freshness-indicator {
    margin-left: 0;
    align-self: flex-end;
  }
}

/* ============================================================
   COMPACT VARIANT (for cards, small spaces)
   ============================================================ */

.freshness-indicator.freshness-compact {
  padding: 0.125rem 0.375rem;
  font-size: 0.75rem;
  gap: 0.125rem;
}

.freshness-indicator.freshness-compact i {
  font-size: 0.75rem;
}

/* ============================================================
   BADGE VARIANT (no background, just colored text)
   ============================================================ */

.freshness-indicator.freshness-badge {
  background: none;
  border: none;
  padding: 0;
}

/* ============================================================
   ANIMATION (optional: pulse for very fresh data)
   ============================================================ */

.freshness-fresh.freshness-pulse {
  animation: freshness-pulse 2s ease-in-out infinite;
}

@keyframes freshness-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

.freshness-indicator:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .freshness-indicator {
    border-width: 2px;
  }
}
