/* ================================================================
   Bizhare Bug Bounty — Design System
   Clean, professional, security-focused dark UI
   ================================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --bg-base:       #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --bg-overlay:    #21262d;
  --border:        #30363d;
  --border-focus:  #388bfd;

  --text-primary:  #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;
  --text-link:     #58a6ff;

  --accent:        #238636;
  --accent-hover:  #2ea043;
  --accent-text:   #ffffff;

  --danger:        #da3633;
  --danger-hover:  #b91c1c;
  --warning:       #d29922;
  --info:          #388bfd;

  --critical:      #ff4d4f;
  --high:          #fa8c16;
  --medium:        #faad14;
  --low:           #52c41a;
  --info-sev:      #1890ff;

  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;
  --radius-xl:     16px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.4);
  --shadow:        0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.6);

  --font-sans:     'Inter', system-ui, sans-serif;
  --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

  --transition:    150ms ease;
  --nav-h:         60px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
ul { list-style: none; }
input, textarea, select {
  font-family: inherit;
  font-size: 0.9375rem;
  background: var(--bg-overlay);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56,139,253,.2);
}
textarea { resize: vertical; min-height: 120px; }

/* ── Navbar ──────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(13,17,23,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  height: 100%;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1.25rem;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1rem; font-weight: 600;
  color: var(--text-primary); text-decoration: none;
  flex-shrink: 0;
}
.nav-brand:hover { text-decoration: none; opacity: .85; }
.nav-logo { font-size: 1.3rem; }
.nav-title strong { color: var(--accent-hover); }
.nav-links {
  display: flex; align-items: center; gap: 0.25rem;
  margin-left: auto;
}
.nav-link {
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-overlay);
  text-decoration: none;
}
.nav-hamburger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: none; padding: 6px; margin-left: auto;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-secondary);
  transition: transform var(--transition), opacity var(--transition);
}

/* ── Page Loader ─────────────────────────────────────────────── */
.page-loader {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-hover);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: 1100px; margin: 0 auto;
  padding: 2rem 1.25rem;
}
.container-sm { max-width: 640px; margin: 0 auto; padding: 2rem 1.25rem; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.card-sm { padding: 1rem; }
.card + .card { margin-top: 1rem; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: none; border-radius: var(--radius);
  font-size: 0.9375rem; font-weight: 500;
  transition: background var(--transition), opacity var(--transition), transform 80ms ease;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-overlay); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-elevated); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-overlay); color: var(--text-primary); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-loading::after {
  content: ''; display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Form ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; margin-bottom: 0.4rem;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
}
.form-label span.req { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 0.3rem; }
.input-error { border-color: var(--danger) !important; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-critical { background: rgba(255,77,79,.15); color: var(--critical); }
.badge-high     { background: rgba(250,140,22,.15); color: var(--high); }
.badge-medium   { background: rgba(250,173,20,.15); color: var(--medium); }
.badge-low      { background: rgba(82,196,26,.15);  color: var(--low); }
.badge-info     { background: rgba(24,144,255,.15); color: var(--info-sev); }
.badge-success  { background: rgba(35,134,54,.15);  color: #3fb950; }
.badge-muted    { background: var(--bg-overlay); color: var(--text-secondary); }

/* ── Status chips ────────────────────────────────────────────── */
.status-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 99px; font-size: 0.78rem; font-weight: 600;
}
.status-submitted   { background: rgba(56,139,253,.15); color: #58a6ff; }
.status-triaging    { background: rgba(250,173,20,.15); color: var(--medium); }
.status-accepted    { background: rgba(35,134,54,.15);  color: #3fb950; }
.status-resolved    { background: rgba(35,134,54,.2);   color: #56d364; }
.status-rejected    { background: rgba(218,54,51,.15);  color: #f85149; }
.status-duplicate   { background: rgba(139,148,158,.15);color: var(--text-secondary); }
.status-informative { background: rgba(139,148,158,.12);color: var(--text-muted); }
.status-draft       { background: var(--bg-overlay); color: var(--text-muted); }

/* ── Verified tick ───────────────────────────────────────────── */
.verified-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  background: #1da1f2; border-radius: 50%;
  color: #fff; font-size: 9px; font-weight: 700;
  flex-shrink: 0;
}
.verified-badge::after { content: '✓'; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .875rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: .875rem; max-width: 360px;
  pointer-events: all;
  animation: slideIn .2s ease;
}
.toast.toast-error  { border-left: 3px solid var(--danger); }
.toast.toast-success{ border-left: 3px solid var(--accent); }
.toast.toast-info   { border-left: 3px solid var(--info); }
.toast.fade-out     { animation: fadeOut .3s ease forwards; }
@keyframes slideIn  { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut  { to { transform: translateX(100%); opacity: 0; } }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th {
  background: var(--bg-elevated);
  padding: .7rem 1rem; text-align: left;
  font-size: .8rem; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
}
td { padding: .75rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: var(--bg-elevated); }

/* ── Timeline ────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: ''; position: absolute; left: .6rem; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative; padding-bottom: 1.5rem;
}
.timeline-item::before {
  content: ''; position: absolute; left: -1.45rem; top: .3rem;
  width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg-base);
}
.timeline-item.tl-created::before  { background: var(--accent); border-color: var(--accent); }
.timeline-item.tl-status::before   { background: var(--info); border-color: var(--info); }
.timeline-item.tl-comment::before  { background: var(--bg-overlay); border-color: var(--border-focus); }
.timeline-item.tl-bounty::before   { background: var(--medium); border-color: var(--medium); }
.timeline-item.tl-file::before     { background: var(--high); border-color: var(--high); }
.tl-header { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.tl-actor   { font-weight: 600; font-size: .9rem; }
.tl-action  { color: var(--text-secondary); font-size: .875rem; }
.tl-time    { color: var(--text-muted); font-size: .8rem; margin-left: auto; }

/* ── Comments ────────────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 1rem; }
.comment-item {
  display: flex; gap: .875rem;
}
.comment-item.internal {
  background: rgba(250,173,20,.05);
  border-left: 2px solid var(--warning);
  padding-left: .75rem; border-radius: 0 var(--radius) var(--radius) 0;
}
.comment-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-overlay); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--text-secondary);
  flex-shrink: 0; overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-body { flex: 1; }
.comment-meta { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .35rem; }
.comment-author { font-weight: 600; font-size: .9rem; }
.comment-time   { color: var(--text-muted); font-size: .8rem; }
.comment-content { font-size: .9rem; line-height: 1.65; color: var(--text-primary); white-space: pre-wrap; }

/* ── Auth Pages ──────────────────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.25rem;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-header h1 { font-size: 1.5rem; font-weight: 700; }
.auth-header p  { color: var(--text-secondary); margin-top: .5rem; font-size: .9rem; }
.auth-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 1.25rem 0; color: var(--text-muted); font-size: .85rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 1.25rem 3rem;
  text-align: center;
}
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 700; line-height: 1.25; }
.hero h1 span { color: var(--accent-hover); }
.hero p  { color: var(--text-secondary); font-size: 1.0625rem; max-width: 600px; margin: 1rem auto 0; }
.hero-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.75rem; }

/* ── Wall of Fame ────────────────────────────────────────────── */
.wof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem; margin-top: 1.5rem;
}
.wof-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: .75rem;
  transition: border-color var(--transition), transform var(--transition);
}
.wof-card:hover { border-color: var(--border-focus); transform: translateY(-2px); }
.wof-rank {
  font-size: 1.5rem; font-weight: 800; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.wof-rank.gold   { color: #f0c040; }
.wof-rank.silver { color: #b0b8c4; }
.wof-rank.bronze { color: #cd7f32; }
.wof-hunter { display: flex; align-items: center; gap: .75rem; }
.wof-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-overlay); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; overflow: hidden;
}
.wof-avatar img { width: 100%; height: 100%; object-fit: cover; }
.wof-name    { font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: .35rem; }
.wof-stats   { display: flex; gap: .5rem; flex-wrap: wrap; }
.wof-stat    { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text-secondary); }
.wof-sev-bar { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── Report List ─────────────────────────────────────────────── */
.report-list { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  display: flex; flex-direction: column; gap: .5rem;
}
.report-card:hover { border-color: var(--border-focus); background: var(--bg-elevated); }
.report-card-header { display: flex; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.report-title { font-weight: 600; font-size: .95rem; flex: 1; }
.report-meta  { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); }

/* ── Dashboard Tabs ──────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .6rem 1rem; background: none; border: none;
  color: var(--text-secondary); font-size: .9rem; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn:hover    { color: var(--text-primary); }
.tab-btn.active   { color: var(--text-primary); border-bottom-color: var(--accent-hover); }
.tab-panel        { display: none; }
.tab-panel.active { display: block; }

/* ── Admin Grid ──────────────────────────────────────────────── */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.admin-stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  text-align: center;
}
.admin-stat-card .stat-num { font-size: 2rem; font-weight: 700; }
.admin-stat-card .stat-lbl { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Misc helpers ────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1       { gap: .5rem; }
.gap-2       { gap: 1rem; }
.mt-1        { margin-top: .5rem; }
.mt-2        { margin-top: 1rem; }
.mt-3        { margin-top: 1.5rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-secondary); }
.text-sm     { font-size: .85rem; }
.text-mono   { font-family: var(--font-mono); font-size: .85rem; }
.w-full      { width: 100%; }
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-secondary); font-size: .95rem;
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.section-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.page-title    { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.page-sub      { color: var(--text-secondary); margin-bottom: 1.5rem; }
.divider       { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.code-block {
  background: var(--bg-overlay); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  font-family: var(--font-mono); font-size: .85rem;
  overflow-x: auto; white-space: pre;
}
.user-role-select {
  display: flex; gap: .75rem; margin-bottom: .75rem;
}
.role-btn {
  flex: 1; padding: .75rem; border: 2px solid var(--border);
  border-radius: var(--radius-lg); background: var(--bg-overlay);
  color: var(--text-secondary); font-size: .9rem; font-weight: 500;
  transition: all var(--transition); text-align: center; cursor: pointer;
}
.role-btn.selected { border-color: var(--accent-hover); color: var(--accent-hover); background: rgba(35,134,54,.1); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    padding: .75rem 1.25rem;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: .65rem .75rem; }
  .hero h1  { font-size: 1.75rem; }
  .wof-grid { grid-template-columns: 1fr; }
  .tabs     { flex-wrap: wrap; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
}
