/*
 * TMIPS additions to the Dreams Core design system.
 * Only things the compiled theme does not provide live here; everything else
 * should use the theme's own classes (surface-card, btn, badge-soft, icon-chip,
 * field-control, Tailwind utilities present in assets/theme/script-DbEScXyL.css).
 * Colours always come from theme tokens so light and dark mode both work.
 */

@layer components {

  /* ---------- Credential preview modal (opened by admin-generator.js) ---------- */
  .tips-doc-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: rgb(10 12 11 / 0.55);
    backdrop-filter: blur(2px);
  }
  .tips-doc-modal-dialog {
    width: 100%;
    max-width: 1000px;
    margin: auto 0;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
    overflow: hidden;
  }
  .tips-doc-modal-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: var(--surface-sunken);
  }

  /* ---------- Toast ---------- */
  .tips-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-success-700);
    background: var(--surface-raised);
    border: 1px solid color-mix(in oklab, var(--color-success-500) 45%, transparent);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
  }
  .tips-toast.is-error {
    color: var(--color-danger-700);
    border-color: color-mix(in oklab, var(--color-danger-500) 45%, transparent);
  }
  .tips-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  [data-theme="dark"] .tips-toast { color: var(--color-success-400); }
  [data-theme="dark"] .tips-toast.is-error { color: var(--color-danger-400); }

  /* Document canvases are paper: keep them white in dark mode too */
  .tips-paper {
    background: #ffffff;
    color: #0f172a;
  }

  /* Wide tables scroll inside their card instead of widening the page */
  .tips-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Semantic Typography and Surface Utilities */
  .u-color-text-primary { color: var(--text-primary) !important; }
  .u-color-text-secondary { color: var(--text-secondary) !important; }
  .u-color-text-tertiary { color: var(--text-tertiary) !important; }
  .u-background-surface-sunken { background-color: var(--surface-sunken) !important; }
}

/* ---------- Print: only the document, never the app shell ---------- */
@media print {
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  .app-sidebar,
  .app-header,
  .app-main > footer,
  .tips-breadcrumb,
  .sidebar-backdrop,
  .tips-toast,
  .hs-dropdown-menu,
  .no-print {
    display: none !important;
  }
  .app-shell,
  .app-main,
  .app-main > main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Header search field sits inside the pill; drop the native field chrome */
.tips-header-search,
.tips-header-search:focus {
  -webkit-appearance: none;
  appearance: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: none;
  padding: 0;
  color: var(--text-primary);
}
