/*
 * This is a manifest file that'll be compiled into application.css.
 */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 300px);
  gap: 40px;
  margin-top: 20px;
  justify-content: center;
}

.book-cover-item {
  width: 300px;
  height: 450px;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.book-cover-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chapter-page {
  background-color: #fff;
  border: 1px solid #ddd;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 300px;
  height: 450px;
  overflow: hidden;
  text-align: center;
}

.chapter-page h3 {
  margin: 0;
  font-family: 'Lora', serif;
  font-size: 1.5rem;
}

.add-chapter-button {
  border-style: dashed;
  border-width: 2px;
  color: #ccc;
  transition: all 0.2s ease-in-out;
}

.add-chapter-button:hover {
  background-color: #f9f9f9;
  color: #aaa;
  border-color: #aaa;
}

.add-chapter-button span {
  font-size: 5rem;
  font-weight: 100;
}

.add-book-button {
  display: flex;
  justify-content: center;
  align-items: center;
  border-style: dashed;
  border-width: 2px;
  color: #ccc;
  transition: all 0.2s ease-in-out;
}

.add-book-button:hover {
  background-color: #f9f9f9;
  color: #aaa;
  border-color: #aaa;
}

.add-book-button span {
  font-size: 5rem;
  font-weight: 100;
}


.chapter-page p {
  font-size: 16px;
  color: #555;
  line-height: 1.5;
  overflow: hidden;
  flex-grow: 1;
}


/* app/assets/stylesheets/components/_buttons.css */
.btn {
  display: inline-block;
  padding: 10px 15px;
  border-radius: 5px;
  text-decoration: none !important;
  font-weight: bold;
  transition: background-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary {
  background-color: #007bff;
  color: white;
  border: 1px solid #007bff;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
  border: 1px solid #6c757d;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-ghost {
  background-color: transparent;
  color: #007bff;
  border: 1px solid #007bff;
}

.btn-ghost:hover {
  background-color: #007bff;
  color: white;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  border: 1px solid #dc3545;
}

.btn-danger:hover {
  background-color: #c82333;
}

/* app/assets/stylesheets/components/_cards.css */
.card {
  background-color: #ffffff;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-5px);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e7e7e7;
}

.card-header h1,
.card-header h2,
.card-header h3 {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 0;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1.5rem;
  border-top: 1px solid #e7e7e7;
  background-color: #f8f9fa;
}

/* Universal Box Sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Basic styles for the application */
body {
  font-family: "Montserrat", sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f4f4f4;
  margin: 0;
}

.chapter-content,
.book-card p,
.book-item p,
textarea.form-control {
  font-family: "Lora", serif;
}

.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles */
.app-header {
  background-color: #fff;
  border-bottom: 1px solid #e7e7e7;
  padding: 1rem 0;
}

.app-header .container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.app-header .logo {
  text-align: center;
}

.app-header .user-session {
  position: absolute;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header .user-session .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  /* Adjust padding for icon-only buttons */
}

.app-header .user-session .icon {
  width: 20px;
  height: 20px;
}

/* Icon Sizes */
.size-4 {
  width: 1rem;
  height: 1rem;
}

.size-5 {
  width: 1.25rem;
  height: 1.25rem;
}

.size-6 {
  width: 1.5rem;
  height: 1.5rem;
}

.app-header .logo a {
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
  text-decoration: none;
}

.app-header .main-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.app-header .main-nav a {
  color: #555;
  text-decoration: none;
  font-weight: 500;
}

.app-header .main-nav a:hover {
  color: #007bff;
}

/* Footer Styles */
.app-footer {
  background-color: #343a40;
  color: #fff;
  padding: 2rem 0;
  margin-top: 4rem;
}

.app-footer p {
  margin: 0;
  text-align: center;
  color: #adb5bd;
}

a {
  color: #007bff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Books Page Styles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 1rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: bold;
  margin: 0;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.book-card {
  padding: 0;
  overflow: hidden;
  /* Ensures the image respects the border-radius */
}

.book-card__image {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.2s ease-in-out;
}

.book-card:hover .book-card__image {
  transform: scale(1.05);
}

.book-card__content {
  padding: 1.5rem;
}

.book-card h2 {
  font-size: 1.5rem;
  font-weight: bold;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.book-card p {
  color: #6c757d;
  margin-bottom: 1rem;
}

.book-cover-show {
  max-width: 300px;
  height: auto;
  margin-top: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Book Show Page Styles */
.chapters-list {
  margin-top: 2rem;
}

.chapter-item {
  background-color: #f8f9fa;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease-in-out;
}

.chapter-item:hover {
  background-color: #e9ecef;
}

.chapter-item a {
  font-size: 1.25rem;
  font-weight: bold;
}

.reading-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 20px;
}

.reading-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.reading-header-start .back-link {
  font-weight: bold;
  color: #555;
}

.reading-header-end .admin-actions {
  display: flex;
  gap: 10px;
}

.reading-content {
  background-color: #fdfdfd;
  border: 1px solid #e0e0e0;
  padding: 40px 60px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.reading-content h1 {
  font-size: 2.5rem;
  font-family: 'Lora', serif;
  margin-bottom: 10px;
  text-align: center;
}

.chapter-meta {
  text-align: center;
  color: #888;
  margin-bottom: 40px;
}

.chapter-meta span {
  margin: 0 5px;
}

.chapter-body {
  font-family: 'Lora', serif;
  font-size: 1.2rem;
  line-height: 1.8;
  color: #333;
  word-wrap: break-word;
}

.chapter-body h2,
.chapter-body h3,
.chapter-body h4 {
  font-family: 'Montserrat', sans-serif;
  margin-top: 2em;
  margin-bottom: 1em;
}

.chapter-body p {
  margin-bottom: 1.5em;
}


/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 5px;
  font-size: 1rem;
}

.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 5px;
  font-size: 1rem;
  min-height: 400px;
  /* Adjust height as needed */
  resize: vertical;
}

.actions {
  margin-top: 2rem;
}



/* Books page styles */
.books-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.books-header h1 {
  font-size: 2em;
  margin: 0;
}

.book-item {
  border: 1px solid #ddd;
  padding: 15px;
  margin-bottom: 15px;
  border-radius: 5px;
  background-color: #fff;
}

.book-item h2 {
  font-size: 1.5em;
  margin-top: 0;
}

.book-item p {
  color: #555;
  margin-bottom: 10px;
}

/* Form Card Styles */
.form-card {
  margin-bottom: 2rem;
}

.form {
  padding: 1.5rem;
}

.form-label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 5px;
  font-size: 1rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

textarea.form-control {
  min-height: 400px;
  resize: vertical;
}

.preview-content {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 400px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e7e7e7;
}

/* Markdown Editor Styles */
.markdown-editor-container {
  display: flex;
  gap: 1.5rem;
}

.editor-pane,
.preview-pane {
  flex: 1;
  min-width: 0;
  /* Prevents overflow issues with flexbox */
}

/* Status Badge Styles */
.status-badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.375rem;
  color: #fff;
}

.status-draft {
  background-color: #6c757d;
}

.status-in-review {
  background-color: #ffc107;
  color: #000;
}

.status-published {
  background-color: #28a745;
}

@media (max-width: 768px) {
  .main-container {
    padding: 15px;
  }

  .container {
    padding-left: 15px;
    padding-right: 15px;
  }

  .card-body,
  .card-header,
  .card-footer,
  .form {
    padding: 1rem;
  }

  .reading-container {
    padding: 0 8px;
    margin-top: 20px;
    margin-bottom: 20px;
  }

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

  .reading-header-end {
    margin-left: 0;
    align-self: flex-start;
  }

  .reading-content {
    padding: 1rem 8px;
  }

  .reading-header-end .admin-actions {
    margin-right: 0;
    align-self: flex-start;
  }

  .reading-content h1 {
    font-size: 1.5rem;
  }

  .chapter-body {
    font-size: 1rem;
    line-height: 1.7;
  }

  .book-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    justify-items: center;
  }

  .book-cover-item,
  .chapter-page {
    width: 90%;
    max-width: 300px;
    height: auto;
    aspect-ratio: 2 / 3;
  }
}