/* =========================================================
   VietAZ Forum – Pro Minimal UI (vx-)
   OPTIMIZED: Mobile-first, iPhone-friendly, Performance
   Harmonized with vietaz-core single.css
   ========================================================= */

/* ===================== TOKENS / BASE ===================== */

.vx-forum {
  /* VietAZ Theme Colors: Light, Professional - harmonized with vz- vars */
  --vx-bg: #f7f8fa;
  --vx-card: #ffffff;
  --vx-border: #e1e4e8;
  --vx-border2: #f1f5f9;
  --vx-text: #24313f;
  --vx-muted: #64748b;
  --vx-link: #2563eb;
  --vx-shadow: 0 10px 22px rgba(17, 24, 39, 0.08);
  --vx-radius: 12px;
  --vx-radius2: 8px;

  --vx-ok: #2ecc71;
  --vx-warn: #f39c12;
  --vx-err: #e74c3c;

  /* Header colors matching VietAZ */
  --vx-header-bg: #334155;
  --vx-header-text: #ffffff;
  --vx-accent: #dc2626;

  /* Performance: reduce shadows on mobile */
  --vx-shadow-mobile: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* iOS Safari: prevent text size adjust */
.vx-forum {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Smooth scrolling */
@media (prefers-reduced-motion: no-preference) {
  .vx-forum {
    scroll-behavior: smooth;
  }
}

.vx-forum .vx-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 16px 46px;
}

.vx-forum a {
  color: var(--vx-link);
  text-decoration: none;
}
.vx-forum a:hover {
  text-decoration: underline;
}
.vx-muted {
  color: var(--vx-muted);
}

/* Touch optimization: larger tap targets */
.vx-forum a,
.vx-forum button {
  -webkit-tap-highlight-color: rgba(2, 132, 199, 0.1);
}

/* Dark mode support - REMOVED to keep light theme only */
/* VietAZ uses light theme consistently */

/* ===================== TOP BAR / HEADER ===================== */

.vx-forum-notice {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: var(--vx-radius2);
  box-shadow: var(--vx-shadow);
  padding: 12px 14px;
  margin-bottom: 14px;
  color: #78350f;
}

.vx-forum-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--vx-header-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--vx-radius2);
  box-shadow: var(--vx-shadow);
}

.vx-forum-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  flex-wrap: wrap;
}
.vx-forum-breadcrumb a {
  color: var(--vx-header-text);
}

.vx-forum-userbox {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vx-forum-userbox__hi {
  color: var(--vx-header-text);
  font-weight: 600;
  font-size: 14px;
}

.vx-forum-head {
  padding: 18px 2px 10px;
}
.vx-forum-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  color: var(--vx-text);
  letter-spacing: -0.02em;
}
.vx-forum-subtitle {
  margin: 6px 0 0;
  color: var(--vx-muted);
}

.vx-forum-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 18px;
  flex-wrap: wrap;
}

.vx-forum-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.vx-forum-search input {
  width: min(520px, 100%);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-card);
  color: var(--vx-text);
  font-size: 14px;
}
.vx-forum-search input:focus {
  outline: none;
  border-color: var(--vx-link);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

/* ===================== BUTTONS ===================== */

.vx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-card);
  color: var(--vx-text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vx-btn:hover {
  background: var(--vx-bg);
  border-color: var(--vx-link);
  text-decoration: none;
}
.vx-btn--primary {
  background: var(--vx-link);
  border-color: var(--vx-link);
  color: white;
}
.vx-btn--primary:hover {
  background: #0369a1;
  border-color: #0369a1;
}
.vx-btn--accent {
  background: var(--vx-accent);
  border-color: var(--vx-accent);
  color: white;
}
.vx-btn--accent:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
.vx-btn--ghost {
  background: var(--vx-card);
}
.vx-btn--small {
  padding: 9px 12px;
  font-size: 13px;
}
.vx-btn--tiny {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 4px;
}
.vx-btn--warn {
  border-color: var(--vx-warn);
  background: #fef3c7;
  color: #78350f;
}
.vx-btn.is-active {
  border-color: var(--vx-link);
  background: #e0f2fe;
  color: var(--vx-link);
}

/* ===================== SECTIONS / CARDS ===================== */

.vx-forum-section {
  background: var(--vx-card);
  border: 1px solid var(--vx-border);
  border-radius: var(--vx-radius);
  box-shadow: var(--vx-shadow);
  margin: 14px 0;
  overflow: hidden;
  /* Performance: use will-change sparingly */
}

/* Reduce shadows on mobile for performance */
@media (max-width: 860px) {
  .vx-forum-section,
  .vx-forum-topbar,
  .vx-post--phpbb,
  .vx-replybox,
  .vx-compose-card {
    box-shadow: var(--vx-shadow-mobile);
  }
}
.vx-forum-section__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--vx-border2);
}
.vx-forum-section__head h2 {
  margin: 0;
  font-size: 18px;
  color: var(--vx-text);
}
.vx-forum-section__head p {
  margin: 6px 0 0;
  color: var(--vx-muted);
}
.vx-forum-section__head--compact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

/* ===================== INDEX / SUBFORUMS TABLE ===================== */

.vx-forum-list--table {
  padding: 0;
}

.vx-forum-headrow {
  display: grid;
  grid-template-columns: 1fr 180px 220px;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--vx-border2);
  border-bottom: 1px solid var(--vx-border2);
  background: #f8fafc;
  color: var(--vx-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.vx-forum-row--table {
  display: grid;
  grid-template-columns: 1fr 180px 220px;
  gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid var(--vx-border2);
  align-items: center;
}
.vx-forum-row--table:first-of-type {
  border-top: 0;
}

.vx-forum-col {
  min-width: 0;
}
.vx-forum-col--stats {
  text-align: center;
}
.vx-forum-col--last {
  text-align: center;
}

.vx-forum-row__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--vx-text);
}
.vx-forum-row__title a:hover {
  color: var(--vx-link);
}
.vx-forum-row__desc {
  margin-top: 4px;
  color: var(--vx-muted);
  font-size: 14px;
}
.vx-forum-row__subforums {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--vx-muted);
  font-size: 13px;
}
.vx-forum-row__subforums a {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--vx-border);
  background: #f1f5f9;
  text-decoration: none;
  font-size: 12px;
}
.vx-forum-row__subforums a:hover {
  background: #e0f2fe;
  border-color: var(--vx-link);
}

.vx-forum-help {
  margin: 10px 16px 14px;
}

/* Stats block (used in index) */
.vx-forum-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  align-items: center;
}
.vx-forum-stat {
  text-align: center;
  min-width: 70px;
}
.vx-forum-stat__label {
  font-size: 12px;
  line-height: 1.1;
  color: var(--vx-muted);
  margin-bottom: 4px;
}
.vx-forum-stat__value {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--vx-text);
}

/* ===================== TOPIC LIST TABLE (forum-forum.php) ===================== */

.vx-topic-list--table {
  padding: 0;
}

.vx-topic-headrow {
  display: grid;
  grid-template-columns: 1fr 180px 220px;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--vx-border2);
  border-bottom: 1px solid var(--vx-border2);
  background: #f8fafc;
  color: var(--vx-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.vx-topic-row--table {
  display: grid;
  grid-template-columns: 1fr 180px 220px;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--vx-border2);
  align-items: center;
}
.vx-topic-row--table:first-of-type {
  border-top: 0;
}

.vx-topic-row__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--vx-text);
}
.vx-topic-row__title a:hover {
  color: var(--vx-link);
}
.vx-topic-row__meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--vx-muted);
  font-size: 12px;
}

.vx-topic-titleline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.vx-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--vx-accent);
  display: inline-block;
}

/* Topic flags (icons next to title) */
.vx-topic-icons--left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.vx-topic-icons--left .vx-ticon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  box-shadow: none;
}

/* ===================== STATS / LAST POST ===================== */

.vx-topic-col--stats {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.vx-topic-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
}
.vx-topic-stat {
  text-align: center;
  min-width: 74px;
}
.vx-topic-stat__label {
  font-size: 12px;
  color: var(--vx-muted);
  line-height: 1.1;
  margin-bottom: 4px;
}
.vx-topic-stat__value {
  font-size: 16px;
  font-weight: 850;
  color: var(--vx-text);
  line-height: 1.05;
}

/* Make numbers stable (no wobble) */
.vx-topic-stat__value,
.vx-forum-stat__value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  display: block;
  min-width: 3ch;
  margin: 0 auto;
}

.vx-topic-col--last {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.vx-lastpost {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
}
.vx-lastpost__time {
  font-weight: 850;
  color: var(--vx-text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.vx-lastpost__by {
  margin-top: 0;
  font-size: 12px;
  line-height: 1.1;
}
.vx-lastpost__name {
  font-weight: 700;
  color: var(--vx-text);
}
.vx-lastpost__by .vx-author-link {
  font-weight: 700;
}

/* Right-side icons (optional; used by template markup) */
.vx-topic-icons {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.vx-ticon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid var(--vx-border);
  box-shadow: var(--vx-shadow);
  color: var(--vx-link);
  transition: all 0.15s ease;
}
.vx-ticon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.9;
}
.vx-ticon--announce {
  color: var(--vx-ok);
  background: #dcfce7;
  border-color: #86efac;
}
.vx-ticon--sticky {
  color: var(--vx-warn);
  background: #fef3c7;
  border-color: #fbbf24;
}
.vx-ticon--locked {
  color: var(--vx-err);
  background: #fee2e2;
  border-color: #fca5a5;
}
.vx-ticon:hover {
  transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
  .vx-ticon:hover {
    transform: none;
  }
}

/* ===================== SEARCH RESULTS LIST (forum-search.php) ===================== */

.vx-topic-list .vx-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid var(--vx-border2);
}
.vx-topic-list .vx-topic-row:first-of-type {
  border-top: 0;
}

.vx-topic-row__main {
  min-width: 0;
}
.vx-topic-row__stats {
  display: flex;
  align-items: center;
  gap: 22px;
}

/* ===================== ALERTS / EMPTY / PAGINATION ===================== */

.vx-alert {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-card);
}
.vx-alert--ok {
  border-color: var(--vx-ok);
  background: #dcfce7;
  color: #15803d;
}
.vx-alert--warn {
  border-color: var(--vx-warn);
  background: #fef3c7;
  color: #78350f;
}
.vx-alert--err {
  border-color: var(--vx-err);
  background: #fee2e2;
  color: #991b1b;
}

.vx-empty {
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--vx-border2);
  color: var(--vx-muted);
  font-size: 14px;
}

.vx-pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid var(--vx-border2);
}
.vx-pagination a {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-card);
  text-decoration: none;
  font-weight: 600;
  color: var(--vx-text);
  transition: all 0.15s ease;
}
.vx-pagination a:hover {
  background: #e0f2fe;
  border-color: var(--vx-link);
}
.vx-pagination a.is-active {
  border-color: var(--vx-link);
  background: var(--vx-link);
  color: white;
}

/* ===================== TOPIC VIEW (forum-topic.php) ===================== */

.vx-topic-head {
  padding: 14px 2px 6px;
}
.vx-topic-head__meta {
  margin-top: 6px;
  color: var(--vx-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.vx-topic-head__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===================== POSTS (phpBB-ish) ===================== */

.vx-posts--phpbb {
  margin-top: 10px;
}

.vx-post--phpbb {
  padding: 0 !important;
  overflow: hidden;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  background: var(--vx-card);
  border: 1px solid var(--vx-border);
  border-radius: var(--vx-radius2);
  box-shadow: var(--vx-shadow);
  margin-bottom: 12px;
}

/* Left author pane */
.vx-postpane {
  padding: 16px 12px;
  border-right: 1px solid var(--vx-border2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #f8fafc;
}
.vx-postpane__avatar {
  margin-bottom: 10px;
}
.vx-postpane__avatar img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--vx-border);
}
.vx-postpane__author {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: var(--vx-text);
  margin-bottom: 6px;
}
.vx-postpane__rank {
  display: flex;
  justify-content: center;
  margin: 6px 0 2px;
}
.vx-postpane__meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--vx-muted);
}

/* Author link (like vietaz-core single) */
.vx-postpane__stats {
  margin-top: 8px;
}

.vx-author-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.vx-author-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.vx-author-stats {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  padding: 4px 8px;
  background: #f1f5f9;
  border-radius: 6px;
}

.vx-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--vx-border);
  background: #f1f5f9;
  color: var(--vx-text);
}
.vx-rank--admin {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}
.vx-rank--mod {
  border-color: #fbbf24;
  background: #fef3c7;
  color: #78350f;
}
.vx-rank--member {
  border-color: #7dd3fc;
  background: #e0f2fe;
  color: #0369a1;
}

/* Right post main */
.vx-postmain {
  min-width: 0;
}

/* Post header bar (phpBB feel) */
.vx-posthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--vx-border2);
  background: #f8fafc;
}
.vx-posthead__left {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.vx-posthead__time {
  font-weight: 600;
  color: var(--vx-text);
  font-size: 13px;
}
.vx-posthead__right {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.vx-posthead__link {
  font-weight: 600;
  text-decoration: none;
}
.vx-posthead__sep {
  color: var(--vx-muted);
}

.vx-postcontent {
  padding: 14px 14px 16px;
  color: var(--vx-text);
  line-height: 1.75;
  font-size: 15px;
  word-wrap: break-word;
}

/* Inline form buttons */
.vx-inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}
.vx-inline-form button {
  vertical-align: middle;
}

/* ===================== BBCODE ===================== */

.vx-bb-u {
  text-decoration: underline;
}
.vx-bb-quote {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--vx-link);
  background: #e0f2fe;
  border-radius: 6px;
  color: var(--vx-text);
}
.vx-bb-code {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--vx-border);
  background: #f8fafc;
  border-radius: 6px;
  overflow: auto;
  font-family: "Courier New", monospace;
  font-size: 13px;
}

/* ===================== REPLY BOX ===================== */

.vx-replybox {
  margin-top: 16px;
  background: var(--vx-card);
  border: 1px solid var(--vx-border);
  border-radius: var(--vx-radius);
  box-shadow: var(--vx-shadow);
  overflow: hidden;
}
.vx-replybox__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--vx-border2);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.vx-replybox__head h2 {
  margin: 0;
  font-size: 16px;
  color: var(--vx-text);
}
.vx-replybox__form {
  padding: 14px 16px;
}
.vx-replybox__form textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-bg);
  color: var(--vx-text);
  font-size: 16px;
  font-family: inherit;
}

/* Edit form styling (distinct from normal post content) */
.vx-edit-post {
  background: #ffffff; /* keep form card white */
}
.vx-edit-post textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: #fbfdff; /* slightly different, very light blue tint */
  color: var(--vx-text);
  font-size: 15px;
  font-family: inherit;
}
.vx-replybox__form textarea:focus {
  outline: none;
  border-color: var(--vx-link);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}
.vx-replybox__actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* ===================== COMPOSE (New topic) ===================== */

.vx-forum-new-topic .vx-container {
  padding-top: 18px;
}

.vx-compose-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 12px;
}
.vx-compose-head .vx-forum-title {
  margin: 0;
}

.vx-compose {
  margin-top: 10px;
}

.vx-compose-card {
  background: var(--vx-card);
  border: 1px solid var(--vx-border);
  border-radius: var(--vx-radius);
  box-shadow: var(--vx-shadow);
  overflow: hidden;
}
.vx-compose-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--vx-border2);
}
.vx-compose-row:first-child {
  border-top: 0;
}

.vx-compose-label {
  font-weight: 600;
  color: var(--vx-text);
  font-size: 14px;
  padding-top: 10px;
}
.vx-compose-field {
  min-width: 0;
}

.vx-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-bg);
  color: var(--vx-text);
  font-size: 16px;
  transition: all 0.15s ease;
}
.vx-input:focus {
  outline: none;
  border-color: var(--vx-link);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}
.vx-textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 6px;
  border: 1px solid var(--vx-border);
  background: var(--vx-bg);
  color: var(--vx-text);
  line-height: 1.6;
  font-size: 16px;
  font-family: inherit;
  transition: all 0.15s ease;
}
.vx-textarea:focus {
  outline: none;
  border-color: var(--vx-link);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

.vx-compose-help {
  margin-top: 8px;
  font-size: 13px;
}
.vx-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 0 0;
}

/* ===================== RESPONSIVE ===================== */

/* iPad / Tablet */
@media (max-width: 980px) {
  .vx-forum-headrow,
  .vx-forum-row--table,
  .vx-topic-headrow,
  .vx-topic-row--table {
    grid-template-columns: 1fr;
  }

  .vx-forum-col--stats,
  .vx-forum-col--last,
  .vx-topic-col--stats,
  .vx-topic-col--last {
    justify-content: flex-start;
    text-align: left;
  }

  .vx-forum-stats,
  .vx-topic-stats {
    justify-content: flex-start;
  }

  .vx-lastpost {
    text-align: left;
    flex-direction: row;
    gap: 8px;
  }

  /* Compact stats on tablet */
  .vx-forum-stat,
  .vx-topic-stat {
    min-width: 60px;
  }
}

/* Mobile / iPhone */
@media (max-width: 860px) {
  /* Tighter container padding */
  .vx-forum .vx-container {
    padding: 16px 12px 32px;
  }

  /* Topbar: stack vertically */
  .vx-forum-topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }

  .vx-forum-userbox {
    width: 100%;
    justify-content: flex-end;
  }

  /* Breadcrumb: smaller text */
  .vx-forum-breadcrumb {
    font-size: 13px;
  }

  /* Header: smaller title on mobile */
  .vx-forum-title {
    font-size: 24px;
  }

  /* Search: full width */
  .vx-forum-search {
    min-width: 100%;
  }

  .vx-forum-search input {
    width: 100%;
  }

  /* Buttons: touch-friendly (min 44px height) */
  .vx-btn {
    min-height: 44px;
    padding: 12px 16px;
  }

  .vx-btn--small {
    min-height: 40px;
    padding: 10px 14px;
  }

  .vx-btn--tiny {
    min-height: 36px;
    padding: 8px 12px;
  }

  /* Forum/Topic rows: more padding for touch */
  .vx-forum-row--table,
  .vx-topic-row--table {
    padding: 16px 14px;
  }

  /* Title: slightly smaller */
  .vx-forum-row__title,
  .vx-topic-row__title {
    font-size: 15px;
  }

  /* Stats: compact horizontal layout */
  .vx-forum-stats,
  .vx-topic-stats {
    gap: 16px;
  }

  .vx-forum-stat,
  .vx-topic-stat {
    min-width: 50px;
  }

  .vx-forum-stat__value,
  .vx-topic-stat__value {
    font-size: 15px;
  }

  .vx-forum-stat__label,
  .vx-topic-stat__label {
    font-size: 11px;
  }

  /* Post layout: stack author pane */
  .vx-post--phpbb {
    grid-template-columns: 1fr;
  }

  .vx-postpane {
    border-right: 0;
    border-bottom: 1px solid var(--vx-border2);
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
    gap: 12px;
    padding: 12px;
  }

  .vx-postpane__avatar {
    margin-bottom: 0;
  }

  .vx-postpane__avatar img {
    width: 48px;
    height: 48px;
  }

  /* Post header: wrap on mobile */
  .vx-posthead {
    padding: 12px;
    flex-wrap: wrap;
  }

  .vx-posthead__left,
  .vx-posthead__right {
    width: 100%;
    justify-content: space-between;
  }

  /* Post content: comfortable reading */
  .vx-postcontent {
    padding: 14px 12px;
    font-size: 15px;
    line-height: 1.7;
  }

  /* Compose form: stack */
  .vx-compose-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .vx-compose-label {
    padding-top: 0;
  }

  .vx-compose-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  /* Reply box: comfortable */
  .vx-replybox__head {
    padding: 12px;
  }

  .vx-replybox__form {
    padding: 12px;
  }

  .vx-replybox__form textarea {
    min-height: 140px;
    font-size: 16px; /* Prevent iOS zoom */
  }

  /* Inputs: prevent iOS zoom on focus */
  .vx-input,
  .vx-textarea {
    font-size: 16px;
  }

  /* Pagination: wrap better */
  .vx-pagination {
    padding: 12px;
    gap: 6px;
  }

  .vx-pagination a {
    padding: 10px 14px;
    min-height: 40px;
    display: flex;
    align-items: center;
  }
}
/* =========================================================
   ABSOLUTE FIX: Topic Stats column truly centered (grid-safe)
   Put at VERY END of forum.css
   ========================================================= */

/* force the topic rows to be real 3-col grid */
.vx-topic-row--table {
  display: grid !important;
  grid-template-columns: 1fr 180px 220px !important;
  gap: 14px !important;
  align-items: center !important;
}

/* center the whole Stats cell inside the row */
.vx-topic-row--table > .vx-topic-col--stats {
  justify-self: center !important;
  align-self: center !important;
  display: block !important; /* tránh flex cũ kéo lệch */
}

/* make the stats group a stable 2-column mini-grid */
.vx-topic-row--table .vx-topic-stats {
  display: grid !important;
  grid-auto-flow: column !important;
  grid-auto-columns: 86px !important; /* 2 ô bằng nhau */
  justify-content: center !important;
  align-items: center !important;
  gap: 22px !important;
}

/* each stat: fixed box + centered */
.vx-topic-row--table .vx-topic-stat {
  width: 86px !important;
  min-width: 86px !important;
  text-align: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

/* stable digits */
.vx-topic-row--table .vx-topic-stat__value {
  font-variant-numeric: tabular-nums !important;
  font-feature-settings: "tnum" 1 !important;
  line-height: 1.1 !important;
}
.vx-topic-row--table .vx-topic-stat__label {
  line-height: 1.1 !important;
}

/* responsive: stack */
@media (max-width: 980px) {
  .vx-topic-row--table {
    grid-template-columns: 1fr !important;
  }
  .vx-topic-row--table > .vx-topic-col--stats {
    justify-self: start !important;
  }
  .vx-topic-row--table .vx-topic-stats {
    justify-content: start !important;
  }
}
/* ===== Pro polish: topic view ===== */

/* 1) Số like / label nút không nhảy width */
.vx-btn,
.vx-btn--tiny {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 2) Header bar post: canh baseline + gọn hơn */
.vx-posthead {
  align-items: center;
}
.vx-posthead__right {
  gap: 8px;
}

/* 3) Quick reply: textarea dễ đọc hơn, không “mỏng” */
.vx-replybox__form textarea {
  font-size: 15px;
  line-height: 1.65;
  min-height: 160px;
}
.vx-forum .vx-forum-catlink {
  color: inherit;
  text-decoration: none;
}
.vx-forum .vx-forum-catlink:hover {
  text-decoration: underline;
}
.vx-forum-actions {
  position: relative;
  z-index: 5;
}
.vx-forum-section {
  position: relative;
  z-index: 1;
}
.vx-forum-section::before {
  pointer-events: none;
}
.vx-forum-head {
  position: relative;
  z-index: 2;
}
/* ===== Report form: keep select + button on ONE line ===== */

.vx-posthead__right .vx-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* specifically the report form: select grows, button stays */
.vx-posthead__right form[action*="admin-post.php"] {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  max-width: 100%;
}

.vx-posthead__right form[action*="admin-post.php"] .vx-select.vx-select--tiny {
  flex: 1 1 auto;
  min-width: 120px;
}

.vx-posthead__right form[action*="admin-post.php"] .vx-btn.vx-btn--tiny {
  flex: 0 0 auto;
}

/* if container is too narrow, allow the whole report group to drop,
   but keep select+button together */
.vx-posthead__right form[action*="admin-post.php"] {
  white-space: nowrap;
}

/* ===================== MOBILE OPTIMIZATIONS ===================== */

/* iPhone X/11/12/13/14/15 notch safe area */
@supports (padding: max(0px)) {
  .vx-forum .vx-container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* Small iPhone (SE, 12/13 mini) */
@media (max-width: 430px) {
  .vx-forum-title {
    font-size: 22px;
  }

  .vx-forum-row__title,
  .vx-topic-row__title {
    font-size: 14px;
  }

  /* Extra compact stats */
  .vx-forum-stats,
  .vx-topic-stats {
    gap: 12px;
  }

  .vx-forum-stat,
  .vx-topic-stat {
    min-width: 45px;
  }

  .vx-forum-stat__value,
  .vx-topic-stat__value {
    font-size: 14px;
  }

  /* Smaller buttons */
  .vx-btn {
    padding: 10px 14px;
  }

  .vx-btn--small {
    padding: 8px 12px;
  }

  /* Compact post pane */
  .vx-postpane {
    padding: 10px;
  }

  .vx-postpane__avatar img {
    width: 40px;
    height: 40px;
  }

  .vx-postpane__author {
    font-size: 14px;
  }

  /* Compact post content */
  .vx-postcontent {
    padding: 12px 10px;
    font-size: 14px;
  }

  /* Subforums: stack */
  .vx-forum-row__subforums {
    gap: 6px;
  }

  .vx-forum-row__subforums a {
    padding: 3px 6px;
    font-size: 12px;
  }
}

/* Landscape mode optimization */
@media (max-width: 860px) and (orientation: landscape) {
  .vx-forum .vx-container {
    padding-top: 12px;
    padding-bottom: 20px;
  }

  .vx-forum-head {
    padding-top: 10px;
  }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix iOS Safari input zoom */
  input[type="text"],
  input[type="email"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Fix iOS Safari sticky header issues */
  .vx-forum-topbar {
    position: relative;
    z-index: 10;
  }

  /* Smooth momentum scrolling */
  .vx-postcontent,
  .vx-bb-code {
    -webkit-overflow-scrolling: touch;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .vx-forum *,
  .vx-forum *::before,
  .vx-forum *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .vx-forum {
    --vx-border: rgba(0, 0, 0, 0.4);
    --vx-border2: rgba(0, 0, 0, 0.3);
  }

  .vx-btn {
    border-width: 2px;
  }
}

/* Performance: Hardware acceleration for animations */
.vx-btn,
.vx-ticon {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Loading state optimization */
.vx-forum img {
  loading: lazy;
}

/* Print styles */
@media print {
  .vx-forum-topbar,
  .vx-forum-actions,
  .vx-replybox,
  .vx-btn {
    display: none !important;
  }

  .vx-forum {
    --vx-bg: white;
    --vx-card: white;
    --vx-text: black;
    --vx-shadow: none;
  }

  .vx-post--phpbb {
    page-break-inside: avoid;
  }
}
/* =========================================================
   FIX TOPBAR (Board index + Login/Register) — paste at END
   ========================================================= */

/* 1) Breadcrumb: fix màu + chống CSS parse lệch */
.vx-forum-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  flex-wrap: wrap;
}
.vx-forum-breadcrumb a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
}
.vx-forum-breadcrumb a:hover {
  color: #fff;
  text-decoration: underline;
}

/* 2) Topbar: gọn lại, không bị “cao” */
.vx-forum-topbar {
  align-items: center;
}

/* Chỉ thu nhỏ button trong topbar (Login/Register) */
.vx-forum-topbar .vx-btn {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
}

/* 3) Mobile: giữ topbar 1 hàng, wrap khi cần */
@media (max-width: 860px) {
  .vx-forum-topbar {
    flex-direction: row; /* IMPORTANT: không stack dọc */
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .vx-forum-breadcrumb {
    flex: 1 1 auto;
    min-width: 160px;
  }

  .vx-forum-userbox {
    flex: 0 0 auto;
    width: auto; /* bỏ full-width để khỏi đẩy bar cao */
    justify-content: flex-end;
    gap: 8px;
  }
}
/* =========================================================
   MOBILE: Index rows -> card layout (hide FORUM/STATS/LAST)
   Paste at END of forum.css
   ========================================================= */

@media (max-width: 860px) {
  /* 1) Hide the table header row on mobile */
  .vx-forum-headrow,
  .vx-topic-headrow {
    display: none !important;
  }

  /* 2) Turn each forum row into a compact card */
  .vx-forum-row--table {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 14px 14px !important;
    border-top: 1px solid var(--vx-border2) !important;
  }

  /* 3) Title/desc spacing */
  .vx-forum-row__title {
    font-size: 15px !important;
    line-height: 1.25;
  }
  .vx-forum-row__desc {
    font-size: 13px !important;
    margin-top: 4px !important;
  }

  /* 4) Subforum chips: tighter */
  .vx-forum-row__subforums {
    margin-top: 10px !important;
    gap: 6px !important;
  }
  .vx-forum-row__subforums a {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }

  /* 5) Stats + Last post appear as one compact “meta strip” */
  .vx-forum-col--stats,
  .vx-forum-col--last {
    justify-content: flex-start !important;
    text-align: left !important;
  }

  .vx-forum-stats {
    justify-content: flex-start !important;
    gap: 14px !important;
  }
  .vx-forum-stat {
    min-width: 0 !important;
  }
  .vx-forum-stat__label {
    font-size: 11px !important;
    margin-bottom: 2px !important;
  }
  .vx-forum-stat__value {
    font-size: 15px !important;
  }

  .vx-lastpost {
    align-items: flex-start !important;
    text-align: left !important;
    flex-direction: row !important;
    gap: 8px !important;
  }
  .vx-lastpost__time {
    font-size: 13px !important;
    font-weight: 800 !important;
  }
  .vx-lastpost__by {
    font-size: 12px !important;
  }

  /* 6) If your markup keeps 3 “cols” in order:
        Title col -> Stats col -> Last col
        Add a subtle separator before stats/last */
  .vx-forum-row--table > .vx-forum-col--stats,
  .vx-forum-row--table > .vx-forum-col--last {
    padding-top: 10px !important;
    border-top: 1px dashed var(--vx-border2) !important;
  }

  /* 7) Optional: make whole row feel clickable without changing HTML */
  .vx-forum-row--table {
    border-radius: 12px;
    background: var(--vx-card);
  }
  .vx-forum-list--table {
    padding: 0 0 8px;
  }
}
