/* Standalone stylesheet of the record viewer · app.recentshl123456789.css
 * ---------------------------------------------------------------------------
 * Name id: recentshl (9 letters) + 123456789 (9 digits)
 * Handles only the three buttons (chat records / creation records / novel records) and their responsive dialog;
 * never modifies :root and never overrides other modules' styles. Loaded by index.html directly.
 * ---------------------------------------------------------------------------
 */

/* Parent container of the three entry buttons: keeps them pinned to the inner right edge, width follows sidebar/page */
#sidebarFoot,
.nv-side-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
    box-sizing: border-box;
}

/* Important: the main script hides the session footer via foot.hidden (creation mode), so display:flex on the id must not beat hidden */
#sidebarFoot[hidden] { display: none !important; }

/* Left label is shrinkable, otherwise the right-side button gets pushed out of the container */
#sidebarFoot #sidebarMeta,
.nv-side-foot .nv-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The 'My creations' title row in the creation sidebar stays right-aligned as well */
.crt-list-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

#sidebarFoot .rec-btn,
.nv-side-foot .rec-btn,
.crt-list-head .rec-btn {
    margin-left: auto;
    margin-right: 0;
    align-self: center;
}

/* Shared look of the three entry buttons: small rounded-rectangle card, width follows the available space */
.rec-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 1 auto;
    width: 96px;
    width: clamp(76px, 34%, 132px);
    min-width: 72px;
    max-width: 100%;
    height: 26px;
    padding: 0 10px;
    gap: 4px;
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 9px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: var(--primary, #185fa5);
    font-size: 12px;
    line-height: 1;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.rec-btn:hover {
    background: #ffffff;
    border-color: var(--primary, #185fa5);
    box-shadow: 0 2px 6px rgba(24, 95, 165, .14);
}
.rec-btn:focus-visible {
    outline: 2px solid rgba(24, 95, 165, .35);
    outline-offset: 2px;
}
.rec-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

@media (max-width: 420px) {
    .rec-btn {
        min-width: 64px;
        padding: 0 8px;
    }
}

/* Dialog mask and card: size follows the viewport; long content scrolls inside the list only */
.rcv-mask {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .48);
}
.rcv-mask[hidden] { display: none !important; }

.rcv-card {
    width: min(980px, calc(100vw - 32px));
    max-width: 100%;
    /* Height follows the content: a small card when there are few records, and past the cap only the list scrolls */
    height: auto;
    min-height: 240px;
    max-height: 86vh;
    max-height: min(86vh, 860px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    background: var(--panel, #fff);
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
    color: var(--text, #1f2329);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.rcv-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border, #e3e6ea);
    flex: 0 0 auto;
}
.rcv-head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.4;
    color: var(--text, #1f2329);
}
.rcv-sub {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted, #8a9099);
}
.rcv-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.rcv-icon {
    padding: 5px 10px;
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 8px;
    background: var(--panel, #fff);
    color: var(--text, #1f2329);
    font-size: 12px;
    cursor: pointer;
}
.rcv-icon:hover { background: var(--primary-soft, #e6f1fb); }
.rcv-close { font-size: 18px; line-height: 1; padding: 3px 10px 6px; }

.rcv-progress {
    height: 3px;
    flex: 0 0 auto;
    background: var(--border, #e3e6ea);
    overflow: hidden;
}
.rcv-progress[hidden] { display: none; }
.rcv-progress > i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--primary, #185fa5);
    transition: width .2s ease;
}

.rcv-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg, #f5f6f8);
    /* Hide the scrollbar gutter inside the dialog: content stays scrollable (wheel / touch / keyboard / drag)
       without occupying 15px of width or showing a grey track that clashes with the rounded card.
       Three declarations cover Firefox, legacy Edge/IE, and Chromium-based browsers. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.rcv-list::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* Important: the list is a column flex container and each card sets overflow:hidden.
   Per the flex spec, a child with non-visible overflow gets an automatic minimum size of 0, so with many items (dozens or hundreds)
   the cards are squeezed into a few pixels and only their borders remain, looking like empty rows.
   Hence flex:0 0 auto is mandatory (no shrinking) and .rcv-list itself scrolls. */
.rcv-item {
    flex: 0 0 auto;
    min-height: 0;
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 12px;
    background: var(--panel, #fff);
    overflow: hidden;
}
.rcv-item-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
}
.rcv-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #1f2329);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rcv-item-meta {
    font-size: 11px;
    color: var(--muted, #8a9099);
    white-space: nowrap;
    flex: 0 0 auto;
}
.rcv-item-summary {
    margin: 0 12px 10px;
    font-size: 12px;
    color: var(--muted, #8a9099);
    word-break: break-word;
}
.rcv-item-body {
    border-top: 1px dashed var(--border, #e3e6ea);
    padding: 10px 12px 12px;
}
.rcv-item-body[hidden] { display: none; }

.rcv-msg {
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg, #f5f6f8);
}
.rcv-msg.is-user {
    background: var(--primary-soft, #e6f1fb);
}
.rcv-msg > b {
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
    color: var(--muted, #8a9099);
    font-weight: 600;
}
.rcv-more {
    border: none;
    background: none;
    color: var(--primary, #185fa5);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
}
.rcv-loading, .rcv-empty, .rcv-error {
    flex: 0 0 auto;
    padding: 28px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--muted, #8a9099);
}
.rcv-error { color: var(--danger, #a32d2d); }

.rcv-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 20px;
    border-top: 1px solid var(--border, #e3e6ea);
    font-size: 12px;
    color: var(--muted, #8a9099);
    flex: 0 0 auto;
}
.rcv-foot button {
    border: 1px solid var(--border, #e3e6ea);
    border-radius: 8px;
    background: var(--panel, #fff);
    color: var(--primary, #185fa5);
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
}

@media (max-width: 640px) {
    .rcv-mask { padding: 8px; }
    .rcv-card {
        width: 100%;
        height: auto;
        min-height: 220px;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
    }
    .rcv-head, .rcv-list, .rcv-foot { padding-left: 12px; padding-right: 12px; }
    .rcv-item-meta { display: none; }
}
