/* Ask Mirror Talk Widget Styles */
.ask-mirror-talk {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
  border: 1px solid #e6e2dc;
  background: #faf8f4;
  font-family: "Source Serif 4", Georgia, serif;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ask-mirror-talk h2 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #2e2a24;
  font-size: 28px;
  font-weight: 600;
}

.ask-mirror-talk h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: #2e2a24;
  font-size: 20px;
  font-weight: 600;
}

/* Form Input */
#ask-mirror-talk-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.5;
  margin: 12px 0;
  border: 2px solid #cfc7be;
  border-radius: 8px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

#ask-mirror-talk-input:focus {
  outline: none;
  border-color: #2e2a24;
  box-shadow: 0 0 0 3px rgba(46, 42, 36, 0.1);
}

#ask-mirror-talk-input:disabled {
  background: #f0ede8;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Submit Button */
.ask-mirror-talk button {
  background: #2e2a24;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.1s ease;
  font-family: inherit;
}

.ask-mirror-talk button:hover:not(:disabled) {
  background: #3d3731;
  transform: translateY(-1px);
}

.ask-mirror-talk button:active:not(:disabled) {
  transform: translateY(0);
}

.ask-mirror-talk button:disabled {
  background: #8b8378;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Response Section */
.ask-mirror-talk-response {
  margin-top: 24px;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e6e2dc;
  min-height: 60px;
  line-height: 1.7;
  color: #2e2a24;
}

.ask-mirror-talk-response p {
  margin: 0 0 16px 0;
}

.ask-mirror-talk-response p:last-child {
  margin-bottom: 0;
}

/* Better spacing after headings in paragraphs */
.ask-mirror-talk-response p strong:only-child {
  display: block;
  margin-bottom: 8px;
}

.ask-mirror-talk-response.error {
  background: #fff3f3;
  border-color: #ffcccc;
  color: #c53030;
}

/* Loading Spinner */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e6e2dc;
  border-top-color: #2e2a24;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ask-mirror-talk-response .loading-spinner + p {
  text-align: center;
  color: #6b665d;
  font-style: italic;
}

/* Citations Section */
.ask-mirror-talk-citations {
  margin-top: 24px;
  display: none;
}

.ask-mirror-talk-citations h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 18px;
}

#ask-mirror-talk-citations {
  list-style: none;
  padding: 0;
  margin: 0;
}

.citation-item {
  background: #fff;
  border: 1px solid #e6e2dc;
  border-radius: 6px;
  margin-bottom: 8px;
  padding: 12px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.citation-item:hover {
  border-color: #2e2a24;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.citation-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: inherit;
  gap: 12px;
  cursor: pointer;
}

.citation-link:hover {
  text-decoration: none;
}

.citation-title {
  font-weight: 600;
  color: #2e2a24;
  flex: 1;
}

.citation-time {
  font-size: 14px;
  color: #6b665d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
  background: #f5f2ed;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background 0.2s ease, color 0.2s ease;
}

.citation-link:hover .citation-title {
  color: #1a1815;
  text-decoration: underline;
}

.citation-link:hover .citation-time {
  background: #2e2a24;
  color: #fff;
}

/* Response Content Formatting */
.ask-mirror-talk-response strong {
  font-weight: 700;
  color: #1a1815;
}

.ask-mirror-talk-response em {
  font-style: italic;
}

.ask-mirror-talk-response ol,
.ask-mirror-talk-response ul {
  margin: 16px 0;
  padding-left: 28px;
}

.ask-mirror-talk-response ol {
  list-style-type: decimal;
}

.ask-mirror-talk-response ul {
  list-style-type: disc;
}

.ask-mirror-talk-response li {
  margin: 8px 0;
  line-height: 1.7;
  padding-left: 4px;
}

.ask-mirror-talk-response li strong {
  color: #1a1815;
}

/* Add spacing before lists that follow text */
.ask-mirror-talk-response p + ol,
.ask-mirror-talk-response p + ul {
  margin-top: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .ask-mirror-talk {
    padding: 24px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .ask-mirror-talk h2 {
    font-size: 24px;
  }

  .citation-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .citation-time {
    align-self: flex-start;
  }
}

/* Accessibility */
.ask-mirror-talk button:focus,
#ask-mirror-talk-input:focus {
  outline: 2px solid #2e2a24;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .ask-mirror-talk button,
  #ask-mirror-talk-input,
  .ask-mirror-talk form {
    display: none;
  }
}
