/* css/forum.css
   The Pit Stop — driver forum (menu label: "Forum"). Four fixed boards:
   Shift Swap, General Chat, App Issues, Feature Requests. No backend yet —
   everything here is localStorage-backed (see js/forum.js) — but the data
   shape (author {id, name}, threads/replies) is written so a real login
   system can drop in later and just replace the placeholder "You" author
   with real account data; nothing about the UI or storage shape changes. */

.dd-forum-card {
  max-width: 560px;
  width: 100%;
}
@container app-col (min-width: 460px) {
  .dd-forum-card { max-width: 680px; }
}
@container app-col (min-width: 600px) {
  .dd-forum-card { max-width: 820px; }
}
.dd-forum-card h4 {
  margin-top: 0;
  font-size: 1.4rem;
}

.dd-forum-topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.dd-forum-back-btn {
  flex-shrink: 0;
  border: 1px solid var(--dd-sky) !important;
  background: #fff;
  color: var(--dd-sky);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: none !important;
}
:root[data-theme="dark"] .dd-forum-back-btn {
  background: transparent;
  border-color: var(--dd-amber) !important;
  color: var(--dd-amber);
}
.dd-forum-topbar h4 {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-forum-scroll {
  max-height: min(60svh, 480px);
  overflow-y: auto;
  padding-right: 0.4rem;
  scrollbar-gutter: stable;
}

/* === Board list === */
.dd-forum-board-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  cursor: pointer;
  background: #fff;
}
.dd-forum-board-item:last-child { margin-bottom: 0; }
.dd-forum-board-item:hover { border-color: var(--dd-amber); }
.dd-forum-board-name {
  font-weight: 700;
  color: var(--dd-orange);
  display: block;
}
.dd-forum-board-desc {
  font-size: 0.85rem;
  color: #777;
  display: block;
  margin-top: 0.1rem;
}
.dd-forum-board-count {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dd-sky);
  white-space: nowrap;
}
:root[data-theme="dark"] .dd-forum-board-item {
  border-color: #3a3f47;
  background: #262a31;
}
:root[data-theme="dark"] .dd-forum-board-item:hover { border-color: var(--dd-amber); }
:root[data-theme="dark"] .dd-forum-board-desc { color: #b8b8b8; }

/* === Thread list === */
.dd-forum-new-btn {
  width: 100%;
  margin-bottom: 0.7rem;
}
.dd-forum-thread-item {
  padding: 0.65rem 0.8rem;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  margin-bottom: 0.55rem;
  cursor: pointer;
  background: #fff;
}
.dd-forum-thread-item:last-child { margin-bottom: 0; }
.dd-forum-thread-item:hover { border-color: var(--dd-amber); }
:root[data-theme="dark"] .dd-forum-thread-item {
  border-color: #3a3f47;
  background: #262a31;
}
:root[data-theme="dark"] .dd-forum-thread-item:hover { border-color: var(--dd-amber); }

.dd-forum-thread-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}
.dd-forum-thread-title {
  font-weight: 700;
  color: var(--dd-orange);
}
.dd-forum-thread-note {
  font-size: 0.88rem;
  color: #555;
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
:root[data-theme="dark"] .dd-forum-thread-note { color: #ccc; }

.dd-forum-meta {
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.35rem;
}
:root[data-theme="dark"] .dd-forum-meta { color: #999; }

.dd-forum-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.dd-forum-badge.is-open {
  background: rgba(0, 131, 0, 0.13);
  color: var(--dd-green);
}
.dd-forum-badge.is-filled {
  background: rgba(120, 120, 120, 0.16);
  color: #666;
}
:root[data-theme="dark"] .dd-forum-badge.is-filled { color: #aaa; }

/* === Thread detail === */
.dd-forum-post {
  padding: 0.75rem 0.85rem;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  margin-bottom: 0.9rem;
  background: #fff;
}
:root[data-theme="dark"] .dd-forum-post {
  border-color: #3a3f47;
  background: #262a31;
}
.dd-forum-post-title {
  font-weight: 700;
  color: var(--dd-orange);
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}
.dd-forum-post-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}
.dd-forum-swap-fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.6rem;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}
.dd-forum-swap-label {
  font-weight: 700;
  color: var(--dd-sky);
}
.dd-forum-post-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.dd-forum-post-actions button {
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem !important;
}

.dd-forum-replies-title {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--dd-orange);
  border-bottom: 2px solid var(--dd-amber);
  padding-bottom: 0.25rem;
  margin-bottom: 0.5rem;
}
.dd-forum-reply {
  padding: 0.55rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.dd-forum-reply:last-child { border-bottom: none; }
:root[data-theme="dark"] .dd-forum-reply { border-bottom-color: #333; }
.dd-forum-reply-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.92rem;
}
.dd-forum-reply-actions {
  margin-top: 0.2rem;
}
.dd-forum-reply-delete {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: var(--dd-red);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 !important;
}

/* === Forms (new thread / new swap request / reply) === */
.dd-forum-form {
  border: 1px dashed var(--dd-sky);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.8rem;
}
:root[data-theme="dark"] .dd-forum-form { border-color: var(--dd-amber); }
.dd-forum-field {
  margin-bottom: 0.55rem;
}
.dd-forum-field:last-of-type { margin-bottom: 0.7rem; }
.dd-forum-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dd-orange);
  margin-bottom: 0.2rem;
}
.dd-forum-field input[type="text"],
.dd-forum-field input[type="date"],
.dd-forum-field textarea {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
  resize: vertical;
}
:root[data-theme="dark"] .dd-forum-field input[type="text"],
:root[data-theme="dark"] .dd-forum-field input[type="date"],
:root[data-theme="dark"] .dd-forum-field textarea {
  background: #1f2227;
  border-color: #3a3f47;
  color: #e8e8e8;
}
.dd-forum-form-actions {
  display: flex;
  gap: 0.6rem;
}
.dd-forum-form-actions button { flex: 1; }
.dd-forum-form-msg {
  font-size: 0.8rem;
  color: var(--dd-red);
  margin-bottom: 0.4rem;
}

.dd-forum-reply-form {
  margin-top: 0.6rem;
}
.dd-forum-reply-form textarea {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font: inherit;
  font-size: 0.92rem;
  box-sizing: border-box;
  resize: vertical;
  margin-bottom: 0.5rem;
}
:root[data-theme="dark"] .dd-forum-reply-form textarea {
  background: #1f2227;
  border-color: #3a3f47;
  color: #e8e8e8;
}
