*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

/* Layout */
.site-header {
  background: #ffffff;
  color: #333;
  padding: 1rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.logo-img {
  height: 40px;
  width: auto;
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: #333;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: #555;
  text-decoration: none;
}

.nav-links a:hover {
  color: #1a73e8;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #1a73e8;
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary:hover {
  background: #1557b0;
}

.btn-secondary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #e8eaed;
  color: #333;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #dadce0;
}

.btn-danger {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #dc3545;
  color: white;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
}

.btn-danger:hover {
  background: #c82333;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* AI Parse */
.ai-parse-group {
  background: #f8f9ff;
  border: 1px solid #d0d8ff;
  border-radius: 8px;
  padding: 1rem;
}

.ai-parse-group textarea.form-control {
  min-height: 60px;
}

.ai-parse-actions {
  margin-top: 0.5rem;
}

.ai-parse-status {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  min-height: 1.4em;
}

.ai-parse-loading {
  color: #555;
}

.ai-parse-success {
  color: #137333;
}

.ai-parse-error {
  color: #c5221f;
}

/* Search */
.search-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  max-width: 600px;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

/* Movie Grid */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.movie-card a {
  text-decoration: none;
  color: inherit;
}

.movie-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.movie-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #e0e0e0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
}

.movie-info {
  padding: 0.75rem 0;
}

.movie-title {
  font-weight: 600;
  display: block;
}

.movie-year {
  color: #666;
}

/* Movie Detail */
.movie-page .movie-header {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
}

.movie-poster-large {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.movie-poster-large-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #e0e0e0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
}

.movie-details h1 {
  margin-top: 0;
}

.original-title {
  color: #666;
  font-style: italic;
}

.runtime, .rating {
  color: #666;
}

.overview {
  line-height: 1.7;
  max-width: 600px;
}

/* Release Form */
.release-form-page {
  max-width: 600px;
}

/* Collection */
.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.collection-header h1 {
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

.release-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}

.release-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.release-card > a {
  text-decoration: none;
  color: inherit;
}

.release-card > a:hover .release-poster {
  opacity: 0.9;
}

.release-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.release-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
}

.release-info {
  padding: 0.75rem;
}

.release-title {
  font-weight: 600;
  display: block;
  font-size: 0.9rem;
}

.release-year {
  color: #666;
  font-size: 0.85rem;
}

.release-format {
  display: inline-block;
  background: #e8f0fe;
  color: #1a73e8;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.4rem;
}

.release-edition {
  display: inline-block;
  background: #fef3e8;
  color: #e37400;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.4rem;
  margin-left: 0.3rem;
}

/* Delete form */
.delete-form {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #ddd;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #666;
}

/* Landing */
.landing-page {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.landing-page h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.landing-page p {
  font-size: 1.125rem;
  color: #666;
  margin-bottom: 2rem;
}

/* Collections List */
.collections-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.collection-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.collection-card a {
  text-decoration: none;
  color: inherit;
}

.collection-name {
  font-size: 1.125rem;
  font-weight: 600;
}

.collection-description {
  color: #666;
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}

/* Media type badge */
.media-type-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #e3f2fd;
  color: #1565c0;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  margin-left: 0.5rem;
}

/* TV Series Page */
.tv-series-page .season-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.season-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.season-card a {
  text-decoration: none;
  color: inherit;
}

.season-poster {
  width: 100%;
  border-radius: 6px;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.season-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #e0e0e0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 0.875rem;
}

.season-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.season-name {
  font-weight: 600;
}

.season-year {
  color: #666;
}

.season-episodes {
  color: #888;
  font-size: 0.875rem;
}

/* Box Set Page */
.box-set-page .movie-grid {
  margin-top: 1rem;
}

/* Shelf badge */
.shelf-badge {
  border: 1px solid transparent;
}

/* Shelves page */
.shelves-page {
  max-width: 700px;
}

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

.shelves-header h1 {
  margin: 0;
}

.shelves-form-wrap {
  background: #f8f9ff;
  border: 1px solid #d0d8ff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.shelves-form-wrap h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.shelf-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: end;
}

.shelves-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.shelf-item {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.shelf-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.1);
}

.shelf-name {
  font-weight: 500;
  flex: 1;
}

.shelf-edit-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.shelf-edit-form .form-control {
  width: auto;
}

.shelf-delete-form {
  margin-left: 0.5rem;
}

.color-input {
  padding: 0.25rem;
  width: 60px;
  height: 40px;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  /* drop the wordmark on narrow screens; the mascot carries the brand */
  .logo-text {
    display: none;
  }

  .movie-page .movie-header {
    grid-template-columns: 1fr;
  }

  .collection-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
