/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1a1a3e;
  --accent: #e040fb;
  --accent-soft: #ce93d8;
  --accent-glow: rgba(224, 64, 251, 0.3);
  --text-primary: #f5f5f5;
  --text-secondary: #b0b0b0;
  --text-muted: #6b6b8d;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --page-pad: 12px;
  --header-h: 56px;
  --picker-h: 44px;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.layout-container {
  width: min(1400px, calc(100% - var(--page-pad) * 2));
  margin: 0 auto;
}

/* ===== HEADER (mobile base) ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--bg-primary) 0%, rgba(13, 13, 13, 0.97) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(224, 64, 251, 0.1);
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  min-height: var(--header-h);
  justify-content: center;
  gap: 12px;
}

.month-picker {
  position: sticky;
  top: var(--header-h);
  z-index: 95;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
  background: rgba(13, 13, 13, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.month-picker::-webkit-scrollbar {
  display: none;
}

.month-picker-btn {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.month-picker-btn:hover {
  border-color: rgba(224, 64, 251, 0.45);
  color: var(--text-primary);
}

.month-picker-btn.active {
  background: rgba(224, 64, 251, 0.2);
  border-color: rgba(224, 64, 251, 0.55);
  color: #fff;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

/* ===== MAIN CONTENT (mobile base) ===== */
.main {
  padding: 20px 0 60px;
}

/* ===== MONTH SECTION ===== */
.month-section {
  margin-bottom: 32px;
  scroll-margin-top: calc(var(--header-h) + var(--picker-h) + 16px);
}

.month-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.month-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.month-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== MOVIE GRID (mobile base — 2 columns) ===== */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* ===== MOVIE CARD ===== */
.movie-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.04);
  -webkit-tap-highlight-color: transparent;
}

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

.movie-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.movie-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  font-size: 36px;
}

.rating-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 18px rgba(0, 0, 0, 0.28);
}

.rating-badge.like {
  background: rgba(130, 177, 255, 0.13);
}

.rating-badge.love {
  background: rgba(224, 64, 251, 0.13);
}

.rating-badge.not-sure {
  background: rgba(255, 214, 102, 0.13);
}

/* Hover overlay */
.movie-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 60px 14px 14px;
  background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 60%, transparent 100%);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.movie-overlay-title {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-secondary);
}

/* Card info below poster */
.movie-info {
  padding: 8px 8px 10px;
}

.movie-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.movie-year {
  font-size: 11px;
  color: var(--text-muted);
}

.movie-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

.type-badge.movie {
  background: rgba(224, 64, 251, 0.16);
  border: 1px solid rgba(224, 64, 251, 0.35);
  color: var(--accent-soft);
}

.type-badge.series {
  background: rgba(130, 177, 255, 0.16);
  border: 1px solid rgba(130, 177, 255, 0.35);
  color: #a5c9ff;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 16px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state-text {
  font-size: 16px;
  font-weight: 500;
}

/* ===== FOOTER ===== */
.footer {
  padding: 24px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.footer-inner {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.footer a {
  color: var(--accent-soft);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
}

/* ===== SCROLLBAR (desktop) ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(224, 64, 251, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ====================================================================
   BREAKPOINT: SMALL TABLET (≥480px)
   ==================================================================== */
@media (min-width: 480px) {
  :root {
    --page-pad: 16px;
  }

  .movie-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .movie-title {
    font-size: 13px;
  }

  .movie-info {
    padding: 10px 10px 12px;
  }

  .month-title {
    font-size: 20px;
  }
}

/* ====================================================================
   BREAKPOINT: TABLET (≥768px)
   ==================================================================== */
@media (min-width: 768px) {
  :root {
    --page-pad: 24px;
    --radius: 12px;
    --radius-sm: 8px;
    --header-h: 64px;
    --picker-h: 48px;
  }

  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    min-height: var(--header-h);
    gap: 16px;
  }

  .month-picker {
    padding: 9px 0;
  }

  .month-picker-btn {
    font-size: 13px;
    padding: 7px 14px;
  }

  .logo-text {
    font-size: 20px;
  }

  .logo-icon {
    font-size: 26px;
  }

  .main {
    padding: 28px var(--page-pad) 70px;
  }

  .month-section {
    margin-bottom: 40px;
  }

  .month-title {
    font-size: 22px;
  }

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

  .movie-info {
    padding: 10px 12px 14px;
  }

  .movie-title {
    font-size: 13px;
  }

  .movie-poster-placeholder {
    font-size: 44px;
  }

  .footer {
    padding: 28px 0;
  }

  .footer-inner {
    font-size: 13px;
  }
}

/* ====================================================================
   BREAKPOINT: DESKTOP (≥1024px)
   ==================================================================== */
@media (min-width: 1024px) {
  :root {
    --page-pad: 40px;
    --header-h: 72px;
    --picker-h: 50px;
  }

  .header {
    padding: 0;
  }

  .header-inner {
    min-height: var(--header-h);
  }

  .logo-text {
    font-size: 22px;
  }

  .logo-icon {
    font-size: 28px;
  }

  .main {
    padding: 32px 0 80px;
  }

  .month-section {
    margin-bottom: 48px;
  }

  .month-title {
    font-size: 24px;
  }

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

  .movie-info {
    padding: 12px 14px 16px;
  }

  .movie-title {
    font-size: 14px;
  }

  .movie-poster-placeholder {
    font-size: 48px;
  }

  /* Enable hover effects only on desktop (pointer device) */
  .movie-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow), 0 0 40px var(--accent-glow);
    border-color: rgba(224, 64, 251, 0.2);
    z-index: 10;
  }

  .movie-card:hover .movie-poster {
    transform: scale(1.08);
    filter: brightness(0.7);
  }

  .movie-card:hover .movie-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .empty-state {
    padding: 80px 20px;
  }

  .empty-state-icon {
    font-size: 64px;
  }

  .empty-state-text {
    font-size: 18px;
  }

  .footer {
    padding: 32px 0;
  }

  .footer-inner {
    font-size: 13px;
  }
}

/* ====================================================================
   BREAKPOINT: WIDE DESKTOP (≥1400px)
   ==================================================================== */
@media (min-width: 1400px) {
  .movie-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.movie-card {
  animation: fadeInUp 0.5s ease backwards;
}

.movie-card:nth-child(1) { animation-delay: 0s; }
.movie-card:nth-child(2) { animation-delay: 0.05s; }
.movie-card:nth-child(3) { animation-delay: 0.1s; }
.movie-card:nth-child(4) { animation-delay: 0.15s; }
.movie-card:nth-child(5) { animation-delay: 0.2s; }
.movie-card:nth-child(6) { animation-delay: 0.25s; }

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
