/* ==========================================================================
   Business Card Exchange Platform — application theme

   1. Tokens
   2. Base
   3. App shell (sidebar + topbar)
   4. Components
   5. Public card
   6. Auth screens
   7. Responsive
   8. Print / motion
   ========================================================================== */

/* ───────────────────────────── 1. Tokens ─────────────────────────────── */

:root {
  --bc-primary:      #4f46e5;
  --bc-primary-600:  #4338ca;
  --bc-primary-050:  #eef2ff;
  --bc-accent:       #7c3aed;

  --bc-bg:           #f6f7fb;
  --bc-surface:      #ffffff;
  --bc-surface-2:    #f9fafb;
  --bc-sidebar:      #111827;
  --bc-sidebar-hover:#1f2937;

  --bc-ink:          #111827;
  --bc-ink-2:        #374151;
  --bc-muted:        #6b7280;

  --bc-line:         #e5e7eb;
  --bc-line-2:       #d1d5db;

  --bc-success:      #059669;
  --bc-warning:      #d97706;
  --bc-danger:       #dc2626;
  --bc-info:         #0284c7;

  --bc-shadow-sm:    0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.10);
  --bc-shadow:       0 4px 6px -1px rgba(16,24,40,.07), 0 2px 4px -2px rgba(16,24,40,.06);
  --bc-shadow-lg:    0 20px 25px -5px rgba(16,24,40,.10), 0 8px 10px -6px rgba(16,24,40,.06);

  --bc-radius:       14px;
  --bc-radius-sm:    10px;
  --bc-sidebar-w:    248px;
  --bc-topbar-h:     62px;

  /* Bootstrap bridge, so .btn-primary and friends inherit the brand. */
  --bs-primary:      #4f46e5;
  --bs-primary-rgb:  79,70,229;
  --bs-body-color:   #111827;
  --bs-body-bg:      #f6f7fb;
  --bs-border-color: #e5e7eb;
  --bs-link-color:   #4f46e5;
  --bs-link-hover-color: #4338ca;
}

/* ────────────────────────────── 2. Base ──────────────────────────────── */

* { box-sizing: border-box; }

body {
  background: var(--bc-bg);
  color: var(--bc-ink);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

::selection { background: var(--bc-primary); color: #fff; }

h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -.015em; color: var(--bc-ink); }

.text-muted { color: var(--bc-muted) !important; }

/* Thin scrollbars so the dark sidebar doesn't show a bright gutter. */
* { scrollbar-width: thin; scrollbar-color: var(--bc-line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--bc-line-2); border-radius: 6px; }

/* ─────────────────────────── 3. App shell ────────────────────────────── */

.bc-topbar {
  height: var(--bc-topbar-h);
  background: var(--bc-surface);
  border-bottom: 1px solid var(--bc-line);
  position: sticky; top: 0; z-index: 1040;
  display: flex; align-items: center;
  padding: 0 18px;
}

.bc-brand { display: flex; align-items: center; gap: 10px; }
.bc-brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bc-primary), var(--bc-accent));
  color: #fff; font-size: 18px;
  box-shadow: 0 4px 10px rgba(79,70,229,.35);
  flex-shrink: 0;
}
.bc-brand-name { font-weight: 800; font-size: 17px; color: var(--bc-ink); letter-spacing: -.02em; }

.bc-shell { display: flex; min-height: calc(100vh - var(--bc-topbar-h)); }

.bc-sidebar {
  width: var(--bc-sidebar-w); flex: 0 0 var(--bc-sidebar-w);
  background: var(--bc-sidebar);
  position: sticky; top: var(--bc-topbar-h);
  height: calc(100vh - var(--bc-topbar-h));
  overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 16px 0;
  z-index: 1030;
}
.bc-nav-label {
  color: #6b7280; font-size: 10.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 14px 20px 6px;
}
.bc-nav { list-style: none; margin: 0; padding: 0 10px; }
.bc-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-bottom: 3px;
  border-radius: var(--bc-radius-sm);
  color: #d1d5db; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.bc-nav a i { font-size: 16px; width: 20px; text-align: center; opacity: .85; }
.bc-nav a:hover { background: var(--bc-sidebar-hover); color: #fff; }
.bc-nav a.active {
  background: linear-gradient(135deg, var(--bc-primary), var(--bc-accent));
  color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
}
.bc-nav a.active i { opacity: 1; }

.bc-sidebar-foot { margin-top: auto; padding: 16px 20px 4px; border-top: 1px solid #1f2937; }
.bc-sidebar-foot .small { color: #6b7280; }

.bc-main { flex: 1 1 auto; min-width: 0; padding: 24px 26px 48px; }

.bc-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.bc-page-title { font-size: 24px; font-weight: 800; margin: 0 0 3px; }
.bc-page-sub { color: var(--bc-muted); font-size: 14px; margin: 0; }

.bc-backdrop { display: none; position: fixed; inset: 0; background: rgba(17,24,39,.5); z-index: 1025; }
.bc-backdrop.show { display: block; }

/* ─────────────────────────── 4. Components ───────────────────────────── */

.bc-card {
  background: var(--bc-surface);
  border: 1px solid var(--bc-line);
  border-radius: var(--bc-radius);
  box-shadow: var(--bc-shadow-sm);
  margin-bottom: 22px;
}
.bc-card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--bc-line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.bc-card-title { font-size: 16px; font-weight: 700; margin: 0; }
.bc-card-body { padding: 20px; }
.bc-card-body.tight { padding: 0; }

/* Stat tiles */
.bc-stat {
  background: var(--bc-surface);
  border: 1px solid var(--bc-line);
  border-radius: var(--bc-radius);
  box-shadow: var(--bc-shadow-sm);
  padding: 18px 20px; height: 100%;
  display: flex; align-items: center; gap: 15px;
  transition: transform .18s, box-shadow .18s;
}
.bc-stat:hover { transform: translateY(-2px); box-shadow: var(--bc-shadow); }
.bc-stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
}
.bc-stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.bc-stat-label { font-size: 12px; color: var(--bc-muted); font-weight: 600;
                 text-transform: uppercase; letter-spacing: .04em; }
.bc-stat-sub { font-size: 12px; color: var(--bc-muted); }

.grad-indigo { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.grad-emerald{ background: linear-gradient(135deg,#059669,#10b981); }
.grad-amber  { background: linear-gradient(135deg,#d97706,#f59e0b); }
.grad-rose   { background: linear-gradient(135deg,#e11d48,#f43f5e); }
.grad-sky    { background: linear-gradient(135deg,#0284c7,#0ea5e9); }
.grad-slate  { background: linear-gradient(135deg,#334155,#64748b); }

/* Completion ring, drawn with a conic gradient so no SVG or JS is needed. */
.bc-ring {
  width: 118px; height: 118px; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--bc-primary) calc(var(--pct) * 1%), var(--bc-line) 0);
  flex-shrink: 0;
}
.bc-ring-inner {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--bc-surface);
  display: grid; place-items: center; text-align: center;
}
.bc-ring-value { font-size: 22px; font-weight: 800; line-height: 1; }
.bc-ring-label { font-size: 10.5px; color: var(--bc-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Forms */
.form-label { font-weight: 600; font-size: 13.5px; color: var(--bc-ink-2); margin-bottom: 5px; }
.form-control, .form-select {
  border-radius: var(--bc-radius-sm);
  border-color: var(--bc-line-2);
  font-size: 14.5px; padding: .55rem .8rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--bc-primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}
.input-group-text {
  background: var(--bc-surface-2); border-color: var(--bc-line-2);
  color: var(--bc-muted); border-radius: var(--bc-radius-sm);
}
.form-text { font-size: 12.5px; color: var(--bc-muted); }
.required::after { content: ' *'; color: var(--bc-danger); }

.btn { border-radius: var(--bc-radius-sm); font-weight: 600; font-size: 14.5px; padding: .55rem 1.1rem; }
.btn-primary { background: var(--bc-primary); border-color: var(--bc-primary); }
.btn-primary:hover, .btn-primary:focus {
  background: var(--bc-primary-600); border-color: var(--bc-primary-600);
}
.btn-lg { padding: .75rem 1.5rem; font-size: 16px; }
.btn-sm { padding: .35rem .75rem; font-size: 13px; }
.btn-gradient {
  background: linear-gradient(135deg, var(--bc-primary), var(--bc-accent));
  color: #fff; border: none;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.btn-gradient:hover { color: #fff; filter: brightness(1.07); }

.badge { font-weight: 600; letter-spacing: .01em; }

/* Photo widgets */
.bc-avatar {
  border-radius: 50%; object-fit: cover;
  background: var(--bc-primary-050); color: var(--bc-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.bc-avatar-sm { width: 36px; height: 36px; font-size: 14px; }
.bc-avatar-md { width: 56px; height: 56px; font-size: 20px; }
.bc-avatar-lg { width: 104px; height: 104px; font-size: 36px; }

/* Table */
.table { --bs-table-color: var(--bc-ink); margin-bottom: 0; }
.table > thead th {
  background: var(--bc-surface-2);
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--bc-muted);
  border-bottom: 1px solid var(--bc-line); white-space: nowrap;
  padding: 11px 14px;
}
.table > tbody td { padding: 12px 14px; vertical-align: middle; border-color: var(--bc-line); }
.table > tbody tr:hover > * { background: var(--bc-surface-2); }

/* Empty state */
.bc-empty { text-align: center; padding: 46px 20px; color: var(--bc-muted); }
.bc-empty i { font-size: 42px; opacity: .3; display: block; margin-bottom: 12px; }

/* QR panel */
.bc-qr-frame {
  background: #fff; border: 1px solid var(--bc-line);
  border-radius: var(--bc-radius); padding: 14px;
  display: inline-block; box-shadow: var(--bc-shadow-sm);
}
.bc-qr-frame img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }

/* Copyable URL row */
.bc-copy {
  display: flex; align-items: center; gap: 8px;
  background: var(--bc-surface-2); border: 1px dashed var(--bc-line-2);
  border-radius: var(--bc-radius-sm); padding: 9px 12px;
  font-size: 13px; word-break: break-all;
}

/* ───────────────────────── 5. Public card ────────────────────────────── */

.bc-public {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 26px 16px;
  background: linear-gradient(160deg, #eef2ff 0%, #f6f7fb 45%, #faf5ff 100%);
}
.bc-vcard {
  width: 100%; max-width: 430px;
  background: var(--bc-surface);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(17,24,39,.16);
  overflow: hidden;
}
.bc-vcard-banner {
  height: 118px; position: relative;
  background: linear-gradient(135deg, var(--card-a, #4f46e5), var(--card-b, #7c3aed));
}
/* Subtle texture so the banner isn't a flat slab. */
.bc-vcard-banner::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 18% 120%, rgba(255,255,255,.28), transparent 55%);
}
.bc-vcard-photo {
  width: 116px; height: 116px; border-radius: 50%;
  border: 4px solid #fff; object-fit: cover;
  margin: -62px auto 0; position: relative; z-index: 2;
  box-shadow: 0 8px 20px rgba(17,24,39,.16);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: var(--card-a, #4f46e5);
}
.bc-vcard-body { padding: 16px 26px 26px; text-align: center; }
.bc-vcard-name { font-size: 23px; font-weight: 800; margin: 10px 0 2px; letter-spacing: -.02em; }
.bc-vcard-title { color: var(--card-a, #4f46e5); font-weight: 600; font-size: 14.5px; }
.bc-vcard-org { color: var(--bc-muted); font-size: 14px; margin-top: 1px; }
.bc-vcard-bio {
  color: var(--bc-ink-2); font-size: 14px; margin: 14px 0 0;
  padding-top: 14px; border-top: 1px solid var(--bc-line);
  text-align: left; white-space: pre-line;
}

.bc-contact-list { list-style: none; margin: 16px 0 0; padding: 0; text-align: left; }
.bc-contact-list li { margin-bottom: 8px; }
.bc-contact-list a, .bc-contact-list span {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--bc-radius-sm);
  background: var(--bc-surface-2); border: 1px solid var(--bc-line);
  color: var(--bc-ink); font-size: 14px;
  transition: border-color .15s, transform .15s;
  word-break: break-word;
}
.bc-contact-list a:hover { border-color: var(--card-a, #4f46e5); transform: translateX(2px); }
.bc-contact-ico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bc-primary-050); color: var(--card-a, #4f46e5); font-size: 16px;
}
.bc-contact-val { min-width: 0; }
.bc-contact-key { font-size: 11px; color: var(--bc-muted); text-transform: uppercase; letter-spacing: .04em; }

.bc-socials { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.bc-social {
  width: 42px; height: 42px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; transition: transform .15s, filter .15s;
}
.bc-social:hover { transform: translateY(-3px); filter: brightness(1.1); color: #fff; }
.bc-social.linkedin  { background: #0a66c2; }
.bc-social.facebook  { background: #1877f2; }
.bc-social.twitter   { background: #000000; }
.bc-social.instagram { background: linear-gradient(45deg,#f09433,#dc2743,#bc1888); }

.bc-save-btn {
  width: 100%; margin-top: 20px; padding: .85rem;
  font-size: 16px; font-weight: 700; border: none; border-radius: var(--bc-radius-sm);
  background: linear-gradient(135deg, var(--card-a, #4f46e5), var(--card-b, #7c3aed));
  color: #fff; box-shadow: 0 8px 20px rgba(79,70,229,.35);
  transition: transform .15s, box-shadow .15s;
}
.bc-save-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(79,70,229,.45); color: #fff; }

.bc-vcard-foot { text-align: center; padding: 14px; font-size: 12px; color: var(--bc-muted);
                 border-top: 1px solid var(--bc-line); background: var(--bc-surface-2); }

/* ────────────────────────── 6. Auth screens ──────────────────────────── */

.bc-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 16px;
  background: linear-gradient(150deg, #1e1b4b 0%, #312e81 45%, #4c1d95 100%);
}
.bc-auth-wrap { width: 100%; max-width: 440px; }
.bc-auth-brand { text-align: center; margin-bottom: 22px; color: #fff; }
.bc-auth-brand .bc-brand-mark { width: 54px; height: 54px; font-size: 26px; margin: 0 auto 12px; }
.bc-auth-brand h1 { color: #fff; font-size: 22px; margin: 0 0 4px; }
.bc-auth-brand p { color: rgba(255,255,255,.65); font-size: 13.5px; margin: 0; }
.bc-auth-card {
  background: var(--bc-surface); border-radius: 18px; padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.bc-auth-card h2 { font-size: 20px; margin: 0 0 4px; }
.bc-auth-card .sub { color: var(--bc-muted); font-size: 13.5px; margin: 0 0 20px; }
.bc-auth-foot { text-align: center; margin-top: 18px; font-size: 13.5px; color: rgba(255,255,255,.7); }
.bc-auth-foot a { color: #c7d2fe; font-weight: 600; }

/* Password strength meter */
.bc-meter { height: 5px; border-radius: 3px; background: var(--bc-line); overflow: hidden; margin-top: 7px; }
.bc-meter span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }

/* ─────────────────────────── 7. Responsive ───────────────────────────── */

@media (max-width: 991.98px) {
  .bc-sidebar {
    position: fixed; left: 0; top: var(--bc-topbar-h);
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--bc-shadow-lg);
  }
  .bc-sidebar.open { transform: translateX(0); }
  .bc-main { padding: 18px 16px 40px; }
  .bc-page-title { font-size: 21px; }
}

@media (max-width: 575.98px) {
  body { font-size: 14.5px; }
  .bc-card-body { padding: 16px; }
  .bc-card-head { padding: 14px 16px; }
  .bc-stat { padding: 15px 16px; gap: 12px; }
  .bc-stat-icon { width: 40px; height: 40px; font-size: 17px; }
  .bc-stat-value { font-size: 20px; }
  .bc-vcard-body { padding: 14px 18px 22px; }
  .bc-vcard-name { font-size: 21px; }
  .bc-auth-card { padding: 24px 20px; }
  .bc-qr-frame img { width: 168px; height: 168px; }
}

/* ───────────────────────── 8. Print / motion ─────────────────────────── */

@media print {
  .bc-topbar, .bc-sidebar, .bc-backdrop, .bc-save-btn, .no-print { display: none !important; }
  .bc-main { padding: 0; }
  .bc-public { background: #fff; min-height: auto; }
  .bc-vcard { box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
