/* ============================================================
   Trade context, confirmation, success, and logged-out callout
   ============================================================ */

/* -------------------------------------------- */
/*        Trade Context Summary (login/register)   */
/* -------------------------------------------- */

/* Both variants: dark flyout-inspired card, white text, poster flush left */
.trade-context-summary {
  display: flex;
  align-items: stretch;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.35);
  color: #fff;
  background: linear-gradient(0deg, rgba(88,88,88,1) 0%, rgba(46,46,46,1) 61%, rgba(25,25,25,1) 100%);
  border: 1px solid #555;
}

.trade-context-summary,
.trade-context-summary * {
  box-sizing: border-box;
}

/* Sidebar: column layout - top row is poster+info, then H$2M strip spans full width */
.trade-context-summary--sidebar {
  flex-wrap: wrap;
  margin-top: 25px;
}

.trade-context-summary--banner {
  margin-top: 15px;
  margin-bottom: 20px;
}

/* Poster: flush left. Layered fallback (matches .trade-confirm__poster): an icon
   background sits behind the <img> so a StarBond (no picture_url) or a 404'd
   image still shows something other than a solid black box. */
.trade-context-summary__poster {
  flex-shrink: 0;
  overflow: hidden;
  background-color: #111;
  position: relative;
}

.trade-context-summary--sidebar .trade-context-summary__poster {
  width: 54px;
  height: 80px;
}

.trade-context-summary--banner .trade-context-summary__poster {
  width: 75px;
}

.trade-context-summary__poster-bg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  opacity: 0.5;
  box-shadow: inset 0 0 0 2px #ffc343;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.trade-context-summary__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0; left: 0;
}

/* Trade info body */
.trade-context-summary__trade-info {
  flex: 1;
  padding: 12px 14px;
  min-width: 0;
}

.trade-context-summary--banner .trade-context-summary__trade-info {
  padding: 14px 18px;
}

/* Component colors override page-level selectors such as div.login p. */

/* "PENDING TRADE" badge - white pill with black text, mirrors FREE badge shape */
.trade-context-summary__overline {
  display: inline-block;
  margin: 0 0 6px;
  padding: 1px 6px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: bold;
  background-color: #fff;
  color: #000 !important;
  border-radius: 2px;
}

/* Security name */
.trade-context-summary__name {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: bold;
  color: #fff !important;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trade-context-summary--banner .trade-context-summary__name {
  font-size: 15px;
}

/* Trade action + symbol + price line */
.trade-context-summary__details {
  margin: 0 0 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7) !important;
}

.trade-context-summary__action {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.trade-context-summary__symbol {
  font-weight: bold;
  color: var(--color-brand-green-light);
}

/* H$2M bonus panel - green accent: right column on banner, full-width bottom strip on sidebar */
/* Force white text over page-level paragraph color rules. */
.trade-context-summary__bonus p {
  color: #fff !important;
}

.trade-context-summary__bonus {
  flex-shrink: 0;
  background-color: var(--color-brand-green);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.trade-context-summary--banner .trade-context-summary__bonus {
  padding: 14px 18px;
  min-width: 130px;
}

/* Sidebar: bonus strip spans full bottom of card */
.trade-context-summary--sidebar .trade-context-summary__bonus {
  width: 100%;
  padding: 7px 14px;
  flex-direction: row;
  gap: 8px;
  align-items: baseline;
}

/* Trade code headline e.g. "Buy SWAR3" - leads the bonus panel */
.trade-context-summary__bonus-trade {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.9) !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.trade-context-summary--sidebar .trade-context-summary__bonus-trade {
  display: none;
}

/* H$2M figure */
.trade-context-summary__bonus-amount {
  margin: 0 0 1px;
  font-size: 22px;
  font-weight: bold;
  color: #fff !important;
  line-height: 1.1;
  white-space: nowrap;
}

.trade-context-summary--sidebar .trade-context-summary__bonus-amount {
  font-size: 14px;
  margin: 0;
}

/* "FREE" badge inline with the amount */
.trade-context-summary__bonus-free {
  display: inline-block;
  font-size: 13px;
  font-weight: bold;
  background-color: #fff;
  color: var(--color-brand-green);
  border-radius: 2px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.05em;
}

.trade-context-summary--sidebar .trade-context-summary__bonus-free {
  display: none;
}

.trade-context-summary__bonus-label {
  margin: 0 0 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85) !important;
}

.trade-context-summary--sidebar .trade-context-summary__bonus-label {
  margin: 0;
  font-size: 11px;
}

.trade-context-summary__bonus-sub {
  margin: 0;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65) !important;
  font-style: italic;
}

.trade-context-summary--sidebar .trade-context-summary__bonus-sub {
  display: none;
}

/* ============================================================
   Trade Confirm page - dark flyout aesthetic (trade-confirm)
   ============================================================ */

.trade-confirm {
  background: linear-gradient(0deg, rgba(88,88,88,1) 0%, rgba(46,46,46,1) 61%, rgba(25,25,25,1) 100%);
  border: 1px solid #555;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  color: #fff;
}

.trade-confirm__header {
  padding: 12px 20px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.trade-confirm__header-left {
  flex: 1;
  min-width: 0;
}

/* Flex container below header: poster on left, rows on right */
.trade-confirm__content {
  display: flex;
  align-items: flex-start;   /* was: stretch — stop the poster tracking row count */
}

/* Poster: fixed 90x130 box (matches templates/security/view.tpl), never stretches. */
.trade-confirm__poster {
  flex-shrink: 0;
  width: 90px;
  height: 130px;              /* was: min-height — fixed 2:3 box, no zoom crop */
  overflow: hidden;
  position: relative;
}

.trade-confirm__poster__bg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0;
  opacity: 0.5;
  box-shadow: inset 0 0 0 2px #ffc343;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.trade-confirm__poster img {
  display: block;
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trade-confirm__overline {
  margin: 0 0 3px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff !important;
  font-weight: bold;
}

.trade-confirm__title {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  color: #fff !important;
  line-height: 1.2;
}

.trade-confirm__body {
  display: table;
  width: 100%;
  table-layout: auto;
  border-spacing: 0;
  padding: 4px 0;
  min-width: 0;
}

.trade-confirm__row {
  display: table-row;
  font-size: 13px;
}

.trade-confirm__row:last-child .trade-confirm__label,
.trade-confirm__row:last-child .trade-confirm__value {
  border-bottom: none;
}

/* width:1% + nowrap collapses the column to its widest label, so the value
   column keeps the remainder instead of a fixed share of it. */
.trade-confirm__label {
  display: table-cell;
  width: 1%;
  padding: 7px 20px 7px 16px;
  color: #fff !important;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.trade-confirm__value {
  display: table-cell;
  width: 100%;
  color: #fff !important;
  font-weight: 500;
  padding: 7px 20px 7px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: right;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Currency values remain on one line and use tabular numerals. */
.trade-confirm__value--num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.trade-confirm__symbol {
  color: #b8e06a;
  font-weight: bold;
}

.trade-confirm__symbol-separator {
  color: rgba(255,255,255,0.45);
  padding: 0 3px;
}

.trade-confirm__value--action {
  color: rgba(255,255,255,0.9) !important;
  font-weight: bold;
}

.trade-confirm__row--total .trade-confirm__label {
  color: #fff !important;
  font-weight: bold;
}

.trade-confirm__value--total {
  color: #b8e06a !important;
  font-size: 15px;
  font-weight: bold;
}

/* Actions bar mirrors the content row layout so the button aligns under the value column */
.trade-confirm__actions {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #555;
  border-top: 2px solid #444;
  border-radius: 0 0 4px 4px;
}

/* Spacer matching the poster width. border-box so the padding and divider sit
   inside the 90px; content-box made it 106px and pushed the button column 16px
   right of the labels above it. */
.trade-confirm__actions-poster {
  box-sizing: border-box;
  flex-shrink: 0;
  width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-right: 1px solid #ddd;
}

/* On confirm.tpl this slot is empty (pure spacer) — don't draw a divider next
   to nothing. success.tpl fills it with the "« Back" link, so it keeps the
   border there. */
.trade-confirm__actions-poster:empty {
  border-right: none;
}

/* Inner row matching __body padding and label width */
.trade-confirm__actions-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 12px 16px;
  min-width: 0;
}

.trade-confirm__actions-body--left {
  justify-content: flex-start;
}

.trade-confirm__cancel {
  font-size: 12px;
  color: #666 !important;
  text-decoration: underline;
}

.trade-confirm__cancel:hover {
  color: #333 !important;
}

.trade-confirm__footnote {
  padding: 10px 0 4px;
  font-size: 11px;
  color: #999;
  line-height: 1.5;
}

.trade-confirm__footnote a {
  color: #777;
  text-decoration: underline;
}

.trade-confirm__footnote strong {
  color: #777;
}

/* Sub-text beneath a value (e.g. commission calculation breakdown) */
.trade-confirm__value-sub {
  display: block;
  font-size: 11px;
  font-weight: normal;
  color: rgba(255,255,255,0.55) !important;
  margin-top: 2px;
  white-space: normal;
}

/* Action badge: BUY/SELL/SHORT/COVER chip in the header, right-aligned. Lime with
   dark text: 12.5:1 text, 10.2:1 against the header. A dark green chip melts into
   the near-black header (2.4:1) and white on brand green fails text contrast (3.1:1). */
.trade-confirm__action-badge {
  flex-shrink: 0;
  margin-left: 16px;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
}

.trade-confirm__action-badge__action {
  display: inline-block;
  font-size: 18px;
  font-weight: bold;
  color: #111;
  letter-spacing: 0.03em;
  background: #b8e06a;
  border-radius: 3px;
  padding: 3px 8px;
  line-height: 1.3;
}

/* Success variant: green accent bar across the top of the header */
.trade-confirm__header--success {
  border-top: 3px solid var(--color-brand-green);
}

.trade-confirm__header--success .trade-confirm__title {
  color: #b8e06a !important;
}

/* Standard-template pages can still be viewed in narrow desktop-class windows.
   Actual mobile user agents use confirm_mobile.tpl, but these rules keep the
   shared card and login/register carry-through usable down to 320 CSS pixels. */
@media only screen and (max-width: 600px) {
  .trade-context-summary--banner {
    flex-wrap: wrap;
  }

  .trade-context-summary--banner .trade-context-summary__poster {
    width: 60px;
    min-height: 82px;
  }

  .trade-context-summary--banner .trade-context-summary__trade-info {
    padding: 10px 12px;
  }

  .trade-context-summary--banner .trade-context-summary__bonus {
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    flex-flow: row wrap;
    gap: 4px 8px;
  }

  .trade-context-summary--banner .trade-context-summary__bonus-trade,
  .trade-context-summary--banner .trade-context-summary__bonus-amount,
  .trade-context-summary--banner .trade-context-summary__bonus-label,
  .trade-context-summary--banner .trade-context-summary__bonus-sub {
    margin: 0;
  }

  .trade-context-summary--banner .trade-context-summary__bonus-sub {
    flex-basis: 100%;
  }

  .trade-confirm__header {
    padding: 10px 12px 9px;
  }

  .trade-confirm__title {
    font-size: 16px;
  }

  .trade-confirm__action-badge {
    margin-left: 8px;
    margin-right: 0;
  }

  .trade-confirm__action-badge__action {
    padding: 3px 5px;
    font-size: 13px;
  }

  /* Same 60px poster the login banner uses at this breakpoint. Measured: with it
     a realistic worst-case total still fits down to ~420px. */
  .trade-confirm__poster {
    width: 60px;
    height: 90px;
  }

  .trade-confirm__actions-poster {
    width: 60px;
    padding: 0 4px;
  }

  /* Labels wrap at this size, so keep the fixed split - shrink-to-fit would
     collapse them to one word per line. */
  .trade-confirm__body {
    table-layout: fixed;
  }

  .trade-confirm__label {
    width: 42%;
    padding: 7px 8px 7px 10px;
    white-space: normal;
  }

  .trade-confirm__value {
    width: 58%;
    padding: 7px 10px 7px 6px;
  }

  .trade-confirm__value--num {
    white-space: nowrap;
  }

  .trade-confirm__actions-body {
    padding: 10px;
  }

  .trade-success__links {
    gap: 8px 14px;
  }
}

/* Below this the 60px poster costs the value column too much: measured with a
   realistic worst-case total, "Estimated Total" starts wrapping at 400px. Only
   the poster and the empty confirm-page spacer go; the success page's "Back"
   link shares that slot and the actions bar has room for it. */
@media only screen and (max-width: 420px) {
  .trade-confirm__poster,
  .trade-confirm__actions-poster:empty {
    display: none;
  }
}

/* Navigation links in the success actions bar */
.trade-success__links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.trade-success__links a {
  font-size: 12px;
  color: #444 !important;
  text-decoration: underline;
}

.trade-success__links a:hover {
  color: #111 !important;
}

/* Trade callout on security page for logged-out users - sits below the trade form */
.trade-callout-logged-out {
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(0deg, rgba(88,88,88,1) 0%, rgba(46,46,46,1) 61%, rgba(25,25,25,1) 100%);
  border: 1px solid #555;
  border-radius: 3px;
  color: #fff;
}

.trade-callout-logged-out__headline {
  margin: 0 0 3px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}

.trade-callout-logged-out__body {
  margin: 0 0 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.trade-callout-logged-out__body strong {
  color: #fff;
  font-weight: bold;
}

.trade-callout-logged-out__btn {
  display: block;
  text-align: center;
  padding: 6px 10px;
  background-color: var(--color-brand-green);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  text-decoration: none;
  border-radius: 2px;
}

.trade-callout-logged-out__btn:hover {
  background-color: var(--color-brand-green-light);
  color: #fff;
  text-decoration: none;
}
