/**
 * Crushh iMessage-style float bubbles (CSS component).
 * Size matched to legacy PNG strip (42 / 52.5 slot, ~59% chrome).
 * Grey look from b2barSF-nonew.psd (#EBEBEB, #7E7E7E, SF Pro Light, shadows).
 */

.imsg-bubble {
  --imsg-slot-h: 42px;
  --imsg-chrome-h: 24.7px; /* opaque height of OG file-attachment PNGs */
  --imsg-pad-x: 11px;
  --imsg-gap: 6px;
  --imsg-icon-w: 14px;
  --imsg-icon-h: 18px;
  --imsg-font: 12.5px;
  --imsg-radius: 999px;
  --imsg-label-max: min(78vw, 320px);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--imsg-slot-h);
  max-height: var(--imsg-slot-h);
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}

/* Visible pill chrome — single line; long labels scale down slightly */
.imsg-bubble__chrome {
  display: inline-flex;
  align-items: center;
  gap: var(--imsg-gap);
  height: var(--imsg-chrome-h);
  max-height: var(--imsg-chrome-h);
  padding: 0 var(--imsg-pad-x);
  border-radius: var(--imsg-radius);
  box-sizing: border-box;
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--imsg-font);
  font-weight: 300;
  letter-spacing: -0.01em; /* PSD Tracking -10 */
  line-height: 1;
  white-space: nowrap;
}

.imsg-bubble--compact .imsg-bubble__chrome {
  font-size: calc(var(--imsg-font) * 0.82);
  letter-spacing: -0.02em;
}

.imsg-bubble--compact .imsg-bubble__label {
  max-width: min(85vw, 380px);
}

@media (min-width: 431px) {
  .imsg-bubble {
    --imsg-slot-h: 52.5px;
    --imsg-chrome-h: 30.9px;
    --imsg-pad-x: 14px;
    --imsg-gap: 7px;
    --imsg-icon-w: 17px;
    --imsg-icon-h: 22px;
    --imsg-font: 15px;
    --imsg-label-max: min(70vw, 360px);
  }
}

/* Text-only pills (shop / upcoming) — same height as file pills */
.imsg-bubble--simple {
  --imsg-pad-x: 16px;
}
@media (min-width: 431px) {
  .imsg-bubble--simple {
    --imsg-pad-x: 20px;
  }
}

.imsg-bubble--simple .imsg-bubble__chrome {
  justify-content: center;
  min-width: 4.5em;
}

/* Blue — sampled from taste-2 / b2bar PNGs (#59A8FF soft, not system #007AFF) */
.imsg-bubble--blue .imsg-bubble__chrome {
  color: #ffffff;
  background: linear-gradient(
    180deg,
    #60a8f7 0%,
    #59a8ff 45%,
    #59a4f5 100%
  );
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 2px 5px rgba(89, 168, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(40, 110, 200, 0.12);
}

.imsg-bubble--blue .imsg-bubble__label {
  color: #ffffff;
  font-weight: 300;
}

/*
 * Grey — b2barSF-nonew.psd Rectangle 1:
 * fill #EBEBEB, layer opacity 65%, radius 51.5 on 103h (= pill)
 * DropShadow: 90°, dist 6, blur 21, choke 18, op 25%, rgb≈(13,24,20)
 * InnerShadow: 180°, dist 3, blur 24, op 15%
 * BevelEmboss: highlight white 75% / shadow black 75%, size 4
 * Values below are @1x (PSD art is @2x).
 */
.imsg-bubble--grey .imsg-bubble__chrome {
  color: #7e7e7e;
  background: #ebebeb;
  box-shadow:
    /* PSD drop shadow, scaled to OG chrome size */
    0 1.5px 5px rgba(13, 24, 20, 0.22),
    /* bevel */
    inset 0 0.5px 0 rgba(255, 255, 255, 0.75),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.1),
    /* inner shadow */
    inset 1px 0 3px rgba(0, 0, 0, 0.12);
}

.imsg-bubble--grey .imsg-bubble__label {
  color: #7e7e7e;
  font-weight: 300;
}

/* Uploaded / default WAV icon */
.imsg-bubble__icon {
  flex: 0 0 var(--imsg-icon-w);
  width: var(--imsg-icon-w);
  height: var(--imsg-icon-h);
  border-radius: 2px;
  object-fit: contain;
  display: block;
  background: transparent;
}

.imsg-bubble__icon--default {
  object-fit: contain;
}

.imsg-bubble__label {
  flex: 0 1 auto;
  max-width: var(--imsg-label-max);
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 1px;
}

.imsg-bubble__badge {
  position: absolute;
  top: -3px;
  right: -10px;
  height: 16px;
  padding: 0 7px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 16px;
  color: #f5f5f7;
  background: linear-gradient(180deg, #636366 0%, #48484a 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  pointer-events: none;
  z-index: 2;
}

@media (min-width: 431px) {
  .imsg-bubble__badge {
    top: -4px;
    right: -12px;
    height: 18px;
    line-height: 18px;
    font-size: 11px;
    padding: 0 8px;
  }
}

/* Strip item wrapper */
.float-strip-item {
  position: fixed;
  z-index: 10;
  pointer-events: auto;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.pills-home .float-strip-item {
  position: absolute;
  z-index: 10;
}

.float-strip-item .imsg-bubble {
  position: relative;
}

/* Expanded: action row replaces the parent pill at the same width */
.float-strip-item.is-expanded {
  width: var(--imsg-expand-w, auto);
}

.float-strip-item.is-expanded .imsg-bubble {
  display: none;
}

.float-strip-item.is-expanded .imsg-actions {
  display: flex;
  width: 100%;
}

/* Clickthrough action pills — same total width as overlying pill (OG overlay) */
.imsg-actions {
  --imsg-action-h: 24.7px;
  --imsg-action-slot: 42px;
  --imsg-action-gap: 6px;
  --imsg-action-font: 12.5px;
  --imsg-action-pad-x: 6px;

  display: none;
  align-items: center; /* same vertical center as .imsg-bubble chrome */
  justify-content: stretch;
  gap: var(--imsg-action-gap);
  height: var(--imsg-action-slot);
  max-height: var(--imsg-action-slot);
  box-sizing: border-box;
}

@media (min-width: 431px) {
  .imsg-actions {
    --imsg-action-h: 30.9px;
    --imsg-action-slot: 52.5px;
    --imsg-action-gap: 7px;
    --imsg-action-font: 15px;
    --imsg-action-pad-x: 8px;
  }
}

.imsg-action {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--imsg-action-h);
  margin: 0;
  padding: 0 var(--imsg-action-pad-x);
  border-radius: 999px;
  box-sizing: border-box;
  border: none;
  background: #ebebeb;
  box-shadow:
    0 1.5px 5px rgba(13, 24, 20, 0.22),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.75),
    inset 0 -0.5px 0 rgba(0, 0, 0, 0.1),
    inset 1px 0 3px rgba(0, 0, 0, 0.12);
  color: #7e7e7e;
  font-family: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--imsg-action-font);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.12s ease, transform 0.12s ease;
}

.imsg-action:hover {
  filter: brightness(1.03);
}

.imsg-action:active {
  transform: scale(0.98);
  filter: brightness(0.97);
}

/* Admin preview stage — white like the live site */
.imsg-preview-stage {
  background: #ffffff;
  border: 1px solid #e5e5ea;
  border-radius: 12px;
  padding: 28px 20px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.imsg-preview-stage .imsg-actions {
  display: inline-flex;
}
