/* ═══════════════════════════════════════════════════
   Hnaya Éco Community — Widget CSS v1.1
   ═══════════════════════════════════════════════════ */

#hec-widget-host { contain:layout style paint; max-width:1100px; margin:0 auto; }
#hec-widget,#hec-widget * { box-sizing:border-box; }

#hec-widget {
  font-family:'Cairo','Tahoma','Segoe UI',system-ui,sans-serif;
  background:linear-gradient(135deg,#0a0f1e 0%,#0d1530 50%,#0a1228 100%);
  border-radius:16px; padding:20px; color:#e8eaf6;
  position:relative; overflow:hidden; direction:rtl;
}
#hec-widget::before {
  content:''; position:absolute; top:-60px; right:-60px;
  width:200px; height:200px;
  background:radial-gradient(circle,rgba(255,215,0,.07) 0%,transparent 70%);
  pointer-events:none; z-index:0;
}
#hec-widget[dir="ltr"]{ direction:ltr; }

/* ── Header ── */
.hec-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:10px; position:relative; z-index:1; }
.hec-title  { font-size:17px; font-weight:700; color:rgba(255,215,0,.95); letter-spacing:.4px; }
.hec-subtitle { font-size:10px; color:rgba(255,215,0,.5); margin-top:2px; }
.hec-lang-btn { background:rgba(255,215,0,.1); border:1px solid rgba(255,215,0,.35); color:rgba(255,215,0,.9); border-radius:20px; padding:5px 14px; font-size:12px; font-weight:700; cursor:pointer; font-family:inherit; transition:all .2s; white-space:nowrap; }
.hec-lang-btn:hover { background:rgba(255,215,0,.2); border-color:rgba(255,215,0,.7); }

/* ── Sections ── */
.hec-section-header { display:flex; align-items:center; justify-content:space-between; margin:18px 0 10px; gap:10px; position:relative; z-index:1; }
.hec-section-header h3 { margin:0; font-size:12px; font-weight:700; color:rgba(255,215,0,.85); font-family:inherit; }
.hec-toggle-section { background:rgba(255,215,0,.08); border:1px solid rgba(255,215,0,.3); border-radius:20px; padding:3px 12px; font-size:10px; font-weight:700; cursor:pointer; color:rgba(255,215,0,.8); font-family:inherit; transition:all .2s; white-space:nowrap; }
.hec-toggle-section:hover { background:rgba(255,215,0,.18); border-color:rgba(255,215,0,.6); }

/* ── Grilles ── */
.hec-cards-grid,.hec-metals-grid,.hec-tv-grid,.hec-charts-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; position:relative; z-index:1; }

/* ── Carte devise ── */
.hec-card {
  background:rgba(255,255,255,.04); border:1px solid rgba(255,215,0,.18);
  border-radius:12px; padding:12px 14px; position:relative; overflow:hidden;
  transition:border-color .2s,transform .15s;
}
.hec-card:hover { border-color:rgba(255,215,0,.4); transform:translateY(-1px); }
.hec-card::after { content:''; position:absolute; bottom:0; left:0; right:0; height:2px; background:linear-gradient(90deg,transparent,rgba(255,215,0,.35),transparent); }
.hec-card-pair  { font-size:12px; font-weight:700; color:rgba(255,215,0,.85); margin-bottom:3px; }
.hec-card-label { font-size:9px; color:rgba(200,210,240,.45); text-transform:uppercase; letter-spacing:1px; margin-bottom:8px; }
.hec-rates { display:flex; gap:14px; }
.hec-rate-type  { font-size:8px; text-transform:uppercase; letter-spacing:1px; color:rgba(200,210,240,.4); margin-bottom:2px; }
.hec-rate-value { font-size:17px; font-weight:700; color:#fff; line-height:1; }
.hec-rate-unit  { font-size:9px; color:rgba(200,210,240,.45); margin-top:2px; }
.hec-rate-buy  .hec-rate-value { color:#4ade80; }
.hec-rate-sell .hec-rate-value { color:#fb923c; }
.hec-updated { font-size:9px; color:rgba(200,210,240,.25); margin-top:8px; text-align:right; }

/* ── Taux observé + badge confiance ── */
.hec-obs-row { display:flex; align-items:center; flex-wrap:wrap; gap:5px; margin-top:7px; padding-top:7px; border-top:1px solid rgba(255,215,0,.1); }
.hec-obs-label { font-size:8px; color:rgba(200,210,240,.45); text-transform:uppercase; letter-spacing:.8px; }
.hec-obs-val   { font-size:11px; font-weight:700; color:rgba(255,215,0,.8); }
.hec-conf-badge { font-size:8px; padding:2px 6px; border-radius:10px; color:#fff; font-weight:700; margin-right:auto; }

/* ── Cartes métaux ── */
.hec-metal-card {
  background:rgba(255,255,255,.04); border:1px solid rgba(255,215,0,.18);
  border-radius:12px; padding:12px 14px; position:relative; overflow:hidden;
  transition:border-color .2s,transform .15s;
}
.hec-metal-card:hover { border-color:rgba(255,215,0,.4); transform:translateY(-1px); }
.hec-metal-card::after { content:''; position:absolute; bottom:0; left:0; right:0; height:2px; background:linear-gradient(90deg,transparent,rgba(255,215,0,.35),transparent); }
.hec-metal-icon  { font-size:20px; line-height:1; display:block; margin-bottom:4px; }
.hec-metal-name  { font-size:11px; font-weight:700; color:rgba(255,215,0,.85); margin-bottom:2px; }
.hec-metal-price { font-size:16px; font-weight:700; color:#fbbf24; line-height:1; }
.hec-metal-unit  { font-size:9px; color:rgba(200,210,240,.4); margin-top:2px; }

/* ── Convertisseur & calculateur ── */
.hec-converter-wrapper,.hec-metal-calc-wrapper {
  margin:12px 0; border-radius:12px; border:1px solid rgba(255,215,0,.12);
  background:rgba(255,255,255,.02); padding:10px 12px; position:relative; z-index:1;
}
.hec-converter-label,.hec-metal-calc-label { font-size:9px; font-weight:700; color:rgba(255,215,0,.6); text-transform:uppercase; letter-spacing:1px; margin-bottom:6px; }
.hec-converter-row,.hec-metal-calc-row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.hec-conv-input  { flex:1; min-width:80px; padding:6px 10px; border-radius:8px; border:1px solid rgba(255,215,0,.3); background:rgba(255,255,255,.06); color:#fff; font-family:inherit; font-size:13px; }
.hec-conv-select { padding:6px 6px; border-radius:8px; border:1px solid rgba(255,215,0,.3); background:rgba(255,255,255,.06); color:#fff; font-family:inherit; font-size:12px; cursor:pointer; }
.hec-conv-select option { background:#0a0f1e; color:#fff; }
.hec-conv-result { flex:1; min-width:90px; padding:6px 10px; border-radius:8px; border:1px solid rgba(255,215,0,.3); background:rgba(255,215,0,.06); color:#fbbf24; font-weight:700; font-size:14px; text-align:center; }
.hec-conv-arrow  { font-size:12px; color:rgba(255,215,0,.7); }

/* Ligne contribution calculette */
.hec-conv-contribute-row { display:flex; align-items:center; gap:10px; margin-top:8px; flex-wrap:wrap; }
.hec-btn-contribute {
  background:rgba(255,215,0,.12); border:1px solid rgba(255,215,0,.4);
  color:rgba(255,215,0,.9); border-radius:20px; padding:4px 14px;
  font-size:11px; font-weight:700; cursor:pointer; font-family:inherit;
  transition:all .2s; white-space:nowrap;
}
.hec-btn-contribute:hover { background:rgba(255,215,0,.25); border-color:rgba(255,215,0,.7); }

/* ── TradingView items ── */
.hec-tv-item { background:rgba(255,255,255,.03); border:1px solid rgba(255,215,0,.1); border-radius:10px; overflow:hidden; }
.hec-tv-label { padding:6px 10px 0; font-size:9px; font-weight:700; color:rgba(255,215,0,.55); text-transform:uppercase; letter-spacing:1px; }

/* ── Carte économique ── */
.hec-carte-wrapper { border-radius:12px; overflow:hidden; border:1px solid rgba(255,215,0,.15); min-height:280px; background:rgba(255,255,255,.02); position:relative; z-index:1; }
.hec-carte-expand-btn {
  position:absolute; top:8px; right:8px; z-index:10;
  background:rgba(0,0,0,.6); border:1px solid rgba(255,215,0,.4);
  color:rgba(255,215,0,.9); border-radius:6px; padding:4px 8px;
  font-size:14px; cursor:pointer; line-height:1;
  transition:all .2s; backdrop-filter:blur(4px);
}
.hec-carte-expand-btn:hover { background:rgba(255,215,0,.2); }

/* ── Barre communautaire ── */
.hec-community-bar { text-align:center; padding:10px; margin:14px 0 0; border-radius:10px; background:rgba(255,215,0,.05); border:1px solid rgba(255,215,0,.1); position:relative; z-index:1; }
.hec-community-num { font-size:18px; font-weight:700; color:rgba(255,215,0,.9); }
.hec-community-label { font-size:11px; color:rgba(200,210,240,.5); margin-right:5px; }

/* ── Footer ── */
.hec-footer { margin-top:14px; text-align:center; font-size:9px; color:rgba(200,210,240,.2); line-height:1.8; position:relative; z-index:1; }
.hec-powered a,.hec-footer a { color:rgba(255,215,0,.35); text-decoration:none; }
.hec-powered a:hover,.hec-footer a:hover { color:rgba(255,215,0,.7); }

/* ── Chargement ── */
.hec-loading { display:flex; align-items:center; justify-content:center; min-height:80px; color:rgba(255,215,0,.4); font-size:11px; letter-spacing:1px; }

/* ── Utilitaires ── */
.hec-hidden { display:none !important; }

/* ════════════════════════════════════════════════════
   MODAL CONTRIBUTION
   ════════════════════════════════════════════════════ */
.hec-modal-overlay {
  position:fixed; inset:0; z-index:99999;
  background:rgba(0,0,0,.75); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity .25s;
}
.hec-modal-overlay.hec-modal-visible { opacity:1; pointer-events:all; }

.hec-modal-box {
  background:linear-gradient(135deg,#0d1530,#0a1228);
  border:1px solid rgba(255,215,0,.35); border-radius:16px;
  padding:28px 24px; max-width:380px; width:90%;
  position:relative; text-align:center; direction:ltr;
  box-shadow:0 20px 60px rgba(0,0,0,.6);
}
#hec-widget[dir="rtl"] .hec-modal-box { direction:rtl; }

.hec-modal-close {
  position:absolute; top:12px; right:12px;
  background:rgba(255,255,255,.08); border:none; color:rgba(255,255,255,.6);
  border-radius:50%; width:26px; height:26px; cursor:pointer; font-size:12px; line-height:1;
}
.hec-modal-icon   { font-size:32px; margin-bottom:8px; }
.hec-modal-title  { font-size:16px; font-weight:700; color:rgba(255,215,0,.95); margin:0 0 10px; font-family:'Cairo',sans-serif; }
.hec-modal-body   { font-size:12px; color:rgba(200,210,240,.75); line-height:1.7; margin:0 0 14px; }
.hec-modal-value  { font-size:15px; font-weight:700; color:#fbbf24; margin-bottom:16px; padding:8px 14px; background:rgba(255,215,0,.06); border-radius:8px; }
.hec-modal-actions { display:flex; gap:10px; justify-content:center; margin-bottom:12px; flex-wrap:wrap; }
.hec-btn-confirm  { background:rgba(255,215,0,.15); border:1px solid rgba(255,215,0,.5); color:rgba(255,215,0,.95); border-radius:20px; padding:8px 18px; font-size:12px; font-weight:700; cursor:pointer; font-family:inherit; transition:all .2s; }
.hec-btn-confirm:hover { background:rgba(255,215,0,.28); }
.hec-btn-cancel   { background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.15); color:rgba(255,255,255,.6); border-radius:20px; padding:8px 18px; font-size:12px; cursor:pointer; font-family:inherit; transition:all .2s; }
.hec-btn-cancel:hover { background:rgba(255,255,255,.1); }
.hec-modal-note   { font-size:9px; color:rgba(200,210,240,.3); margin:0; }

/* ── Modal carte plein écran ── */
.hec-carte-overlay { padding:20px; }
.hec-carte-modal-box {
  background:#0a0f1e; border:1px solid rgba(255,215,0,.3); border-radius:16px;
  width:95vw; max-width:1200px; height:85vh; overflow:auto;
  position:relative; padding:16px;
}
.hec-carte-close { position:absolute; top:10px; right:10px; z-index:10; background:rgba(0,0,0,.7); border:1px solid rgba(255,215,0,.4); color:rgba(255,215,0,.9); border-radius:50%; width:30px; height:30px; cursor:pointer; font-size:14px; }
#hec-carte-modal-content { width:100%; height:100%; }

/* ── Responsive ── */
@media (max-width:600px) {
  .hec-cards-grid,.hec-metals-grid,.hec-tv-grid,.hec-charts-grid { grid-template-columns:1fr; }
  .hec-rate-value { font-size:15px; }
  #hec-widget { padding:14px; }
  .hec-modal-box { padding:22px 16px; }
}

/* ── Ligne taux modifiable ── */
.hec-conv-rate-row {
  display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:8px;
}
.hec-conv-rate-label {
  font-size:9px; color:rgba(255,215,0,.55); text-transform:uppercase;
  letter-spacing:.8px; white-space:nowrap;
}
.hec-conv-rate-input {
  flex:0 0 auto; width:120px;
  border-color:rgba(255,215,0,.5) !important;
  background:rgba(255,215,0,.05) !important;
}
.hec-conv-rate-input:focus { border-color:rgba(255,215,0,.9) !important; }

/* ── Bouton info ── */
.hec-btn-info {
  width:22px; height:22px; border-radius:50%;
  background:rgba(255,215,0,.12); border:1px solid rgba(255,215,0,.4);
  color:rgba(255,215,0,.85); font-size:11px; font-weight:700;
  cursor:pointer; line-height:1; flex-shrink:0;
  transition:all .2s; font-style:normal;
}
.hec-btn-info:hover { background:rgba(255,215,0,.28); }

/* ── Modal overlay en position fixed hors du widget ── */
/* Les modals sont maintenant après #hec-widget-host dans le DOM */
#hec-modal,
#hec-carte-modal {
  position:fixed;
  z-index:999999;
}
