/* Eddie on the website (js/eddie-widget.js): a launcher bottom-right and a chat panel.
   Drawn only when /api/eddie/web-starters says the eddieWeb feature is on. */

.eddie-launch { position: fixed; right: 16px; bottom: 20px; z-index: 40; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--sgc-orange); color: #fff; border: none; font: 600 14px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; cursor: pointer; box-shadow: 0 4px 18px rgb(0 0 0 / 40%); }
.eddie-launch img { width: 32px; height: 32px; border-radius: 50%; background: #fff; object-fit: contain; }
.eddie-launch:hover { filter: brightness(1.08); }
.eddie-launch[hidden] { display: none; }

.eddie-panel { position: fixed; right: 16px; bottom: 16px; z-index: 41; width: 380px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text-primary); font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; overflow: hidden; }
.eddie-panel[hidden] { display: none; }

.eddie-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--card-border); }
.eddie-head img { width: 36px; height: 36px; border-radius: 50%; background: #fff; object-fit: contain; }
.eddie-head-text { flex: 1; min-width: 0; }
.eddie-head-title { font-weight: 700; }
.eddie-head-sub { font-size: 12px; color: var(--text-secondary); }
.eddie-icon-btn { background: none; border: none; color: var(--text-secondary); font-size: 20px; line-height: 1; padding: 4px 6px; cursor: pointer; border-radius: var(--radius-sm); }
.eddie-icon-btn:hover { color: var(--text-primary); background: rgb(255 255 255 / 6%); }

.eddie-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.eddie-intro { color: var(--text-secondary); font-size: 13px; }
.eddie-intro-note { padding: 8px 10px; border: 1px solid var(--card-border); border-radius: var(--radius-sm); }
.eddie-starters, .eddie-follow { display: flex; flex-direction: column; gap: 6px; }
.eddie-chip { text-align: left; background: var(--sgc-orange-dim); border: 1px solid var(--sgc-orange-border); color: var(--text-primary); border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.eddie-chip:hover { border-color: var(--sgc-orange); }
.eddie-chip:disabled { opacity: 0.5; cursor: default; }

.eddie-msg { max-width: 88%; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.eddie-msg.user { align-self: flex-end; background: var(--sgc-orange); color: #fff; border-bottom-right-radius: 4px; }
.eddie-msg.eddie { align-self: flex-start; background: var(--input-bg); border: 1px solid var(--input-border); border-bottom-left-radius: 4px; }
.eddie-msg.error { align-self: stretch; max-width: none; background: #000; border: 1px solid #ef4444; color: #fca5a5; font-size: 13px; }
.eddie-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.eddie-links a { color: var(--sgc-orange); font-weight: 600; text-decoration: none; border: 1px solid var(--sgc-orange-border); border-radius: 999px; padding: 3px 10px; font-size: 12px; white-space: normal; }
.eddie-inline-link { color: var(--sgc-orange); text-decoration: underline; }
.eddie-links a:hover { border-color: var(--sgc-orange); }
.eddie-typing { align-self: flex-start; color: var(--text-secondary); font-size: 13px; }
.eddie-verify { align-self: stretch; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-secondary); }

.eddie-foot { border-top: 1px solid var(--card-border); padding: 10px; display: flex; gap: 8px; align-items: flex-end; }
.eddie-foot textarea { flex: 1; resize: none; min-height: 38px; max-height: 120px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-sm); color: var(--text-primary); padding: 9px 10px; font: inherit; outline: none; }
.eddie-foot textarea:focus { border-color: var(--sgc-orange-border); }
.eddie-send { background: var(--sgc-orange); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0 14px; height: 38px; font: inherit; font-weight: 600; cursor: pointer; }
.eddie-send:disabled { opacity: 0.5; cursor: default; }
.eddie-note { padding: 0 12px 10px; font-size: 11px; color: var(--text-secondary); }
.eddie-note a { color: var(--text-secondary); }

@media (width <= 480px) {
    /* A smaller pill, clear of the device's home bar. */
    .eddie-launch { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 4px 12px 4px 4px; font-size: 13px; gap: 6px; }
    .eddie-launch img { width: 28px; height: 28px; }

    /* Full screen, inside the notch and home-bar areas. */
    .eddie-panel { inset: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: none; }
    body.has-dev-banner .eddie-panel { top: 22px; height: calc(100dvh - 22px); }
    .eddie-head { padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
    body.has-dev-banner .eddie-head { padding-top: 10px; }
    .eddie-icon-btn { min-width: 44px; min-height: 44px; font-size: 22px; }
    .eddie-msg { max-width: 92%; }
    .eddie-chip { padding: 11px 12px; font-size: 14px; }

    /* 16px stops iOS zooming the page when the field is tapped. */
    .eddie-foot textarea { font-size: 16px; }
    .eddie-send { height: 42px; }
    .eddie-note { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

    /* The page behind doesn't scroll while the panel is open. */
    html.eddie-open, html.eddie-open body { overflow: hidden; }
}
