@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --lavender: #c1baff;
  --lavender-light: #e8e5ff;
  --warm: #f8ebe4;
  --warm-dark: #f0e0d8;
  --dark: #1a1a1a;
  --grey: #555;
  --grey-light: #888;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--warm);
  color: var(--dark);
  line-height: 1.6;
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--dark);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--lavender);
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
  margin: 0 0 1rem 0;
}

.accent {
  color: var(--lavender);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.header {
  padding: 1.5rem 0;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--dark);
}

.nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
}

.nav a {
  color: var(--grey);
}

.nav a:hover {
  color: var(--lavender);
}

.nav a.active {
  color: var(--dark);
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--grey);
  font-size: 1.1rem;
  font-weight: 300;
}

/* Currently Watching Banner */
.currently-watching {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.currently-watching-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.currently-watching h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-indicator {
  width: 8px;
  height: 8px;
  background: var(--lavender);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.progress-bar {
  height: 6px;
  background: var(--warm);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: var(--lavender);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.currently-watching-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--grey);
}

.currently-watching-meta a {
  color: var(--lavender);
  font-weight: 500;
}

/* Section */
.section {
  margin: 3rem 0;
}

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

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 500;
}

.section-header a {
  font-size: 0.85rem;
  color: var(--grey);
}

.section-header a:hover {
  color: var(--lavender);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Entry Card */
.entry-card {
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}

.entry-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.entry-card-poster {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
}

.entry-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.entry-card:hover .entry-card-poster img {
  transform: scale(1.03);
}

.entry-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(193, 186, 255, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.entry-card:hover .entry-card-overlay {
  opacity: 1;
}

.entry-card-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.badge {
  background: var(--white);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.type-show { background: var(--lavender); color: var(--dark); }
.badge.type-movie { background: var(--warm); color: var(--grey); }
.badge.status-watching { background: var(--lavender); color: var(--dark); }
.badge.status-on-hold { background: var(--warm-dark); color: var(--grey); }

.entry-card-content {
  padding: 1rem;
}

.entry-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--grey);
  margin-bottom: 0.5rem;
}

.entry-card-rating {
  display: flex;
  gap: 2px;
}

.star {
  width: 14px;
  height: 14px;
  fill: var(--lavender);
}

.star.empty {
  fill: var(--warm-dark);
}

.entry-card-review {
  font-size: 0.85rem;
  color: var(--grey);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

/* Poster Grid (Watched Page) */
.filter-bar {
  background: var(--white);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border: 1px solid var(--warm-dark);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--warm);
  transition: border-color 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--lavender);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--warm-dark);
  border-radius: 6px;
  background: var(--warm);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--lavender);
}

.filter-btn.active {
  background: var(--lavender);
  border-color: var(--lavender);
  color: var(--dark);
}

select {
  padding: 0.5rem 2rem 0.5rem 1rem;
  border: 1px solid var(--warm-dark);
  border-radius: 6px;
  background: var(--warm);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

select:focus {
  outline: none;
  border-color: var(--lavender);
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .poster-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (min-width: 1024px) {
  .poster-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Poster Card */
.poster-card {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.poster-card:hover {
  transform: scale(1.03);
}

.poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(193, 186, 255, 0.9), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
}

.poster-card:hover .poster-card-overlay {
  opacity: 1;
}

.poster-card-title {
  color: var(--dark);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.poster-card-rating {
  display: flex;
  gap: 2px;
}

.poster-card-rating .star {
  width: 12px;
  height: 12px;
}

/* Season Grouping */
.season-group {
  margin-bottom: 2rem;
}

.season-group-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--warm-dark);
}

.season-group-header img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.season-group-title {
  font-weight: 600;
}

.season-group-meta {
  font-size: 0.8rem;
  color: var(--grey);
}

.season-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  padding-left: 56px;
}

.season-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.season-item:hover {
  background: var(--lavender-light);
}

.season-item-poster {
  width: 30px;
  height: 45px;
  border-radius: 3px;
  object-fit: cover;
}

.season-item-info {
  flex: 1;
  min-width: 0;
}

.season-item-title {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.season-item-rating {
  display: flex;
  gap: 1px;
}

.season-item-rating .star {
  width: 10px;
  height: 10px;
}

/* Detail Page */
.detail-header {
  display: flex;
  gap: 2rem;
  padding: 2rem 0;
}

.detail-poster {
  width: 200px;
  flex-shrink: 0;
}

.detail-poster img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.detail-info {
  flex: 1;
}

.detail-type-badge {
  display: inline-block;
  background: var(--lavender);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.detail-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.detail-subtitle {
  color: var(--grey);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.detail-rating {
  display: flex;
  gap: 4px;
  margin-bottom: 1.5rem;
}

.detail-rating .star {
  width: 24px;
  height: 24px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.detail-meta-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.detail-meta-label {
  color: var(--grey);
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  background: var(--warm);
  border-radius: 20px;
  font-size: 0.8rem;
}

.detail-badge.platform {
  background: var(--lavender-light);
}

.detail-badge.mood {
  background: var(--warm-dark);
}

.detail-watched-date {
  font-size: 0.9rem;
  color: var(--grey);
  margin-top: 1rem;
}

.detail-rewatch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--grey);
  margin-top: 0.5rem;
}

.detail-awards {
  margin-top: 1rem;
}

.detail-awards h4 {
  font-size: 0.85rem;
  color: var(--grey);
  margin-bottom: 0.5rem;
}

.award-tag {
  display: inline-block;
  background: linear-gradient(135deg, var(--lavender), var(--lavender-light));
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.detail-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.detail-review {
  font-size: 1.05rem;
  line-height: 1.8;
  font-weight: 300;
  color: var(--dark);
  margin-bottom: 2rem;
}

.detail-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 0;
  border-top: 1px solid var(--warm-dark);
}

.detail-nav a {
  padding: 0.75rem 1.5rem;
  background: var(--white);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.detail-nav a:hover {
  background: var(--lavender);
  color: var(--dark);
}

/* Watchlist */
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}

.watchlist-card {
  background: var(--white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.watchlist-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.watchlist-card-poster {
  aspect-ratio: 2/3;
}

.watchlist-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.watchlist-card-content {
  padding: 1rem;
}

.watchlist-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.watchlist-card-meta {
  font-size: 0.8rem;
  color: var(--grey);
}

.watchlist-card-notes {
  font-size: 0.85rem;
  color: var(--grey);
  margin-top: 0.5rem;
  font-style: italic;
}

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

.stat-card {
  background: var(--white);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--lavender);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--grey);
}

.stat-breakdown {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--grey);
}

.charts-section {
  margin-bottom: 3rem;
}

.chart-card {
  background: var(--white);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.chart-card h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.genre-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.genre-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.genre-bar-label {
  width: 100px;
  font-size: 0.85rem;
}

.genre-bar-track {
  flex: 1;
  height: 8px;
  background: var(--warm);
  border-radius: 4px;
  overflow: hidden;
}

.genre-bar-fill {
  height: 100%;
  background: var(--lavender);
  border-radius: 4px;
}

.genre-bar-count {
  width: 30px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--grey);
}

.rating-distribution {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  height: 120px;
  padding-top: 1rem;
}

.rating-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.rating-bar-fill {
  width: 100%;
  background: var(--lavender);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.rating-bar-label {
  font-size: 0.75rem;
  color: var(--grey);
}

.milestones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.milestone-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, var(--lavender-light), var(--white));
  border-radius: 10px;
  padding: 1rem;
}

.milestone-icon {
  font-size: 2rem;
}

.milestone-info h4 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.milestone-info p {
  font-size: 0.8rem;
  color: var(--grey);
  margin: 0;
}

/* Top Lists */
.lists-grid {
  display: grid;
  gap: 2rem;
}

.list-card {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.list-card h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.list-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--warm);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.list-item:hover {
  background: var(--lavender-light);
}

.list-rank {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lavender);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.9rem;
}

.list-item-poster {
  width: 40px;
  height: 60px;
  border-radius: 4px;
  object-fit: cover;
}

.list-item-info {
  flex: 1;
}

.list-item-title {
  font-weight: 500;
  font-size: 0.95rem;
}

.list-item-meta {
  font-size: 0.8rem;
  color: var(--grey);
}

.list-item-rating {
  display: flex;
  gap: 2px;
}

.list-item-rating .star {
  width: 14px;
  height: 14px;
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 2rem 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--grey);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sub-footer {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--grey);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--dark);
}

.empty-state p {
  font-size: 0.9rem;
}

/* Keyboard Navigation Hint */
.keyboard-hint {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  color: var(--grey);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.keyboard-hint.visible {
  opacity: 1;
}

.keyboard-hint kbd {
  background: var(--warm);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-family: inherit;
  margin: 0 0.15rem;
}

/* Back Button */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--grey);
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--lavender);
}

/* Responsive */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;
    gap: 1rem;
  }

  .nav {
    gap: 1rem;
    font-size: 0.8rem;
  }

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

  .detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .detail-poster {
    width: 180px;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .season-items {
    padding-left: 0;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    justify-content: center;
  }
}

/* Lazy Loading */
.poster-card img,
.entry-card-poster img,
.watchlist-card-poster img,
.detail-poster img,
.list-item-poster img,
.season-item-poster img {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.poster-card img.loaded,
.entry-card-poster img.loaded,
.watchlist-card-poster img.loaded,
.detail-poster img.loaded,
.list-item-poster img.loaded,
.season-item-poster img.loaded {
  opacity: 1;
}

/* Print styles */
@media print {
  .nav,
  .filter-bar,
  .footer,
  .keyboard-hint {
    display: none;
  }

  body {
    background: white;
  }
}
