/* src/styles/dashboard.css - Cleaned Dashboard Page Styles */
/* All theme variables are now in themes.css */
/* All animations are now in animations.css */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family:
    "IBM Plex Sans Arabic",
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Display",
    "Segoe UI",
    Roboto,
    sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /*
   * DO NOT use padding shorthand here — side-menu.css owns padding-right
   * (the sidebar side). Use individual properties so the shorthand doesn't
   * clobber the sidebar offset.
   */
  padding-top: 40px;
  padding-bottom: 40px;
  padding-left: 24px; /* physical left — the non-sidebar side */
  /* padding-right is controlled by side-menu.css */
  position: relative;
  overflow-x: hidden;
}

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* The footer */
/* Premium Footer */
.watermark {
  text-align: center;
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--color-border-light);
  font-size: 0.9375rem;
  font-weight: 500;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.watermark p {
  margin: 0;
}

.watermark a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.watermark::before {
  content: "✨";
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
}

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

.stat-card {
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--color-border-light);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

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

.stat-card .icon {
  font-size: 2.5rem;
}

.stat-card .info {
  display: flex;
  flex-direction: column;
}

.stat-card .label {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 800;
}

/* Level Progress Card */
.level-progress-card {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  padding: 28px;
  border-radius: 20px;
  margin-bottom: 30px;
  color: white;
  box-shadow: var(--shadow-xl);
}

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

.level-info h3 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.level-info p {
  opacity: 0.9;
  font-size: 0.95rem;
}

.level-badge {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.progress-bar-container {
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: white;
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  opacity: 0.95;
}

/*
 * Badges card: JS moves this out of the right sidebar column and inserts it
 * after .level-progress-card so it never hides under the fixed side-menu.
 * Make it full-width and display the grid properly outside the 2-col layout.
 */
.sidebar-card.badges-relocated {
  margin-bottom: 30px;
}

.sidebar-card.badges-relocated .badge-display-grid {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

/* Dashboard Layout */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

/*
 * Badges + leaderboard sidebar: ensure this column is never obscured by the
 * fixed side-menu panel on the right. The body already has padding-right set
 * by side-menu.css, but we add an explicit max-width cap on the layout to
 * guarantee the 1fr column never overlaps the sidebar even on narrow desktops.
 */
.dashboard-layout > *:last-child {
  min-width: 0; /* prevent grid blowout */
}

/* History Items */
.history-item {
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  border: 1px solid var(--color-border-light);
}

.history-item:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
}

.history-info {
  flex: 1;
}

.history-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.delete-btn,
.unstar-btn {
  background: transparent;
  border: 2px solid var(--color-border);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.delete-btn {
  background: var(--color-error-light);
  color: var(--color-error);
}

.delete-btn:hover {
  transform: scale(1.1);
}

.unstar-btn:hover {
  transform: scale(1.1);
}

.history-score {
  font-weight: 800;
  font-size: 1.25rem;
  padding: 8px 16px;
  border-radius: 8px;
}

.history-score.pass {
  background: var(--color-success-light);
  color: var(--color-success);
}

.history-score.fail {
  background: var(--color-error-light);
  color: var(--color-error);
}

/* Sidebar Cards */
.sidebar-card {
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  border: 1px solid var(--color-border-light);
}

.sidebar-card h3 {
  margin-bottom: 16px;
  font-size: 1.125rem;

  direction: rtl;
  text-align: right;
}

/* .sidebar-card .statsContainer{
  direction: rtl;
  text-align: right;
} */

/* Badge Display */
.badge-display-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.dash-badge {
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
  cursor: pointer;

  border: 1px solid var(--color-border);
}

.dash-badge:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.dash-badge .badge-icon {
  font-size: 2.5rem;
  margin-bottom: 6px;
}

.dash-badge .badge-title {
  font-size: 0.75rem;
  font-weight: 600;
}

.dash-badge .badge-desc {
  font-size: 0.65rem;
  margin-top: 4px;
}

/* Leaderboard */
.leaderboard-list {
  max-height: 500px;
  overflow-y: auto;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 8px;
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.2s ease;
}

.lb-row.highlight {
  font-weight: 700;
  border-left: 4px solid var(--color-primary);
  padding-left: 8px;
}

.lb-rank {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Statistics Container */
.stats-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border-light);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row span {
  font-size: 0.9rem;
}

.stat-row strong {
  font-size: 1.1rem;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px;
  border-radius: 15px;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* Navigation Buttons */
.nav-btn {
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

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

.nav-btn.primary {
  background: var(--color-primary);
}

.nav-btn.primary:hover {
  background: var(--color-primary-hover);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Header */
.header {
  border-radius: 24px;
  box-shadow: var(--shadow-xl);
  padding: 48px;
  margin-bottom: 40px;
  border: 1px solid var(--color-border-light);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--gradient-accent);
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
  line-height: 1.1;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header p {
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding-top: 24px;
    padding-bottom: 24px;
    padding-left: 16px;
    /* padding-right is controlled by side-menu.css (16px on mobile) */
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

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

  .history-actions {
    flex-direction: column;
    gap: 8px;
  }

  .badge-display-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }

  .header {
    padding: 32px 24px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .header p {
    font-size: 1.125rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .header p {
    font-size: 1rem;
  }
}
