/* =========================================================
   PRIXDUBARIL.COM — Module Sidebar Pétrolières / Pays
   =========================================================
   Conventions :
     .pdb-cmp-wrap        → conteneur global (tabs + 2 panneaux + dots)
       .pdb-cmp-tabs      → barre des tabs Pétrolières / Pays
       .pdb-cmp-panel     → panneau actif (TradingView OU liste pays)
         [data-pdb-c="companies"] → TradingView lazy loaded
         [data-pdb-c="countries"] → Liste des pays
       .pdb-cmp-dots      → indicateurs sous le module
   =========================================================
   Réutilise les variables CSS globales définies dans
   pdb-module-baril.css (présent sur la home). Fallbacks via
   var(--xxx, valeur) → reste impeccable sur les pages
   intérieures où ces variables ne sont pas chargées.
   ========================================================= */

/* === WRAPPER === */
.pdb-cmp-wrap{
  width:100%;
  max-width:330px;
  margin:0 auto 16px;
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 8px 24px -8px rgba(15,23,42,.12),
             0 0 0 1px rgba(15,23,42,.05);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--pdb-text,#0f172a);
}

/* === TABS === */
.pdb-cmp-tabs{
  display:flex;
  background:linear-gradient(180deg,#e2e8f0 0%,var(--pdb-bg-2,#eef2f7) 60%,var(--pdb-bg-1,#f8fafc) 100%);
  border-bottom:1px solid #cbd5e1;
  margin:0;
  padding:0;
}
.pdb-cmp-tab{
  flex:1;
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:5px;
  margin:0;
  padding:11px 8px;
  font-size:11px;
  font-weight:700;
  color:var(--pdb-muted-2,#94a3b8);
  background:transparent;
  border:none;
  border-radius:0;
  cursor:pointer;
  transition:color .2s,background .2s;
  letter-spacing:.04em;
  white-space:nowrap;
  text-transform:uppercase;
  font-family:inherit;
  -webkit-tap-highlight-color:transparent;
}
.pdb-cmp-tab:hover{color:var(--pdb-muted,#64748b);background:rgba(0,0,0,.02)}
.pdb-cmp-tab.is-active{color:var(--pdb-text,#0f172a);background:#fff}
.pdb-cmp-tab::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:-1px;
  height:3px;
  background:transparent;
  transition:background .2s;
}
.pdb-cmp-tab[data-pdb-c="companies"].is-active{color:#1e40af}
.pdb-cmp-tab[data-pdb-c="companies"].is-active::after{background:linear-gradient(90deg,#1e40af,#1e3a8a)}
.pdb-cmp-tab[data-pdb-c="countries"].is-active{color:#013971}
.pdb-cmp-tab[data-pdb-c="countries"].is-active::after{background:linear-gradient(90deg,#013971,#001f3d)}
.pdb-cmp-tab__icon{font-size:1.05em;line-height:1}

/* === PANELS === */
.pdb-cmp-panel{display:none;background:#fff}
.pdb-cmp-panel.is-active{display:block}
.pdb-cmp-panel[data-pdb-c="companies"]{padding:0}

/* Zone TradingView : technique GavickPro
   → hauteur fixe + overflow:hidden coupe l'espace blanc TV */
.pdb-cmp-tv-zone{
  position:relative;
  height:322px;
  overflow:hidden;
}
.pdb-cmp-tv-zone .tradingview-widget-container{
  display:block;
  margin:0;
  width:100%;
  height:100%;
  background:#fff;
}

/* Placeholder loader pendant le lazy load */
.pdb-cmp-tv-loading{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  color:var(--pdb-muted-2,#94a3b8);
  font-size:12px;
  background:linear-gradient(180deg,var(--pdb-bg-1,#f8fafc) 0%,#fff 100%);
}
.pdb-cmp-tv-loading.is-hidden{display:none}
.pdb-cmp-tv-loading__spinner{
  width:24px;
  height:24px;
  border:2.5px solid #e2e8f0;
  border-top-color:#1e40af;
  border-radius:50%;
  animation:pdb-cmp-spin .8s linear infinite;
}
@keyframes pdb-cmp-spin{to{transform:rotate(360deg)}}

/* === Panneau Pays === */
.pdb-cmp-panel[data-pdb-c="countries"]{padding:12px 14px 14px}
.pdb-cmp-panel__title{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
  color:var(--pdb-muted,#64748b);
  font-weight:700;
  margin:0 0 10px;
  padding-bottom:8px;
  border-bottom:1px solid #e2e8f0;
  text-align:center;
}
.pdb-cmp-panel__title-link{
  color:var(--pdb-muted,#64748b);
  text-decoration:none;
  transition:color .15s;
}
.pdb-cmp-panel__title-link:hover{color:#1e40af}

.pdb-cmp-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.pdb-cmp-list__link{
  display:flex;
  align-items:center;
  gap:9px;
  padding:8px 10px;
  font-size:13px;
  color:#334155;
  text-decoration:none;
  border-radius:7px;
  transition:background .15s,color .15s,transform .15s;
  position:relative;
  line-height:1.3;
}
.pdb-cmp-list__link::before{
  content:"";
  position:absolute;
  top:8px;bottom:8px;left:0;
  width:3px;
  background:transparent;
  border-radius:0 2px 2px 0;
  transition:background .15s;
}
.pdb-cmp-list__link:hover{
  background:rgba(30,64,175,.06);
  color:#1e40af;
  transform:translateX(2px);
}
.pdb-cmp-list__link:hover::before{background:linear-gradient(180deg,#1e40af,#1e3a8a)}
.pdb-cmp-list__flag{
  font-size:18px;
  line-height:1;
  flex-shrink:0;
  filter:drop-shadow(0 1px 2px rgba(15,23,42,.1));
}
.pdb-cmp-list__country{
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.pdb-cmp-list__country b{font-weight:700;color:var(--pdb-text,#0f172a)}
.pdb-cmp-list__link:hover .pdb-cmp-list__country b{color:#1e40af}
.pdb-cmp-list__arrow{
  font-size:11px;
  color:#cbd5e1;
  flex-shrink:0;
  transition:transform .15s,color .15s;
}
.pdb-cmp-list__link:hover .pdb-cmp-list__arrow{
  color:#1e40af;
  transform:translateX(2px);
}

/* === Footer CTA (générique pour les 2 panels) === */
.pdb-cmp-panel__footer{
  padding:10px 14px 14px;
  border-top:1px solid #e2e8f0;
  text-align:center;
  background:#fff;
}
.pdb-cmp-panel[data-pdb-c="countries"] .pdb-cmp-panel__footer{
  margin-top:10px;
  padding:10px 0 0;
}
.pdb-cmp-panel__cta{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:7px 14px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:#1e40af;
  background:rgba(30,64,175,.06);
  border:1px solid rgba(30,64,175,.15);
  border-radius:7px;
  text-decoration:none;
  transition:all .15s;
}
.pdb-cmp-panel__cta:hover{
  background:linear-gradient(135deg,#1e40af,#1e3a8a);
  color:#fff;
  border-color:transparent;
  transform:translateY(-1px);
  box-shadow:0 3px 8px rgba(30,64,175,.25);
}

/* === Dots indicateurs === */
.pdb-cmp-dots{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  padding:10px 0 12px;
  background:#fff;
  border-top:1px solid #f1f5f9;
}
.pdb-cmp-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  border:none;
  margin:0;
  padding:0;
  background:#cbd5e1;
  cursor:pointer;
  transition:background .2s,width .2s;
  -webkit-tap-highlight-color:transparent;
  position:relative;
}
/* Zone tactile élargie sans changer la taille visuelle */
.pdb-cmp-dot::before{content:"";position:absolute;inset:-8px}
.pdb-cmp-dot:hover{background:var(--pdb-muted-2,#94a3b8)}
.pdb-cmp-dot[data-pdb-c="companies"].is-active{background:#1e40af;width:22px;border-radius:4px}
.pdb-cmp-dot[data-pdb-c="countries"].is-active{background:#013971;width:22px;border-radius:4px}

/* === Mobile === */
@media(max-width:380px){
  .pdb-cmp-wrap{max-width:100%}
  .pdb-cmp-list__link{padding:9px 10px;font-size:12.5px}
  .pdb-cmp-list__flag{font-size:17px}
}
