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

body {
  font-family: "Segoe UI", sans-serif;
  background: #f9f9f9;
  color: #333;
}

header {
  background: #fff;
  padding: 1rem 2rem;
  border-bottom: 1px solid #eee;
}

header h1 {
  font-size: 1.5rem;
}

main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Controls */
#controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

#controls input,
#controls select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
}

#controls input {
  flex: 1;
  min-width: 200px;
}

#controls button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  background: #333;
  color: #fff;
}

#controls button:hover {
  background: #555;
}

/* Series grid */
#series-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
}

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

.card-body {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.card-body h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body p {
  font-size: 0.8rem;
  color: #666;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.card-actions button {
  flex: 1;
  padding: 0.4rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-edit {
  background: #f0f0f0;
  color: #333;
}

.btn-delete {
  background: #ffe0e0;
  color: #c00;
}

/* Pagination */
#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

#pagination button {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

#pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modal */
#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #666;
}

#series-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#series-form label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

#series-form input,
#series-form select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

#series-form button[type="submit"] {
  margin-top: 0.75rem;
  padding: 0.6rem;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

#rating-section {
  margin-top: 1rem;
}

#rating-section h3 {
  margin: 0.75rem 0 0.5rem;
  font-size: 0.95rem;
}

#rating-section input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  width: 100%;
  font-size: 0.9rem;
}

#rating-section button {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

hr {
  border: none;
  border-top: 1px solid #eee;
  margin: 1rem 0;
}