@import url('https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,400;0,600;1,400&family=Source+Sans+3:wght@400;600&display=swap');

:root {
  --ink: #1f1a17;
  --accent: #0f766e;
  --accent-soft: #d7eeeb;
  --line: #e3d8c8;
  --muted: #56626d;
  --danger-strong: #b42318;
}

body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f8f9fa;
}

a {
  color: var(--accent);
}

.text-muted {
  color: var(--muted) !important;
}

.navbar-brand,
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Bitter", Georgia, serif;
}

main h2 {
  margin-bottom: 0.75rem;
}

main h3,
main h5 {
  margin-top: 1rem;
}

.card {
  border-color: var(--line);
}

.card-title {
  margin-bottom: 0.5rem;
}

.session-meta-right {
  min-width: 220px;
}

.session-location-display {
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.session-join-display {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
}

.session-time-display {
  display: block;
}

.event-logo {
  width: auto;
  height: 52px;
  max-width: 160px;
  object-fit: contain;
}

.vote {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
}

.event-logo-preview {
  width: auto;
  height: 70px;
  max-width: 240px;
  object-fit: contain;
  border: 1px solid #ced4da;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

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

.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--danger-strong);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 4px;
}

.nav-messages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.messages-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 600px;
  border: 1px solid #ced4da;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.conversations-panel {
  border-right: 1px solid #ced4da;
  padding: 16px;
  overflow-y: auto;
  background: #fafaf8;
}

.conversations-panel h3 {
  margin: 0 0 12px 0;
  font-size: 1rem;
}

.conversation-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.conversation-item {
  margin-bottom: 8px;
}

.conversation-item a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.2s;
}

.conversation-item a:hover {
  background: var(--accent-soft);
}

.conversation-item a.active {
  background: var(--accent-soft);
  font-weight: 600;
}

.conversation-item.unread a {
  background: rgba(15, 118, 110, 0.08);
}

.conversation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--danger-strong);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
}

.messages-main {
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.conversation-header {
  border-bottom: 1px solid #ced4da;
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.conversation-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px;
}

.message {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #c8d4df;
}

.message.sent {
  background: #eef1f4;
  color: var(--ink);
  align-self: flex-end;
  max-width: 70%;
  border-color: #cfd6de;
}

.message.sent .message-header {
  color: #32404d;
}

.message.received {
  background: #e6f2ff;
  align-self: flex-start;
  max-width: 70%;
  color: var(--ink);
  border-color: #bfd7f2;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.message-header strong {
  font-weight: 600;
  flex: 1;
}

.message-header .text-muted {
  color: #526170 !important;
}

.message-content {
  line-height: 1.5;
  word-wrap: break-word;
}

.message-content p {
  margin: 0;
}

.message-reply-context {
  font-size: 0.85rem;
  font-style: italic;
  padding: 6px;
  border-left: 3px solid rgba(0, 0, 0, 0.1);
  margin-bottom: 6px;
  opacity: 0.8;
}

.message.sent .message-reply-context {
  border-left-color: rgba(255, 255, 255, 0.3);
}

.message.received .message-reply-context {
  border-left-color: rgba(41, 78, 116, 0.24);
}

.btn-reply {
  display: inline-block;
  padding: 4px 8px;
  margin-top: 8px;
  font-size: 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.3);
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.message.sent .btn-reply {
  display: none;
}

.btn-reply:hover {
  background: rgba(255, 255, 255, 0.5);
}

.reply-form-wrapper {
  margin-top: 8px;
}

.reply-form-wrapper form {
  display: grid;
  gap: 8px;
}

.reply-form-wrapper textarea {
  font-size: 0.9rem;
  padding: 8px;
}

.form-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-buttons .btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.message-form {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #ced4da;
}

.message-form textarea {
  font-family: inherit;
  font-size: 0.95rem;
}

.message-form button {
  align-self: flex-start;
}

.messages-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.session-question {
  border: 1px solid #d4dee8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.session-question.presenter-response {
  border-color: #86efac;
  background: #ecfdf3;
}

.session-thread-children {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 2px solid #dbe4ec;
}

.discussion-post-layout {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: start;
}

.discussion-vote-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: sticky;
  top: 12px;
}

.vote-arrow {
  width: 28px;
  height: 28px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #fff;
  color: #495057;
  line-height: 1;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.vote-arrow:hover {
  background: #f1f3f5;
}

.vote-arrow.up:hover {
  color: #d9480f;
}

.vote-arrow.down:hover {
  color: #1864ab;
}

.vote-score {
  min-width: 28px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #495057;
}

.discussion-post-content {
  min-width: 0;
}

@media (max-width: 768px) {
  .messages-container {
    grid-template-columns: 1fr;
  }

  .session-meta-right {
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .conversations-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .message,
  .message.sent {
    max-width: 100%;
  }

  .discussion-post-layout {
    grid-template-columns: 1fr;
  }

  .discussion-vote-rail {
    position: static;
    flex-direction: row;
    justify-content: flex-start;
    margin-bottom: 8px;
  }
}

