/* Animated phone widget — variant colors via CSS vars */
.ob-phone {
  --phone-bg: #E5DDD5;
  --phone-chrome: #075E54;
  --phone-chrome-fg: #fff;
  --bub-user: #DCF8C6;
  --bub-bot: #fff;
  --bub-fg: #111;
  --send-bg: #25D366;
  --send-fg: #fff;
  display: inline-block;
  width: 320px;
  user-select: none;
  -webkit-user-select: none;
}
.ob-phone-mint { --phone-bg: #E5DDD5; }
.ob-phone-cream { --phone-bg: #ECE5DD; }
.ob-phone-dark { --phone-bg: #0B141A; --bub-bot: #1F2C34; --bub-user: #005C4B; --bub-fg: #E9EDEF; --phone-chrome: #1F2C34; }

.ob-phone-frame {
  position: relative;
  background: #111;
  border-radius: 44px;
  padding: 12px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 30px 60px -20px rgba(0,0,0,0.35),
    0 10px 25px -10px rgba(0,0,0,0.25);
  border: 1px solid #0a0a0a;
}
.ob-phone-notch {
  position: absolute;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  width: 100px; height: 26px;
  background: #000;
  border-radius: 16px;
  z-index: 3;
}
.ob-phone-screen {
  position: relative;
  background: var(--phone-bg);
  border-radius: 32px;
  overflow: hidden;
  height: 600px;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 18px 18px, 18px 18px;
  background-position: 0 0, 9px 9px;
}
.ob-phone-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 38px 14px 12px;
  background: var(--phone-chrome);
  color: var(--phone-chrome-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.ob-phone-back { font-size: 22px; opacity: 0.9; }
.ob-phone-avatar {
  width: 36px; height: 36px;
  background: #fff2;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 18px;
}
.ob-phone-id { flex: 1; line-height: 1.15; }
.ob-phone-name { font-weight: 600; font-size: 14.5px; }
.ob-phone-status { font-size: 11px; opacity: 0.85; display: flex; align-items: center; gap: 5px; }
.ob-dot { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; box-shadow: 0 0 0 2px #4ade8033; }
.ob-phone-icons { font-size: 14px; opacity: 0.85; letter-spacing: 4px; }

.ob-phone-body {
  flex: 1;
  overflow: hidden;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}
.ob-phone-daytag {
  align-self: center;
  background: #ffffffcc;
  color: #555;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: 8px;
  margin: 4px 0 8px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
.ob-phone-thread {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.ob-bub {
  max-width: 80%;
  background: var(--bub-bot);
  color: var(--bub-fg);
  padding: 7px 9px 4px;
  border-radius: 9px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.32;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 280ms ease, transform 280ms ease;
  box-shadow: 0 1px 0.5px rgba(0,0,0,0.07);
  align-self: flex-start;
}
.ob-bub.in { opacity: 1; transform: translateY(0); }
.ob-bub-user {
  align-self: flex-end;
  background: var(--bub-user);
}
.ob-bub-text { white-space: pre-wrap; }
.ob-bub-text i { font-style: italic; opacity: 0.92; }
.ob-bub-text b { font-weight: 600; }
.ob-time {
  font-size: 9.5px;
  text-align: right;
  margin-top: 2px;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}
.ob-meta { font-size: 11.5px; opacity: 0.7; }

.ob-typing .ob-bub-text {
  display: flex; gap: 4px; padding: 4px 0;
}
.ob-typing .ob-bub-text span {
  width: 6px; height: 6px;
  background: #999; border-radius: 50%;
  animation: obDot 1.1s ease-in-out infinite;
}
.ob-typing .ob-bub-text span:nth-child(2) { animation-delay: 0.15s; }
.ob-typing .ob-bub-text span:nth-child(3) { animation-delay: 0.3s; }
@keyframes obDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.ob-voice {
  display: flex; align-items: center; gap: 8px;
  min-width: 200px;
}
.ob-voice-play {
  width: 26px; height: 26px;
  background: #128C7E; color: #fff;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 11px;
}
.ob-voice-wave {
  flex: 1;
  display: flex; align-items: center; gap: 2px;
  height: 22px;
}
.ob-voice-wave span {
  flex: 1;
  background: #888;
  border-radius: 1px;
  min-height: 3px;
}
.ob-bub-user .ob-voice-wave span:nth-child(-n+8) { background: #128C7E; }
.ob-voice-dur { font-size: 11px; opacity: 0.7; font-variant-numeric: tabular-nums; }

.ob-phone-input {
  flex-shrink: 0;
  padding: 8px 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
}
.ob-input-pill {
  flex: 1;
  background: #fff;
  border-radius: 22px;
  padding: 9px 14px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 13.5px;
  color: #333;
  min-height: 38px;
  display: flex; align-items: center;
  box-shadow: 0 1px 1px rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
}
.ob-input-pill.recording { background: #ffe4e4; color: #c00; }
.ob-input-pill.recording::before {
  content: '●';
  color: #e11; margin-right: 6px;
  animation: obBlink 1s infinite;
}
@keyframes obBlink { 50% { opacity: 0.3; } }
.ob-input-text { white-space: nowrap; overflow: hidden; }
.ob-input-text:empty::before { content: 'Type a message'; opacity: 0.45; }
.ob-input-caret {
  display: none;
  width: 1.5px; height: 14px;
  background: #25D366;
  margin-left: 1px;
  animation: obCaret 0.9s steps(2) infinite;
}
@keyframes obCaret { 50% { opacity: 0; } }

.ob-send {
  width: 42px; height: 42px;
  background: var(--send-bg); color: var(--send-fg);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 120ms ease;
}
.ob-send.flash { transform: scale(0.85); background: #1ea54c; }

/* --- Document bubble --- */
.ob-bub-doc { padding: 6px 6px 4px; min-width: 220px; }
.ob-doc {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.04);
  border-radius: 7px;
}
.ob-bub-user .ob-doc { background: rgba(0,0,0,0.06); }
.ob-doc-icon {
  width: 36px; height: 44px;
  background: #E04F4F; color: #fff;
  border-radius: 4px;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
  position: relative;
}
.ob-doc-icon::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  border-style: solid;
  border-width: 0 8px 8px 0;
  border-color: transparent #c43c3c transparent transparent;
}
.ob-doc-info { flex: 1; min-width: 0; }
.ob-doc-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-doc-size { font-size: 11px; opacity: 0.55; margin-top: 2px; }

/* --- Image bubble --- */
.ob-bub-image { padding: 4px 4px 4px; max-width: 230px; }
.ob-img {
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  display: block;
  background: #ddd;
  aspect-ratio: 240 / 152;
}
.ob-img svg { display: block; width: 100%; height: 100%; }
.ob-img-cap {
  padding: 4px 6px 0;
  font-size: 11.5px;
  opacity: 0.7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Quick replies --- */
.ob-qr {
  display: flex; flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.07);
  overflow: hidden;
  transition: max-height 240ms ease, padding 240ms ease, margin 240ms ease, opacity 240ms ease;
  max-height: 80px;
}
.ob-qr[style*="max-height: 0"] { padding-top: 0; margin-top: 0; opacity: 0; border-top-color: transparent; }
.ob-qr-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  background: transparent;
  color: #128C7E;
  border: 1px solid #128C7E55;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms, transform 120ms, color 120ms;
}
.ob-phone-dark .ob-qr-btn { color: #4ade80; border-color: #4ade8055; }
.ob-qr-btn.tapped {
  background: #128C7E; color: #fff;
  transform: scale(0.96);
}
.ob-phone-dark .ob-qr-btn.tapped { background: #4ade80; color: #0B141A; }
