:root {
  --primary: #1e1b4b;
  --primary-accent: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --bg-main: #ffffff;
  --bg-soft: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-width: 280px;
  --radius: 16px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background-color: var(--bg-soft);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app-shell { display: flex; min-height: 100vh; position: relative; }

/* Sidebar Collapsed State */
.app-shell.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.app-shell.sidebar-collapsed .main-content {
  margin-left: 0;
  max-width: 100vw;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: fixed;
  left: calc(var(--sidebar-width) - 16px);
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 64px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  background: var(--primary-accent);
  color: white;
  border-color: var(--primary-accent);
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  left: 0;
  border-radius: 0 8px 8px 0;
}

.sidebar-toggle-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100vh;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.sidebar-logo {
  padding: 2.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-gradient);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.5rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  flex: 1;
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 1rem 0.75rem;
  opacity: 0.8;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--primary-accent);
}

.nav-item.active {
  background: #eef2ff;
  color: var(--primary-accent);
  font-weight: 600;
}

.nav-icon { font-size: 1.1rem; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  background: var(--bg-soft);
  padding: 3rem;
  max-width: calc(100vw - var(--sidebar-width));
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s ease;
  overflow-x: hidden;
}

/* Ensure MFE content is visible */
#single-spa-container {
  width: 100%;
  min-height: 100%;
}

#single-spa-container > div {
  width: 100%;
  max-width: 100%;
}

#single-spa-container {
  max-width: 1400px;
  margin: 0 auto;
}

.landing-hero {
  max-width: 800px;
  margin: 2rem auto 5rem;
  text-align: center;
}

.landing-title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  margin-bottom: 1.5rem;
  color: var(--primary);
  line-height: 1.1;
}

.landing-desc {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 2rem;
  margin-bottom: 5rem;
}

.module-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-decoration: none;
  color: var(--text-main);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
}

.module-card:hover {
  transform: translateY(-8px);
  border-color: var(--primary-accent);
  box-shadow: var(--shadow-lg);
}

.module-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.75rem; color: var(--primary); }
.module-desc { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; line-height: 1.6; }

.module-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 99px;
  background: #f1f5f9;
  color: var(--primary-accent);
  border: 1px solid #e2e8f0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fafafa;
  margin-top: auto;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.user-name { font-size: 0.9rem; font-weight: 700; color: var(--primary); }
.user-role { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

.status-dot {
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  margin-left: auto;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #10b981;
}

/* Animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.landing { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

/* Mobile Navigation Toggle (Hidden by default) */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 2000;
  background: var(--primary-gradient);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 100%;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 280px;
    z-index: 2000;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    max-width: 100vw;
    padding: 2rem 1.5rem;
    padding-top: 5rem;
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1500;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .landing-title {
    font-size: 2.5rem;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}

.vibrant-text { background: var(--primary-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; }

