/* Base Reset and Mobile Scaling */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #111;
  line-height: 1.6;
  font-size: 16px;
}

h1, h2, h3 {
  text-align: center;
  margin-top: 1rem;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 1rem;
}

/* Navigation / Footer Buttons */
.nav, .footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem;
}

.nav a, .footer a {
  text-decoration: none;
  background: #007bff;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.nav a:hover, .footer a:hover {
  background: #0056b3;
}

/* Editor Section */
.editor-wrapper {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin-top: 2rem;
}

#editor {
  flex: 2;
  min-height: 400px;
  padding: 1rem;
  border: 2px solid #ccc;
  background: white;
  outline: none;
  white-space: pre-wrap;
  overflow-y: auto;
}

/* Suggestions Sidebar */
#grammar-suggestions {
  flex: 1;
  max-height: 400px;
  overflow-y: auto;
  border: 2px solid #ddd;
  padding: 0.75rem;
  background: #fafafa;
}

.suggestion {
  padding: 0.5rem;
  border-bottom: 1px solid #ddd;
  font-size: 14px;
}

/* Error Underlines */
.error-word {
  text-decoration: underline red wavy;
  cursor: help;
}

/* Book Cards */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.book-card {
  background: white;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: box-shadow 0.2s ease-in-out;
}

.book-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.book-card img {
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

/* Login / Admin Forms */
form {
  max-width: 400px;
  margin: 2rem auto;
  padding: 1rem;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
}

input, textarea, select, button {
  width: 100%;
  margin: 0.5rem 0;
  padding: 0.7rem;
  font-size: 1rem;
}

button {
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background: #0056b3;
}

/* Chapter Reader */
.chapter-view {
  max-width: 800px;
  margin: auto;
  padding: 2rem;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .editor-wrapper {
    flex-direction: column;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
