/* Panel — white floating card, anchored bottom-left */
.context-card-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 480px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 160px);
  border-radius: 10px;
  overflow: hidden;
  padding: 20px 10px 10px 10px;
  z-index: 12;
  box-sizing: border-box;
  /* Override .side-panel dark styles */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: rgba(0, 0, 0, 0.87);
  /* Hidden above viewport by default, slides down on open */
  transform: translateY(calc(100% + 100px));
}
.context-card-panel.active {
  transform: translateY(0);
}

/* Close button — dark on light background */
#context-card-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 14px;
  height: 14px;
  filter: brightness(0);
  opacity: 0.54;
}

/* Title */
#context-card-panel h5 {
  color: rgba(0, 0, 0, 0.87);
  margin: 0 0 8px;
  padding-right: 28px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}




/* Materialize tabs — light background theme */
#context-card-tabs,
#context-card-tabs li {
  list-style: none;
  margin: 0;
  padding: 0;
}
#context-card-panel .tabs {
  display: flex;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  height: 48px;
  width: 100%;
}
#context-card-panel .tabs .tab {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
}
#context-card-panel .tabs .tab a {
  display: block;
  color: rgba(0, 0, 0, 0.6);
  font-family: 'Raleway', sans-serif;
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 0 16px;
  line-height: 48px;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
}
#context-card-panel .tabs .tab a.active,
#context-card-panel .tabs .tab a:hover {
  color: var(--wonda-programs-primary, #247e8d);
  background: transparent;
}
#context-card-panel .tabs .indicator {
  background-color: var(--wonda-programs-primary, #247e8d);
  position: absolute;
  bottom: 0;
  height: 2px;
  will-change: left, right;
  transition: left 0.3s, right 0.3s;
}

/* Suppress Materialize row bottom margin inside the panel */
#context-card-panel .row {
  margin-bottom: 0;
}

/* Section content — fixed max-height, scrolls independently */
.context-card-content {
  max-height: calc(560px - 40px - 30px - 48px - 12px); /* panel - v-padding - title - tabs - content-pt */
  overflow-y: auto;
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
  mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
  padding: 12px 8px 0 8px;
  color: rgba(0, 0, 0, 0.87);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: left;
  cursor: auto;
  -webkit-user-select: text;
  -moz-select: text;
  -ms-select: text;
  user-select: text;
}
.context-card-content.at-bottom {
  -webkit-mask-image: none;
  mask-image: none;
}
.context-card-content p { 
  margin: 0 0 0.75em;
  text-align: left;
  font-size: 14px;
 }
.context-card-content p:last-child { margin-bottom: 0; }
.context-card-content strong { font-weight: 600; }
.context-card-content em { font-style: italic; }
.context-card-content ul { list-style-type: disc; padding-left: 20px; margin: 0 0 0.75em; }
.context-card-content ol { list-style-type: decimal; padding-left: 20px; margin: 0 0 0.75em; }
.context-card-content li { 
  margin-bottom: 4px;
  color: rgba(0, 0, 0, 0.87);
}

.context-card-content a {
  color: var(--wonda-programs-primary, #247e8d);
  word-break: break-all;
  text-decoration: underline;
}
.context-card-content blockquote {
  border-left: 3px solid rgba(0, 0, 0, 0.2);
  margin: 0 0 0.75em;
  padding-left: 12px;
  color: rgba(0, 0, 0, 0.6);
}
.context-card-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px 0;
  border-radius: 8px;
}
.context-card-content * { max-width: 100%; box-sizing: border-box; }

/* Mobile — bottom sheet */
@media (max-width: 600px) {
  .context-card-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    padding: 20px;
    transform: translateY(calc(100% + 10px));
  }
  .context-card-content {
    max-height: calc(90vh - 130px); /* max-height - title - tabs - padding */
  }
}
