/* Dashboard Modern Unified Design System */
/* Light/Dark Mode Support with Clean, Sleek Aesthetic */

:root {
  /* Light Mode Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  
  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Colors */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --text-inverse: #0f172a;
  
  --border-color: #334155;
  --border-hover: #475569;
  
  --accent-primary: #60a5fa;
  --accent-secondary: #a78bfa;
  --accent-success: #34d399;
  --accent-warning: #fbbf24;
  --accent-danger: #f87171;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
}

/* Base Styles */
* {
  transition: background-color var(--transition-normal),
              color var(--transition-normal),
              border-color var(--transition-normal);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* --- LAYOUT FIXES (Requested Update) --- */
.dashboard-main {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: flex-start; /* Changed from space-between */
  gap: 2rem; /* Eliminate massive whitespace */
  padding-bottom: 2rem;
}

/* Fix header alignment */
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem; /* gap-4 */
  justify-content: flex-start; /* ensure left alignment */
  margin-bottom: 1.5rem;
}

/* Modern Card Component */
.modern-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

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

/* Glass Morphism Effect */
.glass-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
}

[data-theme="dark"] .glass-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modern Button Styles */
.modern-btn {
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.modern-btn-primary {
  background: var(--gradient-secondary);
  color: white;
}

.modern-btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modern-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.modern-btn:active {
  transform: translateY(0);
}

/* Ripple Effect */
.modern-btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.5) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 1s;
}

.modern-btn:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* Theme Toggle Switch */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  transition: var(--transition-fast);
  border-radius: 30px;
  border: 2px solid var(--border-color);
}

.theme-slider:before {
  position: absolute;
  content: "🌞";
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 2px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

input:checked + .theme-slider {
  background-color: var(--accent-primary);
}

input:checked + .theme-slider:before {
  transform: translateX(28px);
  content: "🌙";
}

/* Modern Section Headers */
.modern-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.modern-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modern-section-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient-secondary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* Modernize Daily Motivation Component */
.daily-motivation-modern {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.daily-motivation-modern::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: var(--gradient-primary);
  opacity: 0.05;
  transform: rotate(45deg);
}

.motivation-header {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
}

.motivation-date {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.motivation-title {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--gradient-secondary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 8px 0;
}

.motivation-content {
  position: relative;
  z-index: 1;
}

.motivation-quote {
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text-secondary);
  margin: 20px 0;
  padding-left: 20px;
  border-left: 4px solid var(--accent-primary);
}

.motivation-challenge {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
}

.challenge-title {
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

/* Modernize Scientific Fact Component */
.scientific-fact-modern {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  position: relative;
}

.fact-icon {
  width: 60px;
  height: 60px;
  background: var(--gradient-success);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  margin-bottom: 20px;
}

.fact-content {
  color: var(--text-secondary);
  line-height: 1.8;
}

.fact-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

/* Modernize Social Feed */
.social-feed-modern {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.social-post {
  padding: 20px;
  border-radius: 16px;
  background: var(--bg-secondary);
  margin-bottom: 16px;
  transition: all var(--transition-fast);
}

.social-post:hover {
  background: var(--bg-hover);
  transform: translateX(4px);
}

.social-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.social-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gradient-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.125rem;
}

.social-user-info {
  flex: 1;
}

.social-username {
  font-weight: 600;
  color: var(--text-primary);
}

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

.social-workout-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.social-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 0.875rem;
}

.social-stat-icon {
  color: var(--accent-primary);
}

/* Modern Muscle Tracker */
.muscle-tracker-modern {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.muscle-visualization {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.muscle-groups-svg {
  max-width: 100%;
  height: auto;
}

.muscle-group {
  transition: all var(--transition-fast);
  cursor: pointer;
}

.muscle-group:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
}

.muscle-label {
  fill: var(--text-primary) !important;
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
}

.muscle-legend-modern {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.muscle-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  transition: all var(--transition-fast);
}

.muscle-legend-item:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.muscle-legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

.muscle-legend-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Loading States */
.skeleton {
  animation: skeleton-loading 1s linear infinite alternate;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-secondary) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
}

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

/* Smooth Animations */
.fade-in {
  animation: fadeIn var(--transition-slow) ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-in {
  animation: slideIn var(--transition-normal) ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .modern-card {
    padding: 16px;
    border-radius: 12px;
  }
  
  .modern-section-title {
    font-size: 1.25rem;
  }
  
  .theme-toggle {
    top: 70px;
    right: 10px;
  }
  
  .muscle-legend-modern {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Hero Card Styles --- */
.hero-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid #5D5FEF; /* Highlight color */
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.hero-title {
    font-weight: 800;
    color: var(--text-primary);
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(238, 82, 83, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(238, 82, 83, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(238, 82, 83, 0); }
}

/* --- Trend Card Styles --- */
.trend-card {
    position: relative;
    overflow: hidden;
}

.stat-trend {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-trend.positive { color: var(--accent-success); }
.stat-trend.neutral { color: var(--text-secondary); }
.stat-trend.negative { color: var(--accent-danger); }

.trend-sparkline {
    height: 40px;
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0.5;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* --- Muscle Bar Chart Styles --- */
.muscle-chart-container {
    padding: 1rem;
    min-height: 200px;
}

.muscle-bar-row {
    margin-bottom: 12px;
}
