/* ─── Variables ─── */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #4F46E5;
  --topbar-height: 56px;
  --body-bg: #f1f5f9;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-bs-theme="dark"] {
  --body-bg: #0f172a;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
}

/* ─── Global ─── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--body-bg);
}

/* ─── Login Page ─── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #4F46E5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-wrapper {
  width: 100%;
  max-width: 440px;
  padding: 1rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] .login-card {
  background: #1e293b;
}

.login-brand-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.collapsed {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
}

.sidebar-divider {
  border-color: rgba(255,255,255,0.15);
}

.sidebar-section-title {
  padding: 1.2rem 1rem 0.4rem 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  list-style: none;
}

.sidebar-link {
  color: rgba(255,255,255,0.65) !important;
  border-radius: 8px;
  padding: 0.6rem 1rem !important;
  margin-bottom: 2px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  color: #fff !important;
  background: var(--sidebar-hover);
}

.sidebar-link.active {
  color: #fff !important;
  background: var(--sidebar-active);
  box-shadow: 0 2px 8px rgba(79,70,229,0.4);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ─── Page Content ─── */
.page-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.page-content.expanded {
  margin-left: 0;
  width: 100%;
}

/* ─── Top Navbar ─── */
.top-navbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

[data-bs-theme="dark"] .top-navbar {
  background: #1e293b;
  border-color: #334155;
}

/* ─── Main Content ─── */
.main-content {
  flex: 1;
}

/* ─── Avatars ─── */
.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
}

/* ─── Stat Cards ─── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  border: 1px solid #e2e8f0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

[data-bs-theme="dark"] .stat-card {
  background: #1e293b;
  border-color: #334155;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
}

[data-bs-theme="dark"] .stat-value {
  color: #f1f5f9;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* ─── Activity ─── */
.activity-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-item:last-child {
  border-bottom: none !important;
}

/* ─── Hover Background ─── */
.hover-bg {
  transition: background 0.15s ease;
}

.hover-bg:hover {
  background: #f8fafc;
}

[data-bs-theme="dark"] .hover-bg:hover {
  background: #334155;
}

/* ─── Cards ─── */
.card {
  border-radius: 12px;
}

[data-bs-theme="dark"] .card {
  background: #1e293b;
  border-color: #334155;
}

/* ─── Tables ─── */
.table > thead {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.table > tbody > tr {
  transition: background 0.15s ease;
}

/* ─── Forms ─── */
.form-control:focus, .form-select:focus {
  border-color: #4F46E5;
  box-shadow: 0 0 0 0.2rem rgba(79,70,229,0.15);
}

/* ─── Badges ─── */
.badge {
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.35em 0.65em;
  border-radius: 6px;
}

/* ─── Buttons ─── */
.btn-primary {
  background: #4F46E5;
  border-color: #4F46E5;
}
.btn-primary:hover {
  background: #4338CA;
  border-color: #4338CA;
}

/* ─── Real-time notification toast ─── */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}

/* ─── Scrollbar ─── */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

/* ─── Responsive ─── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .page-content {
    margin-left: 0;
    width: 100%;
  }
}

/* ─── Signup Page ─── */
.signup-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #4F46E5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.signup-wrapper {
  width: 100%;
  max-width: 680px;
  padding: 1rem;
}

.signup-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] .signup-card {
  background: #1e293b;
}

/* Signup Steps */
.signup-steps {
  position: relative;
}

.signup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  position: relative;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #64748b;
  transition: all 0.3s ease;
  margin-bottom: 4px;
}

.signup-step.active .step-circle {
  background: #4F46E5;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

.signup-step.completed .step-circle {
  background: #059669;
  color: #fff;
}

.step-progress-bar {
  position: absolute;
  top: 18px;
  left: 12%;
  right: 12%;
  height: 3px;
  background: #e2e8f0;
  z-index: 1;
  border-radius: 3px;
}

.step-progress-fill {
  height: 100%;
  background: #4F46E5;
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

/* Form Steps */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeInUp 0.3s ease;
}

/* Role Cards */
.role-card:checked + label,
.tier-card:checked + label {
  border-color: #4F46E5 !important;
  background: rgba(79,70,229,0.05) !important;
  box-shadow: 0 0 0 2px rgba(79,70,229,0.3);
}

/* Pending Page */
.pending-icon {
  display: inline-block;
}

.spinner-ring {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

.status-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Sidebar badge */
.sidebar-link .badge {
  font-size: 0.65rem;
  padding: 0.25em 0.5em;
}

.sidebar-link {
  display: flex;
  align-items: center;
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card,
.card {
  animation: fadeInUp 0.4s ease;
}

/* ─── Footer ─── */
footer {
  flex-shrink: 0;
}

[data-bs-theme="dark"] footer {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .bg-white {
  background: #1e293b !important;
}

[data-bs-theme="dark"] .bg-light {
  background: #0f172a !important;
}

[data-bs-theme="dark"] .border-bottom {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f1f5f9 !important;
}

/* Document Cards */
.doc-card {
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.doc-card:hover {
  border-color: #4F46E5 !important;
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.1) !important;
}
.doc-icon {
  min-width: 40px;
  min-height: 40px;
}
