/* --- Rich Text Editor Content --- */
.rte-content p:empty {
  margin: 0;
}

.rte-content h2,
.rte-content h3,
.rte-content h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-main);
}

.rte-content h2 {
  font-size: 1.5rem;
}

.rte-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
}

.rte-content h4 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.rte-content ul,
.rte-content ol {
  margin: 0 0 1.25rem 0;
  padding-left: 2rem;
}

/* Restore markers removed by the global * { padding:0; margin:0 } reset */
.rte-content ul {
  list-style-type: disc;
}

.rte-content ol {
  list-style-type: decimal;
}

/* Nested lists */
.rte-content ul ul,
.rte-content ol ul {
  list-style-type: circle;
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

.rte-content ul ul ul,
.rte-content ol ol ul {
  list-style-type: square;
}

.rte-content li {
  margin-bottom: 0.35rem;
  padding-left: 0.25rem; /* small gap between marker and text */
}

/* Tiptap wraps each li's content in a <p> — suppress its bottom margin
   so items don't appear double-spaced */
.rte-content li > p {
  margin-bottom: 0;
}

/* Restore sensible spacing when a list item contains multiple paragraphs */
.rte-content li > p + p {
  margin-top: 0.4rem;
}

.rte-content a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.rte-content a:hover {
  color: var(--primary-hover);
}

.rte-content strong {
  font-weight: 700;
  color: var(--text-main);
}

.rte-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--primary-color);
  background: rgba(79, 70, 229, 0.04);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-style: italic;
}

html.dark .rte-content blockquote {
  background: rgba(99, 102, 241, 0.07);
}

.rte-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2.5rem 0;
}

.rte-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.rte-content th,
.rte-content td {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.rte-content th {
  background: var(--surface-color);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.rte-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.875em;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  color: var(--primary-color);
}

.rte-content pre {
  background: #1a1b26;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.rte-content pre code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  background: none;
  border: none;
  padding: 0;
  color: #a9b1d6;
}

/* ── Callout blocks ───────────────────────────────────────────────────────── */
/*
  Usage in Tiptap source view:
    <div class="callout callout--note">
      <p>...</p>
    </div>

  Variants: callout--note | callout--tip | callout--important | callout--warning | callout--caution
*/

.rte-content .callout {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 1.75rem 0;
  padding: 1rem 1.25rem 1rem 3.25rem;
  border-radius: 8px;
  border: 1px solid;
  position: relative;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Icon pseudo-element */
.rte-content .callout::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.25rem;
  height: 1.25rem;
  background-size: contain;
  background-repeat: no-repeat;
}

.rte-content .callout p:last-child {
  margin-bottom: 0;
}

/* ── Note (blue/indigo) ── */
.rte-content .callout--info {
  background: rgba(79, 70, 229, 0.05);
  border-color: rgba(79, 70, 229, 0.25);
  color: var(--text-main);
}

.rte-content .callout--info::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
}

html.dark .rte-content .callout--info {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.3);
}

html.dark .rte-content .callout--info::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
}

/* ── Tip (green) ── */
.rte-content .callout--tip {
  background: rgba(5, 150, 105, 0.05);
  border-color: rgba(5, 150, 105, 0.25);
  color: var(--text-main);
}

.rte-content .callout--tip::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1.3.5 2.6 1.5 3.5.8.8 1.3 1.5 1.5 2.5'/%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 22h4'/%3E%3C/svg%3E");
}

html.dark .rte-content .callout--tip {
  background: rgba(52, 211, 153, 0.07);
  border-color: rgba(52, 211, 153, 0.25);
}

html.dark .rte-content .callout--tip::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1.3.5 2.6 1.5 3.5.8.8 1.3 1.5 1.5 2.5'/%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 22h4'/%3E%3C/svg%3E");
}

/* ── Important (purple) ── */
.rte-content .callout--highlight {
  background: rgba(124, 58, 237, 0.05);
  border-color: rgba(124, 58, 237, 0.25);
  color: var(--text-main);
}

.rte-content .callout--highlight::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z'/%3E%3C/svg%3E");
}

html.dark .rte-content .callout--highlight {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.25);
}

html.dark .rte-content .callout--highlight::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a78bfa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z'/%3E%3C/svg%3E");
}

/* ── Warning (amber) ── */
.rte-content .callout--warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--text-main);
}

.rte-content .callout--warning::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

html.dark .rte-content .callout--warning {
  background: rgba(251, 191, 36, 0.07);
  border-color: rgba(251, 191, 36, 0.25);
}

html.dark .rte-content .callout--warning::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23fbbf24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

/* ── Caution (red) ── */
.rte-content .callout--caution {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.25);
  color: var(--text-main);
}

.rte-content .callout--caution::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16h.01'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z'/%3E%3C/svg%3E");
}

html.dark .rte-content .callout--caution {
  background: rgba(248, 113, 113, 0.07);
  border-color: rgba(248, 113, 113, 0.25);
}

html.dark .rte-content .callout--caution::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f87171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16h.01'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z'/%3E%3C/svg%3E");
}

/* ── Optional: callout title (strong as first child) ── */
.rte-content .callout > strong:first-child {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .rte-content .callout {
    padding: 0.9rem 1rem 0.9rem 3rem;
  }

  .rte-content table {
    font-size: 0.8rem;
  }

  .rte-content th,
  .rte-content td {
    padding: 0.5rem 0.65rem;
  }
}

/* ── RTE FAQ Accordions ────────────────────────────────────────────────────
   Used on BasicPage (and any template using .rte-content).
   In Tiptap source view, write:

     <div class="rte-faq">
       <div class="rte-faq-item">
         <button class="rte-faq-question">Question text here</button>
         <div class="rte-faq-answer">
           <p>Answer text here.</p>
         </div>
       </div>
     </div>

   JS in _Layout.cshtml handles the open/close toggle.
   ────────────────────────────────────────────────────────────────────────── */

.rte-content .rte-faq {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.75rem 0;
}

.rte-content .rte-faq-item {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  width: 100%;
  box-sizing: border-box;
  transition: box-shadow 0.2s ease;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.rte-content .rte-faq-item.open {
  box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.08);
}

.rte-content .rte-faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: none;
  border: none;
  padding: 1.1rem 1.5rem;
  cursor: pointer;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  line-height: 1.4;
  transition: background-color 0.2s ease;
}

.rte-content .rte-faq-question:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

html.dark .rte-content .rte-faq-question:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Chevron via pseudo-element — no extra markup needed */
.rte-content .rte-faq-question::after {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
}

.rte-content .rte-faq-item.open .rte-faq-question::after {
  transform: rotate(180deg);
}

.rte-content .rte-faq-answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.rte-content .rte-faq-item.open .rte-faq-answer {
  max-height: 1200px;
  opacity: 1;
}

.rte-content .rte-faq-answer-inner {
  padding: 1.1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border-color);
}

/* Suppress top margin on first prose element inside the answer */
.rte-content .rte-faq-answer-inner > *:first-child {
  margin-top: 0;
}

@media (max-width: 480px) {
  .rte-content .rte-faq-question {
    padding: 1rem;
    font-size: 0.875rem;
  }

  .rte-content .rte-faq-answer-inner {
    padding: 0.9rem 1rem 1rem;
  }
}
