* {
  box-sizing: border-box;
}

:root {
  --primary: #e50914;
  --dark-bg: #111;
  --card-bg: rgba(255,255,255,0.05);
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0f0f0f, #1a1a1a);
  color: white;
  text-align: center;
  margin: 0;
  padding: 0 0 60px 0;
}

h1 {
  font-size: 3rem;
  font-weight: 800;

  text-align: center;

  margin-bottom: 20px;

  background: linear-gradient(
    90deg,
    #ef4444,
    #f59e0b
  );

  background-clip: text;
  -webkit-background-clip: text;

  -webkit-text-fill-color: transparent;

  letter-spacing: 1px;
}

input,
select {
  padding: 12px 15px;

  margin: 5px;

  border-radius: 12px;

  border: 1px solid #374151;

  background: #1f2937;

  color: white;

  transition: 0.2s;
}

input:focus,
select:focus {
  border-color: #ef4444;

  box-shadow: 0 0 15px rgba(239,68,68,0.3);

  outline: none;
}

button {
  padding: 10px 16px;

  background: linear-gradient(
    45deg,
    #e50914,
    #ff3c3c
  );

  border: none;

  color: white;

  cursor: pointer;

  border-radius: 12px;

  font-weight: 600;

  transition: all 0.2s ease;

  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

button:hover {
  transform: translateY(-2px);

  box-shadow: 0 8px 20px rgba(229,9,20,0.4);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Stats Bar ── */
#statsBar {
  display: flex;
  justify-content: center;
  gap: 20px;

  margin: 25px auto 10px;

  flex-wrap: wrap;
}

.stat-chip {
  background: #1f2937;

  border: 1px solid #374151;

  border-radius: 16px;

  padding: 12px 18px;

  font-size: 14px;

  display: flex;
  align-items: center;
  gap: 8px;

  box-shadow: 0 8px 20px rgba(0,0,0,0.25);

  transition: 0.2s;
}

.stat-chip:hover {
  transform: translateY(-4px);
}

.stat-chip span.num {
  color: #e50914;
  font-weight: bold;
  font-size: 15px;
}

/* History */

#watchHistory {
  max-width: 1000px;

  margin: 25px auto;

  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 16px;

  padding: 20px;

  text-align: left;
}

#watchHistory h2 {
  margin-bottom: 15px;

  color: #fff;
}

#historyList {
  color: #9ca3af;
}

.history-item {
  padding: 14px 0;

  border-bottom: 1px solid #2d2d2d;
}

.history-item:last-child {
  border-bottom: none;
}

.history-left {
  display: flex;

  align-items: center;

  gap: 12px;
}

.history-dot {
  width: 10px;

  height: 10px;

  border-radius: 50%;

  background: #e50914;

  box-shadow: 0 0 10px rgba(229, 9, 20, 0.7);
}

.history-title {
  font-weight: 600;

  color: white;
}

.history-date {
  font-size: 13px;

  color: #9ca3af;

  margin-top: 4px;
}

#loader {
  display: flex;
}

.skeleton-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.skeleton-card {
  background: #222;
  border-radius: 12px;
  overflow: hidden;
  padding: 10px;
}

.skeleton-poster {
  height: 260px;
  border-radius: 10px;
  margin-bottom: 12px;
  background: linear-gradient(
    90deg,
    #2a2a2a 25%,
    #3a3a3a 50%,
    #2a2a2a 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  background: linear-gradient(
    90deg,
    #2a2a2a 25%,
    #3a3a3a 50%,
    #2a2a2a 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.skeleton-btn {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    #2a2a2a 25%,
    #3a3a3a 50%,
    #2a2a2a 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

body.light .skeleton-card {
  background: linear-gradient(
    90deg,
    #e5e5e5 25%,
    #f5f5f5 50%,
    #e5e5e5 75%
  );
  background-size: 200% 100%;
}

/* Undo Delete Toast */
#undoToast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);

  background: #111827;
  color: white;

  padding: 20px 28px;
  border-radius: 16px;

  display: none;
  align-items: center;
  gap: 18px;

  z-index: 9999;

  min-width: 420px;
  max-width: 90vw;

  font-size: 17px;
  font-weight: 600;

  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}

#undoToast button {
  background: #4f46e5;
  color: white;
  border: none;

  padding: 12px 24px;

  border-radius: 10px;

  font-size: 16px;
  font-weight: 700;

  min-width: 120px;

  cursor: pointer;
  transition: 0.25s;
}

#undoToast button:hover {
  transform: scale(1.05);
}

/* ── Filter Pills ── */
#filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;

  gap: 8px;

  margin: 20px auto;
}

.filter-pill {
  padding: 8px 16px;

  border-radius: 999px;

  border: 1px solid #444;

  background: transparent;

  color: #aaa;

  cursor: pointer;

  font-size: 13px;

  font-weight: 600;

  transition: 0.2s;
}

.filter-pill:hover {
  transform: scale(1.05);
}

.filter-pill.active {
  background: #e50914;
  border-color: #e50914;
  color: white;
}

.container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 12px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

.card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 10px 25px rgba(229, 9, 20, 0.4);
}

.card img {
  width: 100%;
  border-radius: 10px;
  transition: 0.3s;
}

.card:hover img {
  transform: scale(1.05);
}

.watched { text-decoration: line-through; color: gray; }
.favorite { color: gold; }

.small-btn {
  margin: 3px;
  padding: 5px;
  font-size: 12px;
}

#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);

  background: #10b981;
  color: white;

  padding: 16px 24px;
  border-radius: 12px;

  font-size: 17px;
  font-weight: 600;

  min-width: 300px;

  z-index: 9999;
  display: none;

  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

#progressBar {
  width: 80%;
  margin: 10px auto;
  background: #333;
  border-radius: 10px;
}

#progress {
  height: 10px;
   background: var(--primary);
  width: 0%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

#emptyMsg {
  display: none;
  margin-top: 40px;
  color: #555;
  font-size: 16px;
}

/* Footer */
footer {
  margin-top: 50px;

  padding: 20px;

  text-align: center;

  color: #9ca3af;

  font-size: 14px;

  border-top: 1px solid rgba(255,255,255,0.08);

  background: rgba(255,255,255,0.02);

  backdrop-filter: blur(8px);
}

.footer-brand {
  color: #ef4444;

  font-weight: 700;

  letter-spacing: 0.5px;
}

.footer-brand:hover {
  color: #f59e0b;

  transition: 0.2s ease;
}
  
.light {
  background: #f5f5f5;
  color: black;
}
  
.light .card {
  background: white;
  color: black;
}

.light input,
.light select {
  background: white;
  color: black;
  border: 1px solid #ccc;
}

.light footer {
  background: #eee;
  color: #555;
}

body,
.card,
input,
select,
footer {
  transition: background 0.3s ease,
              color 0.3s ease;
}

@media (max-width: 768px) {

  input,
  select,
  button {
    width: 90%;
    margin: 5px auto;
    display: block;
  }

  .container {
    grid-template-columns:
    repeat(auto-fill, minmax(160px, 1fr));
  }

  #statsBar {
    gap: 10px;
  }
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: #1f2937;
  width: 450px;
  max-width: 90%;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  animation: modalPop 0.2s ease;
}

.modal-content h2 {
  margin-bottom: 10px;
}

.modal-subtitle {
  color: #9ca3af;
  margin-bottom: 20px;
  font-size: 14px;
}

.modal-content input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #374151;
  background: #111827;
  color: white;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}

.modal-content input:focus {
  border-color: #4f46e5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.modal-actions button {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.modal-actions button:first-child {
  background: #374151;
  color: white;
}

.modal-actions button:last-child {
  background: #4f46e5;
  color: white;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  margin-top: 20px;
  border: 2px dashed #444;
  border-radius: 12px;
  color: #aaa;
}

.empty-state h3 {
  margin-bottom: 10px;
  color: #fff;
}

body.light .empty-state h3 {
  color: #222;
}

.movie-details-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

#detailsPoster {
  width: 220px;
  border-radius: 14px;
  flex-shrink: 0;
}

#detailsInfo {
  flex: 1;
}

#detailsInfo p {
  margin: 8px 0;
  line-height: 1.5;
}

#detailsTitle {
  margin-bottom: 20px;
  font-size: 28px;
}

#movieDetailsModal .modal-content {
  width: 850px;
  max-width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

#detailsInfo {
  padding-right: 10px;
}

@media (max-width: 768px) {
  .movie-details-layout {
    flex-direction: column;
    align-items: center;
  }

  #detailsPoster {
    width: 180px;
  }

  #detailsInfo {
    width: 100%;
  }

  #movieDetailsModal .modal-content {
    width: 95%;
    padding: 20px;
  }

  #detailsTitle {
    text-align: center;
  }
}

#activityStats {
  max-width: 1000px;

  margin: 25px auto;

  text-align: left;
}

#activityStats h2 {
  margin-bottom: 15px;
}

#activityGrid {
  display: grid;

  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));

  gap: 15px;
}

.activity-card {
  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 16px;

  padding: 18px;

  text-align: center;

  transition: 0.3s ease;
}

.activity-card:hover {
  transform: translateY(-3px);

  border-color: #e50914;
}

.activity-card span {
  display: block;

  font-size: 28px;

  font-weight: 700;

  color: #e50914;

  margin-bottom: 8px;
}

.activity-card small {
  color: #9ca3af;

  font-size: 14px;
}

#dynamicGenres {
  display: flex;

  flex-wrap: wrap;

  gap: 8px;
}

/* Favorite Genre Card */

#genreAnalytics {
  max-width: 1000px;
  margin: 20px auto;
}

.genre-card {
  background: linear-gradient(
    135deg,
    #1f1f1f,
    #2b2b2b
  );

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

  display: flex;

  align-items: center;

  gap: 18px;

  box-shadow:
    0 10px 25px rgba(0,0,0,0.35);

  transition: all 0.3s ease;
}

.genre-card:hover {
  transform: translateY(-3px);

  border-color: #e50914;

  box-shadow:
    0 12px 30px rgba(229,9,20,0.25);
}

.genre-icon {
  font-size: 42px;
}

.genre-info {
  text-align: left;
}

#favoriteGenre {
  font-size: 22px;

  font-weight: 700;

  color: white;
}

#favoriteGenreCount {
  color: #9ca3af;

  margin-top: 4px;

  font-size: 14px;
}

/* Genre Ranking Leaderboard */

#genreLeaderboard {

  max-width: 1000px;

  margin: 20px auto;

  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#genreLeaderboard h2 {

  margin-bottom: 15px;

  color: white;

}

.genre-rank-item {

  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 12px 16px;

  margin-bottom: 10px;

  border-radius: 12px;

  background: #252525;

  transition: all 0.3s ease;

}

.genre-rank-item:hover {

  transform: translateX(5px);

  background: #2f2f2f;

}

.genre-rank-left {

  display: flex;

  align-items: center;

  gap: 12px;

}

.genre-rank-number {

  font-weight: 700;

  color: #e50914;

  width: 30px;

}

.genre-rank-name {

  color: white;

  font-weight: 600;

}

.genre-rank-count {

  color: #9ca3af;

  font-size: 14px;

}

/* Genre Distribution Chart */

#genreDistribution {

  max-width: 1000px;

  margin: 20px auto;

  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#genreDistribution h2 {

  margin-bottom: 15px;

  color: white;

}

.genre-dist-item {

  margin-bottom: 14px;

}

.genre-dist-header {

  display: flex;

  justify-content: space-between;

  margin-bottom: 6px;

}

.genre-dist-name {

  color: white;

  font-weight: 600;

}

.genre-dist-percent {

  color: #9ca3af;

  font-size: 14px;

}

.genre-dist-bar {

  width: 100%;

  height: 10px;

  background: #2f2f2f;

  border-radius: 999px;

  overflow: hidden;

}

.genre-dist-fill {

  height: 100%;

  border-radius: 999px;

  background: linear-gradient(
    90deg,
    #e50914,
    #ff4d4d
  );

}

/* Favorite Genre Insights */

#genreInsights {

  max-width: 1000px;

  margin: 20px auto;

  background: linear-gradient(
    135deg,
    #1c1c1c,
    #252525
  );

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#genreInsights h2 {

  color: white;

  margin-bottom: 15px;

}

#genreInsightText {

  color: #d1d5db;

  line-height: 1.8;

  font-size: 15px;

}

.insight-highlight {

  color: #e50914;

  font-weight: 700;

}

/* Monthly Statistics Card */

#monthlyStats {

  max-width: 1000px;

  margin: 20px auto;

  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#monthlyStats h2 {

  color: white;

  margin-bottom: 15px;

}

#monthlyStatsGrid {

  display: grid;

  grid-template-columns:
    repeat(auto-fit, minmax(180px, 1fr));

  gap: 15px;

}

.month-stat-card {

  background: #252525;

  border-radius: 14px;

  padding: 20px;

  text-align: center;

  transition: all 0.3s ease;

}

.month-stat-card:hover {

  transform: translateY(-3px);

  background: #2f2f2f;

}

.month-stat-value {

  font-size: 28px;

  font-weight: 700;

  color: #e50914;

  margin-bottom: 8px;

}

.month-stat-label {

  color: #9ca3af;

  font-size: 14px;

}

/* Monthly Activity Timeline */

#monthlyTimeline {

  max-width: 1000px;

  margin: 20px auto;

  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#monthlyTimeline h2 {

  color: white;

  margin-bottom: 15px;

}

.timeline-item {

  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 14px 16px;

  margin-bottom: 10px;

  border-radius: 12px;

  background: #252525;

  transition: all 0.3s ease;

}

.timeline-item:hover {

  background: #2f2f2f;

  transform: translateX(5px);

}

.timeline-month {

  color: white;

  font-weight: 600;

}

.timeline-count {

  color: #e50914;

  font-weight: 700;

}

/* Monthly Growth Insights */

#growthInsights {

  max-width: 1000px;

  margin: 20px auto;

  background: linear-gradient(
    135deg,
    #1c1c1c,
    #252525
  );

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#growthInsights h2 {

  color: white;

  margin-bottom: 15px;

}

#growthInsightsText {

  color: #d1d5db;

  line-height: 1.9;

  font-size: 15px;

}

.growth-highlight {

  color: #e50914;

  font-weight: 700;

}

/* Collection Personality */

#collectionPersonality {

  max-width: 1000px;

  margin: 20px auto;

  background: linear-gradient(
    135deg,
    #1c1c1c,
    #252525
  );

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#collectionPersonality h2 {

  color: white;

  margin-bottom: 15px;

}

#collectionPersonalityText {

  color: #d1d5db;

  line-height: 1.9;

  font-size: 15px;

}

.personality-highlight {

  color: #e50914;

  font-weight: 700;

}

/* Viewer Archetype */

#viewerArchetype {

  max-width: 1000px;

  margin: 20px auto;

  background: linear-gradient(
    135deg,
    #1c1c1c,
    #252525
  );

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#viewerArchetype h2 {

  color: white;

  margin-bottom: 15px;

}

#viewerArchetypeText {

  color: #d1d5db;

  line-height: 1.9;

  font-size: 15px;

}

.archetype-title {

  color: #e50914;

  font-size: 22px;

  font-weight: 700;

  margin-bottom: 10px;

}

/* Achievement Badges */

#achievementBadges {

  max-width: 1000px;

  margin: 20px auto;

  background: #1c1c1c;

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#achievementBadges h2 {

  color: white;

  margin-bottom: 15px;

}

#achievementGrid {

  display: grid;

  grid-template-columns:
    repeat(auto-fit, minmax(220px, 1fr));

  gap: 15px;

}

.badge-card {

  background: #252525;

  border: 1px solid #333;

  border-radius: 14px;

  padding: 18px;

  text-align: center;

  transition: all 0.3s ease;

}

.badge-card:hover {

  transform: translateY(-4px);

  background: #2f2f2f;

}

.badge-icon {

  font-size: 32px;

  margin-bottom: 10px;

}

.badge-title {

  color: white;

  font-weight: 700;

  margin-bottom: 6px;

}

.badge-desc {

  color: #9ca3af;

  font-size: 14px;

}

/* Genre Evolution */

#genreEvolution {

  max-width: 1000px;

  margin: 20px auto;

  background: linear-gradient(
    135deg,
    #1c1c1c,
    #252525
  );

  border: 1px solid #333;

  border-radius: 18px;

  padding: 20px;

}

#genreEvolution h2 {

  color: white;

  margin-bottom: 15px;

}

#genreEvolutionText {

  color: #d1d5db;

  line-height: 1.9;

  font-size: 15px;

}

.genre-evolution-highlight {

  color: #e50914;

  font-weight: 700;

}