/* AP Charts – frontend chart wrapper styles */

.ap-chart-wrap {
  position: relative;
  width: 100%;
  /* height is set inline by the shortcode (default 460px) */
  margin: 24px 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* Chart header: title + subtitle rendered by JS above the canvas */
.ap-chart-header {
  text-align: center;
  padding: 10px 0 4px;
  flex-shrink: 0;
}
.ap-chart-title-text {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
.ap-chart-subtitle-text {
  font-size: 12px;
  color: #555;
  margin-top: 2px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Canvas wrapper: fills remaining height after header and citation */
.ap-chart-canvas-area {
  flex: 1;
  position: relative;
  min-height: 0;
}

/* Chart.js requires the canvas parent to have an explicit height
   when responsive:true + maintainAspectRatio:false is used. */
.ap-chart-canvas-area canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Citation line below each chart */
.ap-chart-citation {
  font-size: 10px;
  color: #777;
  line-height: 1.4;
  padding: 5px 4px 4px;
  flex-shrink: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Download button — real clickable button that appears on hover */
.ap-chart-download-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(31, 56, 100, 0.75);
  color: #fff;
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  padding: 3px 8px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.ap-chart-wrap:hover .ap-chart-download-btn {
  opacity: 1;
}
.ap-chart-download-btn:hover {
  background: rgba(31, 56, 100, 1);
}

.ap-chart-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #888;
  font-size: 14px;
  font-style: italic;
  margin: 0;
  white-space: nowrap;
}

/* Set wrapper — expanded by JS into individual .ap-chart-wrap elements. */
.ap-chart-set-wrap {
  width: 100%;
}

/* Add breathing room between consecutive charts within a set. */
.ap-chart-set-wrap .ap-chart-wrap + .ap-chart-wrap {
  margin-top: 40px;
}

/* Shown when no data has been uploaded yet (rendered server-side). */
.ap-chart-placeholder {
  padding: 20px 24px;
  background: #f9f9f9;
  border: 1px dashed #ccc;
  border-radius: 4px;
  color: #777;
  font-style: italic;
  text-align: center;
  margin: 16px 0;
}

/* Shown when the shortcode is missing required attributes. */
.ap-chart-error {
  color: #991b1b;
  font-size: 13px;
  padding: 8px 0;
}
