/* ============================================================================
   chat-share.css — the "Share chat" modal, the Usage Policy popup, and the
   public share-link viewer (a copy of a conversation rendered with the app's
   own chat styling).

   Owner surfaces (modal + policy) reuse the app's theme tokens so they track
   light/dark. The recipient viewer is self-contained: a stranger loads it with
   no stored theme, so every value has a literal fallback.
   ========================================================================== */

/* ── Shared modal backdrop ─────────────────────────────────────────────────── */
.dcs-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.dcs-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.dcs-modal {
    width: min(520px, 100%);
    background: var(--card-bg, #201f1d);
    color: var(--text-color, #eeeae5);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 16px;
    /* Keep dialogs crisp and calm; the backdrop already establishes depth. */
    box-shadow: none;
    padding: 24px;
    transform: translateY(8px) scale(.985);
    opacity: 0;
    transition: transform .22s cubic-bezier(.16, 1, .3, 1), opacity .22s ease;
}
.dcs-backdrop.open .dcs-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.dcs-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.dcs-head h2 {
    font-size: 21px;
    font-weight: 600;
    margin: 0;
    color: var(--text-color, #eeeae5);
}
.dcs-sub {
    font-size: 13.5px;
    color: var(--subheading-color, #a19b93);
    margin: 4px 0 18px;
}
.dcs-x {
    background: transparent;
    border: none;
    color: var(--subheading-color, #a19b93);
    cursor: pointer;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    transition: background .15s ease, color .15s ease;
}
.dcs-x:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-color); }
.dcs-x .material-symbols-rounded { font-size: 20px; }

/* ── Visibility option rows ────────────────────────────────────────────────── */
.dcs-options {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}
.dcs-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    background: var(--secondary-color, rgba(255, 255, 255, 0.02));
    border: none;
    text-align: left;
    color: inherit;
    transition: background .14s ease;
}
.dcs-option + .dcs-option {
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
.dcs-option:hover { background: var(--secondary-hover-color, rgba(255, 255, 255, 0.05)); }
.dcs-option .dcs-opt-ico {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--subheading-color, #a19b93);
}
.dcs-option .dcs-opt-ico .material-symbols-rounded { font-size: 22px; }
.dcs-opt-body { flex: 1 1 auto; min-width: 0; }
.dcs-opt-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color, #eeeae5);
}
.dcs-opt-desc {
    font-size: 13px;
    color: var(--subheading-color, #a19b93);
    margin-top: 1px;
}
.dcs-opt-check {
    flex: 0 0 auto;
    color: var(--accent, #b7795c);
    opacity: 0;
    transition: opacity .14s ease;
}
.dcs-option.is-selected {
    background: var(--accent-soft, rgba(183, 121, 92, .14));
}
.dcs-option.is-selected .dcs-opt-check { opacity: 1; }
.dcs-option.is-selected .dcs-opt-ico { color: var(--accent, #b7795c); }

/* ── Expiry row (only shown for a public link) ─────────────────────────────── */
.dcs-expiry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    background: var(--secondary-color, rgba(255, 255, 255, 0.02));
}
.dcs-expiry.hidden { display: none; }
.dcs-expiry-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    color: var(--text-color, #eeeae5);
}
.dcs-expiry-label .material-symbols-rounded { font-size: 19px; color: var(--subheading-color, #a19b93); }
.dcs-expiry select {
    background: var(--card-bg, #15171a);
    color: var(--text-color, #eeeae5);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
    border-radius: 9px;
    padding: 7px 10px;
    font-size: 13.5px;
    cursor: pointer;
    outline: none;
}
.dcs-expiry select:focus { border-color: var(--accent, #b7795c); }

/* ── Footer note + actions ─────────────────────────────────────────────────── */
.dcs-note {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--subheading-color, #a19b93);
    margin: 18px 0 16px;
}
.dcs-note a { color: var(--accent, #b7795c); text-decoration: none; cursor: pointer; }
.dcs-note a:hover { text-decoration: underline; }

.dcs-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}
.dcs-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 11px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease, transform .1s ease;
}
.dcs-btn:active { transform: scale(.98); }
.dcs-btn .material-symbols-rounded { font-size: 18px; }
.dcs-btn-primary {
    background: #fff;
    color: #14110f;
}
.dcs-btn-primary:hover { opacity: .9; }
.dcs-btn-primary:disabled { opacity: .5; cursor: default; }
.dcs-btn-ghost {
    background: transparent;
    color: var(--text-color, #eeeae5);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
}
.dcs-btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }
.dcs-btn-danger {
    background: transparent;
    color: #f2645a;
    border: 1px solid rgba(242, 100, 90, 0.4);
}
.dcs-btn-danger:hover { background: rgba(242, 100, 90, 0.12); }

/* ── The created link (shown after "Create share link") ────────────────────── */
.dcs-link-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 6px 6px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
    background: var(--card-bg, #15171a);
}
.dcs-link-row input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color, #eeeae5);
    font-size: 13.5px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
.dcs-copy {
    flex: 0 0 auto;
    background: var(--accent, #b7795c);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dcs-copy:hover { background: #3b8ce8; }
.dcs-copy .material-symbols-rounded { font-size: 16px; }
.dcs-link-meta {
    font-size: 12px;
    color: var(--subheading-color, #a19b93);
    margin: 10px 0 16px;
}

.dcs-spin {
    width: 15px; height: 15px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #14110f;
    border-radius: 50%;
    animation: dcs-spin .7s linear infinite;
    display: inline-block;
}
@keyframes dcs-spin { to { transform: rotate(360deg); } }

.dcs-hide { display: none !important; }

/* ── Usage Policy popup ────────────────────────────────────────────────────── */
.dcs-policy .dcs-modal { width: min(560px, 100%); }
.dcs-policy-body {
    max-height: min(56vh, 520px);
    overflow-y: auto;
    padding-right: 6px;
    margin: 4px 0 18px;
}
.dcs-policy-body h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color, #eeeae5);
    margin: 16px 0 6px;
}
.dcs-policy-body h3:first-child { margin-top: 0; }
.dcs-policy-body p,
.dcs-policy-body li {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--subheading-color, #a19b93);
}
.dcs-policy-body ul { margin: 6px 0; padding-left: 20px; }
.dcs-policy-body li { margin-bottom: 6px; }

@media (max-width: 600px) {
    .dcs-modal { border-radius: 16px; padding: 18px 16px 14px; }
    .dcs-head h2 { font-size: 19px; }
}

/* ============================================================================
   The public share-link viewer.

   The host page is the full Delphos SPA. A recipient must see none of it, so
   the viewer takes the whole viewport and every other direct child of <body>
   is hidden — the same technique code-share-view.css uses.
   ========================================================================== */
body.delphos-chat-share { overflow: auto !important; }
body.delphos-chat-share > *:not(.dcsv) { display: none !important; }

.dcsv {
    position: fixed;
    inset: 0;
    z-index: 10000;
    overflow-y: auto;
    background: var(--chat-area-background, #0b0b0d);
    color: var(--text-color, #e3e3e3);
    -webkit-font-smoothing: antialiased;
}

/* Top brand bar */
.dcsv-top {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--nav-bar-color, rgba(15, 15, 15, .92));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
.dcsv-top .dcsv-brand {
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-color, #e3e3e3);
}

/* The "this is a copy" disclosure banner + Report, like the screenshot. */
.dcsv-disclosure {
    max-width: 760px;
    margin: 22px auto 0;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.dcsv-disclosure-card {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--secondary-color, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    font-size: 12px;
    line-height: 1.45;
    color: var(--subheading-color, #9a948c);
}
.dcsv-disclosure-card .material-symbols-rounded { font-size: 18px; flex: 0 0 auto; }
.dcsv-report {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    color: var(--text-color, #e3e3e3);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}
.dcsv-report:hover { background: rgba(255, 255, 255, 0.06); }

/* ── Centre the reused .chat-container/.chat-list markup ────────────────────
   These classes are shared with the live app's style.css, which reserves a
   left sidebar column (`.chat-container { width:80%; margin-left:20% }`). The
   share viewer has no sidebar, so that rule shoved every shared conversation
   off-centre to the right. Scoped overrides here — not an edit to style.css,
   which the live app still needs — put the transcript back in the middle of
   the page and give it the same readable max-width the app itself uses. */
.dcsv .chat-container {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    background: transparent;
    overflow: visible;
}
.dcsv .chat-list {
    width: min(92%, 780px);
    max-width: 780px;
    margin: 24px auto 60px;
    padding: 0 16px 40px;
}
@media (max-width: 600px) {
    .dcsv .chat-list { width: 100%; padding: 0 4px 32px; }
}

/* Copy control appended to every kept bubble in the snapshot (chat-share.js) —
   the same affordance the live app's per-message action bar gives, since the
   real .message-actions / .outgoing-actions bars are stripped (their handlers
   cannot survive into a page that never loads chat-engine.js). */
.dcsv-msg-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}
.dcsv-copy-msg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--subheading-color, #9a948c);
    cursor: pointer;
    padding: 5px 7px;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}
.dcsv-copy-msg:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-color, #e3e3e3); }
.dcsv-copy-msg .material-symbols-rounded { font-size: 16px; }

/* Files-hidden placeholder that replaces attachments/images in a shared chat. */
.dcs-file-hidden {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 150px;
    height: 96px;
    border-radius: 12px;
    background: rgba(255, 60, 60, 0.06);
    border: 1px solid rgba(255, 80, 80, 0.28);
    color: var(--subheading-color, #9a948c);
    font-size: 11.5px;
    text-align: center;
    padding: 8px;
    margin: 6px 0;
}
.dcs-file-hidden .material-symbols-rounded { font-size: 22px; color: #e0685f; }

/* Notice card (expired / revoked / not found) for the viewer. */
.dcsv-notice {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.dcsv-notice-card {
    max-width: 420px;
    width: 100%;
    text-align: center;
    background: var(--card-bg, #171614);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 16px;
    padding: 32px 26px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.dcsv-notice-ico {
    font-size: 30px;
    color: var(--subheading-color, #9a948c);
    background: rgba(255, 255, 255, 0.05);
    width: 60px; height: 60px;
    border-radius: 14px;
    display: grid; place-items: center;
    margin: 0 auto 16px;
}
.dcsv-notice-card h1 { font-size: 19px; font-weight: 600; margin: 0 0 8px; }
.dcsv-notice-card p { font-size: 14px; color: var(--subheading-color, #9a948c); margin: 0 0 20px; line-height: 1.55; }
.dcsv-home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 11px;
    background: var(--accent, #b7795c);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.dcsv-home-btn:hover { opacity: .92; }

/* ── Share modal refinement: clean graphite surfaces, no browser-blue states ─ */
.dcs-option {
    min-height: 68px;
    gap: 13px;
    padding: 13px 16px;
    background: var(--secondary-color, rgba(255, 255, 255, .02));
}
.dcs-opt-body {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}
.dcs-opt-title,
.dcs-opt-desc {
    display: block;
    max-width: 100%;
    line-height: 1.25;
}
.dcs-opt-title { font-size: 14px; }
.dcs-opt-desc { margin: 0; }
.dcs-opt-check,
.dcs-option.is-selected .dcs-opt-ico,
.dcs-note a {
    color: var(--accent, #b7795c);
}
.dcs-option.is-selected {
    background: transparent;
}
.dcs-option:focus-visible,
.dcs-x:focus-visible,
.dcs-btn:focus-visible,
.dcs-copy:focus-visible {
    outline: 2px solid var(--accent-ring, rgba(183, 121, 92, .4));
    outline-offset: -2px;
}

/* Fully custom expiry picker. A native select delegates its popup/highlight to
   the operating system, which is why it appeared with unthemeable blue states. */
.dcs-expiry {
    position: relative;
    min-height: 58px;
    padding: 10px 12px 10px 14px;
    background: var(--secondary-color, rgba(255, 255, 255, .02));
}
.dcs-expiry-picker { position: relative; flex: 0 0 auto; }
.dcs-expiry-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    min-width: 126px;
    min-height: 36px;
    padding: 7px 10px 7px 12px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, .14));
    border-radius: 9px;
    background: var(--card-bg, #15171a);
    color: var(--text-color, #eeeae5);
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
}
.dcs-expiry-trigger:hover { background: var(--secondary-hover-color, rgba(255, 255, 255, .06)); }
.dcs-expiry-trigger .material-symbols-rounded { font-size: 18px; color: var(--subheading-color, #a19b93); }
.dcs-expiry-trigger:focus-visible {
    outline: 2px solid var(--accent-ring, rgba(183, 121, 92, .4));
    outline-offset: 2px;
}
.dcs-expiry-menu {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    z-index: 4;
    min-width: 164px;
    padding: 5px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, .14));
    border-radius: 10px;
    background: var(--card-bg, #1d1c1a);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}
.dcs-expiry-picker.is-open .dcs-expiry-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.dcs-expiry-option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-color, #eeeae5);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.dcs-expiry-option:hover,
.dcs-expiry-option.is-selected { background: var(--accent-soft, rgba(183, 121, 92, .14)); }
.dcs-expiry-option:focus-visible {
    outline: 2px solid var(--accent-ring, rgba(183, 121, 92, .4));
    outline-offset: -2px;
}

/* Dialog notices are also border-led, never floating cards. */
.dcsv-notice-card { box-shadow: none; }
