:root {
  --gist-color-brand-accent-1: #2B62B5;
  --gist-color-brand-accent-2: #4189C9;
  --gist-color-brand-accent-3: #61E0FA;
  --gist-font-family-base: var(--global-body-font-family, sans-serif);
}

/* Main Container */
.mp-qa-container {
  margin: 0 auto;
  margin-top: 10px; /* Kept from original CSS */
  font-family: var(--gist-font-family-base);
}

.mp-qa-row {
  margin-bottom: 60px;
}

.mp-qa-row:first-child .mp-q {
  margin-top: 0;
}

/* Question Header */
.mp-q {
  color: var(--gist-color-brand-accent-1);
  font-size: 2.1rem;
  font-weight: 800;
  margin: 0 0 20px 0;
  line-height: 1.2;
}

/* Answer Content */
.mp-a {
  border-left: 4px solid var(--gist-color-brand-accent-1);
  padding: 0 0 0 30px;
  margin-left: 2px;
  color: #444;
  line-height: 1.8;
  font-size: 1.15rem;
}

.mp-a h1,
.mp-a h2,
.mp-a h3,
.mp-a h4 {
  font-size: 1.35rem !important;
  margin: 30px 0 15px 0 !important;
  color: #111 !important;
  font-weight: 700 !important;
}

/* Breakdown Bars */
.mp-attribution-wrapper {
  margin: 20px 0 30px 0;
  font-family: var(--gist-font-family-base);
  display: flex;
  width: 100%;
}

.mp-breakdown-segment {
  display: flex;
  flex-direction: column;
  margin-right: 3px;
}

.mp-breakdown-segment:last-child {
  margin-right: 0;
}

.mp-breakdown-bar {
  height: 10px;
  margin-bottom: 8px;
}

.mp-breakdown-segment:first-child .mp-breakdown-bar {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.mp-breakdown-segment:last-child .mp-breakdown-bar {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.mp-breakdown-label {
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 5px;
}

.mp-breakdown-percentage {
  font-weight: 700;
}

.mp-breakdown-source {
  color: #777;
}

/* Dynamic Breakdown Colors */
.mp-bar-color-0 {
  background-color: var(--gist-color-brand-accent-1);
}
.mp-bar-color-1 {
  background-color: var(--gist-color-brand-accent-2);
}
.mp-bar-color-2 {
  background-color: var(--gist-color-brand-accent-3);
}
.mp-bar-color-3 {
  background-color: #AAC0E1; /* Fallback (approx 40% accent mix) */
  background-color: color-mix(in srgb, var(--gist-color-brand-accent-1, #2B62B5) 40%, white);
}
.mp-text-color-0 {
  color: var(--gist-color-brand-accent-1);
}
.mp-text-color-1 {
  color: var(--gist-color-brand-accent-2);
}
.mp-text-color-2 {
  color: var(--gist-color-brand-accent-3);
}
.mp-text-color-3 {
  color: #AAC0E1; /* Fallback (approx 40% accent mix) */
  color: color-mix(in srgb, var(--gist-color-brand-accent-1, #2B62B5) 40%, white);
}


/* Related Questions */
.mp-related-box {
  margin-top: 80px;
  padding: 35px;
  background: #fdfdfd;
  border: 1px solid #eee;
  border-radius: 12px;
}

.mp-related-header {
  margin: 0 0 25px 0;
  font-size: 0.95rem;
  color: #888;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.mp-related-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mp-related-link {
  display: block;
  text-decoration: none;
  color: var(--gist-color-brand-accent-1);
  font-size: 1.1rem;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.mp-related-link:hover,
.mp-related-link:focus-visible {
  background: #f7fbff;
}

.mp-related-link:focus-visible {
  outline: 2px solid var(--gist-color-brand-accent-2);
  outline-offset: 2px;
}

.mp-related-arrow {
  margin-right: 12px;
  color: var(--gist-color-brand-accent-1);
  opacity: 0.4;
  font-weight: bold;
}


/* Sources Carousel */
.mp-sources-wrapper {
  margin-top: 30px;
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding-bottom: 15px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
/* Scrollbar styling */
.mp-sources-wrapper::-webkit-scrollbar {
  height: 8px;
}
.mp-sources-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}
.mp-sources-wrapper::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}
.mp-sources-wrapper::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.mp-source-card {
  flex: 0 0 280px;
  scroll-snap-align: start;
  background: #fdfdfd;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  text-decoration: none;
}
.mp-source-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.mp-source-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.mp-source-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 4px;
}
.mp-source-site-name {
  font-size: 0.85rem;
  color: #666;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mp-source-title {
  display: -webkit-box;
  font-weight: bold;
  color: #0073aa;
  margin-bottom: 8px;
  line-height: 1.3;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1rem;
}
.mp-source-excerpt {
  color: #555;
  line-height: 1.4;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Gist Chat Citation (External/Legacy Class) */
.gist-chat-citation {
  position: relative;
  top: -2px;
  vertical-align: middle;
  cursor: pointer;
  color: var(--gist-color-text-primary, #1f2937);
  font-weight: var(--gist-font-weight-light, 300);
  font-size: var(--gist-font-size-xxs, 8px);
  line-height: 1.3;
  padding: 2px 6px;
  border-radius: 1em;
  background-color: var(--gist-color-surface-inset, #f2f2f2);
  transition: all 0.2s ease;
  margin-left: 4.5px;
  border: 1px solid var(--gist-color-border-default, #e5e7eb);

  display: inline-block;
}
.gist-chat-citation:hover {
  background: var(--gist-color-action-primary, #000000);
  color: var(--gist-color-on-action, #ffffff);
  border-color: var(--gist-color-action-primary, #000000);
}

#mp-hover-card {
  position: fixed;
  z-index: 999999;
  width: 300px; /* Matching your carousel card width roughly */
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 15px; /* Matching carousel padding */
  display: none;
  pointer-events: auto;
  border: 1px solid #e0e0e0;
  transform: translate(-50%, -100%);
  transition: opacity 0.2s ease;
}

/* Clear link defaults for the hover card wrapper */
#mp-hover-card a {
  text-decoration: none !important;
  color: inherit !important;
}

/* Invisible bridge to prevent mouse-out */
#mp-hover-card::before {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  height: 20px;
}

/* Hover effects for the inner card (optional, matching carousel behavior) */
#mp-hover-card:hover {
  border-color: #ccc;
}

.mp-hc-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.mp-hc-icon {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  margin-right: 8px;
}
.mp-hc-site {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}
.mp-hc-title {
  font-size: 15px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mp-hc-excerpt {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mp-hover-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* Pointer triangle */
#mp-hover-card::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 20px;
  border-width: 8px 8px 0 8px;
  border-style: solid;
  border-color: white transparent transparent transparent;
}

/*admin page*/
.mp-api-key-container {
  display: flex;
  gap: 5px;
  align-items: center;
}

.mp-api-key-container input[type="password"],
.mp-api-key-container input[type="text"] {
  margin-bottom: 0;
}

.mp-api-key-container .dashicons {
  margin-top: 4px;
}
