/* ==========================================
   Lignus Industrie - Cours des Métaux Widget
   ========================================== */

/* ---- WIDGET PRINCIPAL ---- */
.metals-widget {
  font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #4a5257;
  max-width: 100%;
  margin: 0 auto;
}

.metals-widget a {
  color: #E66445;
  text-decoration: none;
}
.metals-widget a:hover {
  color: #d45335;
  text-decoration: underline;
}

/* Loading & Error */
.metals-loading,
.metals-error {
  text-align: center;
  padding: 30px 20px;
  color: #888;
  font-size: 14px;
}
.metals-loading::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #E66445;
  border-top-color: transparent;
  border-radius: 50%;
  animation: metals-spin .8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes metals-spin {
  to { transform: rotate(360deg); }
}
.metals-error {
  color: #dc2626;
}

/* Header */
.metals-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.metals-title {
  font-size: 16px;
  font-weight: 800;
  color: #121C22;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.metals-title::before {
  content: '📊 ';
}
.metals-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.metals-filter-btn {
  background: transparent;
  border: 1.5px solid #dde1e6;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  transition: all .2s;
  font-family: inherit;
}
.metals-filter-btn:hover {
  border-color: #E66445;
  color: #E66445;
}
.metals-filter-btn.active {
  background: #E66445;
  border-color: #E66445;
  color: #fff;
}

/* Table */
.metals-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #eee;
}
.metals-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}
.metals-table th {
  background: #f8f9fa;
  color: #555;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1.5px solid #eee;
  white-space: nowrap;
}
.metals-table th.th-price { text-align: right; }
.metals-table th.th-change { text-align: right; }
.metals-table th.th-signal { text-align: center; }

.metals-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid #ff1f3;
  vertical-align: middle;
}
.metals-table tr:last-child td {
  border-bottom: none;
}
.metals-table tr:hover td {
  background: #fafbfc;
}

.td-metal {
  display: flex;
  align-items: center;
  gap: 10px;
}
.metal-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #ff4f8;
  color: #121C22;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}
.cat-precieux .metal-symbol {
  background: #fef3c7;
  color: #92400e;
}
.cat-alliage .metal-symbol {
  background: #dbeafe;
  color: #1e4bd2;
}
.metal-name {
  font-weight: 600;
  color: #1a1a2e;
}

.td-price {
  text-align: right;
  white-space: nowrap;
}
.price-val {
  font-weight: 700;
  font-size: 14px;
  color: #1a1a2e;
}
.price-unit {
  color: #999;
  font-size: 11px;
  margin-left: 4px;
}

.td-change {
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
  font-weight: 600;
}
.td-change.up { color: #10b981; }
.td-change.down { color: #ef4444; }
.td-change.stable { color: #f59e0b; }

.td-signal {
  text-align: center;
}
.signal-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.signal-badge.signal-up {
  background: #dcfce7;
  color: #166534;
}
.signal-badge.signal-down {
  background: #fef2f2;
  color: #dc2626;
}
.signal-badge.signal-stable {
  background: #fef3c7;
  color: #92400e;
}

/* Footer */
.metals-footer {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.metals-update {
  font-size: 11px;
  color: #999;
}
.metals-disclaimer {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
  flex: 1;
  min-width: 200px;
}
.metals-actions {
  text-align: right;
}
.metals-link {
  display: inline-block;
  padding: 8px 18px;
  background: #E66445;
  color: #fff !important;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  transition: all .2s;
}
.metals-link:hover {
  background: #d45335;
  transform: translateY(-1px);
}

/* ---- MODE COMPACT ---- */
.metals-compact {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.compact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #eee;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  transition: all .2s;
}
.compact-item:hover {
  border-color: #E66445;
}
.compact-item.up { border-color: #bbf7d; background: #ffdf4; }
.compact-item.down { border-color: #fecaca; background: #fef2f2; }
.compact-symbol {
  font-weight: 800;
  color: #121C22;
}
.compact-price {
  font-weight: 600;
  color: #333;
}
.compact-change {
  font-size: 11px;
  font-weight: 700;
}
.compact-item.up .compact-change { color: #10b981; }
.compact-item.down .compact-change { color: #ef4444; }
.compact-more {
  font-size: 12px;
  font-weight: 600;
  color: #E66445 !important;
  text-decoration: none !important;
}

/* ---- MODE BADGE ---- */
.metals-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-item {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,.1);
  color: #fff;
}
.badge-item.up { background: rgba(16, 185, 129, .3); }
.badge-item.down { background: rgba(239, 68, 68, .3); }
.badge-link {
  color: #fff !important;
  text-decoration: none !important;
  font-size: 14px;
  opacity: .7;
}
.badge-link:hover { opacity: 1; }
.badge-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.badge-dot.up { background: #10b981; }
.badge-dot.down { background: #ef4444; }
.badge-dot.stable { background: #f59e0b; }

/* ---- TOPBAR BADGE ---- */
#metals-topbar-badge {
  display: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

/* ---- PAGE DEDIEE ---- */
.metals-page {
  max-width: 100px;
  margin: 0 auto;
  padding: 40px 20px;
}
.metals-page .metals-header {
  border-bottom: 1.5px solid #eee;
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.metals-page .metals-title {
  font-size: 22px;
}
.metals-page .metals-subtitle {
  color: #777;
  font-size: 14px;
  margin-top: 4px;
}
.metals-page .metals-table th {
  padding: 14px 14px;
  font-size: 12px;
}
.metals-page .metals-table td {
  padding: 13px 14px;
  font-size: 14px;
}
.metals-page .price-val {
  font-size: 16px;
}
.metals-page .metal-symbol {
  width: 38px;
  height: 38px;
  font-size: 13px;
}
.metals-page .metals-disclaimer {
  margin-top: 20px;
  padding: 14px 18px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #eee;
  color: #777;
  font-size: 13px;
}
.metals-page .metals-source {
  margin-top: 10px;
  font-size: 12px;
  color: #aaa;
}
.metals-page .metals-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.metals-page .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #555;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend-dot.up { background: #10b981; }
.legend-dot.down { background: #ef4444; }
.legend-dot.stable { background: #f59e0b; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .metals-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .metals-filters {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .metals-table td,
  .metals-table th {
    padding: 8px 10px;
  }
  .metals-page {
    padding: 20px 12px;
  }
  .metals-footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .metals-actions {
    width: 100%;
    text-align: center;
  }
  .metals-link {
    width: 100%;
    text-align: center;
  }
  .metals-compact {
    flex-direction: column;
    align-items: stretch;
  }
  .compact-item {
    justify-content: space-between;
  }
}
