/* Nili Metal — Styles du composant Graphique de prix */

.graphique-prix {
  --gp-accent: #3E6A78;
  --gp-ink: #161824;
  --gp-cream: #F5F5F0;
  --gp-cream-2: #EEEDE6;
  --gp-border: #E0E0DC;
  --gp-muted: #6B7280;
  --gp-up: #16A34A;
  --gp-down: #DC2626;
  --gp-amber: #B45309;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  font-family: inherit;
  color: var(--gp-ink);
}

/* Header ----------------------------------------------------- */
.graphique-prix .gp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.graphique-prix .gp-nom {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.3rem 0;
  color: var(--gp-ink);
  letter-spacing: -0.01em;
}

.graphique-prix .gp-prix-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.graphique-prix .gp-prix {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--gp-ink);
  line-height: 1;
}

.graphique-prix .gp-unite {
  font-size: 0.95rem;
  color: var(--gp-muted);
}

.graphique-prix .gp-variation {
  font-size: 0.9rem;
  font-weight: 600;
}

.graphique-prix .gp-up { color: var(--gp-up); }
.graphique-prix .gp-down { color: var(--gp-down); }
.graphique-prix .gp-flat { color: var(--gp-muted); }

.graphique-prix .gp-maj {
  font-size: 0.78rem;
  color: var(--gp-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Sélecteur de période -------------------------------------- */
.graphique-prix .gp-periodes {
  display: inline-flex;
  background: var(--gp-cream);
  border-radius: 0.55rem;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  gap: 0.15rem;
}

.graphique-prix .gp-periode-btn {
  background: transparent;
  border: 0;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gp-muted);
  border-radius: 0.4rem;
  cursor: pointer;
  transition: all 180ms ease-out;
  font-family: inherit;
}

.graphique-prix .gp-periode-btn:hover {
  color: var(--gp-ink);
}

.graphique-prix .gp-periode-btn.is-active {
  background: var(--gp-accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Chart container ------------------------------------------- */
.graphique-prix .gp-chart {
  width: 100%;
  min-height: 320px;
}

/* Stats sous le graphique ----------------------------------- */
.graphique-prix .gp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 0;
  padding: 1rem;
  background: var(--gp-cream);
  border-radius: 0.6rem;
}

.graphique-prix .gp-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.graphique-prix .gp-stat-label {
  font-size: 0.72rem;
  color: var(--gp-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.graphique-prix .gp-stat-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gp-ink);
}

/* Sources ---------------------------------------------------- */
.graphique-prix .gp-sources {
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  background: var(--gp-cream);
  border: 1px solid var(--gp-border);
  border-radius: 0.6rem;
  font-size: 0.83rem;
  color: var(--gp-muted);
  line-height: 1.55;
}

.graphique-prix .gp-sources-title {
  font-weight: 600;
  color: var(--gp-ink);
  margin-bottom: 0.5rem;
}

.graphique-prix .gp-sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.graphique-prix .gp-sources-list li {
  margin-bottom: 0.2rem;
}

.graphique-prix .gp-sources-list a {
  color: var(--gp-accent);
  text-decoration: none;
}

.graphique-prix .gp-sources-list a:hover {
  text-decoration: underline;
}

.graphique-prix .gp-sources-footer {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--gp-border);
  font-size: 0.76rem;
}

.graphique-prix .gp-disclaimer {
  margin-top: 0.5rem;
  font-size: 0.76rem;
  color: var(--gp-amber);
}

.graphique-prix .gp-disclaimer a {
  color: var(--gp-amber);
  text-decoration: underline;
}

/* Tooltip ---------------------------------------------------- */
.gp-tooltip {
  background: var(--gp-ink, #161824);
  color: #fff;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-family: inherit;
  min-width: 160px;
}

.gp-tooltip .gp-tt-date {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.2rem;
  text-transform: capitalize;
}

.gp-tooltip .gp-tt-prix {
  font-size: 1.05rem;
  font-weight: 700;
}

.gp-tooltip .gp-tt-var {
  font-size: 0.78rem;
  margin-top: 0.2rem;
}

.gp-tooltip .gp-up { color: #4ade80; }
.gp-tooltip .gp-down { color: #f87171; }

/* Skeleton --------------------------------------------------- */
.graphique-prix .gp-skeleton {
  width: 100%;
}

.graphique-prix .gp-sk {
  background: linear-gradient(90deg, #f0f0eb 25%, #e8e8e2 50%, #f0f0eb 75%);
  background-size: 200% 100%;
  animation: gp-shimmer 1.4s linear infinite;
  border-radius: 0.4rem;
  margin-bottom: 1rem;
}

.graphique-prix .gp-sk-h1 { height: 2rem; width: 35%; }
.graphique-prix .gp-sk-h2 { height: 2.6rem; width: 25%; }
.graphique-prix .gp-sk-tabs { height: 2.4rem; width: 35%; }
.graphique-prix .gp-sk-chart { height: 320px; width: 100%; }

@keyframes gp-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Erreur ----------------------------------------------------- */
.graphique-prix .gp-erreur {
  padding: 1.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.6rem;
  color: #991b1b;
  text-align: center;
}

.graphique-prix .gp-erreur-sub {
  font-size: 0.85rem;
  margin-top: 0.4rem;
  color: #b91c1c;
}

.graphique-prix .gp-erreur a {
  color: #991b1b;
  text-decoration: underline;
}

/* Responsive ------------------------------------------------- */
@media (max-width: 640px) {
  .graphique-prix .gp-nom { font-size: 1.3rem; }
  .graphique-prix .gp-prix { font-size: 2rem; }
  .graphique-prix .gp-maj { font-size: 0.7rem; }
  .graphique-prix .gp-periode-btn { padding: 0.45rem 0.75rem; font-size: 0.8rem; }
  .graphique-prix .gp-stats { grid-template-columns: 1fr 1fr; gap: 0.6rem; padding: 0.85rem; }
}

/* Force le fond clair de la section graphique --------------- */
.metal-chart-section-light {
  background: #FFFFFF;
}
