/* Shared chats (js/share.js): the share dialog, the list of shared links and the read-only view. */

/* ---------- Share dialog and shared links ---------- */
dialog.share-dlg { width: min(560px, calc(100vw - 32px)); }
.share-dlg .sh-note { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 16px; }
/* The link in a read-only field with Copy beside it, like one control. */
.share-dlg .sh-link { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); padding: 3px; transition: border-color var(--dur), box-shadow var(--dur); }
.share-dlg .sh-link:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.share-dlg .sh-link input { flex: 1; min-width: 0; height: 32px; font-size: 14px; color: var(--text); background: none; border: 0; box-shadow: none; padding: 0 8px; text-overflow: ellipsis; }
.share-dlg .sh-link input:focus { outline: none; box-shadow: none; background: none; }
.share-dlg .sh-link .btn { min-height: 32px; }
.share-dlg .sh-when { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.share-dlg .sh-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.share-dlg .sh-msg { display: flex; align-items: center; gap: 8px; color: var(--danger); font-size: 13px; margin: 12px 0 0; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.share-dlg .sh-msg:empty { display: none; }
.share-dlg .sh-manage { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); width: 100%; text-align: left; border-radius: 0; font-size: 13px; }
.share-dlg .sh-manage:focus-visible { border-radius: var(--r-sm); }
.share-dlg .btn.primary { white-space: nowrap; }
.sh-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.sh-list > .sh-when { margin: 0; padding: 24px 16px; text-align: center; }
.sh-item { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 14px; font-size: 14px; }
.sh-item + .sh-item { border-top: 1px solid var(--line); }
.sh-item-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.sh-item-t a { color: var(--text); font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.sh-item-t a:hover { color: var(--accent); }
.sh-item-t small { color: var(--muted); font-size: 12px; }
.sh-item .btn { min-height: 30px; padding: 0 10px; font-size: 13px; }

/* ---------- Read-only view: ./?share=<id> ---------- */
.sv { position: fixed; inset: 0; z-index: 110; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
.sv-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sv-top .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--display); font-weight: 700; font-size: 18px; }
.sv-top .brand img { width: 28px; height: 28px; }
.sv-label { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 3px 10px; }
.sv-start { margin-left: auto; text-decoration: none; color: var(--text); }
.sv-start:hover { border-color: var(--accent); }
.sv-scroll { flex: 1; overflow-y: auto; }
.sv-body { max-width: 780px; margin: 0 auto; padding: 24px 20px 32px; }
.sv-title { font-family: var(--display); font-size: 28px; line-height: 1.25; letter-spacing: -.02em; margin: 0 0 4px; overflow-wrap: anywhere; }
.sv-meta { color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.sv-msgs .m:last-child { margin-bottom: 0; }
.sv-wait { color: var(--muted); text-align: center; margin-top: 18vh; }
.sv-missing { text-align: center; margin: 14vh auto 0; max-width: 440px; padding: 36px 24px; border: 1px dashed var(--line); border-radius: var(--r-lg); }
.sv-missing::before { content: ""; display: block; width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 14px; background: var(--pill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a66ff' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4 4 0 005.7 0l3-3a4 4 0 00-5.7-5.7l-1 1'/%3E%3Cpath d='M14 10a4 4 0 00-5.7 0l-3 3a4 4 0 005.7 5.7l1-1'/%3E%3Cpath d='M4 4l16 16'/%3E%3C/svg%3E") center / 22px no-repeat; }
.sv-missing h1 { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; margin: 0 0 8px; }
.sv-missing p { color: var(--muted); font-size: 14px; margin: 0 0 20px; text-wrap: pretty; }
.sv a.btn { display: inline-flex; align-items: center; min-height: 38px; padding: 0 16px; border-radius: var(--r-sm); font-weight: 600; text-decoration: none; }
.sv-top .sv-start { height: 34px; }
.sv-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.sv-foot[hidden] { display: none; }
.sv-foot .btn.primary { padding: 10px 22px; font-size: 15px; border-radius: 12px; }
.sv-foot small { color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 600px) {
  .sv-top { padding: 8px 12px; gap: 8px; }
  .sv-top .brand span { display: none; }
  .sv-body { padding: 18px 16px 24px; }
  .sv-title { font-size: 23px; }
  .sh-item { flex-wrap: wrap; }
  .sh-item-t { flex-basis: 100%; margin-bottom: 4px; }
}
/* Installed app and phones with a notch (see the safe-area block in app.css): the view covers the
   whole screen, so its top and bottom bars keep clear of the status bar and home bar. */
.sv-top { padding-top: calc(10px + env(safe-area-inset-top)); padding-left: calc(16px + env(safe-area-inset-left)); padding-right: calc(16px + env(safe-area-inset-right)); }
.sv-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (max-width: 600px) {
  .sv-top { padding-top: calc(8px + env(safe-area-inset-top)); padding-left: calc(12px + env(safe-area-inset-left)); padding-right: calc(12px + env(safe-area-inset-right)); }
}
/* The "Update available" bar (js/pwa.js) stays visible over a shared chat. */
body.sharing .sw-update { z-index: 111; }
