/* ============================================================
   IDM Design System — Base Styles
   ZDataCloud App4 Upgrade
   ============================================================
   Scoped under .idm-scope to avoid breaking existing pages.
   When a page is migrated to IDM, add class="idm-scope" to
   the page wrapper or body. Unmigrated pages are unaffected.
   ============================================================ */

/* === Reset within IDM scope only === */
.idm-scope *,
.idm-scope *::before,
.idm-scope *::after {
  box-sizing: border-box;
}

.idm-scope body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-relaxed);
  color: var(--color-text-primary);
  background-color: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Typography === */
.idm-scope h1 { font-size: var(--text-h1); font-weight: var(--weight-bold); line-height: var(--leading-tight); margin: 0 0 var(--space-4); color: var(--color-text-primary); }
.idm-scope h2 { font-size: var(--text-h2); font-weight: var(--weight-semibold); line-height: var(--leading-snug); margin: 0 0 var(--space-4); color: var(--color-text-primary); }
.idm-scope h3 { font-size: var(--text-h3); font-weight: var(--weight-semibold); line-height: var(--leading-normal); margin: 0 0 var(--space-3); color: var(--color-text-primary); }
.idm-scope h4 { font-size: var(--text-h4); font-weight: var(--weight-semibold); line-height: var(--leading-normal); margin: 0 0 var(--space-3); color: var(--color-text-primary); }
.idm-scope p { margin: 0 0 var(--space-4); line-height: var(--leading-relaxed); }
.idm-scope small { font-size: var(--text-body-sm); }
.idm-scope a { color: var(--color-text-link); text-decoration: none; transition: color var(--duration-fast) var(--ease-default); }
.idm-scope a:hover { color: var(--color-text-link-hover); }

/* === Overline === */
.idm-scope .idm-overline {
  font-size: var(--text-overline);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}

/* === Caption === */
.idm-scope .idm-caption {
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
}

/* === Focus Reset (within scope only) === */
.idm-scope :focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* === Skip Link === */
.idm-scope .idm-skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--idm-primary);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: var(--z-toast);
  font-size: var(--text-body-sm);
  font-weight: var(--weight-semibold);
  transition: top var(--duration-normal) var(--ease-out);
}
.idm-scope .idm-skip-link:focus {
  top: 0;
}

/* === Utility Classes === */
.idm-scope .idm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.idm-scope .idm-text-center { text-align: center; }
.idm-scope .idm-text-right { text-align: right; }
.idm-scope .idm-text-left { text-align: left; }
.idm-scope .idm-font-bold { font-weight: var(--weight-bold); }
.idm-scope .idm-font-semibold { font-weight: var(--weight-semibold); }
.idm-scope .idm-font-medium { font-weight: var(--weight-medium); }
.idm-scope .idm-text-primary { color: var(--color-text-primary); }
.idm-scope .idm-text-secondary { color: var(--color-text-secondary); }
.idm-scope .idm-text-inverse { color: var(--color-text-inverse); }
.idm-scope .idm-text-success { color: var(--color-success); }
.idm-scope .idm-text-warning { color: var(--color-warning); }
.idm-scope .idm-text-danger { color: var(--color-danger); }
.idm-scope .idm-text-info { color: var(--color-info); }
.idm-scope .idm-bg-primary { background-color: var(--idm-primary); }
.idm-scope .idm-bg-surface { background-color: var(--color-bg-surface); }
.idm-scope .idm-bg-alt { background-color: var(--color-bg-alt); }
.idm-scope .idm-bg-page { background-color: var(--color-bg-page); }
.idm-scope .idm-hidden { display: none !important; }
.idm-scope .idm-block { display: block; }
.idm-scope .idm-flex { display: flex; }
.idm-scope .idm-inline-flex { display: inline-flex; }
.idm-scope .idm-items-center { align-items: center; }
.idm-scope .idm-justify-between { justify-content: space-between; }
.idm-scope .idm-justify-center { justify-content: center; }
.idm-scope .idm-gap-1 { gap: var(--space-1); }
.idm-scope .idm-gap-2 { gap: var(--space-2); }
.idm-scope .idm-gap-3 { gap: var(--space-3); }
.idm-scope .idm-gap-4 { gap: var(--space-4); }
.idm-scope .idm-w-full { width: 100%; }
.idm-scope .idm-mt-0 { margin-top: 0; }
.idm-scope .idm-mb-0 { margin-bottom: 0; }
.idm-scope .idm-mt-2 { margin-top: var(--space-2); }
.idm-scope .idm-mt-4 { margin-top: var(--space-4); }
.idm-scope .idm-mb-2 { margin-bottom: var(--space-2); }
.idm-scope .idm-mb-4 { margin-bottom: var(--space-4); }
.idm-scope .idm-p-0 { padding: 0; }
.idm-scope .idm-p-2 { padding: var(--space-2); }
.idm-scope .idm-p-4 { padding: var(--space-4); }
.idm-scope .idm-rounded-sm { border-radius: var(--radius-sm); }
.idm-scope .idm-rounded-md { border-radius: var(--radius-md); }
.idm-scope .idm-rounded-lg { border-radius: var(--radius-lg); }
.idm-scope .idm-rounded-pill { border-radius: var(--radius-pill); }
.idm-scope .idm-shadow-sm { box-shadow: var(--shadow-sm); }
.idm-scope .idm-shadow-md { box-shadow: var(--shadow-md); }

/* === Responsive Utilities === */
.idm-scope .idm-d-none { display: none !important; }
.idm-scope .idm-d-block { display: block !important; }
.idm-scope .idm-d-flex { display: flex !important; }

@media (min-width: 768px) {
  .idm-scope .idm-d-md-none { display: none !important; }
  .idm-scope .idm-d-md-block { display: block !important; }
  .idm-scope .idm-d-md-flex { display: flex !important; }
  .idm-scope .idm-d-md-inline { display: inline !important; }
}

@media (min-width: 1024px) {
  .idm-scope .idm-d-lg-none { display: none !important; }
  .idm-scope .idm-d-lg-block { display: block !important; }
  .idm-scope .idm-d-lg-flex { display: flex !important; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  .idm-scope *,
  .idm-scope *::before,
  .idm-scope *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}