/*
 * ads.css — Promo ad & sidebar card styles for First Midwest FCU
 * Targets class names injected by ui.js: renderPromoAds(), renderDefaultSidebars(), makeMoneyTipsCard()
 */

/* ─── SIDEBAR SHELL ──────────────────────────────────────────────────────────
   The .sidebar elements are created by createThreeColumnLayout().
   Cap their width and prevent them from ballooning.                         */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 220px;
  width: 100%;
}

/* ─── MONEY TIPS CARD ────────────────────────────────────────────────────────
   Created by makeMoneyTipsCard() — injects a .card with h3 + ul.muted       */
.sidebar > .card {
  background: var(--white, #fff);
  border: 1px solid var(--border, #dde4ef);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(13,43,82,.07);
  padding: 0;
  margin: 0;
  font-size: 13px;
}

.sidebar > .card > h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.9);
  background: var(--navy, #0d2b52);
  padding: 9px 12px;
  margin: 0;
}

.sidebar > .card > ul {
  list-style: none;
  padding: 10px 12px 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sidebar > .card > ul li {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted, #4a5568);
  padding-left: 14px;
  position: relative;
}

.sidebar > .card > ul li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold, #c8922a);
  line-height: 1.5;
}

/* ─── ADS CONTAINER CARD ─────────────────────────────────────────────────────
   .ads-card is the outer wrapper injected by renderPromoAds()               */
.ads-card {
  background: var(--white, #fff);
  border: 1px solid var(--border, #dde4ef);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(13,43,82,.07);
  width: 100%;
  min-width: 0;
}

/* ─── ADS HEADER ─────────────────────────────────────────────────────────────*/
.ads-header {
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--border, #dde4ef);
  background: var(--navy, #0d2b52);
}

.ads-header h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: rgba(255,255,255,.9);
  margin: 0 0 2px;
  line-height: 1.3;
}

.ads-header p.muted {
  font-size: 10px;
  color: rgba(255,255,255,.5);
  margin: 0;
  line-height: 1.4;
}

/* ─── ADS GRID ───────────────────────────────────────────────────────────────*/
.ads-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ─── INDIVIDUAL AD CARD ─────────────────────────────────────────────────────*/
.ad-card {
  border-bottom: 1px solid var(--border, #dde4ef);
  transition: background .12s;
  min-width: 0;
}

.ad-card:last-child {
  border-bottom: none;
}

.ad-card:hover {
  background: var(--sky, #e8f1fb);
}

/* ─── THUMBNAIL ──────────────────────────────────────────────────────────────
   Fixed compact height so images never blow up the sidebar                  */
.ad-thumb {
  width: 100%;
  height: 80px;
  background-color: var(--sky, #e8f1fb);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.ad-thumb > span {
  font-family: 'DM Sans', sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted, #4a5568);
  background: rgba(255,255,255,.82);
  padding: 3px 9px;
  border-radius: 100px;
  pointer-events: none;
  position: relative;
  z-index: 1;
}

.ad-thumb[style*="background-image"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 45%, rgba(13,43,82,.22) 100%);
  pointer-events: none;
}

/* ─── AD BODY ────────────────────────────────────────────────────────────────*/
.ad-body {
  padding: 10px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.ad-body .row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.ad-body .row.between {
  justify-content: space-between;
  align-items: center;
}

.ad-body h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy, #0d2b52);
  margin: 0;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ad-body p.muted {
  font-size: 11px;
  color: var(--muted, #4a5568);
  margin: 0;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.ad-body .muted.small,
.ad-body span.muted.small {
  font-size: 10px;
  color: var(--muted, #4a5568);
  line-height: 1.4;
}

/* ─── BADGE PILL ─────────────────────────────────────────────────────────────*/
.ad-body .pill {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.5;
}

.ad-body .pill.info {
  background: var(--sky, #e8f1fb);
  color: var(--navy-light, #1f5096);
  border: 1px solid var(--sky-dark, #c9ddf7);
}

/* ─── CTA BUTTON ─────────────────────────────────────────────────────────────*/
.ad-body .btn.sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: var(--gold, #c8922a);
  color: #fff;
  border: none;
  transition: background .12s;
  flex-shrink: 0;
}

.ad-body .btn.sm:hover {
  background: #b07d20;
  text-decoration: none;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────*/
@media (max-width: 1024px) {
  .sidebar.left,
  .sidebar.right {
    display: none;
  }
}

/* ─── GRID OVERFLOW FIX ──────────────────────────────────────────────────────
   CSS Grid columns with fixed px widths still need min-width:0 on children
   to actually prevent overflow. Without this, content ignores the column cap. */
.layout-3col > .sidebar {
  min-width: 0;
  overflow: hidden;
}

.ads-card,
.sidebar > .card {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Clamp any image that slips through without using .ad-thumb */
.ads-card img,
.sidebar img {
  max-width: 100%;
  height: auto;
  display: block;
}
