/**
 * AI Personalization Styles
 * Styling for XP badges, learning dashboard, and knowledge graph
 */

/* XP Badge Styles */
.xp-badge-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.xp-badge-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.xp-badge-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.xp-badge-card:hover::before {
  opacity: 1;
}

/* Progress Bar Animation */
@keyframes progressFill {
  from {
    width: 0;
  }
  to {
    width: var(--progress-width);
  }
}

.progress-bar-fill {
  animation: progressFill 1s ease-out;
}

/* Level Badge Pulse */
@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.xp-level-badge {
  animation: badgePulse 2s infinite;
}

/* Learning Dashboard Styles */
.learning-stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.learning-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* Knowledge Graph Styles */
.knowledge-node {
  transition: all 0.2s ease;
  cursor: pointer;
}

.knowledge-node:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* Study Plan Day Card */
.study-plan-day {
  position: relative;
  transition: all 0.3s ease;
}

.study-plan-day.today {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.study-plan-day:hover {
  transform: translateX(5px);
}

/* Recommendation Cards */
.recommendation-card {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.recommendation-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--priority-color, #6366f1);
  transition: width 0.3s ease;
}

.recommendation-card:hover::before {
  width: 8px;
}

.recommendation-card:hover {
  transform: translateX(3px);
}

/* Personalized Lesson Exercise */
.exercise-option {
  transition: all 0.2s ease;
}

.exercise-option:hover {
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.exercise-option.correct {
  background: #d1fae5 !important;
  border-color: #10b981 !important;
}

.exercise-option.incorrect {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
}

/* Level-Up Modal Animation */
@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.level-up-modal {
  animation: modalFadeIn 0.3s ease;
}

.level-up-modal > div {
  animation: modalScaleIn 0.5s ease;
}

/* Confetti Animation for Level Up */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: #fbbf24;
  animation: confetti-fall 3s linear infinite;
  z-index: 10001;
}

/* Writing Analysis Stats Grid */
.writing-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.writing-stat-card {
  text-align: center;
  padding: 15px;
  border-radius: 8px;
  transition: transform 0.2s ease;
}

.writing-stat-card:hover {
  transform: scale(1.05);
}

/* Weekly Report Trend Indicators */
.trend-up {
  color: #10b981;
}

.trend-up::before {
  content: '↑ ';
}

.trend-down {
  color: #ef4444;
}

.trend-down::before {
  content: '↓ ';
}

/* Streak Fire Animation */
@keyframes fireFlicker {
  0%, 100% {
    transform: scale(1) rotate(-2deg);
  }
  50% {
    transform: scale(1.1) rotate(2deg);
  }
}

.streak-fire {
  display: inline-block;
  animation: fireFlicker 0.5s infinite;
}

/* Skill Badge Shimmer Effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skill-badge-shimmer {
  background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  background-size: 1000px 100%;
  animation: shimmer 3s infinite;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .xp-badge-card {
    padding: 15px;
  }

  .writing-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .study-plan-day {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .writing-stats-grid {
    grid-template-columns: 1fr;
  }

  .xp-badge-card {
    font-size: 14px;
  }

  .knowledge-node {
    font-size: 13px;
    padding: 6px 12px;
  }
}

/* Dark Mode Support (if needed in future) */
@media (prefers-color-scheme: dark) {
  .xp-badge-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }

  .learning-stat-card {
    background: #1f2937;
    color: #f3f4f6;
  }

  .study-plan-day {
    background: #374151;
    border-color: #4b5563;
  }
}

/* Accessibility Improvements */
.xp-badge-card:focus-within,
.recommendation-card:focus-within,
.exercise-option:focus {
  outline: 3px solid #667eea;
  outline-offset: 2px;
}

/* Print Styles (for reports) */
@media print {
  .xp-badge-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }

  .level-up-modal {
    display: none;
  }

  .recommendation-card {
    page-break-inside: avoid;
  }
}

/* Sidebar XP Badge */
#sidebar-xp-badge {
  position: relative;
}

#sidebar-xp-badge .xp-badge-compact {
  transition: all 0.3s ease;
}

#sidebar-xp-badge .xp-badge-compact:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Loading State */
@keyframes skeletonLoading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton-loader {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: 8px;
}

/* Tooltip Styles */
.xp-tooltip {
  position: absolute;
  background: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.xp-tooltip.visible {
  opacity: 1;
}

.xp-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f2937;
}
