/**
 * CSS stylesheet for the Rule Manual HTML Viewer.
 * Follows the BoardGamesBot Design System (Design.md).
 */

/* Sidebar and components */

.mv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

.mv-game-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.mv-game-info__cover {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.mv-game-info__name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.mv-game-info__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mv-game-info__meta-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.mv-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.mv-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  border: 1px solid transparent;
}

.mv-btn--primary {
  background: var(--primary);
  color: #0c0c14;
}

.mv-btn--primary:hover {
  background: var(--primary-hover);
}

.mv-btn--ghost {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text);
}

.mv-btn--ghost:hover {
  background: var(--surface-2);
}

/* Chatbot container & mask wrapper */
.mv-chat-wrapper {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Blur/Mask overlay for unauthenticated users */
.mv-chat-mask {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 13, 20, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 10;
}

.mv-chat-mask__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--primary-border);
}

.mv-chat-mask__icon .ds-mso {
  font-size: 24px;
}

.mv-chat-mask__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px 0;
}

.mv-chat-mask__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 20px 0;
  line-height: 1.4;
}

/* PDF panel */
.mv-pdf-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mv-pdf-viewer {
  width: 100%;
  height: 85vh;
  min-height: 800px;
  border: 0;
  background: #2b2b2b; /* Standard dark browser pdf viewer background */
}

/* Responsiveness */
@media (max-width: 992px) {
  .gp-layout {
    flex-direction: column !important;
  }

  .mv-sidebar {
    order: 1;
  }

  .mv-pdf-panel {
    height: 70vh;
    min-height: 480px;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
    order: 2;
  }

  .mv-pdf-viewer {
    height: 100%;
    min-height: 100%;
    width: 100%;
    border: 0;
  }
}

/* Page Layout Spacing */
.gp-layout {
  margin-bottom: 3.5rem !important; /* Margem entre final do box e rodapé */
}

/* On manual viewer page, let the sidebar flow naturally so only the chat card sticks */
.gp-body .gp-sidebar {
  position: relative !important;
  max-height: none !important;
  overflow: visible !important;
  top: auto !important;
}

/* Chatbot container & mask wrapper */
.mv-chat-wrapper {
  position: sticky !important;
  top: calc(var(--top-bar-h, 4rem) + 1.5rem) !important;
  max-height: calc(100vh - var(--top-bar-h, 4rem) - 4.5rem) !important;
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
}

.mv-chat-wrapper .gp-assistant {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mv-chat-wrapper form.gp-assistant-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mv-chat-wrapper .gp-assistant-chat__messages {
  flex: 1;
  min-height: 0;
  max-height: none !important; /* Override the fixed 16rem max-height */
  overflow-y: auto;
}

/* Textarea styling overrides to fix scrollbar arrows and placeholders wrapping */
.bgbot-composer__textarea {
  min-height: 36px !important;
  overflow-y: hidden !important;
  resize: none;
}
