/* ── BanQuiz Design System ──────────────────────────────────────────────────── */

/* Design tokens */
:root {
  --primary: #ec5b13;
  --primary-light: rgba(236,91,19,.1);
  --primary-hover: #d44e0d;
  --bg: #f8f6f6;
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --card-radius: 12px;
  --card-border: 1px solid #e2e8f0;
  --card-shadow: 0 1px 3px rgba(0,0,0,.06);
  --font: 'Public Sans', sans-serif;
}

/* Override Bootstrap primary color */
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover { background-color: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.btn-outline-primary { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-primary:hover { background-color: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* Body */
body { font-family: var(--font); background: var(--bg); color: #1e293b; }

/* App layout */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.app-sidebar .sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none; color: var(--primary);
}
.app-sidebar .sidebar-logo .logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.app-sidebar .sidebar-logo h1 {
  font-size: 16px; font-weight: 700; margin: 0; color: #1e293b;
}
.app-sidebar .nav-section { padding: 16px 12px 8px; }
.app-sidebar .nav-label {
  font-size: 10px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 0 8px; margin-bottom: 6px;
}
.app-sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: #64748b;
  font-size: 14px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px;
  white-space: nowrap;
}
.app-sidebar .nav-item:hover { background: #f8fafc; color: #1e293b; }
.app-sidebar .nav-item.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 4px 12px rgba(236,91,19,.3);
}
.app-sidebar .nav-item .material-symbols-outlined { font-size: 20px; }
.sidebar-premium {
  margin: auto 12px 16px;
  background: #1e293b; border-radius: 12px;
  padding: 16px; color: #fff;
}
.sidebar-premium .pro-label { font-size: 10px; font-weight: 700; opacity: .6; margin-bottom: 4px; }
.sidebar-premium p { font-size: 12px; line-height: 1.5; margin-bottom: 12px; opacity: .85; }
.sidebar-premium .btn-upgrade {
  width: 100%; padding: 8px; border-radius: 8px;
  background: var(--primary); color: #fff; border: none;
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.sidebar-premium .btn-upgrade:hover { background: var(--primary-hover); }

/* Main content area */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */
.app-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-title { font-size: 18px; font-weight: 700; color: #1e293b; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: #64748b;
  cursor: pointer; transition: background .15s; position: relative;
}
.topbar-icon-btn:hover { background: #f1f5f9; color: #1e293b; }
.topbar-icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
}
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 10px;
  cursor: pointer; text-decoration: none;
}
.topbar-user:hover { background: #f8fafc; }
.topbar-user img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.topbar-user .user-name { font-size: 13px; font-weight: 600; color: #1e293b; }
.topbar-user .user-title { font-size: 11px; color: #64748b; }
.topbar-divider { width: 1px; height: 28px; background: #e2e8f0; margin: 0 4px; }

/* Currency ticker */
.ticker-bar {
  background: rgba(236,91,19,.05);
  border-bottom: 1px solid #e2e8f0;
  height: 44px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.ticker-rates {
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px 0 28px;
  border-right: 1px solid #e2e8f0;
  height: 100%; background: rgba(236,91,19,.04);
  flex-shrink: 0; z-index: 1;
}
.ticker-rate { display: flex; align-items: center; gap: 6px; }
.ticker-rate .lbl { font-size: 10px; font-weight: 700; color: #94a3b8; }
.ticker-rate .val { font-size: 13px; font-weight: 700; color: #1e293b; }
.ticker-rate .chg-up { font-size: 10px; font-weight: 700; color: #16a34a; }
.ticker-rate .chg-dn { font-size: 10px; font-weight: 700; color: #dc2626; }
.ticker-scroll { flex: 1; overflow: hidden; }
.ticker-inner {
  display: inline-flex; align-items: center; gap: 40px;
  white-space: nowrap;
  animation: ticker-scroll 120s linear infinite;
  font-size: 13px; color: #475569;
}
@keyframes ticker-scroll {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}
.ticker-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); display: inline-block; margin-right: 6px; }

/* Page content */
.page-content { padding: 28px; flex: 1; }

/* Cards */
.bq-card {
  background: #fff;
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
}
.bq-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.bq-card-header h6 { font-size: 15px; font-weight: 700; margin: 0; color: #1e293b; }
.bq-card-body { padding: 20px; }

/* Exam cards */
.exam-card {
  background: #fff;
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  padding: 20px;
  transition: box-shadow .2s, border-color .2s;
  cursor: pointer;
  height: 100%;
}
.exam-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); border-color: rgba(236,91,19,.3); }
.exam-card .cat-badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700;
}
.exam-card .exam-title { font-size: 16px; font-weight: 700; color: #1e293b; margin: 10px 0 6px; }
.exam-card .exam-desc { font-size: 13px; color: #64748b; margin-bottom: 14px; }
.exam-card .exam-meta { display: flex; align-items: center; gap: 16px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
.exam-card .meta-item { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #64748b; }
.exam-card .exam-author { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.exam-card .author-info { display: flex; align-items: center; gap: 6px; }
.exam-card .author-info img { width: 24px; height: 24px; border-radius: 50%; }
.exam-card .author-name { font-size: 12px; font-weight: 600; color: #475569; }
.difficulty-hard { color: #ef4444; }
.difficulty-medium { color: #f59e0b; }
.difficulty-easy { color: #10b981; }

/* Category chips */
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  padding: 7px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: 1px solid #e2e8f0;
  background: #fff; color: #64748b;
  text-decoration: none;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 10px rgba(236,91,19,.25); }

/* Question navigator (exam solve) */
.q-nav-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: 1px solid #e2e8f0; background: #f8fafc; color: #64748b;
}
.q-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.q-nav-btn.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.q-nav-btn.answered { background: var(--primary-light); color: var(--primary); border-color: rgba(236,91,19,.3); }
.q-nav-btn.flagged { background: #fef3c7; color: #d97706; border-color: #fbbf24; }

/* Exam answer options */
.answer-option {
  display: flex; align-items: center;
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid #e2e8f0;
  cursor: pointer; transition: all .15s;
  margin-bottom: 10px;
}
.answer-option:hover { border-color: rgba(236,91,19,.4); background: rgba(236,91,19,.03); }
.answer-option.selected { border: 2px solid var(--primary); background: rgba(236,91,19,.05); }
.answer-option .option-letter { font-weight: 700; margin-right: 12px; color: #64748b; min-width: 20px; }
.answer-option.selected .option-letter { color: var(--primary); }

/* Progress bar */
.bq-progress { height: 8px; border-radius: 100px; background: #f1f5f9; overflow: hidden; }
.bq-progress-bar { height: 100%; border-radius: 100px; background: var(--primary); transition: width .3s; }

/* Forum topic list item */
.forum-topic-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  text-decoration: none; color: inherit;
  transition: background .15s;
}
.forum-topic-item:last-child { border-bottom: none; }
.forum-topic-item:hover { background: #fafafa; }
.forum-topic-icon {
  width: 44px; height: 44px; border-radius: 12px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.forum-topic-item .topic-title { font-size: 14px; font-weight: 600; color: #1e293b; margin-bottom: 3px; }
.forum-topic-item:hover .topic-title { color: var(--primary); }
.forum-topic-item .topic-meta { font-size: 12px; color: #94a3b8; }
.forum-topic-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #94a3b8; }
.min-width-0 { min-width: 0; }

/* Listing cards */
.listing-card {
  background: #fff; border: var(--card-border);
  border-radius: var(--card-radius); overflow: hidden;
  transition: box-shadow .2s; cursor: pointer;
}
.listing-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.listing-card .listing-img { height: 160px; overflow: hidden; position: relative; }
.listing-card .listing-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.listing-card:hover .listing-img img { transform: scale(1.05); }
.listing-card .listing-cat {
  position: absolute; top: 10px; left: 10px;
  padding: 3px 8px; border-radius: 5px;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.listing-card .listing-body { padding: 14px; }
.listing-card .listing-title { font-size: 14px; font-weight: 700; color: #1e293b; }
.listing-price { color: var(--primary); font-weight: 700; font-size: 16px; }

/* Leaderboard */
.lb-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.lb-item .lb-rank {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.lb-rank-1 { background: #f59e0b; }
.lb-rank-2 { background: #94a3b8; }
.lb-rank-3 { background: #f97316; }
.lb-rank-n { background: #e2e8f0; color: #64748b !important; }
.lb-item img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.lb-item .lb-name { font-size: 13px; font-weight: 700; color: #1e293b; }
.lb-item .lb-pts { font-size: 11px; color: #94a3b8; }
.lb-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }

/* Admin sidebar */
.admin-sidebar-wrap {
  width: 220px; flex-shrink: 0;
  background: #fff; border-right: 1px solid #e2e8f0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  overflow-y: auto;
}
.admin-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 8px;
  text-decoration: none; color: #64748b;
  font-size: 13px; font-weight: 500;
  transition: all .15s; margin-bottom: 1px;
}
.admin-nav-item:hover { background: #f8fafc; color: #1e293b; }
.admin-nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }

/* Stats card */
.stat-card {
  background: #fff; border: var(--card-border);
  border-radius: var(--card-radius); padding: 20px;
  box-shadow: var(--card-shadow);
}
.stat-card .stat-label { font-size: 13px; color: #64748b; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: #1e293b; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
}
.stat-badge-up { font-size: 11px; font-weight: 700; color: #16a34a; }
.stat-badge-dn { font-size: 11px; font-weight: 700; color: #dc2626; }

/* Search bar */
.bq-search {
  display: flex; align-items: center;
  background: #fff; border: var(--card-border);
  border-radius: 10px; padding: 0 14px;
  box-shadow: var(--card-shadow);
}
.bq-search .material-symbols-outlined { color: #94a3b8; font-size: 20px; }
.bq-search input {
  border: none; outline: none; background: transparent;
  padding: 12px 8px; font-size: 14px; font-family: var(--font);
  flex: 1; width: 100%;
}

/* Flash messages */
.flash-bar { padding: 12px 28px; font-size: 14px; font-weight: 500; }

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none; /* hidden by default, shown only on mobile via media query */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #e2e8f0;
  align-items: stretch;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.mob-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #94a3b8;
  position: relative;
  transition: color .15s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
}
.mob-nav-item i { font-size: 22px; }
.mob-nav-item:hover { color: var(--primary); }
.mob-nav-item.active { color: var(--primary); }
.mob-nav-label { font-size: 10px; font-weight: 600; }
.mob-badge {
  position: absolute;
  top: 6px; right: calc(50% - 14px);
  background: #ef4444;
  color: #fff;
  border-radius: 99px;
  font-size: 9px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 700;
}

/* Responsive: hide sidebar on mobile */
@media (max-width: 768px) {
  .app-sidebar { display: none; }
  .app-main { margin-left: 0; }
  .page-content { padding: 16px; padding-bottom: 74px; }
  .admin-sidebar-wrap { display: none; }
  footer { margin-bottom: 62px; }
  /* Show bottom nav on mobile */
  .mobile-bottom-nav { display: flex; }
}

/* Auth pages (no sidebar) */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.auth-card { background: #fff; border: var(--card-border); border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,.08); padding: 36px; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .logo-text { font-size: 22px; font-weight: 800; color: var(--primary); }

/* Nav guest (top navbar for non-auth) */
.guest-nav {
  background: #fff; border-bottom: 1px solid #e2e8f0;
  height: 60px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 100;
}
.guest-nav .nav-links a {
  font-size: 14px; font-weight: 500; color: #64748b;
  text-decoration: none; margin-right: 20px;
  transition: color .15s;
}
.guest-nav .nav-links a:hover { color: var(--primary); }

/* Messaging */
.msg-bubble { max-width: 70%; word-break: break-word; border-radius: 16px; padding: 10px 14px; font-size: 14px; }
.msg-bubble.mine { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }

/* Profile */
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-light); }
.title-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; background: var(--primary-light); color: var(--primary); border-radius: 100px; font-size: 12px; font-weight: 700; }

/* Existing compat: quality bar used by exam cards */
.quality-bar { height: 4px; background: #e2e8f0; border-radius: 2px; }
.quality-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #f97316); border-radius: 2px; }

/* Score circle for result page */
.score-circle {
  width: 120px; height: 120px; border-radius: 50%;
  border: 6px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 700; margin: 0 auto;
}

/* Table */
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #64748b; }

/* Pagination */
.page-link { border-radius: 6px !important; margin: 0 2px; }
.page-item.active .page-link { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.page-link:focus { box-shadow: 0 0 0 .2rem rgba(236,91,19,.25); }

/* Listing photo compat */
.listing-photo { object-fit: cover; width: 100%; height: 220px; border-radius: var(--card-radius) var(--card-radius) 0 0; }

/* Forum topic row compat */
.forum-topic-row:hover { background: #f8fafc; }
.post-body { line-height: 1.7; }

/* Exam timer */
#exam-timer.warning { color: #dc2626; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
