:root {
  --mf-primary: #EE72FD;
  --mf-secondary: #0AE8F9;
  --mf-bg-light: #F7F8FC;
  --mf-bg-dark: #0F1117;
  --mf-card-light: #FFFFFF;
  --mf-card-dark: #171A22;
  --mf-text-light: #0F172A;
  --mf-text-muted: #64748B;
  --mf-border-light: #E8ECF3;
  --mf-border-dark: #2B3242;
  --mf-card-radius: 18px;
  --mf-surface: var(--mf-card-light);
  --mf-bg: var(--mf-bg-light);
  --mf-text: var(--mf-text-light);
}

html[data-theme="dark"] {
  --mf-surface: var(--mf-card-dark);
  --mf-bg: var(--mf-bg-dark);
  --mf-text: #E5EAF4;
  --mf-text-muted: #A3AFC3;
}

body {
  background:
    radial-gradient(circle at 10% 10%, rgba(238, 114, 253, 0.12), transparent 35%),
    radial-gradient(circle at 90% 15%, rgba(10, 232, 249, 0.1), transparent 28%),
    var(--mf-bg);
  color: var(--mf-text);
  transition: background 240ms ease, color 240ms ease;
}

.mf-navbar {
  border-bottom: 1px solid var(--mf-border-light);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

html[data-theme="dark"] .mf-navbar {
  background: rgba(15, 17, 23, 0.88);
  border-bottom-color: var(--mf-border-dark);
}

.mf-brand-logo {
  height: 28px;
  width: auto;
}

.mf-footer {
  background: rgba(255, 255, 255, 0.75);
}

html[data-theme="dark"] .mf-footer {
  background: rgba(23, 26, 34, 0.8);
  border-color: var(--mf-border-dark) !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .navbar,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .list-group-item {
  color: var(--mf-text) !important;
}

.nav-link,
.text-secondary,
.text-muted,
small {
  color: var(--mf-text-muted) !important;
}

.hero-section {
  background: transparent;
}

.client-dashboard {
  background: transparent;
}

.card,
.dashboard-card {
  border-radius: var(--mf-card-radius) !important;
  border: 1px solid var(--mf-border-light) !important;
  background: var(--mf-surface) !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, box-shadow 220ms ease, border-color 220ms ease;
  animation: mfFadeUp 320ms ease both;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .dashboard-card {
  border-color: var(--mf-border-dark) !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
}

.card:hover,
.dashboard-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 34px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(238, 114, 253, 0.15),
    0 0 28px rgba(10, 232, 249, 0.12);
}

.btn {
  border-radius: 12px;
  transition: transform 160ms ease, box-shadow 200ms ease, opacity 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  border: 0;
  color: #fff;
  background-image: linear-gradient(135deg, #6348E5 0%, #4DA3FF 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(99, 72, 229, 0.35),
    0 0 22px rgba(99, 72, 229, 0.5);
}

.btn-outline-secondary {
  border-color: var(--mf-border-light);
}

html[data-theme="dark"] .btn-outline-secondary {
  border-color: var(--mf-border-dark);
  color: var(--mf-text);
  background: rgba(8, 12, 20, 0.88);
  box-shadow: inset 0 0 0 1px rgba(99, 72, 229, 0.18);
}

html[data-theme="dark"] .btn-outline-secondary:hover {
  background: rgba(12, 17, 28, 0.96);
  border-color: rgba(77, 163, 255, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(77, 163, 255, 0.28),
    0 0 18px rgba(99, 72, 229, 0.22);
}

html[data-theme="dark"] .btn-primary {
  color: #F8FAFF;
  background-image: linear-gradient(135deg, #6348E5 0%, #4DA3FF 100%);
  box-shadow:
    0 10px 26px rgba(0, 0, 0, 0.42),
    0 0 20px rgba(99, 72, 229, 0.28);
}

html[data-theme="dark"] .btn-primary:hover {
  background-image: linear-gradient(135deg, #5A41DA 0%, #4398F4 100%);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.48),
    0 0 24px rgba(77, 163, 255, 0.3);
}

.form-control,
.form-select {
  border-radius: 12px;
  border-color: var(--mf-border-light);
  background-color: var(--mf-card-light);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  border-color: var(--mf-border-dark);
  background-color: #111722;
  color: #DFE6F6;
}

html[data-theme="dark"] .form-control::placeholder {
  color: #8FA0BD;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--mf-primary);
  box-shadow: 0 0 0 0.2rem rgba(238, 114, 253, 0.2);
}

.text-mf-primary {
  color: var(--mf-primary);
}

.mf-progress {
  background: linear-gradient(90deg, var(--mf-primary), var(--mf-secondary));
}

.mf-badge-secondary {
  background-color: rgba(10, 232, 249, 0.14);
  color: #067785;
  border: 1px solid rgba(10, 232, 249, 0.35);
}

.mf-plan-badge {
  background: rgba(238, 114, 253, 0.12);
  color: #A024C8;
  border: 1px solid rgba(238, 114, 253, 0.24);
}

.connection-connected {
  background: #ECFDF3 !important;
}

.connection-pairing {
  background: #FFF7ED !important;
}

.connection-disconnected {
  background: #FEF2F2 !important;
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mf-secondary);
  box-shadow: 0 0 0 4px rgba(10, 232, 249, 0.16);
  position: relative;
}

.connection-dot-connected {
  background: #A855F7;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.2), 0 0 12px rgba(168, 85, 247, 0.55);
}

.connection-dot-connected::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  border: 2px solid rgba(168, 85, 247, 0.5);
  animation: mfNeonPing 1.8s ease-out infinite;
}

.connection-badge-connected {
  background: #16A34A;
  color: #fff;
}

.connection-badge-pairing {
  background: #EA580C;
  color: #fff;
}

.connection-badge-disconnected {
  background: #DC2626;
  color: #fff;
}

.settings-locked-select {
  opacity: 0.68;
  cursor: not-allowed;
}

.settings-premium-badge {
  background: rgba(238, 114, 253, 0.12);
  color: #8D19B4;
  border: 1px solid rgba(238, 114, 253, 0.3);
  font-weight: 600;
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  font-size: 0.72rem;
}

.settings-premium-note {
  color: var(--mf-text-muted) !important;
}

.settings-upgrade-btn {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--mf-primary), var(--mf-secondary));
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-security-box {
  background: #FAF7FF;
  border-color: #EFE3FF !important;
}

.admin-security-pre {
  background: #FFFFFF;
  font-family: "Courier New", monospace;
}

.auth-shell {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
}

.auth-card {
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 12% 12%, rgba(238, 114, 253, 0.1), transparent 48%);
}

.auth-logo {
  width: 180px;
  max-width: 100%;
  margin-bottom: 1rem;
}

.auth-logo-icon {
  width: 112px;
}

html[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: #DFE6F6;
  --bs-table-border-color: #2B3242;
  --bs-table-hover-color: #fff;
  --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .admin-security-box {
  background: #151B28;
  border-color: #2B3242 !important;
}

html[data-theme="dark"] .admin-security-pre {
  background: #0F1522;
  color: #DCE6FA;
  border: 1px solid #293246;
}

html[data-theme="dark"] .bg-light {
  background-color: #141A26 !important;
  color: var(--mf-text) !important;
  border: 1px solid #2B3242 !important;
}

html[data-theme="dark"] .bg-light .text-muted,
html[data-theme="dark"] .bg-light small {
  color: #9FB0CC !important;
}

html[data-theme="dark"] .connection-connected {
  background: rgba(22, 163, 74, 0.12) !important;
  border-color: rgba(22, 163, 74, 0.35) !important;
}

html[data-theme="dark"] .connection-pairing {
  background: rgba(234, 88, 12, 0.14) !important;
  border-color: rgba(234, 88, 12, 0.35) !important;
}

html[data-theme="dark"] .connection-disconnected {
  background: rgba(220, 38, 38, 0.14) !important;
  border-color: rgba(220, 38, 38, 0.35) !important;
}

html[data-theme="dark"] .connection-connected .small,
html[data-theme="dark"] .connection-pairing .small,
html[data-theme="dark"] .connection-disconnected .small,
html[data-theme="dark"] .connection-connected p,
html[data-theme="dark"] .connection-pairing p,
html[data-theme="dark"] .connection-disconnected p,
html[data-theme="dark"] .connection-connected h2,
html[data-theme="dark"] .connection-pairing h2,
html[data-theme="dark"] .connection-disconnected h2 {
  color: #E7ECF8 !important;
}

html[data-theme="dark"] .alert-danger {
  background-color: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.3);
  color: #FECACA;
}

html[data-theme="dark"] .alert-success {
  background-color: rgba(22, 163, 74, 0.2);
  border-color: rgba(22, 163, 74, 0.32);
  color: #BBF7D0;
}

@keyframes mfFadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mfNeonPing {
  0% {
    transform: scale(0.85);
    opacity: 0.78;
  }
  70% {
    transform: scale(1.9);
    opacity: 0;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}
