/**
 * Unified Statistics Widget Styles
 *
 * Styles for the dashboard unified stats widget with Free/Premium distinction.
 * Uses blur + lock overlay for premium-only content on free tier.
 *
 * @version 1.0
 */

/* =============================================================================
   Container
   ============================================================================= */

/* Full width container for dashboard placement */
.dashboard-unified-stats-fullwidth {
  width: 100%;
  max-width: 100%;
  margin: 24px 0;
  padding: 0 20px;
  box-sizing: border-box;
}

.unified-stats-widget {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  width: 100%;
}

.unified-stats-widget.unified-stats-loading {
  min-height: 300px;
}

.unified-stats-widget.unified-stats-error {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================================================================
   Locked Widget (Free Users)
   ============================================================================= */

.unified-stats-widget.unified-stats-locked {
  background: linear-gradient(135deg, var(--card-bg, #ffffff) 0%, #f8fafc 100%);
}

.unified-stats-locked-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
}

.unified-stats-locked-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary-color, #4f46e5), #818cf8);
  border-radius: 50%;
  color: white;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.unified-stats-locked-icon svg {
  width: 28px;
  height: 28px;
}

.unified-stats-locked-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  margin: 0 0 8px 0;
}

.unified-stats-locked-description {
  font-size: 0.9rem;
  color: var(--text-secondary, #64748b);
  margin: 0 0 20px 0;
  max-width: 350px;
  line-height: 1.5;
}

.unified-stats-locked-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 24px;
}

.unified-stats-locked-features li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
}

.unified-stats-locked-features li svg {
  width: 16px;
  height: 16px;
  color: #10b981;
}

.unified-stats-unlock-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary-color, #4f46e5), #818cf8);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.unified-stats-unlock-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.unified-stats-unlock-btn svg {
  width: 18px;
  height: 18px;
}

/* Dark Mode for Locked Widget */
[data-theme="dark"] .unified-stats-widget.unified-stats-locked {
  background: linear-gradient(135deg, var(--card-bg-dark, #1e293b) 0%, #334155 100%);
}

[data-theme="dark"] .unified-stats-locked-title {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .unified-stats-locked-description {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .unified-stats-locked-features li {
  color: var(--text-secondary-dark, #94a3b8);
}

/* =============================================================================
   Header
   ============================================================================= */

.unified-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.unified-stats-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  margin: 0;
}

.unified-stats-title svg {
  width: 20px;
  height: 20px;
  color: var(--primary-color, #4f46e5);
}

/* Premium Badge in Header */
.unified-stats-premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.unified-stats-premium-badge svg {
  width: 14px;
  height: 14px;
}

/* =============================================================================
   KPI Cards
   ============================================================================= */

.unified-stats-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.unified-stats-kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-secondary, #f8fafc);
  border-radius: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.unified-stats-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-light, #e0e7ff);
  color: var(--primary-color, #4f46e5);
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 20px;
  height: 20px;
}

.kpi-icon-alert {
  background: #fef3c7;
  color: #d97706;
}

.kpi-icon-streak {
  background: #fce7f3;
  color: #db2777;
}

.kpi-content {
  min-width: 0;
  flex: 1;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =============================================================================
   Module Mini-Cards
   ============================================================================= */

.unified-stats-modules-section {
  margin-bottom: 20px;
}

.unified-stats-section-header {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.unified-stats-modules {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.unified-stats-module {
  background: var(--bg-secondary, #f8fafc);
  border-radius: 10px;
  padding: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.unified-stats-module:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.module-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.module-header svg {
  width: 16px;
  height: 16px;
  color: var(--primary-color, #4f46e5);
}

.module-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.module-activated {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary, #1a1a2e);
}

.module-due {
  font-size: 0.75rem;
  color: #d97706;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

/* =============================================================================
   Study Time by Module Chart
   ============================================================================= */

.module-time-chart {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-secondary, #f8fafc);
  border-radius: 10px;
}

.module-time-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.module-time-total {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
}

.module-time-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.module-time-row {
  display: grid;
  grid-template-columns: 120px 1fr 60px;
  align-items: center;
  gap: 12px;
}

.module-time-label {
  font-size: 0.8rem;
  color: var(--text-primary, #1a1a2e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-time-bar-container {
  height: 10px;
  background: var(--border-color, #e2e8f0);
  border-radius: 5px;
  overflow: hidden;
}

.module-time-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 5px;
  transition: width 0.5s ease;
  min-width: 4px;
}

.module-time-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  text-align: right;
}

.module-progress {
  height: 4px;
  background: var(--border-color, #e2e8f0);
  border-radius: 2px;
  overflow: hidden;
}

.module-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color, #4f46e5), #818cf8);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* =============================================================================
   Distribution Section (Memorization Level)
   ============================================================================= */

.unified-stats-distribution-section {
  background: var(--card-bg, #ffffff);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.distribution-metrics {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.1));
}

.distribution-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.distribution-metric .metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
}

.distribution-metric .metric-value.positive {
  color: #10b981;
}

.distribution-metric .metric-value.negative {
  color: #ef4444;
}

.distribution-metric .metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
}

/* =============================================================================
   Premium Section
   ============================================================================= */

.unified-stats-premium-section {
  position: relative;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 10px;
  padding: 16px;
  overflow: hidden;
}

.unified-stats-premium-section.is-locked {
  min-height: 180px;
}

.unified-stats-premium-content {
  position: relative;
  z-index: 1;
}

/* Premium Badge */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.premium-badge svg {
  width: 14px;
  height: 14px;
}

/* =============================================================================
   Period Stats Section (Premium)
   ============================================================================= */

.premium-period-stats {
  margin-bottom: 20px;
}

.period-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.period-stat-card {
  background: var(--bg-secondary, #f8fafc);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.period-stat-card.period-stat-total {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.period-stat-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.period-stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.period-stat-row svg {
  width: 14px;
  height: 14px;
  color: var(--primary-color, #4f46e5);
  flex-shrink: 0;
}

.period-stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
}

.period-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
}

/* =============================================================================
   Daily Activity Bar Chart (Premium)
   ============================================================================= */

.premium-daily-chart {
  margin-bottom: 20px;
}

.daily-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.daily-chart-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
}

.chart-period-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary, #f1f5f9);
  padding: 3px;
  border-radius: 8px;
}

.chart-tab {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #64748b);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-tab:hover {
  color: var(--text-primary, #1a1a2e);
}

.chart-tab.active {
  background: white;
  color: var(--primary-color, #4f46e5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.daily-chart-container {
  min-height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-loading,
.chart-empty,
.chart-error {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary, #64748b);
  font-size: 0.85rem;
  min-height: 150px;
}

.chart-loading .spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  height: 150px;
  padding: 0 4px;
}

.bar-chart-week {
  max-width: 500px;
}

.bar-chart-week .chart-bar-group {
  flex: 1;
  max-width: 60px;
}

.bar-chart-month {
  gap: 3px;
  justify-content: center;
  max-width: 100%;
  flex-wrap: nowrap;
}

.bar-chart-month .chart-bar-group {
  min-width: 16px;
  max-width: 22px;
  flex: 1;
}

.bar-chart-year {
  max-width: 700px;
}

.bar-chart-year .chart-bar-group {
  flex: 1;
  max-width: 50px;
}

.bar-chart-today {
  max-width: 150px;
}

.bar-chart-today .chart-bar-group {
  flex: 1;
  min-width: 100px;
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chart-bar-group.is-today .chart-label {
  color: var(--primary-color, #4f46e5);
  font-weight: 600;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  width: 100%;
}

.chart-bar {
  flex: 1;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: height 0.3s ease;
}

.bar-reviews {
  background: linear-gradient(180deg, var(--primary-color, #4f46e5) 0%, #818cf8 100%);
}

.bar-time {
  background: linear-gradient(180deg, #10b981 0%, #34d399 100%);
}

.bar-value {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
}

.chart-label {
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
  text-align: center;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-reviews {
  background: var(--primary-color, #4f46e5);
}

.legend-time {
  background: #10b981;
}

.legend-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
}

/* Summary Cards */
.premium-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  align-items: start;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary, #f8fafc);
  border-radius: 10px;
  min-height: 70px;
}

.summary-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--primary-light, #e0e7ff);
  border-radius: 8px;
  color: var(--primary-color, #4f46e5);
}

.summary-icon svg {
  width: 18px;
  height: 18px;
}

.summary-content {
  flex: 1;
  min-width: 0;
}

.summary-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
}

.summary-label {
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
}

/* Expandable Summary Card with Time Breakdown */
.summary-card-expandable {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.summary-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-breakdown {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-breakdown-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.time-breakdown-label {
  flex: 1;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-breakdown-value {
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  min-width: 50px;
  text-align: right;
}

.time-breakdown-pct {
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
  min-width: 30px;
  text-align: right;
}

/* Distribution Bars */
.premium-distribution {
  margin-bottom: 16px;
}

.distribution-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.distribution-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
}

.distribution-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
  font-weight: 400;
}

.distribution-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: 12px;
}

.dist-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
}

.dist-bar-container {
  height: 8px;
  background: var(--border-color, #e2e8f0);
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.dist-bar.dist-strong {
  background: #10b981;
}

.dist-bar.dist-good {
  background: #34d399;
}

.dist-bar.dist-moderate {
  background: #fbbf24;
}

.dist-bar.dist-weak {
  background: #ef4444;
}

.dist-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  text-align: right;
}

/* Distribution Legend */
.distribution-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color, rgba(0,0,0,0.1));
}

.distribution-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
}

.distribution-legend .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.distribution-legend .legend-dot.dist-strong {
  background: #10b981;
}

.distribution-legend .legend-dot.dist-good {
  background: #34d399;
}

.distribution-legend .legend-dot.dist-moderate {
  background: #fbbf24;
}

.distribution-legend .legend-dot.dist-weak {
  background: #ef4444;
}

/* Premium Metrics */
.premium-metrics {
  display: flex;
  gap: 24px;
}

.premium-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
}

.metric-value.positive {
  color: #10b981;
}

.metric-value.negative {
  color: #ef4444;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #64748b);
}

/* =============================================================================
   Blur Overlay for Free Tier
   ============================================================================= */

.unified-stats-blurred {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.unified-stats-premium-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(1px);
  z-index: 10;
  cursor: pointer;
  transition: background 0.2s ease;
  border-radius: 10px;
}

.unified-stats-premium-overlay:hover {
  background: rgba(255, 255, 255, 0.7);
}

.premium-lock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color, #4f46e5), #818cf8);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.premium-lock-icon svg {
  width: 24px;
  height: 24px;
}

.premium-unlock-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
  text-align: center;
  max-width: 200px;
}

.premium-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color, #4f46e5);
  animation: bounceRight 1s infinite;
}

.premium-arrow svg {
  width: 20px;
  height: 20px;
}

@keyframes bounceRight {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

/* =============================================================================
   Skeleton Loading
   ============================================================================= */

.skeleton-text {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-title {
  width: 150px;
  height: 24px;
}

.skeleton-kpi {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  height: 68px;
}

.skeleton-module {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  height: 80px;
}

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

/* =============================================================================
   Error State
   ============================================================================= */

.unified-stats-error-content {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary, #64748b);
}

.unified-stats-error-content svg {
  width: 20px;
  height: 20px;
  color: #ef4444;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

@media (max-width: 1024px) {
  .unified-stats-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .unified-stats-modules {
    grid-template-columns: repeat(2, 1fr);
  }

  .period-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .unified-stats-widget {
    padding: 16px;
  }

  .module-time-chart {
    padding: 12px;
  }

  .module-time-row {
    grid-template-columns: 90px 1fr 50px;
    gap: 8px;
  }

  .module-time-label {
    font-size: 0.75rem;
  }

  .module-time-value {
    font-size: 0.75rem;
  }

  .unified-stats-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .unified-stats-kpi {
    padding: 12px;
    gap: 10px;
  }

  .kpi-icon {
    width: 36px;
    height: 36px;
  }

  .kpi-icon svg {
    width: 18px;
    height: 18px;
  }

  .kpi-value {
    font-size: 1.1rem;
  }

  .unified-stats-modules {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .unified-stats-module {
    padding: 10px;
  }

  .distribution-row {
    grid-template-columns: 70px 1fr 35px;
    gap: 8px;
  }

  .premium-metrics {
    gap: 16px;
  }

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

  .premium-summary-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .summary-card {
    padding: 10px;
  }

  .time-breakdown-row {
    font-size: 0.7rem;
  }

  .time-breakdown-value {
    min-width: 45px;
  }

  .time-breakdown-pct {
    min-width: 25px;
  }

  .bar-chart {
    height: 120px;
  }

  .chart-bars {
    height: 90px;
  }
}

/* =============================================================================
   Dark Mode Support
   ============================================================================= */

[data-theme="dark"] .unified-stats-widget {
  background: var(--card-bg-dark, #1e293b);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .unified-stats-title {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .unified-stats-kpi {
  background: var(--bg-secondary-dark, #334155);
}

[data-theme="dark"] .kpi-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .kpi-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .unified-stats-module {
  background: var(--bg-secondary-dark, #334155);
}

[data-theme="dark"] .module-name {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .module-activated {
  color: var(--text-primary-dark, #f1f5f9);
}

/* Study Time by Module Chart - Dark Mode */
[data-theme="dark"] .module-time-chart {
  background: var(--bg-secondary-dark, #334155);
}

[data-theme="dark"] .module-time-header {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .module-time-total {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .module-time-label {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .module-time-bar-container {
  background: var(--border-color-dark, #475569);
}

[data-theme="dark"] .module-time-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .unified-stats-premium-section {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="dark"] .chart-period-tabs {
  background: var(--bg-secondary-dark, #334155);
}

[data-theme="dark"] .chart-tab {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .chart-tab:hover {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .daily-chart-title {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .chart-tab.active {
  background: var(--card-bg-dark, #1e293b);
  color: var(--primary-color, #818cf8);
}

[data-theme="dark"] .chart-loading,
[data-theme="dark"] .chart-empty,
[data-theme="dark"] .chart-error {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .chart-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .bar-value {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .legend-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .summary-card {
  background: var(--bg-secondary-dark, #334155);
}

[data-theme="dark"] .summary-icon {
  background: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .summary-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .summary-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .time-breakdown {
  border-top-color: var(--border-color-dark, #475569);
}

[data-theme="dark"] .time-breakdown-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .time-breakdown-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .time-breakdown-pct {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .distribution-title {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .distribution-subtitle {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .distribution-legend {
  border-top-color: var(--border-color-dark, #475569);
}

[data-theme="dark"] .distribution-legend .legend-item {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .unified-stats-distribution-section {
  background: var(--card-bg-dark, #1e293b);
}

[data-theme="dark"] .distribution-metrics {
  border-top-color: var(--border-color-dark, #475569);
}

[data-theme="dark"] .distribution-metric .metric-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .distribution-metric .metric-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .dist-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .dist-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .metric-value {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .metric-label {
  color: var(--text-secondary-dark, #94a3b8);
}

[data-theme="dark"] .unified-stats-premium-overlay {
  background: rgba(30, 41, 59, 0.7);
}

[data-theme="dark"] .unified-stats-premium-overlay:hover {
  background: rgba(30, 41, 59, 0.85);
}

[data-theme="dark"] .premium-unlock-text {
  color: var(--text-primary-dark, #f1f5f9);
}

[data-theme="dark"] .skeleton-text,
[data-theme="dark"] .skeleton-kpi,
[data-theme="dark"] .skeleton-module {
  background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .unified-stats-error-content {
  color: var(--text-secondary-dark, #94a3b8);
}
