/* ==================== Livres ==================== */
.books-section {
  padding: 2rem 0 5rem;
}

.books-layout {
  display: flex;
  gap: 2rem;
}

.books-main {
  flex: 3;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.book-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
  border: 1px solid rgba(202, 138, 16, 0.08);
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 32px rgba(202, 138, 16, 0.16);
  border-color: rgba(202, 138, 16, 0.2);
}

.book-image {
  height: 200px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.book-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.book-card:hover .book-image::after {
  opacity: 1;
}

.book-info {
  padding: 1rem;
}

.book-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.page-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: #ca8a10;
}

.book-author,
.book-date {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0.1rem 0;
}

.btn-download {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background-color: #037f2c;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 0.5rem;
}

.badge.coming-soon {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  background: #f59e0b;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* Sidebar */
.books-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.search-box {
  background: #fff;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.search-box input {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.recent-books {
  background-color: white;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 5rem;
}

.recent-books h4 {
  margin-bottom: 1rem;
  font-weight: 600;
}

.recent-books ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-books li {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.recent-books li img {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
}

.book-info h5 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.book-info p {
  margin: 0;
  font-size: 0.85rem;
  color: #555;
}

.book-info .book-date {
  font-size: 0.8rem;
  color: #888;
}

/* Pagination */
.pagination {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 5rem;
}

.page-btn {
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  background: #e5e7eb;
  cursor: pointer;
  transition: 0.2s;
  margin-top: 2rem;
}

.page-btn:hover {
  background: #d1d5db;
}

.page-btn.active {
  background: #1976d2;
  color: #fff;
}

.dots {
  padding: 0.4rem 0.8rem;
  display: inline-block;
  font-weight: 600;
  color: #6b7280;
}

/* ==================== Commentaires ==================== */
.comments-section {
  margin-top: 1rem;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 8px;
}

.comments-section.hidden {
  display: none;
}

.comments-list {
  margin-bottom: 1rem;
}

.comment {
  padding: 16px;
  border-bottom: 1px solid #e5e5e5;
  position: relative;
}

.reply-comment {
  margin-left: 48px;
  padding: 12px;
  background-color: #f8f9fa;
  border-left: 2px solid #e5e7eb;
}

.comment-actions {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.btn-toggle-replies {
  color: #065fd4;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 18px;
}

.btn-toggle-replies:hover {
  background-color: #f0f7ff;
}

.toggle-icon {
  transition: transform 0.2s ease;
}

.replies {
  margin-top: 0.5rem;
  margin-left: 24px;
  padding-left: 24px;
  border-left: 2px solid #e5e7eb;
  transition: all 0.3s ease;
}

.replies.hidden {
  display: none;
}

.reply-form {
  margin: 16px 0;
  padding: 16px;
  background-color: #f9f9f9;
  border-radius: 8px;
}

.reply-form.hidden {
  display: none;
}

.reply-form form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Formulaire commentaire */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
}

.comment-form textarea {
  resize: vertical;
  min-height: 60px;
}

.comment-form button {
  align-self: flex-start;
  padding: 0.4rem 0.8rem;
  border: none;
  border-radius: 6px;
  background-color: #1976d2;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.comment-form button:hover {
  background-color: #115293;
}

/* Boutons commentaires */
.btn-comments {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.3rem 0.6rem;
  background-color: #f59e0b;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: 0.2s;
}

.btn-comments:hover {
  background-color: #d97706;
}

.btn-reply {
  background-color: #5ab35d;   /* Vert */
  color: white;
  border: none;
  padding: 6px 12px;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  margin-right: 5px;
}

.btn-reply:hover {
  background-color: #45a049;
  text-decoration: none;
  transform: translateY(-2px);
  color: white;
}

/* ==================== Modals ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  z-index: 1000;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90%;
  overflow-y: auto;
  z-index: 1001;
  opacity: 0;
  transition: 0.3s;
}

.modal.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-content {
  padding: 1rem;
}

.full-book-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Reply form */
.reply-form {
  margin-top: 0.5rem;
}

.reply-form.hidden {
  display: none;
}

/* Conteneur du formulaire de réponse */
.reply-form {
  margin: 10px 0 15px 20px; /* décalé pour montrer que c’est une réponse */
  padding: 12px;
  border-left: 3px solid #5ab35d; /* petite barre verte pour indiquer la réponse */
  background-color: #f9f9f9;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Inputs et textarea */
.reply-form input[type="text"],
.reply-form input[type="email"],
.reply-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.reply-form input:focus,
.reply-form textarea:focus {
  border-color: #5ab35d;
  outline: none;
}

/* Zone de texte plus petite que le commentaire principal */
.reply-form textarea {
  min-height: 60px;
  resize: vertical;
}

/* Boutons du formulaire */
.reply-form .form-actions {
  display: flex;
  gap: 10px;
  margin-top: 5px;
}

.reply-form .btn-submit {
  background-color: #5ab35d;
  color: white;
  border: none;
  padding: 6px 14px;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.reply-form .btn-submit:hover {
  background-color: #45a049;
  transform: translateY(-2px);
}

.reply-form .btn-cancel {
  background-color: #ccc;
  color: #333;
  border: none;
  padding: 6px 14px;
  font-size: 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.reply-form .btn-cancel:hover {
  background-color: #999;
  transform: translateY(-2px);
}

/* Masquer le formulaire par défaut */
.reply-form.hidden {
  display: none;
}


.replies {
  margin-top: 0.5rem;
}

.replies.hidden {
  display: none;
}

/* Responsive */
@media(max-width:1024px) {
  .books-layout {
    flex-direction: column;
  }

  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media(max-width:640px) {
  .books-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Modals et Commentaires pour Livres ==================== */

/* Overlay modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-height: 90vh;
  overflow-y: auto;
}

.modal.active,
.modal-overlay.active {
  display: block;
}

/* Header modal */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: #6b7280;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #374151;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
}

/* Contenu modal description */
.modal-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.description-image {
  text-align: center;
  background: #f9fafb;
  padding: 1rem;
  border-radius: 8px;
}

.full-book-image {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.description-text {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 8px;
}

.description-text h4 {
  margin: 0 0 1rem 0;
  color: #1f2937;
  font-size: 1.2rem;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.description-text p {
  color: #4b5563;
  line-height: 1.6;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.description-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.description-meta p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  color: #6b7280;
}

.description-meta strong {
  color: #374151;
}

/* Formulaire commentaire */
.comment-form {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  margin-bottom: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-submit {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-submit:hover {
  background: #1d4ed8;
}

.btn-description {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 0.5rem;
  margin-right: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-description:hover {
  background-color: #1d4ed8;
}

.comments-list {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid #e2e8f0;
}

.comments-title {
  font-size: 1.1rem;
  color: #1f2937;
  margin-bottom: 1rem;
  font-weight: 600;
}

.comment {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  animation: fadeIn 0.3s ease-out;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.comment-author {
  font-weight: 600;
  color: #2563eb;
  font-size: 1rem;
}

.comment-date {
  font-size: 0.85rem;
  color: #6b7280;
}

.comment-text {
  color: #4b5563;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width:1024px) {
  .modal {
    max-width: 600px;
  }

  .modal-content {
    flex-direction: column;
  }
}

@media (max-width:640px) {
  .modal {
    padding: 1.5rem;
    max-width: 95%;
  }

  .comment-form {
    padding: 1rem;
  }

  .comment {
    padding: 1rem;
  }

  .description-text {
    padding: 1rem;
  }
}

