/**
 * CM PRICE HISTORY module
 * PrestaShop 1.7.x, 8.x & 9.x
 * CSS
 * Front-office
 *
 * Theme-agnostic on purpose: no icon fonts, no framework utility classes and
 * no theme variables are required. The line, the dots and the filled area take
 * their colour from the module settings and are painted by the renderer, so
 * everything defined here is the neutral chrome around them.
 */

.cmph-note,
.cmph-tab,
.cmph-modal {
  --cmph-border: #e4e7eb;
  --cmph-surface: #fff;
  --cmph-surface-alt: #f7f8fa;
  --cmph-text: #1f2933;
  --cmph-muted: #6b7280;
  --cmph-reference: #f59e0b;
  --cmph-radius: 12px;
}

/* ------------------------------------------------------------------ *
 *  The sentence under the price
 * ------------------------------------------------------------------ */

.cmph-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 10px 0;
  padding: 9px 13px;
  background-color: var(--cmph-surface-alt);
  border: 1px solid var(--cmph-border);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--cmph-text);
}

.cmph-note-icon {
  display: inline-flex;
  color: var(--cmph-muted);
}

.cmph-note-text {
  flex: 1 1 auto;
  color: var(--cmph-muted);
}

.cmph-note-price {
  color: var(--cmph-text);
  font-weight: 600;
  white-space: nowrap;
}

.cmph-note-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.cmph-note-link:hover,
.cmph-note-link:focus {
  text-decoration: none;
  opacity: 0.75;
}

/* ------------------------------------------------------------------ *
 *  The panel with the chart
 * ------------------------------------------------------------------ */

.cmph-tab-intro {
  margin-bottom: 18px;
  color: var(--cmph-muted);
  line-height: 1.6;
}

.cmph-tab-intro p:last-child {
  margin-bottom: 0;
}

.cmph-panel {
  background-color: var(--cmph-surface);
  border: 1px solid var(--cmph-border);
  border-radius: var(--cmph-radius);
  padding: 18px 18px 14px;
}

.cmph-panel-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-bottom: 6px;
}

.cmph-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmph-stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--cmph-muted);
}

.cmph-stat-value {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--cmph-text);
}

.cmph-badge {
  align-self: center;
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: #fef3c7;
  color: #92400e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.cmph-canvas {
  width: 100%;
  margin-top: 4px;
}

.cmph-panel-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding-top: 10px;
  border-top: 1px solid var(--cmph-border);
  font-size: 13px;
  color: var(--cmph-muted);
}

.cmph-legend {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cmph-legend-line,
.cmph-legend-dash {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top-width: 2px;
}

.cmph-legend-line {
  border-top-style: solid;
  border-top-color: currentColor;
  opacity: 0.75;
}

.cmph-legend-dash {
  border-top-style: dashed;
  border-top-color: var(--cmph-reference);
}

.cmph-range {
  margin-left: auto;
}

.cmph-disclaimer {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--cmph-muted);
}

/* ------------------------------------------------------------------ *
 *  The chart itself
 * ------------------------------------------------------------------ */

.cmph-chart-canvas {
  position: relative;
  width: 100%;
}

.cmph-svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.cmph-grid line {
  stroke: var(--cmph-border);
  stroke-width: 1;
}

.cmph-axis-y,
.cmph-axis-x {
  font-size: 12.5px;
  fill: var(--cmph-muted);
  font-family: inherit;
}

.cmph-axis-y {
  text-anchor: end;
}

.cmph-reference line {
  stroke: var(--cmph-reference);
  stroke-width: 1.5;
}

.cmph-guide {
  stroke: var(--cmph-muted);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.cmph-marker {
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.cmph-hit {
  cursor: crosshair;
}

.cmph-tip {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 8px;
  background-color: rgba(31, 41, 51, 0.94);
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.cmph-tip[hidden] {
  display: none;
}

.cmph-tip-price {
  font-weight: 700;
}

.cmph-tip-date {
  opacity: 0.75;
  font-size: 12px;
}

/* ------------------------------------------------------------------ *
 *  Modal window
 * ------------------------------------------------------------------ */

body.cmph-modal-open {
  overflow: hidden;
}

.cmph-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cmph-modal[hidden] {
  display: none;
}

.cmph-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(17, 24, 39, 0.55);
  animation: cmph-fade 0.18s ease;
}

.cmph-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 24px 20px;
  background-color: var(--cmph-surface);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  animation: cmph-pop 0.2s ease;
}

.cmph-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--cmph-surface-alt);
  color: var(--cmph-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cmph-modal-close:hover,
.cmph-modal-close:focus {
  background-color: #e9ecf1;
  color: var(--cmph-text);
}

.cmph-modal-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  padding-right: 36px;
}

.cmph-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--cmph-text);
}

.cmph-modal-sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--cmph-muted);
}

/* Inside the modal and inside the product page tab the panel is already the
   only thing in its own box - a second frame around it only adds noise. */
.cmph-modal .cmph-panel,
.cmph-tab .cmph-panel {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: none;
}

.cmph-modal .cmph-panel-head {
  padding-bottom: 4px;
}

@keyframes cmph-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cmph-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cmph-modal-backdrop,
  .cmph-modal-dialog {
    animation: none;
  }
}

/* ------------------------------------------------------------------ *
 *  Small screens
 * ------------------------------------------------------------------ */

@media (max-width: 575px) {
  .cmph-panel-head {
    gap: 10px 18px;
  }

  .cmph-stat-value {
    font-size: 17px;
  }

  .cmph-badge {
    margin-left: 0;
  }

  .cmph-range {
    margin-left: 0;
  }

  .cmph-modal {
    padding: 10px;
  }

  .cmph-modal-dialog {
    padding: 20px 16px 16px;
  }
}

/* EOF */
