@import url("https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Playfair+Display:wght@400;700&family=Quicksand:wght@300;400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Abril+Fatface&display=swap");

:root {
  --bg-color: #fdfdfd;
  --text-main: #555555;

  --baby-pink: #ff9a9e;
  --baby-blue: #a1c4fd;

  --card-bg: #ffffff;
  --shadow-soft: 0 10px 30px rgba(161, 196, 253, 0.2);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: "Quicksand", sans-serif;
  line-height: 1.6;
  padding: 40px 20px;
  background-image: linear-gradient(to bottom right, #fff5f5, #f0f8ff);
  min-height: 100vh;
}

header {
  text-align: center;
  margin-bottom: 50px;
}

h1 {
  font-family: "Abril Fatface", serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 10px;
  font-style: italic;
}

h1::after {
  content: "";
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(to right, var(--baby-pink), var(--baby-blue));
  margin: 15px auto 0;
  border-radius: 10px;
}

.search-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 60px;
}

input {
  padding: 15px 25px;
  font-size: 1rem;
  border: 2px solid #f0f0f0;
  border-radius: 50px;
  width: 350px;
  font-family: "Quicksand", sans-serif;
  transition: all 0.3s ease;
  background-color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.02);
}

input:focus {
  outline: none;
  border-color: var(--baby-blue);
  box-shadow: 0 5px 20px rgba(161, 196, 253, 0.3);
}

button {
  background: linear-gradient(
    45deg,
    var(--baby-pink) 0%,
    var(--baby-blue) 100%
  );
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 5px 15px rgba(255, 154, 158, 0.4);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  text-transform: uppercase;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(161, 196, 253, 0.5);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.book-card {
  background-color: var(--card-bg);
  padding: 20px;
  border-radius: 25px;
  box-shadow: var(--shadow-soft);
  text-align: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  position: relative;
  top: 0;
}

.book-card:hover {
  top: -10px;
  border-color: #ffd1d4;
}

.book-card img {
  width: 128px;
  height: 192px;
  object-fit: cover;
  border-radius: 10px;
  border: 4px solid white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
}

.book-card h3 {
  font-family: "Playfair Display", serif;
  font-size: 1.1rem;
  margin-bottom: 5px;
  color: #444;
}

.book-card p {
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
}

.book-card button {
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 15px;
  width: auto;
  box-shadow: none;
  border: 1px solid transparent;
}

.btn-plan {
  background: white;
  color: var(--baby-blue);
  border: 1px solid var(--baby-blue) !important;
}

.btn-plan:hover {
  background: var(--baby-blue);
  color: white;
}

.btn-read {
  background: white;
  color: var(--baby-pink);
  border: 1px solid var(--baby-pink) !important;
}

.btn-read:hover {
  background: var(--baby-pink);
  color: white;
}

.hidden {
  display: none !important;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.nav-btn {
  background: white;
  color: var(--text-main);
  border: 2px solid transparent;
  padding: 10px 25px;
  border-radius: 50px;
  cursor: pointer;
  font-family: "Quicksand", sans-serif;
  font-weight: 600;
  transition: all 0.3s ease;
}

.nav-btn.active {
  background: linear-gradient(45deg, var(--baby-pink), var(--baby-blue));
  color: white;
  box-shadow: 0 5px 15px rgba(161, 196, 253, 0.4);
}

#view-library h2 {
  text-align: center;
  font-family: "Playfair Display", serif;
  margin-bottom: 30px;
  color: var(--text-main);
}

.btn-delete {
  background: transparent;
  color: #a0a0a0;
  border: 1px solid #e0e0e0 !important;
  font-size: 0.8rem;
  padding: 8px 15px;
  border-radius: 15px;
  margin-top: 5px;
  width: auto;
  box-shadow: none;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: #f5f5f5;
  color: #555555;
  border-color: #d0d0d0 !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}

.filter-container {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
}

.filter-btn {
  background-image: none !important;
  background-color: #f5f5f5 !important;

  color: #666 !important;
  border: 1px solid #e0e0e0 !important;

  padding: 10px 25px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Quicksand", sans-serif;
  transition: all 0.3s ease;
  box-shadow: none !important;
}

.filter-btn:hover {
  background-color: #e8e8e8 !important;
  color: #333 !important;
  transform: translateY(-2px);
}

#filter-all.active {
  background-image: linear-gradient(
    45deg,
    var(--baby-pink),
    var(--baby-blue)
  ) !important;
  background-color: transparent !important;
  color: white !important;
  border: 1px solid transparent !important;
  box-shadow: 0 5px 15px rgba(161, 196, 253, 0.4) !important;
}

#filter-planned.active {
  background-image: none !important;
  background-color: var(--baby-blue) !important;
  color: white !important;
  border: 1px solid var(--baby-blue) !important;
  box-shadow: 0 5px 15px rgba(161, 196, 253, 0.4) !important;
}

#filter-read.active {
  background-image: none !important;
  background-color: var(--baby-pink) !important;
  color: white !important;
  border: 1px solid var(--baby-pink) !important;
  box-shadow: 0 5px 15px rgba(255, 154, 158, 0.4) !important;
}

.input-group {
  margin-top: 15px;
  text-align: left;
}

.input-group label {
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--text-main);
  display: block;
  margin-bottom: 5px;
}

textarea {
  width: 100%;
  height: 80px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-family: "Quicksand", sans-serif;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--baby-blue);
}

.star-rating-container {
  font-size: 2rem;
  color: #e0e0e0;
  cursor: pointer;
  margin: 10px 0;
}

.star {
  transition: color 0.2s;
}

.star:hover,
.star.gold {
  color: #ffd700;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  width: 90%;
  max-width: 500px;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.btn-cancel {
  background: #f0f0f0;
  color: #555;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
}

.btn-confirm {
  background: var(--baby-blue);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(161, 196, 253, 0.4);
}

.stats-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.stat-box {
  background: white;
  padding: 15px 25px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  text-align: center;
  border: 1px solid #f0f0f0;
  min-width: 120px;
}

.stat-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: "Playfair Display", serif;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.author-link {
  color: #888;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.author-link:hover {
  color: var(--baby-pink);
  text-decoration: underline;
  color: #555;
}

/* --- RESPONSIVE MOBILE OPTIMIZATION --- */

@media (max-width: 768px) {
  body {
    padding: 20px 10px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .main-nav {
    flex-direction: column;
    gap: 10px;
  }

  .nav-btn {
    width: 100%;
    text-align: center;
  }

  .search-container {
    flex-direction: column;
    align-items: center;
  }

  input {
    width: 100%;
  }

  #search-btn {
    width: 100%;
    margin-top: 10px;
  }

  .filter-container {
    flex-wrap: wrap;
  }

  .filter-btn {
    flex: 1 1 auto;
    font-size: 0.8rem;
    padding: 8px 15px;
  }

  .stat-box {
    min-width: 80px;
    padding: 10px;
  }

  .stat-number {
    font-size: 1.4rem;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
    margin: 10px;
  }
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 20px;
    border-top: 1px solid #eee;
    color: #aaa;
}

.backup-title {
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.btn-backup {
    background: #f9f9f9;
    color: #666;
    padding: 5px 10px;
    font-size: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-backup:hover {
    background: #eee;
    color: #333;
}

#btn-import-trigger {
    margin-left: 5px;
}