/* Baratelli Institute — Shared Client Context Module styles
 * Floating chip + slide-out panel + toast.
 */

/* ===== Floating Chip (bottom-right) ===== */
.bi-context-chip {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 12px;
  background: #0D2747;
  color: #ffffff;
  border-radius: 999px;
  border: 2px solid #C89000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 39, 71, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  max-width: 360px;
}
.bi-context-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(13, 39, 71, 0.35);
}
.bi-context-chip .bi-ctx-eye {
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: #C89000;
  font-weight: 800;
}
.bi-context-chip .bi-ctx-co {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.bi-context-chip .bi-ctx-rev {
  color: #d6e0ec;
  font-weight: 500;
  font-size: 11.5px;
}
.bi-context-chip .bi-ctx-arrow {
  font-size: 10px;
  color: #d6e0ec;
  margin-left: 2px;
}
.bi-context-chip:not(.has-context) {
  background: #ffffff;
  color: #0D2747;
  border-color: #c4cad6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.bi-context-chip:not(.has-context) .bi-ctx-eye {
  color: #C89000;
}
.bi-context-chip:not(.has-context) .bi-ctx-arrow {
  color: #6b7280;
}

/* ===== Slide-out Panel ===== */
.bi-context-panel {
  position: fixed;
  bottom: 70px;
  right: 18px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #c4cad6;
  box-shadow: 0 12px 32px rgba(13, 39, 71, 0.22);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.bi-context-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bi-ctx-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #fafaf7;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}
.bi-ctx-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  font-weight: 700;
  color: #0D2747;
  margin: 0 0 4px;
}
.bi-ctx-sub {
  font-size: 11.5px;
  line-height: 1.45;
  color: #4a5568;
}

.bi-ctx-fields {
  padding: 12px 18px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.bi-ctx-fields .bi-ctx-field:nth-child(1),
.bi-ctx-fields .bi-ctx-field:nth-child(2) {
  /* company name + industry full-width */
  grid-column: 1 / -1;
}
.bi-ctx-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bi-ctx-flabel {
  font-size: 10.5px;
  letter-spacing: 0.3px;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
}
.bi-ctx-field input {
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  color: #0D2747;
  background: #ffffff;
  border: 1px solid #c4cad6;
  border-radius: 5px;
  outline: none;
}
.bi-ctx-field input:focus {
  border-color: #0D2747;
  box-shadow: 0 0 0 2px rgba(13, 39, 71, 0.12);
}

.bi-ctx-outputs {
  padding: 10px 18px;
  background: #fafaf7;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}
.bi-ctx-outputs-label {
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: #C89000;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 6px;
}
.bi-ctx-output-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: #1a202c;
  padding: 3px 0;
}
.bi-ctx-output-row strong {
  color: #0D2747;
  font-variant-numeric: tabular-nums;
}

.bi-ctx-actions {
  padding: 12px 18px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e5e7eb;
}
.bi-ctx-btn {
  flex: 1;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #c4cad6;
  background: #ffffff;
  color: #0D2747;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.bi-ctx-btn:hover {
  background: #f0f3f8;
  border-color: #0D2747;
}
.bi-ctx-btn.primary {
  background: #0D2747;
  color: #ffffff;
  border-color: #0D2747;
}
.bi-ctx-btn.primary:hover {
  background: #1a3b5c;
}

.bi-ctx-footnote {
  padding: 10px 18px 14px;
  font-size: 10.5px;
  color: #6b7280;
  font-style: italic;
  line-height: 1.45;
}

/* ===== In-tool prefill button ===== */
.bi-ctx-prefill-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fafaf7;
  border: 1px solid #C89000;
  border-radius: 6px;
  margin: 12px 0;
}
.bi-ctx-prefill-bar .label {
  font-size: 11px;
  letter-spacing: 1px;
  color: #C89000;
  font-weight: 700;
  text-transform: uppercase;
}
.bi-ctx-prefill-bar .desc {
  font-size: 12.5px;
  color: #4a5568;
}
.bi-ctx-prefill-bar button {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  background: #0D2747;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}
.bi-ctx-prefill-bar button:hover {
  background: #1a3b5c;
}

/* ===== Toast (fallback if BIShared toast not present) ===== */
.bi-ctx-toast {
  position: fixed;
  bottom: 80px;
  right: 18px;
  z-index: 10000;
  padding: 10px 16px;
  background: #0D2747;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.bi-ctx-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .bi-context-chip {
    bottom: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    font-size: 11.5px;
  }
  .bi-context-chip .bi-ctx-co { max-width: 130px; }
  .bi-context-panel {
    bottom: 64px;
    right: 12px;
    width: calc(100vw - 24px);
  }
  .bi-ctx-fields {
    grid-template-columns: 1fr;
  }
  .bi-ctx-fields .bi-ctx-field:nth-child(1),
  .bi-ctx-fields .bi-ctx-field:nth-child(2) {
    grid-column: 1;
  }
}

/* ===== Print: hide context UI ===== */
@media print {
  .bi-context-chip,
  .bi-context-panel,
  .bi-ctx-toast,
  .bi-ctx-prefill-bar {
    display: none !important;
  }
}
