/* Family Analytics Dashboard Styling */
/* Integrates with existing loveform-dashboard.css design system */

/* Analytics Section Container */
.lf-analytics-section {
  margin: 2rem 0;
  animation: fadeInUp 0.6s ease-out;
}

/* Analytics Grid Layout */
.lf-analytics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .lf-analytics-grid {
    grid-template-columns: 2fr 3fr;
  }
}

@media (min-width: 1200px) {
  .lf-analytics-grid {
    grid-template-columns: 1fr 2fr 1fr;
  }
}

/* Analytics Cards */
.lf-analytics-card {
  background: var(--lf-surface-color, #ffffff);
  border-radius: 16px;
  border: 1px solid var(--lf-border-color, #e8eaed);
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

/* Analytics Card Variants */
.lf-analytics-card--primary {
  background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  color: white;
  grid-row: 1 / 3;
}

.lf-analytics-card--trend {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #00b894 0%, #55efc4 100%);
  color: white;
}

.lf-analytics-card--health {
  background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%);
  color: white;
}

/* Analytics Card Headers */
.lf-analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.lf-analytics-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: inherit;
}

.lf-analytics-score {
  text-align: right;
}

.lf-score-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.lf-score-suffix {
  font-size: 1rem;
  opacity: 0.8;
}

/* Engagement Level Styling */
.lf-engagement-level {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-weight: 500;
  margin-bottom: 1rem;
}

.lf-level-excellent { background: rgba(76, 175, 80, 0.2); }
.lf-level-high { background: rgba(33, 150, 243, 0.2); }
.lf-level-medium { background: rgba(255, 193, 7, 0.2); }
.lf-level-low { background: rgba(244, 67, 54, 0.2); }

.lf-engagement-trend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* KPI Grid Layout */
.lf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

@media (min-width: 768px) {
  .lf-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* KPI Cards */
.lf-kpi-card {
  background: var(--lf-surface-color, #ffffff);
  border-radius: 12px;
  border: 1px solid var(--lf-border-light, #f0f0f0);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.lf-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6c5ce7, #74b9ff, #00b894, #fdcb6e, #fd79a8, #6c5ce7);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lf-kpi-card:hover::before {
  opacity: 1;
}

.lf-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* KPI Card Content */
.lf-kpi-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  color: white;
  font-size: 1.1rem;
}

.lf-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--lf-text-primary, #2d3436);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.lf-kpi-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--lf-text-secondary, #636e72);
  margin-bottom: 0.25rem;
}

.lf-kpi-subtitle {
  font-size: 0.75rem;
  color: var(--lf-text-tertiary, #b2bec3);
}

/* Trend Analysis Styling */
.lf-trend-content {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .lf-trend-content {
    grid-template-columns: 2fr 1fr;
  }
}

.lf-trend-insights {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lf-insight-primary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 1rem;
  border-radius: 10px;
  font-weight: 500;
}

.lf-usage-patterns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.lf-pattern-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lf-pattern-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

.lf-pattern-value {
  font-size: 1.1rem;
  font-weight: 600;
}

/* Trend Alerts and Recommendations */
.lf-trend-alerts,
.lf-recommendations {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1rem;
}

.lf-alerts-title,
.lf-recommendations-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  opacity: 0.9;
}

.lf-alert-list,
.lf-recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lf-alert-item,
.lf-recommendation-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.lf-alert-item i,
.lf-recommendation-item i {
  margin-top: 0.1rem;
  opacity: 0.8;
  flex-shrink: 0;
}

/* System Health Visualization */
.lf-health-score {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
}

.lf-health-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lf-health-inner {
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #2d3436;
}

.lf-health-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.lf-health-suffix {
  font-size: 0.8rem;
  opacity: 0.8;
}

.lf-health-details {
  text-align: center;
}

.lf-health-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.lf-health-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.lf-metric-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

.lf-metric-value {
  font-size: 1.1rem;
  font-weight: 600;
}

/* Loading and Empty States */
.lf-analytics-loading {
  text-align: center;
  padding: 3rem 1rem;
}

.lf-loading-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lf-analytics-empty {
  text-align: center;
  padding: 4rem 1rem;
}

.lf-empty-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lf-empty-message i {
  font-size: 3rem;
  color: var(--lf-text-tertiary, #b2bec3);
}

.lf-empty-message h3 {
  font-size: 1.25rem;
  color: var(--lf-text-secondary, #636e72);
  margin: 0;
}

.lf-empty-message p {
  color: var(--lf-text-tertiary, #b2bec3);
  margin: 0;
  max-width: 300px;
}

/* Refresh Controls */
.lf-refresh-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lf-refresh-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: inherit;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.lf-refresh-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.lf-text-micro {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Trend Period Display */
.lf-trend-period {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .lf-analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .lf-analytics-card--primary {
    grid-row: unset;
  }
  
  .lf-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .lf-usage-patterns {
    grid-template-columns: 1fr;
  }
  
  .lf-trend-content {
    grid-template-columns: 1fr;
  }
  
  .lf-health-circle {
    width: 80px;
    height: 80px;
  }
  
  .lf-health-inner {
    width: 56px;
    height: 56px;
  }
  
  .lf-health-value {
    font-size: 1.2rem;
  }
}

/* Animation Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) and (prefers-color-scheme: light) {
  .lf-analytics-card {
    background: var(--lf-surface-dark, #2d3436);
    border-color: var(--lf-border-dark, #636e72);
    color: var(--lf-text-light, #ddd);
  }
  
  .lf-kpi-card {
    background: var(--lf-surface-dark, #2d3436);
    border-color: var(--lf-border-dark, #636e72);
  }
  
  .lf-kpi-value {
    color: var(--lf-text-light, #ddd);
  }
  
  .lf-empty-message i {
    color: var(--lf-text-secondary-dark, #81ecec);
  }
}