/*
  EMRSphere WebView2 Fit Layer
  File: /static/css/emrsphere_webview2_fit.css
  Purpose: Make EMRSphere pages render cleanly inside the GO/WebView2 shell.
*/

:root {
  --emr-vh: 1vh;
  --emr-vw: 1vw;
  --emr-safe-pad-x: clamp(10px, 1.6vw, 24px);
  --emr-safe-pad-y: clamp(8px, 1.2vh, 18px);
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.emr-webview2-fit,
body.emr-webview2-fit {
  width: 100%;
  min-width: 0;
  min-height: calc(var(--emr-vh, 1vh) * 100);
  max-width: 100vw;
}

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

body.emr-webview2-fit {
  overscroll-behavior: none;
}

body.emr-webview2-fit img,
body.emr-webview2-fit svg,
body.emr-webview2-fit canvas,
body.emr-webview2-fit video {
  max-width: 100%;
  height: auto;
}

body.emr-webview2-fit iframe,
body.emr-webview2-fit object,
body.emr-webview2-fit embed {
  max-width: 100%;
}

body.emr-webview2-fit table {
  max-width: 100%;
}

body.emr-webview2-fit input,
body.emr-webview2-fit select,
body.emr-webview2-fit textarea,
body.emr-webview2-fit button {
  max-width: 100%;
}

body.emr-webview2-fit .container,
body.emr-webview2-fit .container-sm,
body.emr-webview2-fit .container-md,
body.emr-webview2-fit .container-lg,
body.emr-webview2-fit .container-xl,
body.emr-webview2-fit .container-xxl,
body.emr-webview2-fit .container-fluid {
  width: 100%;
  max-width: 100%;
}

body.emr-webview2-fit #app,
body.emr-webview2-fit #root,
body.emr-webview2-fit main,
body.emr-webview2-fit .page,
body.emr-webview2-fit .page-shell,
body.emr-webview2-fit .workspace-shell,
body.emr-webview2-fit .myworkspace-shell,
body.emr-webview2-fit .login-shell,
body.emr-webview2-fit .emr-page-shell,
body.emr-webview2-fit .emr-shell {
  min-width: 0;
  max-width: 100%;
}

body.emr-webview2-fit .row,
body.emr-webview2-fit [class*="row"] {
  min-width: 0;
}

body.emr-webview2-fit .card,
body.emr-webview2-fit .panel,
body.emr-webview2-fit .modal,
body.emr-webview2-fit .modal-dialog,
body.emr-webview2-fit .modal-content,
body.emr-webview2-fit .dropdown-menu,
body.emr-webview2-fit .offcanvas {
  max-width: 100%;
}

body.emr-webview2-fit .modal-dialog {
  margin-left: auto;
  margin-right: auto;
}

body.emr-webview2-fit .emr-fit-x-scroll,
body.emr-webview2-fit .table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.emr-webview2-fit .emr-prevent-wide-text,
body.emr-webview2-fit .card,
body.emr-webview2-fit .queue-card,
body.emr-webview2-fit .workspace-card,
body.emr-webview2-fit .myworkspace-card {
  overflow-wrap: anywhere;
  word-break: normal;
}

body.emr-webview2-fit .emr-fit-min-screen {
  min-height: calc(var(--emr-vh, 1vh) * 100);
}

body.emr-webview2-fit .emr-fit-full-screen {
  width: 100%;
  min-height: calc(var(--emr-vh, 1vh) * 100);
}

body.emr-webview2-fit .emr-fit-safe-padding {
  padding: var(--emr-safe-pad-y) var(--emr-safe-pad-x);
}

@media (max-width: 900px) {
  body.emr-webview2-fit .modal-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  body.emr-webview2-fit .workspace-grid,
  body.emr-webview2-fit .myworkspace-grid,
  body.emr-webview2-fit .queue-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  }
}

@media print {
  html,
  body,
  html.emr-webview2-fit,
  body.emr-webview2-fit {
    overflow: visible !important;
    width: auto !important;
    min-height: auto !important;
    max-width: none !important;
  }
}

/* ============================================================
   EMRSphere MyWorkspace compact desktop card layout
   Added to reduce card height and improve WebView2 density.
   ============================================================ */

.workspace-grid,
.myworkspace-grid,
.cards-grid,
.workspace-cards {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
    gap: 14px !important;
}

.workspace-card {
    min-height: 150px !important;
    padding: 14px 14px 12px 14px !important;
}

.thumbnail-wrap {
    height: 88px !important;
    min-height: 88px !important;
    max-height: 88px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.thumbnail-wrap img,
.thumbnail-wrap svg {
    max-height: 72px !important;
    max-width: 72px !important;
}

.workspace-card .card-title,
.workspace-card h3,
.workspace-card h4 {
    font-size: 1rem !important;
    line-height: 1.15 !important;
    margin-bottom: 6px !important;
}

.workspace-card .card-description,
.workspace-card .description {
    font-size: 0.82rem !important;
    line-height: 1.25 !important;
    opacity: 0.86 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.workspace-card .card-path,
.workspace-card .path,
.workspace-card code {
    display: none !important;
}

.card-number {
    font-size: 0.78rem !important;
    padding: 3px 7px !important;
}

/* ============================================================
   EMRSphere MyWorkspace true tiny thumbnails: 25x25
   ============================================================ */

body .workspace-card .thumbnail-wrap,
body .thumbnail-wrap {
    height: 72px !important;
    min-height: 72px !important;
    max-height: 72px !important;
    margin: 0 0 4px 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body .workspace-card .thumbnail-wrap img,
body .workspace-card .thumbnail-wrap svg,
body .thumbnail-wrap img,
body .thumbnail-wrap svg {
    width: 72px !important;
    height: 72px !important;
    max-width: 72px !important;
    max-height: 72px !important;
    object-fit: contain !important;
}
/* ============================================================
   EMRSphere MyWorkspace laptop-friendly thumbnails
   Bigger than compact mode, still readable and not huge.
   FINAL OVERRIDE - keep at bottom.
   ============================================================ */

body.emr-webview2-fit .workspace-card {
    min-height: 180px !important;
    padding: 12px 12px 10px 12px !important;
}

body.emr-webview2-fit .workspace-card .thumbnail-wrap,
body.emr-webview2-fit .thumbnail-wrap {
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
    margin: 0 0 6px 0 !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.emr-webview2-fit .workspace-card .thumbnail-wrap img,
body.emr-webview2-fit .workspace-card .thumbnail-wrap svg,
body.emr-webview2-fit .thumbnail-wrap img,
body.emr-webview2-fit .thumbnail-wrap svg {
    width: 92px !important;
    height: 92px !important;
    max-width: 92px !important;
    max-height: 92px !important;
    object-fit: contain !important;
}

body.emr-webview2-fit .workspace-card .card-title,
body.emr-webview2-fit .workspace-card h3,
body.emr-webview2-fit .workspace-card h4 {
    font-size: 0.95rem !important;
    line-height: 1.12 !important;
    margin-bottom: 4px !important;
}

body.emr-webview2-fit .workspace-card .card-description,
body.emr-webview2-fit .workspace-card .description {
    font-size: 0.75rem !important;
    line-height: 1.15 !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
}