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


body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f7fa;
  color: #1f2937;
  line-height: 1.6;
  padding: 2rem;
}


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

h1 {
  font-size: 2rem;
  font-weight: 600;
}


button {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

#new-book-btn {
  background-color: #2563eb;
  color: white;
}

.toggle-btn {
  background-color: #10b981;
  color: white;
}

.remove-btn {
  background-color: #ef4444;
  color: white;
}


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


.book-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.book-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}


.status.read {
  color: #10b981;
  font-weight: 600;
}

.status.not-read {
  color: #ef4444;
  font-weight: 600;
}


dialog {
  border: none;
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;

  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

dialog[open] {
  animation: fadeIn 0.2s ease-out;
}


#book-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#book-form input[type="text"],
#book-form input[type="number"] {
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
}

#book-form input:focus {
  outline: none;
  border-color: #2563eb;
}

#book-form button[type="submit"] {
  background-color: #2563eb;
  color: white;
}

#close-dialog {
  background-color: #9ca3af;
  color: white;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem;
  }

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

  dialog {
    width: 95%;
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  h1 {
    font-size: 2.25rem;
  }

  #library {
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  body {
    max-width: 1200px;
    margin: 0 auto;
  }

  dialog {
    max-width: 450px;
  }
}