/* Anesthguide Tools – Anjongap (compact + responsive + print only result) */

/* Scope everything to the tool to avoid theme collisions */
.agt-tool,
.agt-tool * {
  box-sizing: border-box;
}

.agt-tool {
  width: 100%;
  max-width: 100%;
  overflow-x: clip; /* prevents accidental horizontal scroll */
  font: inherit;    /* inherit site typography */
  color: inherit;
}

/* Optional: match typical content width behavior */
.agt-tool .agt-card {
  width: 100%;
  max-width: 100%;
}

/* Header */
.agt-tool__header { margin: 0 0 .5rem; }
.agt-tool__title  { margin: 0; font-size: 1.15rem; line-height: 1.2; }

/* Card */
.agt-card {
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

/* Form layout */
.agt-form { margin: 0; }

.agt-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Critical for overflow issues on some themes */
.agt-grid > * { min-width: 0; }

@media (max-width: 720px){
  .agt-grid { grid-template-columns: 1fr; }
}

/* Fields */
.agt-field label {
  display: block;
  font-weight: 600;
  margin: 0 0 5px;
  font-size: .95rem;
}

.agt-muted { font-weight: 500; opacity: .75; }

.agt-field input,
.agt-field select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid rgba(0,0,0,.16);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 16px;       /* keep iOS from zooming */
  line-height: 1.2;
  background: #fff;
}

/* Inline albumin row */
.agt-inline {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.agt-inline select {
  width: auto;
  min-width: 88px;
  max-width: 140px;
}

/* Help text */
.agt-help {
  margin: 6px 0 0;
  font-size: .88rem;
  opacity: .8;
}

/* Actions */
.agt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.agt-btn {
  appearance: none;
  border: 1px solid rgba(0,0,0,.16);
  background: rgba(0,0,0,.03);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.1;
}

.agt-btn--primary {
  background: #0b66ff;
  color: #fff;
  border-color: transparent;
}

/* Status */
.agt-status {
  margin-top: 8px;
  font-size: .92rem;
}
.agt-status[data-type="ok"]    { color: #0a7a2f; }
.agt-status[data-type="warn"]  { color: #8a5b00; }
.agt-status[data-type="error"] { color: #b00020; }

/* Result card */
.agt-result { margin-top: 10px; }

.agt-result__top {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.agt-result__top > * { min-width: 0; }

@media (max-width: 720px){
  .agt-result__top { grid-template-columns: 1fr; }
}

.agt-result__value {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.agt-result__label {
  opacity: .85;
  font-size: .95rem;
}

.agt-result__ref {
  opacity: .75;
  font-size: .9rem;
  margin-top: 2px;
}

.agt-divider {
  height: 1px;
  background: rgba(0,0,0,.10);
  margin: 10px 0;
}

.agt-result__bottom { font-size: .95rem; }
.agt-result__row { margin: 6px 0; }

/* Details */
.agt-details summary {
  cursor: pointer;
  font-weight: 700;
  margin-top: 6px;
}
.agt-details ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

/* Disclaimer */
.agt-disclaimer {
  margin: 8px 0 0;
  font-size: .88rem;
  opacity: .75;
}

/* ---------- PRINT: print ONLY the result card ---------- */
/* This makes printing from the print button AND browser menu show only results. */
@media print {
  /* Hide everything by default */
  body * {
    visibility: hidden !important;
  }

  /* Show only result card(s) */
  .agt-result,
  .agt-result * {
    visibility: visible !important;
  }

  /* Position result at top-left of page */
  .agt-result {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 12mm !important;
  }

  /* Remove UI-only stuff if it would appear */
  .agt-actions,
  .agt-status,
  .agt-details summary {
    display: none !important;
  }

  /* Make sure text is readable on paper */
  .agt-result__value { font-size: 18pt !important; }
  .agt-result__label,
  .agt-result__ref,
  .agt-result__bottom { font-size: 11pt !important; }

  @page { margin: 10mm; }
}
