html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  max-width: 100vw;
  font-family: 'Segoe UI', sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

ul {
  margin: 0;
  padding: 0;
}

/* --- Microsoft Add-in Header --- */
.ms-welcome__header {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ms-welcome__main {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  flex: 1 0 0;
  padding: 10px 20px;
}

.ms-welcome__main > h2 {
  width: 100%;
  text-align: center;
}

.ms-welcome__features {
  list-style-type: none;
  margin-top: 20px;
}

.ms-welcome__features.ms-List .ms-ListItem {
  padding-bottom: 20px;
  display: flex;
}

.ms-welcome__features.ms-List .ms-ListItem > .ms-Icon {
  margin-right: 10px;
}

.ms-welcome__action.ms-Button--hero {
  margin-top: 30px;
}

.ms-Button.ms-Button--hero .ms-Button-label {
  color: #0078d7;
}

.ms-Button.ms-Button--hero:hover .ms-Button-label,
.ms-Button.ms-Button--hero:focus .ms-Button-label {
  color: #005a9e;
  cursor: pointer;
}

b {
  font-weight: bold;
}

/* --- Chat Container --- */
.chat-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
  background-color: #fafafa;
}

/* --- Chat Box --- */
.chat-box {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  background-color: transparent;
  width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
}

/* --- Message Bubbles --- */
.message {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* --- Bot “Card” Style (Centered) --- */
.message.bot.checklist {
  width: 90%;
  max-width: 500px;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  padding: 16px;
  border-radius: 16px;
  margin: 0 auto;
}

.message-row.checklist {
  justify-content: center !important;
}

.message-row.checklist .message-icon {
  display: none;
}

/* --- Checklist Content --- */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.checklist-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #1f2d3d;
  text-align: center;
}

.checklist-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checklist-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.checklist-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #0078d7;
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
}

.checklist-entry {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #2c3a4b;
}

/* --- Responsive Checklist --- */
@media (max-width: 600px) {
  .checklist-item {
    grid-template-columns: 1fr;
  }

  .checklist-number {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* --- Message Row --- */
.message-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  flex-wrap: nowrap;
}

.message-row.progress-row {
  align-items: center;
}

.message.user {
  background-color: #0078d7;
  color: white;
  border-top-right-radius: 0;
}

.message-row.user {
  justify-content: flex-end;
}

.message-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 8px;
  flex-shrink: 0;
}

.message-icon.user {
  background-image: url('../../assets/user-icon14.png');
  background-size: cover;
}

.message-icon.bot {
  background-image: url('../../assets/VAQA-icon.ico');
  background-size: cover;
}

.message.bot {
  background-color: #e5e5e5;
  color: #000;
  border-top-left-radius: 0;
}

.message.bot.progress {
  margin: 6px 0;
}

/* --- Chat Input --- */
.chat-input-container {
  display: flex;
  align-items: center;
  margin-top: 10px;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.chat-send-btn {
  background-color: #0078d7;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.chat-send-btn:hover {
  background-color: #005a9e;
}

/* --- Status Indicator --- */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 12px;
  background-color: #f0f0f0;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #666;
}

.status-dot.connected {
  background-color: #4caf50;
}

.status-dot.error {
  background-color: #f44336;
}

.status-dot.loading {
  background-color: #ff9800;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* --- Requirement Buttons --- */
.requirement-buttons {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}

.req-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 50px;
  max-width: 60px;
}

.accept-btn {
  background-color: #28a745;
  color: white;
}

.accept-btn:hover {
  background-color: #218838;
}

.reject-btn {
  background-color: #dc3545;
  color: white;
}

.reject-btn:hover {
  background-color: #c82333;
}

.ignore-btn {
  background-color: #ffc107;
  color: #212529;
}

.ignore-btn:hover {
  background-color: #e0a800;
}

.req-btn.selected {
  opacity: 0.7;
  transform: scale(0.95);
}

/* --- Comment Box --- */
.comment-box {
  margin: 10px 0;
  padding: 12px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
}

.comment-input {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}

.comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.comment-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}

.ok-btn {
  background-color: #007bff;
  color: white;
}

.ok-btn:hover {
  background-color: #0056b3;
}

.cancel-btn {
  background-color: #6c757d;
  color: white;
}

.cancel-btn:hover {
  background-color: #545b62;
}

/* --- Centered Options (3 per row) --- */
.analysis-options,
.page-selection,
.subpart-selection {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  width: 100%;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.option-btn {
  background-color: #0078d7;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  flex: 1 1 calc(33.33% - 12px);
  max-width: calc(33.33% - 12px);
  min-width: 140px;
  text-align: center;
  transition: all 0.2s ease;
}

.option-btn:hover {
  background-color: #005a9e;
}

/* Responsive button layout */
@media (max-width: 800px) {
  .option-btn {
    flex: 1 1 calc(50% - 12px);
    max-width: calc(50% - 12px);
  }
}

@media (max-width: 500px) {
  .option-btn {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

#page-input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 100px;
}

/* --- Subpart Buttons --- */
.subpart-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
}

.subpart-btn {
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.4;
  transition: all 0.2s ease;
}

.subpart-btn .description {
  display: block;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.subpart-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.subpart-btn:hover {
  background-color: #0078d7;
  color: white;
}

/* --- Document Info --- */
.chat-header {
  padding: 10px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.document-info {
  font-size: 12px;
  color: #666;
  padding: 8px;
  background-color: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #0078d7;
}

.document-info.loading {
  color: #999;
  font-style: italic;
}

.document-info.error {
  border-left-color: #f44336;
  color: #d32f2f;
}

/* --- System Message --- */
.message.system {
  background-color: #e3f2fd;
  color: #1976d2;
  border-left: 3px solid #1976d2;
  font-style: italic;
}

/* --- Progress Messages --- */
.message.progress {
  font-style: normal;
  color: #0078d4;
  opacity: 1;
  background-color: transparent;
  border: none;
  font-size: 14px;
  margin: 8px 0;
  box-shadow: none;
  display: inline;
  gap: 0;
  padding: 0;
  border-radius: 0;
}

.message.progress .progress-text {
  font-weight: 500;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  flex: 0 1 auto;
  display: inline;
}

.message.progress .progress-ellipsis {
  display: inline;
  gap: 0;
  min-width: 0;
  margin-left: 2px;
}

.message.progress .progress-ellipsis span {
  opacity: 0.4;
  animation: dotFade 1.2s infinite;
  font-size: 16px;
  font-weight: bold;
  height: 14px;
  display: inline-block;
}

.message.progress .progress-ellipsis span:nth-child(1) {
  animation-delay: 0s;
}

.message.progress .progress-ellipsis span:nth-child(2) {
  animation-delay: 0.2s;
}

.message.progress .progress-ellipsis span:nth-child(3) {
  animation-delay: 0.4s;
}

.message.progress .progress-ellipsis span:nth-child(4) {
  animation-delay: 0.6s;
}

@keyframes dotFade {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* --- Compliance Results --- */
.compliance-results,
.compliance-summary {
  margin: 10px 0;
  padding: 15px;
  border: 1px solid #e1e1e1;
  border-radius: 8px;
  background-color: #ffffff;
}

.compliance-results h3,
.compliance-summary h3 {
  color: #0078d4;
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.compliance-results h4,
.compliance-summary h4 {
  color: #333;
  margin-top: 15px;
  margin-bottom: 5px;
  font-size: 1.1em;
}

.compliance-results p,
.compliance-summary p {
  margin: 5px 0;
  line-height: 1.4;
}

.compliance-results ul,
.compliance-summary ul {
  margin: 5px 0;
  padding-left: 20px;
}

.compliance-results li,
.compliance-summary li {
  margin: 3px 0;
}

.compliance-score {
  background-color: #e6f3ff;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #0078d4;
}

/* --- Success message (persistent) --- */
.message.success {
  background-color: transparent;
  color: #0b682b;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 6px 0;
  box-shadow: none;
}

.message.success .tick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex: 0 0 18px;
  color: #0b682b;
  font-size: 16px;
  line-height: 1;
  margin: 0;
}

.message-row.success-centered {
  justify-content: flex-start;
  padding-left: 40px; /* align with bot icon space for consistent left edge */
}

/* --- Multi-Page Layout (3 per row) --- */
.multi-page-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  overflow-y: auto;
  padding: 10px;
}

.page-view {
  flex: 1 1 calc(33.33% - 12px);
  max-width: calc(33.33% - 12px);
  min-width: 280px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  padding: 10px;
  height: fit-content;
  overflow: hidden;
}

/* Responsive layout: 2 per row, then 1 */
@media (max-width: 1200px) {
  .page-view {
    flex: 1 1 calc(50% - 12px);
    max-width: calc(50% - 12px);
  }
}

@media (max-width: 800px) {
  .page-view {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* --- Submitted Comments --- */
.submitted-comment {
  margin: 0;
  padding: 4px 8px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}

.submitted-comment-content {
  color: #495057;
  line-height: 1.2;
  font-weight: 500;
  margin: 0;
  padding: 0;
}

.submitted-comment-content div {
  margin: 0;
  padding: 0;
  line-height: 1.2;
}

.submitted-comment-content.error {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}