/*
 * MegaforBB frontend core stylesheet.
 * This file contains UI rules that are required by system JS and shared components,
 * independent from the active theme.
 */

/* Keep Alpine placeholders hidden before hydration. */
[x-cloak] {
  display: none !important;
}

/* Editor container sizing used by core editor init logic. */
.mb-4:has(textarea[data-editor]),
div:has(> textarea[data-editor]) {
  min-height: 280px;
}

.mfbb-editor-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  height: 350px;
}

@media (min-width: 769px) {
  .mfbb-editor-wrap {
    min-height: 350px;
    height: 350px;
  }
}

.mfbb-editor-wrap > [id^="mfbb-tui-"] {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mfbb-editor-wrap > [id^="mfbb-tui-"] .toastui-editor-defaultUI {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mfbb-editor-wrap > [id^="mfbb-tui-"] .toastui-editor-md-container,
.mfbb-editor-wrap > [id^="mfbb-tui-"] .toastui-editor-ww-container {
  flex: 1;
  min-height: 0;
}

.mfbb-editor-wrap .toastui-editor-defaultUI {
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
}

.mfbb-editor-resize-handle {
  flex-shrink: 0;
  height: 10px;
  cursor: ns-resize;
  background: linear-gradient(to bottom, transparent 0%, #e5e7eb 50%, transparent 100%);
  border-radius: 0 0 0.375rem 0.375rem;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.mfbb-editor-resize-handle:hover {
  background: linear-gradient(to bottom, transparent 0%, #d1d5db 50%, transparent 100%);
}

.mfbb-editor-resize-handle:active {
  background: #9ca3af;
}

/* Content helpers emitted by parser/editor output. */
.prose blockquote,
.post-content blockquote,
blockquote[data-author],
.mfbb-quote {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid #3b82f6;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
  border-radius: 0 0.375rem 0.375rem 0;
  color: #334155;
  font-style: normal;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.35);
}

.prose blockquote strong:first-child,
blockquote[data-author] strong:first-child,
.mfbb-quote-author {
  color: #1d4ed8;
}

.prose details.mfbb-spoiler,
.post-content details.mfbb-spoiler,
.post-body details.mfbb-spoiler {
  margin: 0.5rem 0;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  overflow: hidden;
  background: #f1f5f9;
}

.prose details.mfbb-spoiler summary,
.post-content details.mfbb-spoiler summary,
.post-body details.mfbb-spoiler summary {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-weight: 600;
  color: #475569;
  user-select: none;
  list-style: none;
}

.prose details.mfbb-spoiler summary::-webkit-details-marker,
.post-content details.mfbb-spoiler summary::-webkit-details-marker {
  display: none;
}

.prose details.mfbb-spoiler summary::before,
.post-content details.mfbb-spoiler summary::before,
.post-body details.mfbb-spoiler summary::before {
  content: "> ";
  display: inline-block;
  margin-right: 0.25rem;
  transition: transform 0.2s;
}

.prose details.mfbb-spoiler[open] summary::before,
.post-content details.mfbb-spoiler[open] summary::before,
.post-body details.mfbb-spoiler[open] summary::before {
  transform: rotate(90deg);
}

.prose details.mfbb-spoiler > *:not(summary),
.post-content details.mfbb-spoiler > *:not(summary),
.post-body details.mfbb-spoiler > *:not(summary) {
  padding: 0.75rem 1rem;
  margin: 0;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

a.mention {
  color: #1d4ed8;
  background: #dbeafe;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
  text-decoration: none;
}

a.mention:hover {
  background: #bfdbfe;
  text-decoration: underline;
}

a.post-ref {
  color: #15803d;
  background: #dcfce7;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
  text-decoration: none;
}

a.post-ref:hover {
  background: #bbf7d0;
  text-decoration: underline;
}

/* Global loading + soft navigation progress bar. */
.mfbb-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 10010;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.mfbb-top-progress.is-active {
  opacity: 1;
}

.mfbb-top-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #0ea5e9 0%, #2563eb 55%, #1d4ed8 100%);
  box-shadow: 0 0 14px rgba(37, 99, 235, 0.45);
  transition: transform 0.24s ease-out;
}


/* Toast notifications used by core event handlers. */
.mfbb-toast-container {
  position: fixed;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 10020;
  width: min(92vw, 23.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}

.mfbb-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.55rem;
  padding: 0.78rem 0.78rem 0.78rem 0.72rem;
  border-radius: 0.85rem;
  border: 1px solid #dbeafe;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.mfbb-toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.mfbb-toast__icon {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.12rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.mfbb-toast__content {
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.35;
  font-weight: 600;
}

.mfbb-toast__link {
  color: inherit;
  text-decoration: none;
}

.mfbb-toast__link:hover {
  text-decoration: underline;
}

.mfbb-toast__close {
  border: 0;
  background: transparent;
  color: #475569;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
}

.mfbb-toast__close:hover {
  background: rgba(148, 163, 184, 0.22);
  color: #0f172a;
}

.mfbb-toast--success {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
}

.mfbb-toast--success .mfbb-toast__icon {
  background: #22c55e;
}

.mfbb-toast--error {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
}

.mfbb-toast--error .mfbb-toast__icon {
  background: #ef4444;
}

.mfbb-toast--info {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.mfbb-toast--info .mfbb-toast__icon {
  background: #3b82f6;
}

/* Shared code block style for parser output. */
.mfbb-code-block,
.prose pre.mfbb-code-block,
.prose .mfbb-code-block {
  border: 1px solid #22c55e;
  border-left: 3px solid #22c55e;
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 0.375rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.mfbb-code-block code,
.mfbb-code-block .mfbb-code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.mfbb-code-block .token.comment,
.mfbb-code-block .token.prolog {
  color: #94a3b8;
}

.mfbb-code-block .token.keyword {
  color: #22d3ee;
}

.mfbb-code-block .token.string {
  color: #a5f3fc;
}

.mfbb-code-block .token.function {
  color: #c084fc;
}

.mfbb-code-block .token.number {
  color: #fbbf24;
}

.mfbb-code-block .token.operator {
  color: #e2e8f0;
}

.mfbb-code-block .token.punctuation {
  color: #94a3b8;
}

.mfbb-code-block .token.tag .token.punctuation {
  color: #22d3ee;
}

.mfbb-code-block .token.attr-name {
  color: #c084fc;
}

.mfbb-code-block .token.attr-value {
  color: #a5f3fc;
}

@media (max-width: 768px) {
  .mb-4:has(textarea[data-editor]),
  div:has(> textarea[data-editor]) {
    min-height: 220px;
  }

  .mfbb-editor-wrap {
    min-height: 220px;
    height: 260px;
    max-height: min(70vh, 400px);
  }

  .mfbb-editor-wrap .toastui-editor-toolbar-icons {
    padding: 6px;
  }

  .mfbb-editor-wrap .toastui-editor-toolbar-icons .toastui-editor-toolbar-icon {
    width: 28px;
    height: 28px;
  }

  .mfbb-editor-resize-handle {
    height: 16px;
    min-height: 16px;
  }

  .mfbb-toast-container {
    left: 0.5rem;
    right: 0.5rem;
    top: 0.5rem;
    width: auto;
  }

}


.mfbb-topic-read-frame {
  position: relative;
  overflow: visible;
}

.mfbb-topic-replied-mark {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.12);
  z-index: 2;
  line-height: 0;
  pointer-events: none;
}

.mfbb-topic-replied-mark .fa-reply {
  font-size: 5px;
  transform: scaleX(-1);
  line-height: 1;
}

.mfbb-topic-read-frame--sm .mfbb-topic-replied-mark {
  width: 9px;
  height: 9px;
  top: 0;
  right: 0;
  transform: translate(35%, -35%);
  box-shadow: 0 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mfbb-topic-read-frame--sm .mfbb-topic-replied-mark .fa-reply {
  font-size: 4px;
}

/* Masaüstü: 32px göz kutusu — rozet orantılı */
.mfbb-topic-read-frame--compact .mfbb-topic-replied-mark {
  width: 8px;
  height: 8px;
  top: -1px;
  right: -1px;
}

.mfbb-topic-read-frame--compact .mfbb-topic-replied-mark .fa-reply {
  font-size: 4px;
}

/* ── Postbit: online status dot ──────────────────────────── */
.online-dot {
  display: block;
  position: absolute;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  z-index: 5;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.online-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.45);
  animation: online-ping 1.6s ease-in-out infinite;
}

@keyframes online-ping {
  0%   { transform: scale(0.8); opacity: 0.8; }
  50%  { transform: scale(1.55); opacity: 0.25; }
  100% { transform: scale(0.8); opacity: 0.8; }
}
