/* ==========================================================================
   SociaLeadCapture — Violet & White Theme
   Ported from the SociaLeadCapture.Web design system so this app shares the
   same palette, typography, sidebar/topbar shell, cards, forms and tables.
   Palette:
     Primary      #6548C5
     Hover        #50379F
     Secondary    #D8CEF3
     Accent       #B6A5E4
     Soft bg      #F8F6FD
   Type: Inter (body), Manrope (display), IBM Plex Mono (numbers)
   ========================================================================== */

:root {
  /* ---- Brand ---- */
  --brand-900: #211A38;
  --brand-800: #39265F;
  --brand-700: #50379F;
  --brand-600: #6548C5;
  --brand-500: #7B5CCB;
  --brand-400: #B6A5E4;
  --brand-100: #D8CEF3;
  --brand-50:  #F8F6FD;
  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --secondary: var(--brand-100);

  /* ---- Surfaces ---- */
  --white: #FFFFFF;
  --bg: #F8F6FD;
  --surface: #FFFFFF;
  --surface-2: #F0ECFA;

  /* ---- Text ---- */
  --text: #252038;
  --text-secondary: #625C70;
  --text-inverse: #FFFFFF;

  /* ---- Semantic ---- */
  --success: #059669;
  --success-text: #065F46;
  --success-bg: #D1FAE5;
  --warning: #D97706;
  --warning-bg: #FEF3C7;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --info: #0EA5E9;
  --info-bg: #E0F2FE;
  --muted-bg: #F1F5F9;

  /* ---- Borders ---- */
  --border: #E8E2F4;
  --border-strong: #D8CEF3;

  /* ---- Shadows ---- */
  --shadow-xs: 0 1px 0 rgba(33,26,56, .04);
  --shadow-sm: 0 1px 3px rgba(33,26,56, .06);
  --shadow-md: 0 4px 14px rgba(33,26,56, .07);
  --shadow-lg: 0 16px 32px rgba(33,26,56, .12);
  --shadow-ring: 0 0 0 3px rgba(101,72,197, .18);

  /* ---- Radii ---- */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;

  /* ---- Layout ---- */
  --topbar-h: 64px;

  /* ---- Type ---- */
  --font-display: 'Manrope', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', monospace;
}

/* ==========================================================================
   RESET / BASE
   ========================================================================== */
html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(101,72,197,.06), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(101,72,197,.05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14.5px;
  letter-spacing: -0.005em;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--brand-800);
  letter-spacing: -0.02em;
  font-weight: 700;
}

a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-600); }
::selection { background: var(--brand-500); color: #fff; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }

code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  color: var(--brand-800);
  padding: .1rem .35rem;
  border-radius: var(--radius-xs);
}

/* ==========================================================================
   LOGIN
   ========================================================================== */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.14), transparent 45%),
    radial-gradient(circle at 88% 82%, rgba(255,255,255,.10), transparent 50%),
    linear-gradient(140deg, var(--brand-800) 0%, var(--brand-600) 60%, var(--brand-500) 100%);
}
.login-card {
  width: 440px;
  max-width: 100%;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 28px;
  border: 1px solid rgba(255,255,255,.6);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  display: flex; align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0;
}
.login-brand .brand-text { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--brand-800); letter-spacing: -.01em; }
.login-brand .brand-sub { font-size: 11px; color: var(--text-secondary); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-desc { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 24px; display: block; }
.login-footer { text-align: center; margin-top: 22px; font-size: 11.5px; color: var(--text-secondary); }

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-label {
  font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text);
}
.form-control, .form-select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-500);
  box-shadow: var(--shadow-ring);
  outline: none;
}
.form-check-input { cursor: pointer; }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.form-check-input:focus { border-color: var(--brand-500); box-shadow: var(--shadow-ring); }
textarea.form-control { resize: vertical; line-height: 1.6; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-width: 1px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: var(--shadow-ring);
}
.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--brand-700);
  border-color: var(--brand-700);
  color: #fff;
}
.btn-outline-primary {
  color: var(--brand-700);
  border-color: var(--border-strong);
  background: var(--white);
}
.btn-outline-primary:hover {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-800);
}
.btn-outline-secondary {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--white);
}
.btn-outline-secondary:hover {
  background: var(--brand-50);
  border-color: var(--brand-500);
  color: var(--brand-800);
}
.btn-outline-danger { color: var(--danger); border-color: var(--danger); background: var(--white); }
.btn-outline-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-group > .btn { border-radius: var(--radius-sm); }

/* ==========================================================================
   APP SHELL (top navbar)
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: linear-gradient(180deg, var(--brand-800) 0%, var(--brand-900) 100%);
  color: #fff;
  display: flex; align-items: center; gap: 22px;
  padding: 0 24px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-brand .brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: flex; align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0; font-size: 16px;
}
.topbar-brand .brand-text { font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: -.01em; color: #fff; white-space: nowrap; }

.topbar-nav { flex: 1; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topbar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 13px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75); font-size: 13px; font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-item i { opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; }
.nav-item button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
  padding: 0;
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-toggle {
  display: none; padding: 6px; border-radius: var(--radius-sm); color: #fff;
  border: 0; background: transparent;
}
.topbar-toggle:hover { background: rgba(255,255,255,.1); }
.topbar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.08);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
.topbar-profile .tp-name { font-size: 12px; font-weight: 700; line-height: 1.2; color: #fff; }
.topbar-profile .tp-role { font-size: 10px; color: rgba(255,255,255,.6); }
.topbar-profile form button {
  background: none; border: 0; color: rgba(255,255,255,.75); padding: 0; font-size: 15px;
  display: flex; align-items: center; cursor: pointer;
}
.topbar-profile form button:hover { color: #fff; }

.mobile-nav {
  display: none;
  position: sticky; top: var(--topbar-h); z-index: 95;
  background: linear-gradient(180deg, var(--brand-800), var(--brand-900));
  padding: 10px 14px 16px;
  flex-direction: column; gap: 2px;
}
.mobile-nav.open { display: flex; }
.mobile-nav .nav-item { color: rgba(255,255,255,.8); padding: 11px 12px; }
.mobile-nav .nav-item.active { background: rgba(255,255,255,.16); color: #fff; }

.content { flex: 1; padding: 26px 28px 60px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ==========================================================================
   CARDS
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-body { padding: 22px 24px; }
.card-header {
  background: transparent;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15.5px; font-weight: 800; color: var(--brand-800); }

/* ==========================================================================
   TABLES
   ========================================================================== */
table.table { font-size: 13.5px; }
table.table thead th {
  text-align: left; padding: 12px 18px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-secondary); font-weight: 700;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: var(--surface-2);
}
table.table tbody td {
  padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle;
  border-top: 0;
}
table.table.table-hover tbody tr:hover { background: var(--brand-50); }
table.table tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   ALERTS / LISTS / BADGES
   ========================================================================== */
.alert {
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(220,38,38,.2); }
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: rgba(5,150,105,.25); }
.alert-info { background: var(--info-bg); color: #0369A1; border-color: rgba(14,165,233,.2); }
.alert-warning { background: var(--warning-bg); color: #92400E; border-color: rgba(217,119,6,.25); }

.list-group-item {
  border-color: var(--border);
  font-size: 13.5px;
}
.list-group-item-primary {
  background: var(--brand-50);
  color: var(--brand-800);
  border-color: var(--brand-100);
}

.badge { font-weight: 600; }

/* ==========================================================================
   MOBILE / RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .topbar-nav { display: none; }
  .topbar-toggle { display: flex; }
  .topbar-profile .tp-name, .topbar-profile .tp-role { display: none; }
  .content { padding: 20px 16px 50px; }
}
