:root {
  --primary-bg: #A8201A;
  --secondary-bg: #FFFFFF;
  --text-light: #F3F3F3;
  --text-primary: #2D2D2D;
  --accent: #EC9A29;
  --shadow: #2D2D2D;
  --card-bg: #f3f3f3;
  --transition: all 0.3s ease;
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--text-primary);
  font-size: 2rem;
  font-weight: 700;
}

.intro-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #FFFFFF, #F3F3F3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 1s ease-out;
}

.intro-pic {
  color: var(--accent);
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.8s ease-out forwards 0.3s;
}

.loading-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards 0.9s;
}

.loading-progress {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  animation: load 2s ease-in-out forwards 1s;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes load {
  0% {
    width: 0;
  }

  100% {
    width: 100%;
  }
}

body>*:not(.intro-animation) {
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.loaded>*:not(.intro-animation) {
  opacity: 1;
}

body.loaded .intro-animation {
  opacity: 0;
  pointer-events: none;
}

body {
  background: var(--primary-bg);
  position: relative;
  margin: 0;
  padding: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Inter', sans-serif;
  transition: background 0.5s ease;
  min-height: 100vh;
  box-sizing: border-box;
}

.container {
  min-height: 200px;
  width: 90%;
  max-width: 500px;
  background: var(--secondary-bg);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  margin: 20px auto;
}

.searchbox {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1;
  min-width: 250px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 2px solid #e1e1e1;
  background-color: white;
  color: var(--text-primary);
  font-size: 16px;
  transition: var(--transition);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(236, 154, 41, 0.2);
}

input[type="text"]::placeholder {
  color: #999;
}

#search-button {
  padding: 16px 24px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

#search-button:hover {
  background-color: #d48a20;
  transform: translateY(-2px);
}

#results-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.book-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  border: 1px solid #f0f0f0;
}

.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.book-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.book-card h3 {
  font-size: 0.95rem;
  margin: 8px 0;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card p {
  margin: 4px 0;
  font-size: 0.85rem;
  color: #666;
}

.book-card a {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  background-color: var(--accent);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.book-card a:hover {
  background-color: #d48a20;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  body {
    padding: 20px;
  }

  .container {
    width: 95%;
    padding: 20px;
    margin: 10px auto;
  }

  .searchbox {
    flex-direction: column;
    align-items: center;
  }

  input[type="text"] {
    min-width: unset;
    width: 100%;
  }

  #search-button {
    width: 100%;
  }

  #results-container {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 15px;
  }
}

.error-message {
  color: #A8201A;
  text-align: center;
  padding: 10px;
  background-color: #ffe6e6;
  border-radius: 8px;
  margin-top: 10px;
}