/* 🧠 Omar BYA - Revolutionary Dashboard Design v3.0 */
/* 🤖 Optimized by O.B. - Complete redesign for modern experience */

:root {
  /* 🎨 Omar BYA - Premium Color Palette v3.0 */
  /* Primary Palette - Modern Tech */
  --primary: #3b82f6; /* Bright Blue */
  --primary-dark: #1d4ed8; /* Deep Blue */
  --primary-light: #60a5fa; /* Light Blue */

  /* Secondary Palette - Creative Purple */
  --secondary: #8b5cf6; /* Violet */
  --secondary-dark: #7c3aed; /* Deep Purple */
  --secondary-light: #a78bfa; /* Light Purple */

  /* Accent Colors - Premium Feel */
  --accent: #06b6d4; /* Cyan */
  --accent-warm: #f59e0b; /* Amber */
  --accent-cool: #10b981; /* Emerald */

  /* Status Colors - Clear Communication */
  --success: #059669; /* Emerald 600 */
  --success-light: #10b981; /* Emerald 500 */
  --warning: #d97706; /* Amber 600 */
  --warning-light: #f59e0b; /* Amber 500 */
  --danger: #dc2626; /* Red 600 */
  --danger-light: #ef4444; /* Red 500 */
  --info: #0ea5e9; /* Sky 500 */

  /* Neutral Palette - Professional */
  --dark: #0f172a; /* Slate 900 */
  --darker: #020617; /* Slate 950 */
  --medium: #334155; /* Slate 700 */
  --light: #f8fafc; /* Slate 50 */
  --lighter: #ffffff; /* Pure White */

  /* Glass & Effects */
  --glass-primary: rgba(59, 130, 246, 0.15); /* Primary with transparency */
  --glass-secondary: rgba(139, 92, 246, 0.15); /* Secondary with transparency */
  --glass-neutral: rgba(255, 255, 255, 0.12); /* Neutral glass */
  --glass-dark: rgba(15, 23, 42, 0.8); /* Dark glass */

  /* Shadows - Depth & Elevation */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  /* Text Colors - Dark Mode Optimized */
  --text-primary: #f8fafc; /* Slate 50 - Light text for dark backgrounds */
  --text-secondary: rgba(255, 255, 255, 0.8); /* Light secondary */
  --text-tertiary: rgba(255, 255, 255, 0.6); /* Light tertiary */
  --text-light: #ffffff; /* White */
  --text-light-secondary: rgba(255, 255, 255, 0.8);
  --text-light-tertiary: rgba(255, 255, 255, 0.6);

  /* Border Colors */
  --border-primary: rgba(148, 163, 184, 0.2); /* Slate 400 with opacity */
  --border-light: rgba(255, 255, 255, 0.18); /* Light border */
  --border-focus: var(--primary); /* Focus border */
}

/* Global Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #020617 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-primary);
  position: relative;
}

/* 🎨 Premium background overlay pattern */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 80%,
      rgba(59, 130, 246, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(139, 92, 246, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(6, 182, 212, 0.1) 0%,
      transparent 50%
    );
  pointer-events: none;
  z-index: -1;
}

/* 🎨 Premium Glass Container */
.glass-container {
  background: var(--glass-neutral);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
}

.glass-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--border-light),
    transparent
  );
  opacity: 0.8;
}

/* Modern Dashboard Header */
.dashboard-header {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4),
    rgba(255, 255, 255, 0.1)
  );
  backdrop-filter: blur(15px);
  border-radius: 25px;
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.dashboard-title {
  background: linear-gradient(
    135deg,
    var(--primary),
    var(--secondary),
    var(--accent)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 3rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.dashboard-subtitle {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Modern Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3),
    rgba(255, 255, 255, 0.1)
  );
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--secondary),
    var(--accent)
  );
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.stat-card:hover::before {
  transform: scaleX(1);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4),
    rgba(255, 255, 255, 0.2)
  );
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Revolutionary Habit Cards */
.habits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
}

.habit-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0.15)
  );
  backdrop-filter: blur(15px);
  border-radius: 25px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.habit-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1),
    rgba(139, 92, 246, 0.1)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.habit-card:hover::before {
  opacity: 1;
}

.habit-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
}

.habit-header {
  padding: 2rem 2rem 1rem;
  position: relative;
  z-index: 2;
}

.habit-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.habit-level {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Advanced Streak Display */
.streak-section {
  padding: 0 2rem 1rem;
  position: relative;
  z-index: 2;
}

.streak-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  padding: 1rem;
  backdrop-filter: blur(5px);
}

.streak-current {
  text-align: center;
}

.streak-current-value {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--success), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.streak-current-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  text-transform: uppercase;
}

.streak-max {
  text-align: center;
}

.streak-max-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--warning);
}

/* Modern Progress Bar */
.progress-section {
  padding: 1rem 2rem;
  position: relative;
  z-index: 2;
}

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

.progress-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.progress-value {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--secondary),
    var(--accent)
  );
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Action Buttons */
.habit-actions {
  padding: 1rem 2rem 2rem;
  display: flex;
  gap: 1rem;
  position: relative;
  z-index: 2;
}

.btn-modern {
  flex: 1;
  padding: 0.75rem 1.5rem;
  border-radius: 15px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--accent), var(--success));
  color: white;
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(6, 182, 212, 0.4);
}

/* 📊 Enhanced Chart Section - Mobile First */
.chart-section {
  padding: 1rem 1.5rem 2rem;
  position: relative;
  z-index: 2;
  display: block !important;
  opacity: 1;
  visibility: visible;
  border-top: 1px solid var(--border-light);
  margin-top: 1rem;
}

.chart-container {
  background: var(--glass-neutral);
  border-radius: 16px;
  padding: 1rem;
  backdrop-filter: blur(8px);
  height: 200px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  position: relative;
  scroll-snap-type: x mandatory;
  touch-action: pan-x;
}

/* 🎨 Premium scrollbar styling */
.chart-container::-webkit-scrollbar {
  height: 8px;
}

.chart-container::-webkit-scrollbar-track {
  background: var(--glass-neutral);
  border-radius: 12px;
  margin: 0 8px;
}

.chart-container::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.chart-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    90deg,
    var(--primary-dark),
    var(--secondary-dark)
  );
  transform: scaleY(1.2);
}

/* 📱 Mobile optimized chart canvas */
.chart-container canvas {
  min-width: 400px !important;
  height: 100% !important;
  scroll-snap-align: start;
}

/* 🔧 Chart navigation controls */
.chart-controls {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.chart-period-selector {
  display: flex;
  background: var(--glass-neutral);
  border-radius: 12px;
  padding: 2px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.chart-period-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 10px;
}

.chart-period-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--text-light);
  box-shadow: var(--shadow-sm);
}

.chart-period-btn:hover:not(.active) {
  background: var(--glass-primary);
  color: var(--text-light);
}

/* Mobile chart improvements */
@media (max-width: 768px) {
  .chart-container {
    height: 180px;
    padding: 0.75rem;
  }

  .chart-container canvas {
    min-width: 350px !important;
  }

  .chart-section {
    padding: 0.75rem 1rem 1.5rem;
  }

  .chart-controls {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .chart-period-btn {
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
  }
}

/* 🤖 Optimized by O.B. - Chart visibility fixes */
.habit-card .chart-section {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 1rem;
}

.chart-section h3 {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3),
    rgba(255, 255, 255, 0.1)
  );
  backdrop-filter: blur(15px);
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.empty-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
}

.empty-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Add Button */
.add-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
  position: relative;
  overflow: hidden;
}

.add-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.add-button:hover::before {
  left: 100%;
}

.add-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
  .dashboard-title {
    font-size: 2rem;
  }

  .habits-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .habit-actions {
    flex-direction: column;
  }
}

/* Animation Classes */
.fade-in {
  animation: fadeInUp 0.6s ease-out;
}

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

.slide-in {
  animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulse Animation for Stats */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}
