/* =========================================================
   Trading Evolution — Economic Calendar (econ-cal.js). Bandeau sombre dans les deux thèmes (même famille que COT data
   et Fed Rate Monitor), calendrier TradingView dans un cadre Trading Evolution (bordure lumineuse, fond transparent qui
   suit le thème du site), boutons de région et d'impact, tableaux des dates clés et des publications.
   ========================================================= */

/* ---------- Bandeau ---------- */
.ecal-hero {
  position: relative; isolation: isolate; overflow: hidden; margin-bottom: var(--s-12);
  border-radius: var(--r-xl); border: 1px solid rgba(96, 165, 250, .18);
  background: radial-gradient(120% 100% at 72% 40%, #0d1b3f 0%, #060a18 58%, #04060f 100%);
  box-shadow: 0 30px 80px -30px rgba(2, 8, 30, .7);
  color-scheme: dark; --ink: #eef2fa; --ink-2: #b9c3d9; --muted: #8a95ae; --line: rgba(255, 255, 255, .09);
}
.ecal-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: 62% 50%; }
.ecal-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 7, 18, .88) 0%, rgba(4, 7, 18, .58) 42%, rgba(4, 7, 18, .22) 75%, rgba(4, 7, 18, .45) 100%), linear-gradient(0deg, rgba(4, 7, 18, .7), transparent 38%); }
[dir="rtl"] .ecal-hero::after { background: linear-gradient(270deg, rgba(4, 7, 18, .88) 0%, rgba(4, 7, 18, .58) 42%, rgba(4, 7, 18, .22) 75%, rgba(4, 7, 18, .45) 100%), linear-gradient(0deg, rgba(4, 7, 18, .7), transparent 38%); }
.ecal-hero-in { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: var(--s-10); align-items: center; padding: clamp(1.5rem, .8rem + 3.4vw, 3.75rem); min-height: 470px; }
.ecal-hero h1 { font-family: var(--f-disp); font-size: clamp(2rem, 1.3rem + 2.4vw, 3.1rem); font-weight: 700; line-height: 1.06; letter-spacing: -.03em; color: #fff; margin-bottom: var(--s-5); text-wrap: balance; text-shadow: 0 2px 24px rgba(4, 7, 18, .8); }
.ecal-hero .lead { color: var(--ink-2); margin-bottom: 0; max-width: 37rem; text-shadow: 0 2px 18px rgba(4, 7, 18, .85); }
.ecal-hero .eyebrow { color: #cfe0ff; background: rgba(59, 130, 246, .12); border-color: rgba(96, 165, 250, .3); box-shadow: none; }
.ecal-hero .eyebrow .dot { background: #22c55e; }
.ecal-card {
  display: grid; gap: var(--s-4);
  background: rgba(8, 13, 28, .7); border: 1px solid rgba(96, 165, 250, .24); border-radius: var(--r-xl); padding: clamp(1.1rem, .8rem + 1vw, 1.6rem);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.ecal-count + .ecal-count { padding-top: var(--s-4); border-top: 1px solid rgba(255, 255, 255, .08); }
.ecal-card-label { margin: 0 0 .25rem; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #8fb4ff; }
.ecal-count + .ecal-count .ecal-card-label { color: #fbbf24; }
.ecal-when { margin: 0 0 var(--s-3); font-size: var(--t-sm); color: var(--ink-2); min-height: 1.4em; }
.ecal-clock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .45rem; }
.ecal-clock span { display: grid; gap: .2rem; text-align: center; padding: .6rem .2rem .5rem; border-radius: var(--r-md); background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)); border: 1px solid rgba(255, 255, 255, .08); }
.ecal-clock b { font-family: var(--f-mono); font-size: clamp(1.3rem, 1rem + 1.2vw, 1.85rem); font-weight: 700; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.ecal-clock small { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ecal-meta { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 0; font-size: var(--t-xs); color: var(--muted); }
.ecal-live { display: inline-flex; align-items: center; gap: .4rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #4ade80; }
.ecal-live i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: ecal-ping 2s infinite; }
@keyframes ecal-ping { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* ---------- Calendrier en direct ---------- */
.ecal .ecal-cal { max-width: none; }
.ecal-tools { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin: var(--s-5) 0 var(--s-4); }
.ecal-chips, .ecal-imp { display: flex; flex-wrap: wrap; gap: .4rem; min-width: 0; max-width: 100%; }
.ecal-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font: 600 var(--t-sm) var(--f-body); cursor: pointer; transition: border-color var(--d-fast) var(--ease), background-color var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.ecal-chip:hover { border-color: var(--blue-200); color: var(--ink); }
.ecal-chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.ecal-chip:focus-visible { outline: 2px solid var(--blue-200); outline-offset: 2px; }
.ecal-chip-hi i { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.ecal-chip-hi[aria-pressed="true"] { background: #b91c1c; border-color: #b91c1c; }
.ecal-chip-hi[aria-pressed="true"] i { background: #fff; box-shadow: none; }
.ecal-frame {
  position: relative; border-radius: var(--r-xl); padding: 1px; overflow: hidden;
  background: linear-gradient(135deg, rgba(59, 130, 246, .55), rgba(34, 211, 238, .25) 40%, rgba(255, 74, 18, .3) 100%);
  box-shadow: 0 30px 70px -36px rgba(2, 8, 30, .6);
}
.ecal-widget { position: relative; height: clamp(560px, 78vh, 820px); border-radius: calc(var(--r-xl) - 1px); background: var(--panel); overflow: hidden; }
.ecal-widget tv-economic-calendar { display: block; width: 100%; height: 100%; }
.ecal-status { position: absolute; inset: 0; display: grid; place-content: center; gap: .5rem; margin: 0; padding: var(--s-6); text-align: center; color: var(--muted); font-size: var(--t-sm); }
.ecal-status[hidden] { display: none; }
.ecal-status a { color: var(--blue-300); font-weight: 700; }
.ecal-credit { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; margin: var(--s-3) 0 0; font-size: var(--t-xs); color: var(--muted); }
.ecal-credit a { color: var(--ink-2); text-decoration: none; }
.ecal-credit a:hover { color: var(--blue-300); }

/* ---------- Tableaux ---------- */
.ecal-key th[scope="row"], .ecal-rel th[scope="row"] { font-weight: 700; color: var(--ink); white-space: normal; }
.ecal-note { display: block; margin-top: .2rem; font-size: 12px; font-weight: 500; color: var(--muted); }
.ecal-key tr[data-kind="fomc"] th[scope="row"] { box-shadow: inset 3px 0 0 var(--blue); padding-inline-start: .8rem; }
.ecal-key tr[data-kind="cot"] th[scope="row"] { box-shadow: inset 3px 0 0 #f59e0b; padding-inline-start: .8rem; }
[dir="rtl"] .ecal-key tr[data-kind="fomc"] th[scope="row"] { box-shadow: inset -3px 0 0 var(--blue); }
[dir="rtl"] .ecal-key tr[data-kind="cot"] th[scope="row"] { box-shadow: inset -3px 0 0 #f59e0b; }
.ecal-key time { font-family: var(--f-mono); font-size: 13px; color: var(--ink-2); }
.ecal-time { font-family: var(--f-mono); font-weight: 700; color: var(--blue-300); white-space: nowrap; }

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 960px) {
  .ecal-hero-in { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); min-height: 0; }
}
@media (max-width: 600px) {
  .ecal-hero { margin-inline: calc(var(--s-4) * -1 + 4px); border-radius: var(--r-lg); }
  .ecal-hero-in { padding: var(--s-5) var(--s-4); }
  .ecal-clock b { font-size: 1.3rem; }
  .ecal-tools { flex-direction: column; align-items: stretch; }
  .ecal-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
  .ecal-chips::-webkit-scrollbar { display: none; }
  .ecal-chip { flex: none; }
  .ecal-frame { margin-inline: calc(var(--s-4) * -1 + 4px); border-radius: var(--r-lg); }
  .ecal-widget { height: 640px; border-radius: calc(var(--r-lg) - 1px); }
}
@media (prefers-reduced-motion: reduce) {
  .ecal-live i { animation: none; }
  .ecal-chip { transition: none; }
}
