@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- Mosaic Lite Theme Variables & Base Styles --- */
:root {
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Palette */
  --color-bg: #f3f4f6;
  --color-text-main: #1f2937;
  --color-text-muted: #6b7280;
  
  --sidebar-bg: #ffffff;
  --sidebar-border: #e5e7eb;
  --header-bg: rgba(255, 255, 255, 0.85);
  --header-border: #e5e7eb;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  
  --primary-50: #f1eeff;
  --primary-100: #e6e1ff;
  --primary-500: #8470ff;
  --primary-600: #755ff8;
  --primary-700: #5d47de;
  
  --success-bg: #d2ffe2;
  --success-text: #0f5429;
  --warning-bg: #fff2c9;
  --warning-text: #4f3d0e;
  --danger-bg: #ffe8e8;
  --danger-text: #941818;
  --info-bg: #e3f3ff;
  --info-text: #124d79;
}

html.dark {
  --color-bg: #111827;
  --color-text-main: #f3f4f6;
  --color-text-muted: #9ca3af;
  
  --sidebar-bg: #1f2937;
  --sidebar-border: #374151;
  --header-bg: rgba(31, 41, 55, 0.85);
  --header-border: #374151;
  --card-bg: #1f2937;
  --card-border: #374151;
  
  --primary-50: #2a2254;
  --primary-100: #382d73;
  --primary-500: #8470ff;
  --primary-600: #9c8cff;
  --primary-700: #b7acff;
  
  --success-bg: #0a3f1e;
  --success-text: #67e294;
  --warning-bg: #342809;
  --warning-text: #ffd968;
  --danger-bg: #600f0f;
  --danger-text: #ff9494;
  --info-bg: #0b324f;
  --info-text: #a0d7ff;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Mobile backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(17, 24, 39, 0.4);
  z-index: 40;
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Sidebar */
.mdo-sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  z-index: 50;
  left: 0;
  top: 0;
  bottom: 0;
  width: 16rem;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 1.25rem 1rem;
  transition: transform 0.2s ease-in-out, width 0.2s ease-in-out;
  overflow-y: auto;
}

@media (max-width: 1023px) {
  .mdo-sidebar {
    transform: translateX(-100%);
  }
  .mdo-sidebar.open {
    transform: translateX(0);
  }
}

@media (min-width: 1024px) {
  .mdo-sidebar {
    position: static;
    transform: none;
    flex-shrink: 0;
  }
  body.sidebar-collapsed .mdo-sidebar {
    width: 4.5rem;
  }
  body.sidebar-collapsed .sidebar-text,
  body.sidebar-collapsed .sidebar-group-title {
    display: none;
  }
  body.sidebar-collapsed .sidebar-logo-text {
    display: none;
  }
}

/* Sidebar Branding */
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--color-text-main);
  font-weight: 700;
  font-size: 1.125rem;
}

.sidebar-logo svg {
  width: 2rem;
  height: 2rem;
  fill: var(--primary-500);
}

/* Sidebar Navigation Items */
.sidebar-group {
  margin-bottom: 1.5rem;
}

.sidebar-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
}

.sidebar-link:hover {
  background-color: var(--primary-50);
  color: var(--primary-600);
}

.sidebar-link.active {
  background-color: var(--primary-50);
  color: var(--primary-600);
  font-weight: 600;
}

.sidebar-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Content Area */
.mdo-content-area {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* Header */
.mdo-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--header-border);
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color 0.15s, color 0.15s;
}

.header-btn:hover {
  background-color: rgba(156, 163, 175, 0.15);
  color: var(--color-text-main);
}

.header-btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

/* Breadcrumbs System (Step 13) */
.mdo-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  overflow-x: auto;
  white-space: nowrap;
}

.mdo-breadcrumb-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.mdo-breadcrumb-link:hover {
  color: var(--primary-600);
}

.mdo-breadcrumb-current {
  color: var(--color-text-main);
  font-weight: 600;
}

.mdo-breadcrumb-sep {
  color: var(--color-text-muted);
  opacity: 0.5;
  display: inline-flex;
  align-items: center;
}

.mdo-breadcrumb-sep svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* User Account & Context Profile (Step 13) */
.mdo-user-profile {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background-color: rgba(156, 163, 175, 0.08);
  border: 1px solid var(--card-border);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.mdo-user-profile:hover {
  background-color: rgba(156, 163, 175, 0.15);
}

.mdo-user-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background-color: var(--primary-500);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mdo-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  text-align: left;
}

.mdo-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-main);
}

.mdo-user-role {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

/* Submenu Styles (Step 13) */
.sidebar-submenu {
  list-style: none;
  padding-left: 1rem;
  margin: 0.25rem 0 0.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  border-left: 2px solid rgba(156, 163, 175, 0.2);
}

.sidebar-submenu .sidebar-link {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
}

.sidebar-link.has-active-child {
  color: var(--primary-600);
  font-weight: 600;
}

/* Main Workspace */
.mdo-main-body {
  flex-grow: 1;
  padding: 2rem 1.5rem;
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
}

/* Cards & Widgets */
.mdo-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.mdo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--card-border);
}

.mdo-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text-main);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  text-transform: capitalize;
}

.badge-operational, .badge-healthy {
  background-color: var(--success-bg);
  color: var(--success-text);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning-text);
}

.badge-error {
  background-color: var(--danger-bg);
  color: var(--danger-text);
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--info-text);
}

/* Modern Data Table */
.mdo-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.mdo-table th {
  padding: 0.75rem 1rem;
  background-color: rgba(156, 163, 175, 0.06);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--card-border);
}

.mdo-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--card-border);
  color: var(--color-text-main);
}

.mdo-table tr:last-child td {
  border-bottom: none;
}

.mdo-table tr:hover td {
  background-color: rgba(156, 163, 175, 0.04);
}

/* Metric / Stat Tiles */
.stat-tile {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-radius: 0.75rem;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.375rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.stat-desc {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* Footer */
.mdo-footer {
  border-top: 1px solid var(--header-border);
  padding: 1rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
