/* ==========================================================
   PUBLIC PYTHON CODE COMPANION
   ========================================================== */

.python-companion-button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid #cbd4db;
  border-radius: 9px;
  color: var(--navy);
  background: white;
  font-family: inherit;
  font-weight: 750;
  cursor: pointer;
}
.python-companion {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;

  width: min(460px, 92vw);
  height: 100vh;

  display: flex;
  flex-direction: column;

  color: var(--ink);
  background: #f8fafb;
  border-left: 1px solid var(--line);

  transform: translateX(101%);
  transition: transform 180ms ease;
}

.python-companion.open {
  transform: translateX(0);
}

.python-companion-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;

  padding: 20px;
  color: white;
  background: var(--navy);
}

.python-companion-header span,
.python-companion-header strong {
  display: block;
}

.python-companion-header span {
  color: #b8cad8;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.python-companion-header strong {
  margin-top: 5px;
}

.python-companion-header button {
  width: 36px;
  height: 36px;

  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;

  color: white;
  background: transparent;

  font-size: 1.3rem;
  cursor: pointer;
}

.python-companion-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 28px;
}

.python-companion details {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.python-companion summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.python-companion-section {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.python-library-row {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 10px;

  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.python-library-row code {
  color: var(--teal);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.python-library-row span {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.4;
}

.python-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;

  margin-top: 12px;
}

.python-flow-step {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;

  font-size: 0.71rem;
  font-weight: 700;
}

.python-flow-arrow {
  color: var(--muted);
}

.python-dependency-tree,
.python-code-block {
  margin: 12px 0 0;
  padding: 14px;

  overflow-x: auto;

  border-radius: 9px;

  color: #e8edf2;
  background: #17212b;

  font-family:
    "SFMono-Regular",
    Consolas,
    monospace;

  font-size: 0.73rem;
  line-height: 1.6;
  white-space: pre;
}

.python-code-block code {
  color: inherit;
}

.python-companion-why {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}


@media (max-width: 650px) {
  .python-library-row {
    grid-template-columns: 1fr;
  }
}

/* === DATA AI RESPONSIVE FOUNDATION V19.2 === */
/* Supervised ML Python companion: allow code/content to shrink within its owner. */
@media (max-width:820px){
  .python-companion,
  .python-panel,
  .python-card,
  .python-content{
    min-width:0 !important;
    max-width:100% !important;
  }

  .python-companion pre,
  .python-panel pre,
  .python-card pre{
    max-width:100% !important;
    overflow-x:auto !important;
    white-space:pre !important;
  }
}
/* === /DATA AI RESPONSIVE FOUNDATION V19.2 === */

/* === SUPERVISED ML COMPANION HIDDEN STATE v19.7.4 === */
.python-companion[aria-hidden="true"]{
  visibility:hidden !important;
  pointer-events:none !important;
}

.python-companion.open,
.python-companion[aria-hidden="false"]{
  visibility:visible !important;
  pointer-events:auto !important;
}

@media (max-width:620px){
  .python-companion{
    box-sizing:border-box !important;
    width:min(100vw,460px) !important;
    max-width:100vw !important;
  }

  .python-library-row{
    grid-template-columns:minmax(0,1fr) !important;
  }
}
/* === /SUPERVISED ML COMPANION HIDDEN STATE v19.7.4 === */

/* Deck 01: the companion belongs to the lesson flow on wide screens. */
@media (min-width: 1180px) {
  .python-companion-button {
    display: none !important;
  }

  .python-companion,
  .python-companion[aria-hidden="true"],
  .python-companion[aria-hidden="false"] {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    margin-top: 24px !important;
    overflow: hidden !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    border: 1px solid var(--el-line, #dcded8) !important;
    border-radius: 14px !important;
    background: var(--el-surface-soft, #f5f4ef) !important;
  }

  .python-companion-header {
    padding: 17px 20px !important;
    color: var(--el-ink, #0b1f3a) !important;
    background: transparent !important;
    border-bottom: 1px solid var(--el-line, #dcded8) !important;
  }

  .python-companion-header span {
    color: var(--el-blue, #176b87) !important;
  }

  .python-companion-header button {
    display: none !important;
  }

  .python-companion-scroll {
    display: grid !important;
    grid-template-columns: minmax(0, 1.18fr) minmax(260px, .82fr) !important;
    gap: 0 24px !important;
    overflow: visible !important;
    padding: 6px 20px 18px !important;
  }

  .python-companion details {
    min-width: 0;
  }

  .python-companion details:nth-child(n+3) {
    grid-column: 1 / -1;
  }

  .python-companion summary {
    color: var(--el-ink, #0b1f3a);
  }

  .python-companion-why {
    color: var(--el-copy, #42566f);
    font-size: .82rem;
  }
}
