/* ============================================
   MetalCharts - Light Design
   Compact Widget + Full Modal
   ============================================ */

/* ==========================================================
   COMPACT WIDGET (Homepage)
   ========================================================== */
.mc-compact {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E6E6E6;
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.08);
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  color: #333;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* -- Compact Tabs -- */
.mc-c-tabs {
  display: flex;
  border-bottom: 1px solid #EEEEEE;
}

.mc-c-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  background: #FAFAFA;
  border: none;
  border-right: 1px solid #EEEEEE;
  cursor: pointer;
  transition: all 0.25s ease;
  color: #999;
}

.mc-c-tab:last-child { border-right: none; }

.mc-c-tab:hover { background: #F5F4ED; color: #5E582E; }

.mc-c-tab.active {
  background: #FFFFFF;
  color: #5E582E;
  box-shadow: inset 0 -2px 0 #A89E53;
}

.mc-c-tab-symbol {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.mc-c-tab-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* -- Compact Price Row -- */
.mc-c-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 6px;
}

.mc-c-price-left {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mc-c-price-value {
  font-size: 28px;
  font-weight: 700;
  color: #2C2C2C;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.mc-c-price-unit {
  font-size: 13px;
  color: #AAAAAA;
  font-weight: 500;
}

.mc-c-price-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mc-c-change {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mc-c-arrow { display: inline-flex; width: 0; height: 0; }
.mc-c-arrow.up { border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 5px solid #1E8449; }
.mc-c-arrow.down { border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid #C0392B; }

.mc-c-change-pct {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mc-c-change-pct.up { color: #1E8449; }
.mc-c-change-pct.down { color: #C0392B; }

.mc-c-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  color: #27AE60;
  letter-spacing: 1px;
  padding: 3px 8px;
  background: rgba(39, 174, 96, 0.06);
  border-radius: 10px;
}

.mc-c-live-dot {
  width: 5px;
  height: 5px;
  background: #27AE60;
  border-radius: 50%;
  animation: mc-pulse 2s ease-in-out infinite;
}

.mc-c-time {
  font-weight: 500;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

@keyframes mc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* -- Compact Chart -- */
.mc-c-chart-wrap {
  position: relative;
  padding: 0 8px;
  height: 180px;
}

.mc-c-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.85);
  z-index: 5;
  transition: opacity 0.3s;
}
.mc-c-loading.hidden { opacity: 0; pointer-events: none; }

.mc-c-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid #EBE8D8;
  border-top-color: #A89E53;
  border-radius: 50%;
  animation: mc-spin 0.8s linear infinite;
}

@keyframes mc-spin { to { transform: rotate(360deg); } }

#mc-c-chart {
  width: 100% !important;
  height: 180px !important;
}

/* -- Compact Footer (periods + CTA) -- */
.mc-c-footer {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}

.mc-c-periods {
  display: flex;
  gap: 3px;
  flex: 1;
}

.mc-c-period {
  flex: 1;
  padding: 5px 0;
  background: transparent;
  border: 1px solid #EEEEEE;
  border-radius: 6px;
  color: #BBBBBB;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.mc-c-period:hover { background: #FAFAFA; color: #5E582E; border-color: #DDD; }
.mc-c-period.active {
  background: #F8F7EF;
  border-color: #C4BD82;
  color: #A89E53;
}

.mc-c-fullbtn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #F8F7EF;
  border: 1px solid #C4BD82;
  border-radius: 6px;
  color: #A89E53;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mc-c-fullbtn:hover {
  background: #A89E53;
  color: #FFFFFF;
}
.mc-c-fullbtn:hover svg { stroke: #FFFFFF; }

/* -- Compact Metal Summary Row -- */
.mc-c-metals-row {
  display: flex;
  border-top: 1px solid #EEEEEE;
  background: #FAFAF8;
}

.mc-c-metal-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  gap: 2px;
  border-right: 1px solid #EEEEEE;
}
.mc-c-metal-item:last-child { border-right: none; }

.mc-c-metal-label {
  font-size: 10px;
  font-weight: 600;
  color: #AAAAAA;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mc-c-metal-price {
  font-size: 13px;
  font-weight: 700;
  color: #333;
  font-variant-numeric: tabular-nums;
}

.mc-c-metal-change {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mc-c-metal-unit {
  font-size: 10px;
  font-weight: 500;
  color: #AAAAAA;
}

.mc-c-metal-change.up { color: #1E8449; }
.mc-c-metal-change.down { color: #C0392B; }

/* ==========================================================
   FULL MODAL
   ========================================================== */
.mc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: mc-fade-in 0.25s ease;
}

.mc-modal-overlay.open {
  display: flex;
}

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

.mc-modal {
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  color: #333;
  animation: mc-slide-up 0.3s ease;
}

@keyframes mc-slide-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.mc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #EEEEEE;
  position: sticky;
  top: 0;
  background: #FFFFFF;
  z-index: 2;
  border-radius: 16px 16px 0 0;
}

.mc-modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 700;
  color: #5E582E;
  margin: 0;
}

.mc-modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F5F5F5;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
}
.mc-modal-close:hover {
  background: #EEEEEE;
  color: #333;
}

.mc-modal-body {
  padding: 0;
}

/* -- Full Tabs -- */
.mc-f-tabs {
  display: flex;
  padding: 16px 20px 0;
  gap: 8px;
}

.mc-f-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #FAFAFA;
  border: 1px solid #EEEEEE;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s;
  color: #999;
}
.mc-f-tab:hover { background: #F5F4ED; border-color: #DDD9C4; color: #5E582E; }

.mc-f-tab.active {
  background: #F8F7EF;
  border-color: #C4BD82;
  color: #5E582E;
  box-shadow: 0 2px 8px rgba(168, 158, 83, 0.1);
}

.mc-f-tab[data-symbol="XAU"].active { border-color: #C4A54A; }
.mc-f-tab[data-symbol="XAG"].active { border-color: #A0A0A0; }
.mc-f-tab[data-symbol="XPT"].active { border-color: #8B9DAF; }

.mc-f-tab-sym {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.mc-f-tab-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mc-f-tab-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.mc-f-tab-price {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  font-variant-numeric: tabular-nums;
}

.mc-f-tab-change {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mc-f-tab-change.up { color: #1E8449; background: rgba(39, 174, 96, 0.08); }
.mc-f-tab-change.down { color: #C0392B; background: rgba(231, 76, 60, 0.08); }

/* -- Full Price Block -- */
.mc-f-price-block {
  padding: 18px 24px 10px;
}

.mc-f-price-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mc-f-price-val {
  font-size: 40px;
  font-weight: 700;
  color: #2C2C2C;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  line-height: 1;
}

.mc-f-price-unit {
  font-size: 15px;
  color: #AAA;
}

.mc-f-price-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.mc-f-change-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-f-arrow { display: inline-flex; width: 0; height: 0; }
.mc-f-arrow.up { border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 6px solid #27AE60; }
.mc-f-arrow.down { border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid #E74C3C; }

.mc-f-change-val { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mc-f-change-val.up { color: #1E8449; }
.mc-f-change-val.down { color: #C0392B; }

.mc-f-change-pct { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.mc-f-change-pct.up { color: #1E8449; background: rgba(39,174,96,0.08); }
.mc-f-change-pct.down { color: #C0392B; background: rgba(231,76,60,0.08); }

.mc-f-fixing {
  font-size: 13px;
  color: #AAA;
}
.mc-f-fixing strong {
  color: #5E582E;
}

/* -- Full Periods -- */
.mc-f-periods {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  margin-bottom: 8px;
}

.mc-f-period {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: 1px solid #EEE;
  border-radius: 8px;
  color: #AAA;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.mc-f-period:hover { background: #FAFAFA; color: #5E582E; border-color: #DDD; }
.mc-f-period.active { background: #F8F7EF; border-color: #C4BD82; color: #A89E53; font-weight: 700; }

/* -- Full Chart -- */
.mc-f-chart-wrap {
  position: relative;
  padding: 8px 16px 8px 8px;
  min-height: 320px;
}

.mc-f-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255,255,255,0.9);
  z-index: 5;
  transition: opacity 0.3s;
}
.mc-f-loading.hidden { opacity: 0; pointer-events: none; }

.mc-f-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #EBE8D8;
  border-top-color: #A89E53;
  border-radius: 50%;
  animation: mc-spin 0.8s linear infinite;
}

.mc-f-loading span { font-size: 13px; color: #999; }

#mc-f-chart {
  width: 100% !important;
  max-height: 320px;
}

/* -- Full Stats -- */
.mc-f-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #EEE;
  background: #FAFAF8;
  border-radius: 0 0 16px 16px;
}

.mc-f-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  border-right: 1px solid #EEE;
}
.mc-f-stat:last-child { border-right: none; }

.mc-f-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: #AAA;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.mc-f-stat-val {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  font-variant-numeric: tabular-nums;
}

.mc-f-stat-high { color: #1E8449; }
.mc-f-stat-low { color: #C0392B; }

/* ==========================================================
   NAV ITEM - Cours
   ========================================================== */
.nav-item-cours a {
  display: flex !important;
  align-items: center;
  color: #A89E53 !important;
  font-weight: 600 !important;
}
.nav-item-cours a:hover {
  color: #8B7F2A !important;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 768px) {
  /* Compact */
  .mc-c-tab { padding: 10px 4px; gap: 4px; }
  .mc-c-tab-symbol { width: 24px; height: 24px; font-size: 10px; }
  .mc-c-tab-name { font-size: 10px; }
  .mc-c-price-value { font-size: 24px; }
  .mc-c-chart-wrap { height: 150px; }
  #mc-c-chart { height: 150px !important; }
  .mc-c-period { font-size: 10px; }

  /* Modal */
  .mc-modal { max-width: 100%; border-radius: 12px; }
  .mc-f-tabs { flex-direction: column; gap: 6px; padding: 12px 16px 0; }
  .mc-f-price-val { font-size: 30px; }
  .mc-f-price-block { padding: 14px 16px 8px; }
  .mc-f-price-meta { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mc-f-periods { padding: 0 16px; }
  .mc-f-chart-wrap { min-height: 250px; }
  #mc-f-chart { max-height: 250px; }
  .mc-f-stats { grid-template-columns: repeat(2, 1fr); }
  .mc-f-stat:nth-child(2) { border-right: none; }
  .mc-f-stat:nth-child(1), .mc-f-stat:nth-child(2) { border-bottom: 1px solid #EEE; }
}

@media (max-width: 480px) {
  .mc-c-tab-symbol { display: none; }
  .mc-c-price-value { font-size: 22px; }
  .mc-c-metals-row { flex-wrap: wrap; }
  .mc-c-metal-item { min-width: 33%; }
  .mc-c-fullbtn span { display: none; }
}

/* -- Animations -- */
.mc-price-flash { animation: mc-flash 0.6s ease; }
@keyframes mc-flash { 0% { opacity: 1; } 30% { opacity: 0.4; } 100% { opacity: 1; } }
