/* Official rates page /bnm (web-spec W04). Colors are token variables only (base.css). */

/* ======================================================================================================== */
/* Cobalt panel: left the title and the day, right the currency, the rate and the chart                    */
/* ======================================================================================================== */

/* Above the next section, so the calendar popover overlaps «Toate valutele». */
.bnm-panel {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 24px;
  min-height: 440px;
}

.bnm-panel--empty {
  min-height: 0;
}

/* W04: the right column is 690 wide at 1440; the left keeps room for the date controls (240 + 8 + 44 + 8 + 44). */
.bnm-panel__main {
  flex: 1 1 0;
  min-width: 344px;
  display: flex;
  flex-direction: column;
}

.bnm-panel__side {
  flex: 0 1 690px;
  min-width: 0;
}

.bnm-panel__title {
  margin-top: 12px;
}

/* «Curs pentru vineri, 6 noiembrie» 15/500 on-hero-label. */
.bnm-panel__for {
  margin-top: 8px;
  color: var(--on-hero-label);
  font-size: 15px;
  line-height: 20px;
  font-weight: 500;
}

/* ---------- Day: the date pill, ‹ and › ---------- */

.bnm-date {
  position: relative;
  margin-top: 24px;
}

.bnm-date__bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Pill 240 x 44, hero-control: calendar 20, «6 noiembrie 2026» 15/600, chevron 14. */
.bnm-date__pill {
  display: flex;
  flex: 0 1 240px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 44px;
  padding: 0 14px 0 12px;
  border-radius: 22px;
  background: var(--hero-control);
  color: var(--on-hero);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  transition: background-color var(--transition);
}

.bnm-date__text {
  flex-grow: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Round 44 buttons on cobalt; disabled: hero-control with on-hero-label (app-spec 2). */
.bnm-step {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hero-control);
  color: var(--on-hero);
  transition: background-color var(--transition);
}

.bnm-date__pill:hover,
a.bnm-step:hover {
  background: var(--hero-control-hover);
}

.bnm-date__pill:active,
.bnm-date__pill[aria-expanded='true'],
a.bnm-step:active {
  background: var(--hero-control-pressed);
}

.bnm-step:disabled {
  color: var(--on-hero-label);
  cursor: default;
}

/* ---------- Calendar popover: 320 wide, radius 24, sheet, shadow-nav ---------- */

.bnm-cal {
  position: absolute;
  top: 52px;
  left: 0;
  z-index: 5;
  width: 320px;
  padding: 8px 6px;
  border-radius: 24px;
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 10px 30px var(--shadow-nav);
  --focus-color: var(--focus-ring);
}

.bnm-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
}

.bnm-cal__title {
  font-size: 17px;
  line-height: 22px;
  font-weight: 700;
}

.bnm-cal__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  transition: background-color var(--transition);
}

.bnm-cal__nav:not(:disabled):hover {
  background: var(--row-hover);
}

.bnm-cal__nav:not(:disabled):active {
  background: var(--line);
}

.bnm-cal__nav:disabled {
  color: var(--text-secondary);
  cursor: default;
}

/* 7 columns of 44: heads 24 high 13/600, days 44 round 15/600. */
.bnm-cal__grid {
  width: 308px;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}

.bnm-cal__grid th {
  width: 44px;
  height: 24px;
  padding: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  text-align: center;
}

.bnm-cal__grid td {
  width: 44px;
  height: 44px;
  padding: 0;
}

.bnm-cal__day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--transition);
}

a.bnm-cal__day:not([aria-current]):hover {
  background: var(--row-hover);
}

a.bnm-cal__day:not([aria-current]):active {
  background: var(--line);
}

.bnm-cal__day[aria-current] {
  background: var(--accent);
  color: var(--on-accent);
}

/* A day outside the five years or not published yet: text-secondary, same weight (W04). */
span.bnm-cal__day {
  color: var(--text-secondary);
  cursor: default;
}

/* ---------- Right column: pill and rate 44/800, lines 14/500, chart ---------- */

.bnm-rate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
}

.bnm-rate__value {
  font-size: 44px;
  line-height: 52px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.bnm-rate__line {
  min-height: 18px;
  margin-top: 4px;
  color: var(--on-hero-note);
  font-size: 14px;
  line-height: 18px;
  font-weight: 500;
  text-align: right;
}

.bnm-panel__side .c-chart {
  margin-top: 12px;
}

/* «Curs EUR la bănci ›» 15/600 white, 44 high, right of the period switch. */
.bnm-bank-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--on-hero);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.bnm-bank-link:hover,
.bnm-bank-link:active {
  text-decoration-line: underline;
}

.bnm-chev {
  white-space: nowrap;
}

/* ======================================================================================================== */
/* «Toate valutele»: two columns of rows 56 (W04), one column below 1024                                    */
/* ======================================================================================================== */

.bnm-all__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

/* One table; its two row groups are the columns (read top to bottom, as on W04). The ARIA roles in the markup keep
   the table semantics that some browsers drop once a table is laid out as a grid. */
.bnm-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 24px;
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
}

.bnm-table__col {
  display: block;
}

/* Row 56: flag 30, code 17/600 over the name 13/400, the value 17/600 over the change 13/500. The whole row is the
   link (the ::after of the link covers it); hover row-hover, pressed line, the shown currency surface-muted. */
.bnm-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 22px 18px;
  align-content: center;
  column-gap: 12px;
  height: 56px;
  margin: 0 -12px;
  padding: 0 12px;
  border-radius: 16px;
  transition: background-color var(--transition);
}

.bnm-row:hover {
  background: var(--row-hover);
}

.bnm-row:active {
  background: var(--line);
}

.bnm-row.is-current {
  background: var(--surface-muted);
}

.bnm-row:focus-within {
  z-index: 1;
}

.bnm-row__cur {
  grid-row: 1 / span 2;
  grid-column: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0;
  font-weight: inherit;
  text-align: left;
}

.bnm-row__link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.bnm-row__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
}

/* The focus ring goes around the whole row (spec 4.8: 2 px, offset 2). */
.bnm-row__link:focus-visible {
  outline: none;
}

.bnm-row__link:focus-visible::after {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.bnm-row__txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bnm-row__code {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.bnm-row__name {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bnm-row__value,
.bnm-row__delta {
  grid-column: 2;
  padding: 0;
  text-align: right;
  white-space: nowrap;
}

.bnm-row__value {
  grid-row: 1;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.bnm-row__delta {
  grid-row: 2;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
}

/* Without the day before there is no change: the value sits in the middle of the row, as on W04. */
.bnm-row--solo .bnm-row__value {
  grid-row: 1 / span 2;
  align-self: center;
}

.bnm-all__source {
  margin-top: 26px;
}

/* ======================================================================================================== */
/* Breakpoints                                                                                              */
/* ======================================================================================================== */

@media (max-width: 1023px) {
  .bnm-panel {
    flex-direction: column;
    min-height: 0;
  }

  .bnm-panel__main {
    min-width: 0;
  }

  .bnm-panel__side {
    flex: none;
  }

  .bnm-table {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .bnm-panel {
    gap: 24px;
  }

  .bnm-panel__title {
    margin-top: 8px;
  }

  .bnm-date {
    margin-top: 20px;
  }

  .bnm-all__head {
    min-height: 44px;
  }
}
