/* Need to write styling in here */
* {
  margin: 0;
  padding: 0;
}

/* Override Bootstrap font ONLY for forum */
.forum-page {
  font-family: 'Roboto Mono', monospace;
}

:root {
  --bs-body-font-family: 'Roboto Mono', monospace;
  --background-color: #F9F8F6;
  --text-color: #000000;
  --heading-color: #664930;
}

body {
  background: var(--background-color);
  color: var(--text-color);
  font-family: 'Roboto Mono', monospace;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--heading-color);
  /* Brown color for headings/titles */
  margin-top: 0;
}

a {
  color: var(--heading-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.forum-page img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Utility classes for visually hidden content (for accessibility if needed) */
.visually-hidden {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/*  Layout Structure  */
.container.forum-page {
  display: flex;
  flex-direction: row-reverse;
  /* sidebar on right */
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1em;
  gap: 2em;
  /* space between sidebar and main content */
}

main {
  flex: 1;
}

aside {
  width: 250px;
}
/*  Sidebar Styles  */
aside {
  background: #FFFFFFCC;
  /* semi-transparent white background for sidebar */
  padding: 1em;
  border: 1px solid #DDD;
  border-radius: 5px;
  font-family: 'Roboto Mono', monospace;
}

aside h2 {
  font-size: 1.2em;
  margin-bottom: 0.5em;
}

/* 
   SEARCH SIDEBAR
 */

.search-section {
  margin-top: 1.5rem;
}

.search-section h3 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
  color: #664930;
}

.search-options {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.search-section input[type="text"] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #cfc7be;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}

.search-btn {
  width: 100%;
  padding: 0.45rem;
  border-radius: 999px;
  border: none;
  background: #664930;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.search-btn:hover {
  background: #7a5a3f;
}


aside label {
  margin-right: 1em;
  font-size: 0.9em;
  color: #000;
}

#new-post-section {
  font-family: 'Roboto Mono', monospace;
}

/* New Post button in sidebar */
.new-post-btn {
  display: inline-block;
  width: 100%;
  background: var(--heading-color);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: 1em;
  align-items: center;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.new-post-btn:hover {
  background: #7a5a3f;
}

.post-text {
  white-space: pre-line;
  /*preserve line breaks*/
}

/* 
   CREATE NEW POST MODAL
 */

/* Overlay */
#new-post-section {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  /* toggled via JS */
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* Modal container */
#new-post-form-container {
  background: #ffffff;
  width: 100%;
  max-width: 460px;
  padding: 1.6rem;
  margin-top: 3rem;
  margin-bottom: 3rem;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  font-family: "Roboto Mono", monospace;
}

/* Title */
#new-post-form-container h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: #664930;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 1.4rem;
}


/* Form layout */
#new-post-form-container form {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

/* Labels */
#new-post-form-container label {
  font-size: 0.9rem;
  color: #333;
  font-weight: 500;
}

/* Inputs & textarea */
#new-post-form-container input[type="text"],
#new-post-form-container textarea,
#new-post-form-container select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border: 1px solid #cfc7be;
  font-size: 0.9rem;
  background: #faf9f7;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#new-post-form-container textarea {
  min-height: 90px;
  resize: vertical;
}

/* Focus states */
#new-post-form-container input:focus,
#new-post-form-container textarea:focus,
#new-post-form-container select:focus {
  outline: none;
  border-color: #664930;
  box-shadow: 0 0 0 2px rgba(102, 73, 48, 0.15);
}

/* File input */
#new-post-form-container input[type="file"] {
  font-size: 0.85rem;
  color: #333;
  gap: 0.2rem;
}

/* Submit button */
#new-post-form-container button[type="submit"] {
  margin-top: 0.2rem;
  align-self: center;
  padding: 0.7rem 2.2rem;
  border-radius: 999px;
  border: none;
  background: #664930;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease;
}

/*Cancel button */
.cancel-btn {
  margin-top: 1.5rem;
  align-self: center;
  padding: 0.7rem 4.9rem;
  border-radius: 999px;
  border: none;
  background: #FFF;
  color: #664930;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease;
}

.cancel-btn:hover {
  background: #e6e3df;
}

#new-post-form-container button[type="submit"]:hover {
  background: #7a5a3f;
  transform: translateY(-1px);
}

#new-post-form-container button[type="submit"]:active {
  transform: translateY(0);
}

/*  Forum Posts List Styles  */
#thread-list article.post {
  background: #FFF;
  border: 1px solid #DDD;
  border-radius: 4px;
  padding: 1em;
  margin-bottom: 1.5em;
  position: relative;
}

#thread-list article.post header {
  margin-bottom: 0.5em;
}

#thread-list .post-title {
  font-size: 1.2em;
  font-weight: bold;
  display: inline-block;
  margin-right: 0.5em;
}

#thread-list .tag {
  display: inline-block;
  font-size: 1em;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  color: #ccc;
}

#thread-list .meta .author {
  font-weight: bold;
}

#thread-list .post-content {
  margin: 1em 0;
  font-size: 1em;
  color: #000;
}

#thread-list .post-content p {
  margin: 0.5em 0;
}

/* Style for like/dislike and reply buttons in post footer */
.like-btn,
.dislike-btn,
.reply-btn,
.delete-post {
  background: #664930;
  color: #fff;
  border: none;
  padding: 0.3em 0.6em;
  font-size: 0.9em;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
}

#thread-list footer .reply-btn {
  margin-left: auto;
}

.like-btn:hover,
.dislike-btn:hover,
.reply-btn:hover {
  background: #7a5a3f;
}

.like-btn:disabled,
.dislike-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Count spans inside like/dislike buttons */
.like-btn .count,
.dislike-btn .count {
  font-weight: bold;
  margin-left: 0.3em;
}

/* (No box outlines for replies; using background and indent only) */
/* Smaller reply buttons for each reply, if needed (not actively used in this demo) */
.reply-action-btn {
  background: #664930;
  color: #fff;
  border: none;
  padding: 0.2em 0.5em;
  font-size: 0.8em;
  border-radius: 3px;
  cursor: pointer;
}

.reply-action-btn:hover {
  background: #7a5a3f;
}

/*  Pagination Styles  */
.pagination {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 2em 0 0 0;
  gap: 0.5em;
  font-size: 0.9em;
  flex-wrap: wrap;
}

.pagination li {
  margin: 0;
}

.pagination a {
  display: block;
  padding: 0.4em 0.8em;
  background: #fff;
  border: 1px solid #ccc;
  color: #664930;
  text-decoration: none;
  border-radius: 3px;
}

.pagination a.current-page {
  background: #664930;
  color: #fff;
  font-weight: bold;
  border-color: #664930;
}

.pagination a:hover {
  background: #e6e6e6;
}

.comments-section {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid #ddd;
}

.comment {
  background: #fdfcfb;
  border-left: 3px solid #664930;
  padding: 0.5rem 0.8rem;
  margin-top: 0.5rem;
  border-radius: 4px;
}

.comment-meta {
  font-size: 0.8rem;
  color: #555;
}

.comment-actions button {
  background: none;
  border: none;
  color: #664930;
  cursor: pointer;
  margin-right: 0.5rem;
}

.reply-box textarea {
  width: 100%;
  margin-top: 0.4rem;
}

/* Comment textarea style */
.comment-input {
  width: 100%;
  padding: 1rem;
}

/* post button style, brown color and white text */
.post-btn {
  background: var(--heading-color);
  color: #fff;
  border: none;
  padding: 0.45rem 0.9rem;
  margin: 0.4rem 0rem;
  font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(102,73,48,0.12);
  transition: background 0.18s ease, transform 0.08s ease, box-shadow 0.12s ease;
}

.post-btn:hover {
  background: #7a5a3f;
  transform: translateY(-1px);
}

.post-btn:active { transform: translateY(0); }

.post-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}


.card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 0.5rem;
}

.btn-edit {
  background: #2563eb;
  color: white;
  border: none;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  height: 100%;
}

/* 
   DELETE CONFIRM MODAL
 */
.delete-modal { display: none; position: fixed; inset: 0; z-index: 3000; align-items: center; justify-content: center; }
.delete-modal.is-open { display: flex; }
.delete-modal .modal-content { position: relative; background: #fff; border-radius: 10px; padding: 1rem 1.2rem; width: 92%; max-width: 420px; box-shadow: 0 18px 40px rgba(0,0,0,0.25); transform: translateY(12px) scale(.98); opacity: 0; transition: transform .18s ease, opacity .18s ease; }
.delete-modal.is-open .modal-content { transform: translateY(0) scale(1); opacity: 1; }
.delete-modal .modal-message { margin: 0 0 0.8rem 0; color: #222; font-weight: 600; }
.delete-modal .modal-actions { display:flex; gap:0.6rem; justify-content:flex-end; }
.delete-modal .confirm-delete { background:#d9534f; color:#fff; border:none; padding:0.45rem 0.9rem; border-radius:6px; cursor:pointer; }
.delete-modal .cancel-delete { background:#fff; color:#664930; border:1px solid #ddd; padding:0.45rem 0.9rem; border-radius:6px; cursor:pointer; }


/* Admin modal */
.hidden {
  display: none;
}

.show {
  display: block;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 1.5rem;
  z-index: 100;
  width: 500px;
  max-width: 90%;
  border-radius: 8px;
}

.forum-modal {
  display: flex;
  flex-direction: column;
}

#forumTitle, #forumContent, #forumTag, #forumImage{
  width: 100%;
  padding: 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid #ccc;
}

.forum-modal-header {
  display: flex;
  justify-content: space-between;
}

.forum-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.field-block {
  margin-bottom: 1.2rem;
}

.field-block label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

.forum-modal-submit {
  background-color: #22c55e;
  border: none;
  border-radius: 5px;
  color: white;
  text-align: end;
}

.hover-light {
  transition: filter 0.2s ease;
}

.hover-light:hover {
 filter: brightness(0.8);
}

.btn-edit,
.btn-delete {
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  height: 100%;
}

.btn-edit {
  background: #2563eb;
  color: white;
  border: none;
}

.btn-delete {
  background: #dc2626;
  color: white;
  border: none;
}

.btn-close {
  border: none;
  background-color: white;
  height: 100%;
}

/* 
   RESPONSIVE — TABLET
 */
@media (max-width: 1024px) {
  .container.forum-page {
    flex-direction: column;
    gap: 1.5rem;
  }

  aside {
    width: 100%;
  }

  main {
    width: 100%;
  }

  /* Sidebar buttons full width */
  .new-post-btn,
  .search-btn {
    width: 100%;
  }

  /* Modal slightly smaller */
  #new-post-form-container {
    max-width: 520px;
    padding: 1.4rem;
  }
}

/* 
   RESPONSIVE — MOBILE
 */
@media (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }

  /* Stack layout */
  .container.forum-page {
    padding: 0.8rem;
  }

  aside {
    padding: 0.9rem;
  }

  /* Post cards */
  #thread-list article.post {
    padding: 0.8rem;
  }

  #thread-list .post-title {
    font-size: 1.05rem;
  }

  /* Footer buttons wrap nicely */
  #thread-list footer {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .like-btn,
  .dislike-btn,
  .reply-btn {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    margin-left: 0;
  }

  /* ===== Modal on mobile ===== */
  #new-post-section {
    align-items: flex-start;
    padding-top: 4vh;
    padding-bottom: 4vh;
  }

  #new-post-form-container {
    width: 92%;
    max-width: none;
    padding: 1.2rem;
    border-radius: 12px;
  }

  #new-post-form-container h2 {
    font-size: 1.2rem;
    margin-bottom: 1.4rem;
  }

  #new-post-form-container textarea {
    min-height: 110px;
  }

  /* Buttons full-width */
  #new-post-form-container button[type="submit"],
  .cancel-btn {
    width: 100%;
    padding: 0.7rem;
  }

  .cancel-btn {
    margin-top: 0.8rem;
  }

  /* Pagination */
  .pagination {
    justify-content: center;
  }

  .pagination a {
    padding: 0.35em 0.7em;
    font-size: 0.85rem;
  }
}
