/* ════════════════════════════════════════
   ANIROXA — forum.css
════════════════════════════════════════ */

/* ── Forum header ── */
.forum-header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.forum-header-title {
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-header-spacer {
  width: 36px;
  flex-shrink: 0;
}

/* ── Back button (shared) ── */
.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
}
.back-btn:hover { background: var(--bg3); color: var(--text); }
.back-btn svg { width: 20px; height: 20px; }

/* ── Category tabs ── */
.fr-tabs-wrap {
  position: sticky;
  top: var(--header-h, 56px);
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow: hidden;
  margin-top: var(--header-h, 56px);
}

.fr-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 10px 0;
  max-width: 900px;
  margin: 0 auto;
}
.fr-tabs::-webkit-scrollbar { display: none; }

.fr-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  flex-shrink: 0;
}
.fr-tab:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border2);
}
.fr-tab.active {
  background: rgba(230, 62, 109, 0.12);
  color: var(--accent);
  border-color: rgba(230, 62, 109, 0.35);
}

.fr-tab-icon {
  font-size: 15px;
  line-height: 1;
}

.fr-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  color: inherit;
}
.fr-tab.active .fr-tab-count {
  background: rgba(230, 62, 109, 0.18);
}

/* ── Main topics area ── */
.fr-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}

/* ── Topic list ── */
.fr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Topic card ── */
.fr-topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.14s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.fr-topic-card:hover {
  border-color: var(--border2);
  background: var(--bg3);
  transform: translateY(-1px);
}
.fr-topic-card:active {
  transform: translateY(0);
}

.fr-topic-title {
  font-family: var(--font-d);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fr-topic-card--closed .fr-topic-title {
  color: var(--text2);
}

.fr-topic-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fr-topic-author {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text2);
  flex-shrink: 0;
}

.fr-mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.fr-mini-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.fr-topic-date {
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
}

.fr-topic-meta-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.fr-cat-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.fr-status-open {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
  white-space: nowrap;
}
.fr-status-closed {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text3);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.fr-comment-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text3);
}
.fr-comment-count svg {
  opacity: 0.6;
}

/* ── Loader ── */
.fr-loader:not([hidden]) {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}
.fr-loader-ring {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: fr-spin 0.7s linear infinite;
}
@keyframes fr-spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.fr-empty:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 16px;
  color: var(--text3);
  font-size: 14px;
  text-align: center;
}
.fr-empty svg { opacity: 0.4; }

/* ── FAB ── */
.fr-fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 80;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(230, 62, 109, 0.45), 0 2px 8px rgba(0,0,0,0.4);
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
}
.fr-fab:hover {
  background: #ff6b9d;
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(230, 62, 109, 0.6), 0 2px 12px rgba(0,0,0,0.4);
}
.fr-fab:active { transform: scale(0.97); }

/* ── Create topic modal ── */
.fr-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}
.fr-modal.visible { display: flex; }

.fr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.fr-modal.open .fr-modal-backdrop { opacity: 1; }

.fr-modal-sheet {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  z-index: 1;
  background: var(--bg2);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border2);
  padding: 0 0 env(safe-area-inset-bottom, 0);
  max-height: 92dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.fr-modal.open .fr-modal-sheet { transform: translateY(0); }

/* Desktop: centered dialog */
@media (min-width: 640px) {
  .fr-modal-sheet {
    position: relative;
    margin: auto;
    bottom: auto;
    left: auto;
    right: auto;
    border-radius: 20px;
    border: 1px solid var(--border2);
    max-width: 540px;
    width: 100%;
    max-height: 88dvh;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.24s ease;
  }
  .fr-modal.open .fr-modal-sheet {
    transform: translateY(0);
    opacity: 1;
  }
  .fr-modal-handle { display: none; }
}

.fr-modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border2);
  border-radius: 2px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.fr-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg3);
  border: none;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.fr-modal-close:hover { background: var(--surface); color: var(--text); }

.fr-modal-body {
  padding: 16px 20px 24px;
}

.fr-modal-title {
  font-family: var(--font-d);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
}

/* ── Form ── */
.fr-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fr-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fr-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fr-char-count {
  font-weight: 400;
  color: var(--text3);
  font-size: 11px;
}

.fr-input,
.fr-textarea,
.fr-select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  resize: none;
  appearance: none;
  -webkit-appearance: none;
}
.fr-input::placeholder,
.fr-textarea::placeholder {
  color: var(--text3);
}
.fr-input:focus,
.fr-textarea:focus,
.fr-select:focus {
  border-color: rgba(230, 62, 109, 0.5);
  box-shadow: 0 0 0 3px rgba(230, 62, 109, 0.1);
}
.fr-textarea {
  min-height: 110px;
  line-height: 1.55;
}
.fr-input.error,
.fr-textarea.error {
  border-color: rgba(230, 62, 109, 0.6);
}

.fr-select-wrap {
  position: relative;
}
.fr-select {
  padding-right: 32px;
  cursor: pointer;
}
.fr-select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text3);
}

.fr-form-error {
  color: var(--accent);
  font-size: 13px;
  background: rgba(230, 62, 109, 0.1);
  border: 1px solid rgba(230, 62, 109, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
}

.fr-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.18s, transform 0.14s, opacity 0.18s;
}
.fr-submit-btn:hover { background: #ff6b9d; }
.fr-submit-btn:active { transform: scale(0.98); }
.fr-submit-btn:disabled { opacity: 0.55; pointer-events: none; }

/* ══════════════════════════════════════
   TOPIC DETAIL PAGE
══════════════════════════════════════ */

/* Header actions */
.ft-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ft-action-btn:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.ft-action-btn:hover { background: var(--surface); color: var(--text); }
.ft-action-btn--danger { color: var(--accent); }
.ft-action-btn--danger:hover { background: rgba(230, 62, 109, 0.12); color: var(--accent); }

/* Main area */
.ft-main {
  max-width: 900px;
  margin: var(--header-h, 56px) auto 0;
  padding: 16px 16px 120px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Loader */
.ft-loader:not([hidden]) {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

/* ── Topic card ── */
.ft-topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}


.ft-topic-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ft-author {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.18s;
}
.ft-author:hover { color: var(--accent); }

.ft-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.ft-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ft-author-name {
  font-weight: 600;
}

.ft-topic-date {
  font-size: 12px;
  color: var(--text3);
  margin-left: auto;
}

.ft-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.ft-status-badge--open {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.ft-status-badge--closed {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text3);
  border: 1px solid var(--border);
}

.ft-topic-title {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
@media (min-width: 640px) {
  .ft-topic-title { font-size: 20px; }
}

.ft-topic-body {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Comments section ── */
.ft-comments-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ft-comments-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 2px;
}

.ft-comments-label {
  font-family: var(--font-d);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ft-comments-count {
  font-size: 13px;
  color: var(--text3);
  font-weight: 600;
}

.ft-comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ft-no-comments {
  font-size: 13px;
  color: var(--text3);
  padding: 12px 0;
  text-align: center;
}

/* ── Comment item ── */
.ft-comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
}

.ft-comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  margin-top: 1px;
}
.ft-comment-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ft-comment-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ft-comment-header {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.ft-comment-author {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  transition: color 0.18s;
}
.ft-comment-author:hover { color: var(--accent); }

.ft-comment-admin-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(230, 62, 109, 0.15);
  color: var(--accent);
  border: 1px solid rgba(230, 62, 109, 0.2);
  text-transform: uppercase;
}

.ft-comment-date {
  font-size: 11px;
  color: var(--text3);
  margin-left: auto;
}

.ft-comment-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.ft-comment-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: -2px;
}
.ft-comment-del-btn:hover { background: rgba(230, 62, 109, 0.12); color: var(--accent); }

/* ── Comment input bar ── */
.ft-comment-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 90;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
}

.ft-comment-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}

.ft-comment-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  padding: 9px 13px;
  outline: none;
  resize: none;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.18s;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.ft-comment-input::placeholder { color: var(--text3); }
.ft-comment-input:focus {
  border-color: rgba(230, 62, 109, 0.45);
  box-shadow: 0 0 0 3px rgba(230, 62, 109, 0.08);
}

.ft-comment-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s, transform 0.14s, opacity 0.18s;
}
.ft-comment-send:hover { background: #ff6b9d; }
.ft-comment-send:active { transform: scale(0.94); }
.ft-comment-send:disabled { opacity: 0.45; pointer-events: none; }

/* ── Admin badge (in profile display context) ── */
.fr-admin-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(230, 62, 109, 0.15);
  color: var(--accent);
  border: 1px solid rgba(230, 62, 109, 0.2);
  text-transform: uppercase;
  vertical-align: middle;
}

/* ── Responsive adjustments ── */
@media (min-width: 640px) {
  .fr-main { padding: 20px 24px 100px; }
  .ft-main { padding: 20px 24px 120px; }
  .fr-tabs-wrap { padding: 0 24px; }
}

@media (min-width: 900px) {
  .fr-main { padding: 24px 32px 100px; }
  .ft-main { padding: 24px 32px 120px; }
}

/* ── Generic confirm / alert modal ── */
.ft-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ft-modal.visible { display: flex; }

.ft-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.ft-modal.open .ft-modal-backdrop { opacity: 1; }

.ft-modal-card {
  position: relative;
  z-index: 1;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 18px;
  padding: 24px 22px 20px;
  max-width: 320px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
}
.ft-modal.open .ft-modal-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.ft-modal-title {
  font-family: var(--font-d);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.ft-modal-text {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.55;
  margin: 0;
}

.ft-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ft-modal-cancel {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ft-modal-cancel:hover { background: var(--surface); color: var(--text); }

.ft-modal-ok {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.ft-modal-ok:hover { background: var(--border2); }

.ft-modal-confirm {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: rgba(230, 62, 109, 0.12);
  color: var(--accent);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.ft-modal-confirm:hover { background: rgba(230, 62, 109, 0.22); }
