/* =====================================================
   CATSBE Common Design System
   — QBoard 기준 통일 (2026-02-16)
===================================================== */

:root {
  /* ── 배경 ── */
  --cb-bg:          #FDFCFA;
  --cb-surface:     #FFFFFF;
  --cb-surface-alt: #F8F5F0;
  --cb-bg-warm:     #F8F5F0;
  --cb-bg-hover:    #F2EDE6;

  /* ── 테두리 ── */
  --cb-border:      #E8E2D8;
  --cb-border-light:#F0EBE4;
  --cb-border-focus:#F37021;
  --cb-divider:     rgba(0,0,0,0.07);

  /* ── 텍스트 (4단계) ── */
  --cb-text:        #1A1714;
  --cb-text-sub:    #4A433B;
  --cb-text-muted:  #7A7268;
  --cb-text-faint:  #B0A89C;

  /* ── 악센트 (오렌지 계열) ── */
  --cb-accent:      #F37021;
  --cb-accent-light:#F5934F;
  --cb-accent-bg:   rgba(243,112,33,0.06);
  --cb-accent-border:rgba(243,112,33,0.25);

  /* ── 골드 (레거시 호환) ── */
  --cb-gold:        #F37021;
  --cb-gold-light:  #F5934F;
  --cb-gold-dark:   #D86018;
  --cb-gold-bg:     rgba(243,112,33,0.06);

  /* ── 유틸리티 배경 ── */
  --cb-bg-white:    #FFFFFF;
  --cb-bg-light:    #F8F5F0;

  /* ── 유틸리티 텍스트 ── */
  --cb-text-light:  #9A9288;

  /* ── 시맨틱 컬러 ── */
  --cb-success:     #2E7A44;
  --cb-danger:      #A83838;
  --cb-warning:     #D4A020;
  --cb-secondary:   #7A8889;

  /* ── 상태 컬러 ── */
  --cb-live:        #A83838;
  --cb-upcoming:    #9A7020;
  --cb-closed:      #7A7268;
  --cb-owned:       #2E7A44;
  --cb-wanted:      #2E6A96;

  /* ── 4D 컬러 (QBoard 기준) ── */
  --cb-dram:        #9A7020;
  --cb-dram-bg:     #FBF5EA;
  --cb-dream:       #2E6A96;
  --cb-dream-bg:    #EEF4FA;
  --cb-drama:       #8E3A54;
  --cb-drama-bg:    #FAEFF3;
  --cb-dungeon:     #2E7A44;
  --cb-dungeon-bg:  #EFF8F1;

  /* ── 간격/크기 ── */
  --cb-radius:      10px;
  --cb-radius-sm:   6px;
  --cb-radius-lg:   12px;
  --cb-radius-pill: 24px;
  --cb-shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --cb-shadow-hover:0 4px 12px rgba(0,0,0,0.08);

  /* ── 타이포그래피 ── */
  --cb-font-serif:  'Cormorant Garamond', Georgia, serif;
  --cb-font-mono:   'DM Mono', 'Courier New', monospace;
  --cb-font:        'Noto Sans KR', -apple-system, sans-serif;
}

/* ── Card ── */
.cb-card {
  background: var(--cb-surface);
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--cb-radius-lg);
  overflow: hidden;
  box-shadow: var(--cb-shadow);
  transition: box-shadow .2s, transform .2s;
}
@media (hover: hover) {
  .cb-card:hover {
    box-shadow: var(--cb-shadow-hover);
    transform: translateY(-2px);
  }
}

/* ── Thumbnail ── */
.cb-thumbnail {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--cb-surface-alt);
}
.cb-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cb-thumbnail-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cb-text-muted);
  font-weight: 700;
  font-size: .85rem;
}

/* ── Badge ── */
.cb-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  line-height: 1.4;
}
.cb-badge.live     { background: var(--cb-live); color: #fff; }
.cb-badge.upcoming { background: var(--cb-upcoming); color: #fff; }
.cb-badge.closed   { background: var(--cb-closed); color: #fff; }
.cb-badge.owned    { background: var(--cb-owned); color: #fff; }
.cb-badge.wanted   { background: var(--cb-wanted); color: #fff; }
.cb-badge.sp-linked {
  background: var(--cb-gold-bg);
  color: var(--cb-gold);
  border: 1px solid rgba(197,165,90,.3);
}

/* ── Section Header ── */
.cb-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 12px;
}
.cb-section-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--cb-text);
  margin: 0;
}
.cb-section-header .count {
  font-size: 13px;
  color: var(--cb-text-muted);
  margin-left: 8px;
  font-weight: 400;
}
.cb-section-header .more-link {
  font-size: 13px;
  color: var(--cb-gold);
  text-decoration: none;
  font-weight: 500;
}
.cb-section-header .more-link:hover {
  text-decoration: underline;
}

/* ── Buttons ── */
.cb-btn-primary {
  display: inline-block;
  padding: 10px 28px;
  background: var(--cb-gold);
  color: #fff;
  border: none;
  border-radius: var(--cb-radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
}
.cb-btn-primary:hover { background: var(--cb-gold-dark); color: #fff; }

.cb-btn-secondary {
  display: inline-block;
  padding: 10px 28px;
  background: transparent;
  color: var(--cb-text-sub);
  border: 1px solid var(--cb-border);
  border-radius: var(--cb-radius);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
}
.cb-btn-secondary:hover { background: #f5f5f5; color: var(--cb-text); }

/* =====================================================
   BASE LAYOUT STYLES (from base.html)
===================================================== */

/* ── Global Reset (모바일 CSS 일관성) ── */
*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
img, video, iframe { max-width: 100%; height: auto; }
input, button, select, textarea {
  font: inherit;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 0;
}

/* iOS Safari: 16px 미만 입력필드 자동 줌 방지 */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

body {
  padding-bottom: 70px !important;
  background: #ffffff;
}
main { min-height: 100vh; min-height: 100dvh; }

.navbar { -webkit-user-select: none; user-select: none; }

/* ── Notification ── */
.noti-badge {
  font-size: 0.65rem;
  padding: 3px 6px;
  border-radius: 50%;
}
.noti-dropdown {
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
}
.noti-item-unread {
  font-weight: 600;
  background: #f8f9fa;
}

/* ── Mobile User Bar ── */
.mobile-userbar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mobile-userbar .nav-link {
  padding: 0.25rem 0.35rem;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
}
@media (min-width: 992px) {
  .mobile-userbar { display: none !important; }
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 60px;
  background-color: #fff;
  border-top: 1px solid #dee2e6;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 2000;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -1px 6px rgba(0,0,0,0.08);
}
.bottom-nav a {
  flex: 1;
  color: #6c757d;
  text-decoration: none;
  text-align: center;
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav a i { font-size: 1.25rem; line-height: 1; }
.bottom-nav a.active { color: #ff9800; font-weight: 700; }

.bottom-nav a.back-btn { color: #333; }
.bottom-nav a.back-btn i { font-size: 1.45rem; }
.bottom-nav a.back-btn.hidden { visibility: hidden; }

/* ── 4D Panel ── */
.bottom-4d-panel {
  position: fixed;
  left: 0; right: 0;
  bottom: 60px;
  z-index: 2100;
  padding: 10px 12px 12px;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -6px 18px rgba(0,0,0,0.10);
  display: none;
  will-change: transform;
}
.bottom-4d-panel.show { display: block; }

.bottom-4d-grid {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.bottom-4d-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  text-decoration: none;
  color: #2f3e3d;
  font-size: 0.85rem;
  background: #fff;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Pinned Notice Banner ── */
.cb-pin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FDFAF5;
  border-bottom: 1px solid #E8DCC8;
  padding: 8px 16px;
}
.cb-pin-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--cb-text-sub);
  min-width: 0;
  flex: 1;
}
.cb-pin-link:hover {
  color: var(--cb-accent);
  text-decoration: none;
}
.cb-pin-badge {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  background: var(--cb-accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.cb-pin-text {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cb-pin-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--cb-text-muted);
  cursor: pointer;
  padding: 0 0 0 12px;
  line-height: 1;
  flex-shrink: 0;
}
.cb-pin-close:hover {
  color: var(--cb-text);
}

/* ── Footer ── */
.catsbe-footer {
  background: transparent;
  color: #A09890;
  padding: 18px 12px 24px;
  font-size: 0.72rem;
  font-weight: 300;
  text-align: center;
  margin-bottom: 70px;
  line-height: 1.6;
}
.catsbe-footer .title { font-weight: 400; color: #8A8480; }

/* =====================================================
   TOP NAV (Custom)
===================================================== */
.cb-topnav {
  position: sticky;
  top: 0;
  left: 0; right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  will-change: transform;
}

.cb-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  line-height: 1;
  gap: 0;
}
.cb-logo:hover { text-decoration: none; }
.cb-logo-main {
  font-family: 'DM Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #2f3e3d;
}
.cb-logo-house {
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.78rem;
  font-style: italic;
  font-weight: 400;
  color: #8a7e72;
  letter-spacing: 1px;
  margin-top: -1px;
}

.cb-topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cb-topnav-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #2f3e3d;
  text-decoration: none;
  border-radius: 50%;
  transition: background 0.15s;
}
.cb-topnav-icon:hover {
  background: #f5f5f5;
}
.cb-topnav-icon i {
  font-size: 1.3rem;
}

.cb-badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #dc3545;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 4px;
  line-height: 1;
}

.cb-topnav-points {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  background: transparent;
  color: #5C5650;
  font-size: 0.75rem;
  font-weight: 400;
  border-radius: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.cb-topnav-points:hover {
  color: #3A3530;
}

.cb-topnav-profile {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  color: #2f3e3d;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 768px) {
  .cb-topnav-profile {
    max-width: none;
    font-size: 0.85rem;
    padding: 6px 12px;
  }
}

.cb-hamburger {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}

/* ── Drawer ── */
.cb-drawer {
  position: fixed;
  top: 0; bottom: 0; right: 0;
  width: 280px;
  background: #fff;
  z-index: 3000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 12px rgba(0,0,0,0.15);
}
.cb-drawer.show {
  transform: translateX(0);
}

.cb-drawer-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  cursor: pointer;               /* iOS: div 클릭 이벤트 활성화 */
  -webkit-tap-highlight-color: transparent;
}
.cb-drawer-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.cb-drawer-body {
  position: relative;
  z-index: 3000;
  background: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.cb-drawer-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.cb-drawer-header strong {
  font-size: 1.1rem;
  color: #2f3e3d;
}
.cb-drawer-logout {
  font-size: 0.85rem;
  color: #dc3545;
  text-decoration: none;
}

.cb-drawer-nav {
  flex: 1;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}
.cb-drawer-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  color: #2f3e3d;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.1px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}

.cb-drawer-nav a i.bi {
  font-size: 1.05rem;
  color: #7A7268;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.cb-drawer-nav a:hover {
  background: #f8f9fa;
}
.cb-drawer-nav hr {
  margin: 8px 0;
  border: none;
  border-top: 1px solid #e8e8e8;
}

/* =====================================================
   HISTORY NAV (뒤로/앞으로 - 홈 외 페이지)
===================================================== */
.cb-histnav {
  position: fixed;
  left: 0; right: 0;
  bottom: 60px;
  height: 32px;
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  background: rgba(255,255,255,0.95);
  border-top: 1px solid #eee;
  z-index: 1999;
  will-change: transform;
}
.cb-histnav.show {
  display: flex;
}
.cb-histnav button {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.15s;
}
.cb-histnav button:hover {
  color: #2f3e3d;
}
.cb-histnav button:disabled {
  color: #ccc;
  cursor: not-allowed;
}

/* =====================================================
   BOTTOM NAV V2 (콜렉션 추가, 보드 2중)
===================================================== */
/* 기존 .bottom-nav 스타일은 유지하되, 아이콘만 업데이트 */

/* 보드 패널 (Q-Board/C-Board) */
.bottom-board-panel {
  position: fixed;
  left: 0; right: 0;
  bottom: 60px;
  z-index: 2100;
  padding: 10px 12px 12px;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid #e9ecef;
  box-shadow: 0 -6px 18px rgba(0,0,0,0.10);
  display: none;
  will-change: transform;
}
.bottom-board-panel.show {
  display: block;
}

.bottom-board-grid {
  max-width: 360px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.bottom-board-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  text-decoration: none;
  color: #2f3e3d;
  font-size: 0.9rem;
  background: #fff;
  font-weight: 700;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════
   QBarn-style 내비바 (전역 적용)
═══════════════════════════════════════════ */

/* QBarn CSS 변수 추가 */
:root {
  --qb-pad-x: 20px;
  --qb-bg: #FDFCFA;
  --qb-bg-card: #FFFFFF;
  --qb-bg-warm: #F8F5F0;
  --qb-bg-hover: #F2EDE6;

  --qb-accent: #F37021;
  --qb-accent-light: #F5934F;
  --qb-accent-bg: rgba(243,112,33,0.06);
  --qb-accent-border: rgba(243,112,33,0.25);

  --qb-text: #1A1714;
  --qb-text-sub: #4A433B;
  --qb-text-muted: #7A7268;
  --qb-text-faint: #B0A89C;

  --qb-border: #E8E2D8;
  --qb-border-light: #F0EBE4;
  --qb-divider: rgba(0,0,0,0.07);

  --qb-radius: 10px;
  --qb-radius-sm: 6px;
  --qb-radius-pill: 24px;
  --qb-shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --qb-shadow-hover: 0 4px 12px rgba(0,0,0,0.08);

  --qb-content-max: 1200px;
  --qb-content-pad: 40px;
}

/* ═══ TOP NAV (QBarn 스타일) ═══ */
.qb-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--qb-pad-x);
  background: var(--qb-bg);
  border-bottom: 1px solid var(--qb-border);
  position: sticky;
  top: 0;
  z-index: 200;
  height: 48px;
}

.qb-nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--qb-text-muted);
  font-family: 'Noto Sans KR', sans-serif;
  text-decoration: none;
  transition: color 0.2s;
}

.qb-nav-back:hover {
  color: var(--qb-accent);
  text-decoration: none;
}

.qb-nav-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--qb-text);
  letter-spacing: 1px;
}

.qb-nav-actions {
  display: flex;
  gap: 12px;
}

.qb-nav-action {
  background: none;
  border: none;
  font-size: 17px;
  color: var(--qb-text-muted);
  cursor: pointer;
  padding: 2px;
  text-decoration: none;
  transition: color 0.2s;
}

.qb-nav-action:hover {
  color: var(--qb-accent);
}

/* ═══ BOTTOM NAV (QBarn 스타일) ═══ */
.qb-bnav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  background: var(--qb-bg-card);
  border-top: 1px solid var(--qb-border);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 56px;
  will-change: transform;
}

.qb-bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: none;
  color: inherit;
  min-width: 44px;
  transition: opacity 0.2s;
}

.qb-bnav-item:active {
  opacity: 0.6;
}

.qb-bnav-item:hover {
  text-decoration: none;
  color: inherit;
}

.qb-bnav-icon {
  font-size: 18px;
  line-height: 1;
  color: var(--qb-text-sub);
}

.qb-bnav-icon i {
  font-size: 18px;
}

.qb-bnav-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--qb-text-muted);
  letter-spacing: -0.2px;
}

.qb-bnav-item.active .qb-bnav-icon {
  color: var(--qb-accent);
}

.qb-bnav-item.active .qb-bnav-label {
  color: var(--qb-accent);
  font-weight: 500;
}

/* Desktop에서는 bottom nav 숨김 */
@media (min-width: 768px) {
  .qb-bnav {
    display: none;
  }

  .qb-top-nav {
    max-width: var(--qb-content-max);
    margin: 0 auto;
  }
}

/* ═══════════════════════════════════════════
   INFINITE SCROLL (공통)
═══════════════════════════════════════════ */
.scroll-sentinel {
  display: flex; justify-content: center;
  padding: 20px 0 40px;
}
.scroll-loader {
  font-size: 12px; color: var(--cb-text-muted, #adb5bd);
  padding: 8px 20px;
  border: 1px solid var(--cb-border, #E8E2D8);
  border-radius: 20px;
  background: var(--cb-surface, #fff);
  animation: scrollPulse 1.2s ease infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}

/* 데스크탑에서만 페이지네이션 표시, 모바일에서는 숨김 */
@media (max-width: 768px) {
  .desktop-only { display: none !important; }
}
