/**
 * Q-Bank — layout/css/qbank.css
 * 셸(사이드바 · 상단 바 · 푸터) · 디자인 토큰 · default 화면 덮어쓰기 · 다크
 * 색은 default 와 같은 변수 이름을 재정의 → 게시판·회원·플러그인이 자동으로 Q-Bank 톤
 * 앱 화면 컴포넌트는 Q-Bank 플러그인의 assets/qb.css
 */

/* ══ 토큰 ═══════════════════════════════════════════════════ */
:root {
  --p: #4f46e5;
  --qb-font: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --qb-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: var(--qb-font);

  --bg-body:    #f6f7fb;
  --bg-card:    #ffffff;
  --bg-header:  #ffffff;
  --bg-topbar:  #ffffff;
  --text-main:  #0f172a;
  --text-muted: #64748b;
  --border:     #e5e7ef;
  --hover-row:  #f4f5fb;

  --qb-soft:    color-mix(in srgb, var(--p) 9%, #fff);
  --qb-soft-2:  color-mix(in srgb, var(--p) 16%, #fff);
  --qb-ink-2:   #334155;
  --qb-ok:      #059669;
  --qb-warn:    #d97706;
  --qb-bad:     #e11d48;
  --qb-shadow:  0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px -8px rgba(15, 23, 42, .08);
  --qb-shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .25);
  --qb-r:       14px;
  --qb-side:    256px;
  --qb-top:     64px;
}
body.dark {
  --bg-body:    #0b1020;
  --bg-card:    #121829;
  --bg-header:  #121829;
  --bg-topbar:  #121829;
  --text-main:  #e6e9f2;
  --text-muted: #8a93ab;
  --border:     #222a3f;
  --hover-row:  #182036;
  --qb-soft:    color-mix(in srgb, var(--p) 18%, #121829);
  --qb-soft-2:  color-mix(in srgb, var(--p) 28%, #121829);
  --qb-ink-2:   #c3c9d9;
  --qb-shadow:  0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ══ 기본 ═══════════════════════════════════════════════════ */
body.qbt-body {
  margin: 0;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: var(--qb-font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
.qbt-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.qbt-skip { position: fixed; left: 12px; top: -60px; z-index: 100000; padding: 10px 14px; border-radius: 10px; background: var(--p); color: #fff; font-weight: 700; }
.qbt-skip:focus { top: 12px; }
.qbt-body :focus-visible { outline: 2px solid var(--p); outline-offset: 2px; }
.qbt-only-m { display: none !important; }

.qbt-app { display: grid; grid-template-columns: var(--qb-side) minmax(0, 1fr); min-height: 100vh; }
.qbt-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.qbt-content { flex: 1; outline: none; }

/* ══ 사이드바 ═════════════════════════════════════════════════ */
.qbt-side-wrap { position: relative; z-index: 60; }
.qbt-side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 16px 14px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  scrollbar-width: thin;
}
.qbt-brand-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 16px; }
.qbt-brand { display: flex; align-items: center; gap: 10px; color: var(--text-main); text-decoration: none; min-width: 0; }
.qbt-logo {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--p); color: #fff;
  font: 900 18px/1 'Montserrat', sans-serif;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--p) 80%, transparent);
}
.qbt-brand-name { font: 800 17px/1 'Montserrat', var(--qb-font); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qbt-brand-badge { padding: 3px 6px; border-radius: 6px; background: var(--qb-soft); color: var(--p); font: 800 9.5px/1 var(--qb-mono); letter-spacing: .06em; }

.qbt-new {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 0 2px 8px; height: 42px; border-radius: 12px;
  background: var(--p); color: #fff !important; text-decoration: none;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--p) 90%, transparent);
  transition: filter .15s, transform .15s;
}
.qbt-new:hover { filter: brightness(1.07); }
.qbt-new:active { transform: translateY(1px); }

.qbt-side-label { margin: 18px 12px 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.qbt-nav {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 12px; margin: 1px 0;
  border: 0; border-radius: 10px; background: none;
  color: var(--qb-ink-2); font: 600 14px/1.3 var(--qb-font);
  text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.qbt-nav > i:first-child { width: 18px; text-align: center; font-size: 15px; color: var(--text-muted); transition: color .15s; }
.qbt-nav span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qbt-nav:hover { background: var(--hover-row); color: var(--text-main); }
.qbt-nav.is-active { background: var(--qb-soft); color: var(--p); }
.qbt-nav.is-active > i:first-child { color: var(--p); }
.qbt-caret { font-size: 10px !important; color: var(--text-muted); transition: transform .2s; }
.qbt-grp.is-open .qbt-caret { transform: rotate(180deg); }
.qbt-sub { display: none; margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid var(--border); }
.qbt-grp.is-open .qbt-sub { display: block; }
.qbt-sub a { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text-muted); font-size: 13px; text-decoration: none; }
.qbt-sub a:hover { background: var(--hover-row); color: var(--text-main); }
.qbt-n { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 5px; background: var(--qb-bad); color: #fff; font: 800 9px/1 var(--qb-mono); font-style: normal; }

.qbt-plan {
  display: block; margin-top: auto; padding: 14px;
  border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(160deg, var(--qb-soft), transparent 70%), var(--bg-card);
  color: var(--text-main); text-decoration: none;
}
.qbt-side > .qbt-plan { margin-top: 24px; }
.qbt-plan:hover { border-color: color-mix(in srgb, var(--p) 45%, var(--border)); }
.qbt-plan-top { display: flex; align-items: baseline; justify-content: space-between; }
.qbt-plan-top b { font-size: 14px; }
.qbt-plan-top small { font-size: 11.5px; color: var(--text-muted); }
.qbt-plan-meter { display: block; height: 6px; margin: 10px 0 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.qbt-plan-meter i { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: var(--p); }
.qbt-plan-txt { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ══ 상단 바 ═════════════════════════════════════════════════ */
.qbt-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  height: var(--qb-top); padding: 0 28px;
  background: color-mix(in srgb, var(--bg-body) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.qbt-top-title { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.qbt-top-brand { font: 800 15px/1 'Montserrat', var(--qb-font); color: var(--text-main); text-decoration: none; }
.qbt-search {
  display: flex; align-items: center; gap: 10px;
  flex: 1; max-width: 440px; margin-left: 12px;
  height: 40px; padding: 0 10px 0 14px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--bg-card); color: var(--text-muted);
  transition: border-color .15s, box-shadow .15s;
}
.qbt-search:focus-within { border-color: var(--p); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 16%, transparent); }
.qbt-search input { flex: 1; min-width: 0; height: 100%; border: 0 !important; background: none !important; color: var(--text-main) !important; font: 500 14px var(--qb-font); outline: none; padding: 0 !important; box-shadow: none !important; }
.qbt-search kbd { padding: 2px 7px; border: 1px solid var(--border); border-radius: 6px; font: 600 11px/1.4 var(--qb-mono); color: var(--text-muted); }
.qbt-top-r { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.qbt-ibtn { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-muted); cursor: pointer; font-size: 15px; transition: color .15s, border-color .15s; }
.qbt-ibtn:hover { color: var(--text-main); border-color: #c7cbe0; }
.qbt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-main); font: 700 13.5px/1 var(--qb-font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.qbt-btn-p { background: var(--p); border-color: var(--p); color: #fff !important; }
.qbt-btn-p:hover { filter: brightness(1.07); }
.qbt-btn-ghost:hover { border-color: var(--p); color: var(--p); }

.qbt-notif { position: relative; }
.qbt-badge { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; border: 2px solid var(--bg-body); background: var(--qb-bad); color: #fff; font: 800 9px/13px var(--qb-mono); text-align: center; }
.qbt-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 9999; width: 340px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); box-shadow: var(--qb-shadow-lg); overflow: hidden; }
.qbt-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 14px; }
.qbt-pop-head button { border: 0; background: none; padding: 0 0 0 10px; color: var(--p); font: 700 12px var(--qb-font); cursor: pointer; }
.qbt-pop-head button.mute { color: var(--text-muted); }
.qbt-pop-list { max-height: 340px; overflow-y: auto; }
.qbt-pop-foot { display: block; padding: 11px; border-top: 1px solid var(--border); text-align: center; font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.qbt-toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 99999; pointer-events: none; }

.qbt-user { position: relative; }
.qbt-user-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--text-main); font: 700 13px var(--qb-font); cursor: pointer; }
.qbt-user-btn .fa-chevron-down { font-size: 10px; color: var(--text-muted); }
.qbt-av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--p); color: #fff; font-weight: 800; font-size: 13px; }
.qbt-user-name { max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qbt-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 9999; min-width: 220px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); box-shadow: var(--qb-shadow-lg); }
.qbt-menu[hidden] { display: none; }
.qbt-menu-head { margin: 0; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); }
.qbt-menu-head b { display: block; font-size: 14px; }
.qbt-menu-head small { font-size: 12px; color: var(--text-muted); }
.qbt-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--qb-ink-2); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.qbt-menu a i { width: 16px; color: var(--text-muted); }
.qbt-menu a:hover { background: var(--hover-row); color: var(--text-main); }

/* 알림 · 플래시 */
.qbt-notice { margin: 16px 28px 0; padding: 11px 14px; border-radius: 12px; background: var(--qb-soft); color: var(--p); font-size: 13.5px; font-weight: 600; }
.qbt-flash { display: flex; align-items: center; gap: 10px; margin: 16px 28px 0; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--p); border-radius: 12px; background: var(--bg-card); box-shadow: var(--qb-shadow); font-size: 14px; font-weight: 600; transition: opacity .4s, transform .4s; }
.qbt-flash.is-out { opacity: 0; transform: translateY(-6px); }
.qbt-flash-success { border-left-color: var(--qb-ok); }
.qbt-flash-error { border-left-color: var(--qb-bad); }
.qbt-flash button { margin-left: auto; border: 0; background: none; color: var(--text-muted); cursor: pointer; }

/* ══ 푸터 ═══════════════════════════════════════════════════ */
.qbt-foot { padding: 24px 28px 28px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12.5px; }
.qbt-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.qbt-foot-brand { font: 800 13px/1 'Montserrat', var(--qb-font); color: var(--text-main); }
.qbt-foot-links { display: flex; gap: 16px; }
.qbt-foot-links a { color: var(--text-muted); text-decoration: none; }
.qbt-foot-links a:hover { color: var(--p); }
.qbt-foot-biz, .qbt-foot-copy { margin: 8px 0 0; line-height: 1.6; }

/* ══ FAB (default #dx-fab-wrap 규칙보다 우선) ═══════════════════ */
#dx-fab-wrap.qbt-fab { position: fixed; left: auto; right: 22px; bottom: 22px; transform: none; z-index: 900; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; background: none; box-shadow: none; }
#dx-fab-wrap.qbt-fab .dx-fab-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--bg-card); color: var(--text-main); font: 700 12px var(--qb-font); text-decoration: none; cursor: pointer; box-shadow: var(--qb-shadow-lg); }
#dx-fab-wrap.qbt-fab #dx-fab-top { width: 44px; padding: 0; }
.qbt-fab-ring { position: absolute; inset: 8px; transform: rotate(-90deg); }
.qbt-fab-ring circle { fill: none; stroke-width: 2; }
.qbt-fab-ring .t { stroke: var(--border); }
.qbt-fab-ring .r { stroke: var(--p); stroke-linecap: round; }

/* ══ 사이트 화면 (default 마크업) 다듬기 ═══════════════════════ */
.qbt-body:not(.qbt-is-app) #dx-main { max-width: 1180px !important; padding: 28px 28px 24px !important; }
.qbt-body #dx-community-widget { max-width: 1180px !important; padding: 0 28px 40px !important; }
.qbt-body .dx-card, .qbt-body #dx-sidebar > div { border-radius: var(--qb-r) !important; box-shadow: var(--qb-shadow) !important; }
.qbt-body .bg-blue-600, .qbt-body .bg-blue-500, .qbt-body .bg-sky-600 { background-color: var(--p) !important; }
.qbt-body .text-blue-600, .qbt-body .text-blue-500 { color: var(--p) !important; }
.qbt-body input[type="text"], .qbt-body input[type="search"], .qbt-body input[type="email"], .qbt-body input[type="password"],
.qbt-body input[type="url"], .qbt-body input[type="number"], .qbt-body select, .qbt-body textarea { border-radius: 10px; }
.qbt-body input:focus, .qbt-body select:focus, .qbt-body textarea:focus { border-color: var(--p) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 16%, transparent); outline: none; }
.qbt-app-main { padding: 26px 28px 40px; max-width: 1360px; width: 100%; box-sizing: border-box; margin: 0 auto; }

/* 응시 집중 모드 — 사이드바 숨김 */
.qbt-focus .qbt-app { grid-template-columns: minmax(0, 1fr); }
.qbt-focus .qbt-side-wrap, .qbt-focus .qbt-search, .qbt-focus #dxMobBtn { display: none !important; }
.qbt-focus #dx-fab-wrap { display: none !important; }

/* ══ 반응형 ══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .qbt-app { grid-template-columns: minmax(0, 1fr); }
  .qbt-only-m { display: inline-grid !important; }
  .qbt-top-brand.qbt-only-m { display: inline !important; }
  .qbt-hide-m { display: none !important; }
  .qbt-side-wrap { position: fixed; inset: 0; z-index: 100000; background: rgba(15, 23, 42, .45); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s linear .2s; }
  .qbt-side-wrap.open { opacity: 1; visibility: visible; transition: opacity .2s; }
  .qbt-side { width: min(86vw, 300px); transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
  .qbt-side-wrap.open .qbt-side { transform: none; }
  .qbt-top { padding: 0 14px; gap: 10px; }
  .qbt-search { display: none; }
  .qbt-user-name, .qbt-user-btn .fa-chevron-down { display: none; }
  .qbt-user-btn { padding: 0 4px; }
  .qbt-app-main { padding: 18px 14px 32px; }
  .qbt-notice, .qbt-flash { margin: 12px 14px 0; }
  .qbt-foot { padding: 20px 14px 24px; }
  .qbt-body:not(.qbt-is-app) #dx-main { padding: 18px 14px 16px !important; }
}
@media (max-width: 640px) {
  .qbt-pop { position: fixed; left: 8px; right: 8px; top: calc(var(--qb-top) + 6px); width: auto; }
  .qbt-top-title { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
