/* ============================================================
   Benevolate Platform — Global Styles & Design System Tokens
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, #root {
  height: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

button {
  font-family: var(--font-family);
  cursor: pointer;
}

/* ── App Shell Layout ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sidebar);
  transition: width var(--transition-slow), min-width var(--transition-slow);
}

/* Sleek transparent scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 160, 0.2);
  border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 140, 160, 0.4);
}

/* ── Custom Transparent Scrollbar ── */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 160, 0.25);
  border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 140, 160, 0.5);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  min-height: 64px;
}

.sidebar-header .logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.brand-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
}

.project-switcher {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);

  select {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    outline: none;
  }
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-tertiary);
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
  text-decoration: none;

  &:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
  }

  &.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
  }
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--color-border);
}

/* ── Main Area ── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  z-index: var(--z-topbar);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);

  a {
    color: var(--color-text-secondary);
    &:hover { color: var(--color-text-primary); }
  }

  &:last-child {
    color: var(--color-text-primary);
    font-weight: 600;
  }
}

.breadcrumb-sep {
  color: var(--color-text-tertiary);
  font-size: 12px;
}

/* ── Content Area ── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  background: var(--color-bg);
}

/* ── Page Placeholder (Stub UI) ── */
.page-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  gap: var(--space-3);
}

/* ══════════════════════════════════════════════════════════
   LOGIN — Modern Landing Splash + Auth Form Smooth Transitions
   ══════════════════════════════════════════════════════════ */

.login-overlay-v2 {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #0a1628 100%);
}

/* Stage 1: Splash */
.splash-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .5s cubic-bezier(.4,0,.2,1), transform .5s cubic-bezier(.4,0,.2,1);
  z-index: 2;
}
.splash-stage.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.97) translateY(-20px);
}

.splash-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #0a1628 100%);
}
.splash-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(99,102,241,.25) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(139,92,246,.2) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(6,182,212,.1) 0%, transparent 70%);
  animation: meshShift 8s ease-in-out infinite alternate;
}
@keyframes meshShift {
  0%   { opacity: .7; transform: scale(1) rotate(0deg); }
  100% { opacity: 1;  transform: scale(1.05) rotate(2deg); }
}
.splash-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.splash-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  max-width: 600px;
  animation: splashFadeIn .8s cubic-bezier(.4,0,.2,1) both;
}
@keyframes splashFadeIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-logo {
  margin-bottom: 16px;
  animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.splash-wordmark {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 24px;
}

.splash-tagline {
  font-family: var(--font-family);
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.8) 50%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.splash-sub {
  font-size: 16px;
  color: rgba(255,255,255,.6);
  line-height: 1.7;
  max-width: 480px;
  margin: 0 auto 36px;
  font-weight: 400;
}

.splash-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow .2s, transform .15s;
  box-shadow: 0 8px 32px rgba(99,102,241,.4);
}
.splash-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(99,102,241,.55);
}

.splash-footnote {
  margin-top: 32px;
  font-size: 12px;
  color: rgba(255,255,255,.3);
}

/* Stage 2: Auth form */
.auth-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #0a1628 100%);
  opacity: 0;
  pointer-events: none;
  transform: translateX(40px);
  transition: opacity .45s cubic-bezier(.4,0,.2,1), transform .45s cubic-bezier(.4,0,.2,1);
  z-index: 1;
}
.auth-stage.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

.auth-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  padding: 40px 36px 32px;
  backdrop-filter: blur(20px);
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}

.auth-back {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.auth-back:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin, .animate-spin, svg.spin, svg.animate-spin, i.spin, i.animate-spin {
  animation: spin 1s linear infinite !important;
  display: inline-block !important;
  transform-origin: center center !important;
}

/* ══════════════════════════════════════════════════════════
   ENTERPRISE BUTTON SYSTEM — consistent across all pages
   ══════════════════════════════════════════════════════════ */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  background: #6366f1;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  background: #5558e8;
  box-shadow: 0 4px 16px rgba(99,102,241,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 9px;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--color-surface-hover);
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }
.btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  background: #ef4444;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
  white-space: nowrap;
}
.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

/* ══════════════════════════════════════════════════════════
   PAGE HEADER — enterprise chrome for all content pages
   ══════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 16px;
}

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.page-service-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border: 1px solid;
}
.page-service-badge.blue   { background: rgba(59,130,246,0.1);  color: #3b82f6;  border-color: rgba(59,130,246,0.2);  }
.page-service-badge.indigo { background: rgba(99,102,241,0.1);  color: #6366f1;  border-color: rgba(99,102,241,0.2);  }
.page-service-badge.green  { background: rgba(16,185,129,0.1);  color: #10b981;  border-color: rgba(16,185,129,0.2);  }
.page-service-badge.amber  { background: rgba(245,158,11,0.1);  color: #d97706;  border-color: rgba(245,158,11,0.2);  }
.page-service-badge.purple { background: rgba(168,85,247,0.1);  color: #a855f7;  border-color: rgba(168,85,247,0.2);  }

.page-header-context {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 5px;
  line-height: 1.5;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* Topbar improvements */
.topbar {
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
  background: var(--topbar-bg);
}
.topbar .region-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}
.topbar-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.topbar-icon-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(99,102,241,0.25);
}
.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border: 1.5px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-family: var(--font-family);
}
.account-trigger:hover {
  border-color: rgba(99,102,241,0.4);
  background: var(--color-surface-hover);
}
.account-trigger .avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

/* Breadcrumb separator upgrade */
.breadcrumbs .sep {
  color: var(--color-text-tertiary);
  font-size: 14px;
  margin: 0 4px;
}

/* ── Global Modal Overlay & Dialog Styles ── */
.setup-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: rgba(15, 23, 42, 0.65) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

.setup-modal-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}

