body {
  background-color: #f9f9f9;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

header {
  background: linear-gradient(to right, #0066ff, #00ccff);
  color: white;
  padding: 25px 15px;
  text-align: center;
  border-radius: 0 0 20px 20px;
}

.mission {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
}

.filters {
  margin-bottom: 20px;
}

.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}
/* Base Novel Card Setup */
.novel {
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 15px;
  display: grid;
  grid-template-rows: 350px auto 90px auto; /* Image fixed, metadata auto, description fixed, links auto */
  gap: 10px; /* Space between major sections */
  
  /* CRITICAL for z-index hierarchy and pop-out effect */
  position: relative;
  z-index: 1;
  transition: transform 0.2s, box-shadow 0.2s;
}

.novel:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.novel img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  border-radius: 5px;
}

.novel-metadata {
  display: flex;
  flex-direction: column;
  gap: 2px; /* Tight spacing between metadata items */
}

.novel-metadata h5 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  /* No clamping or overflow - let it wrap naturally */
}

.novel-metadata p {
  margin: 0;
  font-size: 0.9rem;
  /* No overflow hidden or nowrap - allow full display and wrapping */
}

.novel-metadata p:nth-child(4) { /* Genres p - allow wrapping for badges */
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: flex-start;
}

.novel-metadata p:nth-child(4) .badge {
  margin: 0; /* Tighten badge spacing */
}

.description-wrapper {
  margin: 0;
  position: relative; /* Ensure relative for absolute child positioning */
}

.description-container {
  height: 90px;
  overflow: hidden;
  position: relative;
}


.description-container::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px; /* Increased slightly to better cover under button */
  background: linear-gradient(to top, white 60%, rgba(255, 255, 255, 0));
  pointer-events: none; /* Allow clicks through gradient if needed */
}

.description-container .read-more-modal {
  position: absolute;
  bottom: 5px; /* Position above bottom for visibility over gradient */
  left: 0; /* Or 'right: 0;' for right-align */
  z-index: 2; /* Ensure above gradient */
  background: white; /* Optional: white bg to stand out over gradient */
  padding: 0 5px; /* Optional: light padding for readability */
}

.links a,
.links .btn-group,
.links .dropdown {
  margin: 3px 3px 0 0;
  font-size: 0.85rem;
  display: inline-block;
}

.admin-link {
  color: #d9534f;
}

.novel.active-volume {
  z-index: 9999;
  transform: translateY(-10px); /* Increased lift for more pop */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4); /* Stronger, deeper shadow */
}

.volume-list-container {
  position: relative;
  display: inline-block;
}

.volume-list-popup {
  position: absolute;
  top: 100%; /* Changed to pop below the button */
  left: 0; /* Align left for better fit in card */
  right: auto; /* Override previous right: 0 */

  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 300px;
  max-height: 400px;
  overflow-y: auto;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px); /* Start slightly above for slide-down effect */
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.volume-list-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.volume-list-popup .list-header {
  font-weight: bold;
  margin-bottom: 5px;
  color: #495057;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
  padding-top: 5px;
}

.volume-list-popup .volume-item {
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.volume-list-popup .volume-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.volume-list-popup .volume-title {
  font-size: 0.9em;
  margin-top: 0;
  margin-bottom: 5px;
  font-weight: 600;
}
