/* Data Visualization Master CSS - All visualization component styles */

/* Common Variables */
:root {
  --viz-primary: #5d5fef;
  --viz-secondary: #10b981;
  --viz-tertiary: #f59e0b;
  --viz-danger: #ef4444;
  --viz-bg: #ffffff;
  --viz-bg-secondary: #f9fafb;
  --viz-border: #e5e7eb;
  --viz-text: #1f2937;
  --viz-text-secondary: #6b7280;
  --viz-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --viz-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --viz-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --viz-radius: 12px;
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
  :root {
    --viz-bg: #1f2937;
    --viz-bg-secondary: #111827;
    --viz-border: #374151;
    --viz-text: #f9fafb;
    --viz-text-secondary: #9ca3af;
    --viz-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --viz-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  }
}

/* Common Component Styles */
.viz-component {
  background: var(--viz-bg);
  border-radius: var(--viz-radius);
  box-shadow: var(--viz-shadow);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.viz-component:hover {
  box-shadow: var(--viz-shadow-lg);
  transform: translateY(-2px);
}

/* Visualization Dashboard Layout */
.visualization-dashboard {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
}

.viz-row {
  display: grid;
  gap: 1.5rem;
}

.viz-row-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.viz-row-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.viz-full-width {
  grid-column: 1 / -1;
}

/* Export Modal Styles */
.export-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.export-modal-content {
  background: var(--viz-bg);
  border-radius: var(--viz-radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.export-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--viz-border);
}

.export-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--viz-text);
}

.export-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--viz-text-secondary);
  transition: all 0.2s ease;
}

.export-close-btn:hover {
  background: var(--viz-bg-secondary);
  color: var(--viz-text);
}

.export-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.export-section {
  margin-bottom: 1.5rem;
}

.export-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--viz-text);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.export-options {
  display: grid;
  gap: 0.5rem;
}

.export-option {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--viz-bg-secondary);
  border: 1px solid var(--viz-border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-option:hover {
  border-color: var(--viz-primary);
  background: var(--viz-bg);
}

.export-option input[type="radio"] {
  margin-right: 0.75rem;
  accent-color: var(--viz-primary);
}

.export-option-label {
  font-size: 0.875rem;
  color: var(--viz-text);
}

.export-modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.5rem;
  border-top: 1px solid var(--viz-border);
}

.export-cancel-btn,
.export-confirm-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-cancel-btn {
  background: transparent;
  border: 1px solid var(--viz-border);
  color: var(--viz-text-secondary);
}

.export-cancel-btn:hover {
  background: var(--viz-bg-secondary);
  border-color: var(--viz-text-secondary);
}

.export-confirm-btn {
  background: var(--viz-primary);
  border: 1px solid var(--viz-primary);
  color: white;
}

.export-confirm-btn:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  transform: translateY(-1px);
}

/* Export Loading */
.export-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.export-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--viz-border);
  border-top-color: var(--viz-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

/* Export Button */
.data-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--viz-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.data-export-btn:hover {
  background: #4f46e5;
  transform: translateY(-1px);
  box-shadow: var(--viz-shadow);
}

/* Toast Notifications */
.export-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--viz-text);
  color: white;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 10001;
  max-width: 90vw;
}

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

.export-toast.success {
  background: var(--viz-secondary);
}

.export-toast.error {
  background: var(--viz-danger);
}

/* Streak Counter Styles */
.streak-counter-container {
  padding: 1.5rem;
  background: var(--viz-bg);
  border-radius: var(--viz-radius);
  box-shadow: var(--viz-shadow);
}

.streak-main-display {
  text-align: center;
  margin-bottom: 2rem;
}

.streak-flame-container {
  display: inline-block;
  margin-bottom: 1rem;
  position: relative;
}

.streak-flame {
  filter: drop-shadow(0 4px 8px rgba(255, 107, 107, 0.3));
  transition: transform 0.3s ease;
}

.streak-counter {
  margin-bottom: 0.5rem;
}

.streak-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--viz-primary);
  line-height: 1;
}

.streak-label {
  font-size: 1.125rem;
  color: var(--viz-text-secondary);
  margin-left: 0.5rem;
}

.streak-status {
  font-size: 0.875rem;
  color: var(--viz-text-secondary);
  font-weight: 500;
}

.streak-status.record {
  color: var(--viz-tertiary);
  font-weight: 700;
}

.streak-stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--viz-border);
  border-bottom: 1px solid var(--viz-border);
}

.streak-stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
}

.stat-icon {
  font-size: 1.5rem;
}

.stat-content {
  text-align: left;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--viz-text);
  display: block;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--viz-text-secondary);
  display: block;
}

/* Milestones */
.streak-milestones {
  margin-bottom: 2rem;
}

.milestones-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--viz-text);
  margin-bottom: 1rem;
}

.milestone-badges {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.milestone-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--viz-bg-secondary);
  border: 2px solid var(--viz-border);
  border-radius: var(--viz-radius);
  min-width: 80px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.milestone-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--viz-shadow);
}

.milestone-badge.earned {
  background: var(--viz-primary);
  border-color: var(--viz-primary);
  color: white;
}

.milestone-badge.earned .badge-label {
  color: white;
}

.badge-icon {
  font-size: 2rem;
}

.badge-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--viz-text-secondary);
}

/* Calendar */
.streak-calendar {
  margin-top: 2rem;
}

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

.cal-nav-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--viz-border);
  background: var(--viz-bg);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--viz-text-secondary);
  transition: all 0.2s ease;
}

.cal-nav-btn:hover {
  border-color: var(--viz-primary);
  color: var(--viz-primary);
}

.cal-month {
  font-size: 1rem;
  font-weight: 600;
  color: var(--viz-text);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.cal-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--viz-text-secondary);
  padding: 0.5rem 0;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--viz-bg-secondary);
  border: 1px solid var(--viz-border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--viz-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cal-day:hover:not(.empty) {
  background: var(--viz-bg);
  border-color: var(--viz-primary);
}

.cal-day.empty {
  background: transparent;
  border: none;
  cursor: default;
}

.cal-day.workout-day {
  background: var(--viz-primary);
  color: white;
  border-color: var(--viz-primary);
  font-weight: 600;
}

.cal-day.today {
  border-color: var(--viz-tertiary);
  border-width: 2px;
  font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .visualization-dashboard {
    padding: 1rem;
    gap: 1rem;
  }
  
  .viz-row-2,
  .viz-row-3 {
    grid-template-columns: 1fr;
  }
  
  .viz-component {
    padding: 1rem;
  }
  
  .streak-stats-panel {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .milestone-badges {
    gap: 0.5rem;
  }
  
  .milestone-badge {
    padding: 0.75rem;
    min-width: 70px;
  }
  
  .badge-icon {
    font-size: 1.5rem;
  }
  
  .streak-number {
    font-size: 2.5rem;
  }
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  25% { transform: scale(1.05) rotate(2deg); }
  50% { transform: scale(0.95) rotate(-1deg); }
  75% { transform: scale(1.02) rotate(1deg); }
}

.streak-flame-container.active .streak-flame {
  animation: flameFlicker 3s ease-in-out infinite;
}

/* PR Badges Filter Styles */
.pr-filter-container {
  background: var(--viz-bg-secondary);
  border-radius: var(--viz-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--viz-border);
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filter-header h4 {
  margin: 0;
  color: var(--viz-text);
  font-size: 1.2rem;
}

.clear-filters-btn {
  background: var(--viz-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.clear-filters-btn:hover {
  background: #4c4dd8;
  transform: translateY(-1px);
}

.filter-section {
  margin-bottom: 1.5rem;
}

.filter-section:last-child {
  margin-bottom: 0;
}

.filter-section h5 {
  margin: 0 0 1rem 0;
  color: var(--viz-text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.filter-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.filter-label:hover {
  background: var(--viz-bg);
}

.filter-label input[type="checkbox"] {
  margin-right: 0.5rem;
  cursor: pointer;
}

.filter-label span {
  font-size: 0.875rem;
  color: var(--viz-text);
}

.pr-badges-content {
  margin-top: 1rem;
}

/* Update existing PR badge styles for better filtering */
.pr-badge {
  transition: all 0.3s ease;
}

.pr-badge.filtered-out {
  opacity: 0.3;
  transform: scale(0.95);
}

/* Mobile responsive filter styles */
@media (max-width: 768px) {
  .filter-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }
  
  .filter-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .clear-filters-btn {
    width: 100%;
  }
}