/* ── Buzzparade Admin Design System ──────────────────────────────────────── */
:root {
  --bp-primary:       #4f46e5;
  --bp-primary-dark:  #3730a3;
  --bp-primary-light: #818cf8;
  --bp-accent:        #f59e0b;
  --bp-sidebar-bg:    #1e1b4b;
  --bp-sidebar-text:  #c7d2fe;
  --bp-sidebar-hover: rgba(255,255,255,.08);
  --bp-sidebar-w:     228px;
  --bp-topnav-h:      56px;
  --bp-page-bg:       #f5f6fa;
  --bp-card-bg:       #ffffff;
  --bp-border:        #e5e7eb;
  --bp-text:          #1e1b4b;
  --bp-muted:         #6b7280;
  --bp-light:         #9ca3af;
  --bp-radius:        10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .875rem;
  background: var(--bp-page-bg);
  color: var(--bp-text);
  margin: 0;
}

/* ── Top Navigation ──────────────────────────────────────────────────────── */
.bp-topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bp-topnav-h);
  background: #fff;
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 1040;
  gap: 1rem;
}

.bp-topnav-brand {
  display: flex;
  align-items: center;
  gap: .625rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--bp-primary);
  text-decoration: none;
  width: var(--bp-sidebar-w);
}

.bp-topnav-brand .brand-icon {
  width: 30px; height: 30px;
  background: var(--bp-primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .875rem;
  flex-shrink: 0;
}

.bp-topnav-spacer { flex: 1; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.bp-sidebar {
  position: fixed;
  top: var(--bp-topnav-h);
  left: 0;
  bottom: 0;
  width: var(--bp-sidebar-w);
  background: var(--bp-sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  padding: 1rem 0 2rem;
}

.bp-sidebar::-webkit-scrollbar { width: 4px; }
.bp-sidebar::-webkit-scrollbar-track { background: transparent; }
.bp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.bp-nav-section {
  padding: .375rem 1rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(199,210,254,.45);
  margin-top: .75rem;
}

.bp-nav-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem 1.25rem;
  color: var(--bp-sidebar-text);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  position: relative;
}

.bp-nav-item:hover {
  background: var(--bp-sidebar-hover);
  color: #fff;
}

.bp-nav-item.active {
  background: var(--bp-primary);
  color: #fff;
}

.bp-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--bp-accent);
}

.bp-nav-item i { font-size: .9375rem; width: 16px; text-align: center; flex-shrink: 0; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.bp-content {
  margin-left: var(--bp-sidebar-w);
  margin-top: var(--bp-topnav-h);
  padding: 1.75rem;
  min-height: calc(100vh - var(--bp-topnav-h));
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.bp-page-header {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.5rem;
}

.bp-page-icon {
  width: 40px; height: 40px;
  background: rgba(79,70,229,.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--bp-primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.bp-page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--bp-text);
  margin: 0;
  line-height: 1.2;
}

.bp-page-subtitle {
  font-size: .8rem;
  color: var(--bp-muted);
  margin: .125rem 0 0;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.bp-card {
  background: var(--bp-card-bg);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.25rem;
}

.bp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.bp-card-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--bp-text);
  margin: 0;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.bp-stat-card {
  background: var(--bp-card-bg);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bp-stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.bp-stat-icon.indigo  { background: rgba(79,70,229,.1);  color: var(--bp-primary); }
.bp-stat-icon.green   { background: rgba(16,185,129,.1); color: #10b981; }
.bp-stat-icon.amber   { background: rgba(245,158,11,.1); color: var(--bp-accent); }
.bp-stat-icon.red     { background: rgba(239,68,68,.1);  color: #ef4444; }

.bp-stat-value { font-size: 1.625rem; font-weight: 700; line-height: 1; }
.bp-stat-label { font-size: .75rem;   color: var(--bp-muted); margin-top: .25rem; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.bp-table-wrap {
  overflow-x: auto;
}

.bp-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.bp-table th {
  background: #f9fafb;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bp-muted);
  padding: .625rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--bp-border);
  white-space: nowrap;
}

.bp-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  color: var(--bp-text);
  font-size: .8125rem;
}

.bp-table tbody tr:hover td { background: #f9fafb; }
.bp-table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.bp-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .625rem;
  border-radius: 99px;
  font-size: .6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.bp-badge-active   { background: #d1fae5; color: #065f46; }
.bp-badge-inactive { background: #fee2e2; color: #991b1b; }
.bp-badge-pending  { background: #fef3c7; color: #92400e; }
.bp-badge-blue     { background: #dbeafe; color: #1e40af; }
.bp-badge-purple   { background: #ede9fe; color: #5b21b6; }
.bp-badge-gray     { background: #f3f4f6; color: #374151; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.bp-btn {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  line-height: 1.4;
}

.bp-btn:disabled { opacity: .55; cursor: not-allowed; }

.bp-btn-primary   { background: var(--bp-primary);      color: #fff; }
.bp-btn-primary:hover:not(:disabled)  { background: var(--bp-primary-dark); color: #fff; }

.bp-btn-outline   { background: transparent; color: var(--bp-primary); border: 1.5px solid var(--bp-primary); }
.bp-btn-outline:hover:not(:disabled)  { background: var(--bp-primary); color: #fff; }

.bp-btn-danger    { background: #ef4444; color: #fff; }
.bp-btn-danger:hover:not(:disabled)   { background: #dc2626; color: #fff; }

.bp-btn-sm { padding: .3rem .75rem; font-size: .75rem; border-radius: 6px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.bp-form-section {
  background: #fff;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.bp-form-section-title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--bp-text);
  margin: 0 0 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--bp-border);
}

.bp-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--bp-text);
  margin-bottom: .375rem;
}

.bp-input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--bp-border);
  border-radius: 8px;
  font-size: .875rem;
  color: var(--bp-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.bp-input:focus {
  border-color: var(--bp-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.bp-input.is-invalid { border-color: #ef4444; }
.bp-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

.bp-error-msg { color: #ef4444; font-size: .75rem; margin-top: .25rem; }

/* ── Role Checkboxes ─────────────────────────────────────────────────────── */
.bp-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem;
}

.bp-role-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem .875rem;
  border: 1.5px solid var(--bp-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: .8125rem;
  font-weight: 500;
}

.bp-role-checkbox:has(input:checked) {
  border-color: var(--bp-primary);
  background: rgba(79,70,229,.06);
  color: var(--bp-primary);
}

.bp-role-checkbox input { accent-color: var(--bp-primary); }

/* ── Toasts / Alerts ─────────────────────────────────────────────────────── */
.bp-alert {
  padding: .875rem 1.125rem;
  border-radius: 8px;
  font-size: .8125rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}

.bp-alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.bp-alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.bp-alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.bp-alert-warn    { background: #fef3c7; color: #92400e; border-left: 4px solid var(--bp-accent); }

/* ── Search Bar ──────────────────────────────────────────────────────────── */
.bp-search-wrap {
  position: relative;
}

.bp-search-wrap i {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bp-muted);
  font-size: .875rem;
  pointer-events: none;
}

.bp-search-wrap .bp-input { padding-left: 2.25rem; }

/* ── Auth / Login Page ───────────────────────────────────────────────────── */
.bp-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #4f46e5 100%);
  padding: 2rem;
}

.bp-auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,.35);
}

.bp-auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 2rem;
}

.bp-auth-logo-icon {
  width: 44px; height: 44px;
  background: var(--bp-primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 1.25rem;
}

.bp-auth-logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--bp-text);
}

.bp-auth-logo-text span { color: var(--bp-primary); }

.bp-auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--bp-text);
  margin: 0 0 .375rem;
  text-align: center;
}

.bp-auth-subtitle {
  font-size: .8rem;
  color: var(--bp-muted);
  text-align: center;
  margin: 0 0 1.75rem;
}

.bp-auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .75rem;
  color: var(--bp-muted);
}

/* ── Password Input Toggle ───────────────────────────────────────────────── */
.bp-password-wrap { position: relative; }
.bp-password-wrap .bp-input { padding-right: 2.5rem; }
.bp-password-toggle {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bp-muted);
  padding: 0;
  font-size: .9rem;
}
.bp-password-toggle:hover { color: var(--bp-primary); }

/* ── TOTP Input ──────────────────────────────────────────────────────────── */
.bp-totp-input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .25em;
  padding: .75rem;
}

/* ── QR Code Setup ───────────────────────────────────────────────────────── */
.bp-qr-container {
  text-align: center;
  margin: 1.25rem 0;
}

.bp-qr-container img {
  border: 8px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  border-radius: 12px;
  max-width: 180px;
}

.bp-secret-code {
  background: #f9fafb;
  border: 1px dashed var(--bp-border);
  border-radius: 8px;
  padding: .625rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--bp-primary);
  text-align: center;
  word-break: break-all;
  margin: .75rem 0;
}

/* ── User Avatar ─────────────────────────────────────────────────────────── */
.bp-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bp-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Topnav Profile Button ───────────────────────────────────────────────── */
.bp-topnav-profile {
  display: flex;
  align-items: center;
  gap: .625rem;
  /* reset <button> defaults */
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  line-height: 1;
  /* custom styling */
  background: transparent;
  border: 1.5px solid var(--bp-border);
  border-radius: 50px;
  padding: .3rem .75rem .3rem .375rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-align: left;
}

.bp-topnav-profile:focus        { outline: none; }
.bp-topnav-profile:focus-visible { outline: 2px solid var(--bp-primary); outline-offset: 2px; border-radius: 50px; }

.bp-topnav-profile:hover,
.bp-topnav-profile[aria-expanded="true"] {
  background: #f5f6fa;
  border-color: #d1d5db;
}

.bp-topnav-profile-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--bp-text);
  line-height: 1.2;
}

.bp-topnav-profile-email {
  font-size: .7rem;
  color: var(--bp-muted);
  line-height: 1.2;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bp-topnav-chevron {
  font-size: .65rem;
  color: var(--bp-muted);
  margin-left: .125rem;
  transition: transform .2s;
}

.bp-topnav-profile[aria-expanded="true"] .bp-topnav-chevron {
  transform: rotate(180deg);
}

/* ── Dropdown Profile Header ─────────────────────────────────────────────── */
.bp-dropdown-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
}

.bp-avatar-lg {
  width: 40px;
  height: 40px;
  font-size: .875rem;
  flex-shrink: 0;
}

.bp-dropdown-header-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--bp-text);
  line-height: 1.2;
}

.bp-dropdown-header-email {
  font-size: .75rem;
  color: var(--bp-muted);
  line-height: 1.4;
  word-break: break-all;
}

/* ── Dropdown ────────────────────────────────────────────────────────────── */

/* Bootstrap CSS is not loaded; these rules replicate the essential
   dropdown-menu visibility behaviour that Bootstrap JS depends on. */
.dropdown-menu {
  display: none;
  position: absolute;
  z-index: 1050;
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
}
.dropdown-menu.show { display: block; }

.bp-dropdown-menu {
  min-width: 220px;
  padding: .375rem 0;
  border: 1px solid var(--bp-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.bp-dropdown-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem 1rem;
  font-family: inherit;
  font-size: .8125rem;
  color: var(--bp-text);
  cursor: pointer;
  text-align: left;
  background: transparent;
  border: none;
  text-decoration: none;
  line-height: 1.4;
}

.bp-dropdown-item:hover { background: #f9fafb; }

.bp-dropdown-item-danger       { color: #ef4444; }
.bp-dropdown-item-danger:hover { background: #fef2f2; color: #dc2626; }

.bp-dropdown-divider { border-top: 1px solid var(--bp-border); margin: .25rem 0; }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.bp-flex       { display: flex; }
.bp-flex-col   { display: flex; flex-direction: column; }
.bp-items-center { align-items: center; }
.bp-gap-1      { gap: .5rem; }
.bp-gap-2      { gap: 1rem; }
.bp-mb-1       { margin-bottom: .5rem; }
.bp-mb-2       { margin-bottom: 1rem; }
.bp-mb-3       { margin-bottom: 1.5rem; }
.bp-text-muted { color: var(--bp-muted); }
.bp-text-sm    { font-size: .75rem; }
.bp-fw-600     { font-weight: 600; }
.bp-w-100      { width: 100%; }
