/*
 * The chat library pane.
 *
 * A plain stylesheet in wwwroot rather than ChatLibraryManager.razor.css, because this project's scoped CSS
 * is not served: the app's bundle carries the website project's components and none of this library's, so a
 * .razor.css file here would be a stylesheet nobody loads. Class names stay prefixed (clm-) so living in the
 * global sheet does not make them anybody else's problem.
 *
 * Linked from _Host.cshtml beside _content/Sole.Components/sitewide.css.
 */

.clm {
    /* The pane is as wide as the monitor; a table stretched across 3000px puts the actions a head-turn away
       from the name they belong to. Reading width first, centred, so it looks composed rather than clipped. */
    max-width: 1040px;
    margin: 0 auto;
    color: #1f2328;
}

/* ---- header ------------------------------------------------------------------------------------------ */

.clm-head {
    padding-bottom: .85rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid #e6e9ec;
}

.clm-head h2 {
    margin: 0 0 .3rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.clm-sub {
    margin: 0;
    max-width: 68ch;
    color: #6b7075;
    font-size: .84rem;
    line-height: 1.5;
}

/* ---- toolbar ----------------------------------------------------------------------------------------- */

.clm-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}

.clm-btn {
    border: 1px solid #d7dbdf;
    background: #fff;
    border-radius: 6px;
    padding: .38rem .8rem;
    font: inherit;
    font-size: .84rem;
    color: #1f2328;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}

.clm-btn:hover {
    background: #f1f5f9;
    border-color: #c3c9cf;
}

.clm-btn.primary {
    background: #1b6ec2;
    border-color: #1b6ec2;
    color: #fff;
}

.clm-btn.primary:hover {
    background: #175ca3;
}

/* The file input.
 *
 * It stays a real, visible <input type="file"> and only its native button is restyled, via
 * ::file-selector-button. That matters: every attempt to replace this control with a prettier one — a hidden
 * input behind a label, an input laid transparently over a button — ended up unclickable. The pseudo-element
 * changes how the button looks without changing what it is, so there is no click to forward and nothing to
 * get wrong.
 *
 * ::-webkit-file-upload-button is the same thing under the older prefixed name, kept for anything not yet on
 * the standard one. The rules are duplicated rather than combined in one selector list on purpose: a browser
 * that does not recognise one of two selectors in a list throws the whole rule away. */
.clm-file {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
    color: #6b7075;
}

/* The input's own text — "No file chosen", then the filename. Kept, because it is the only confirmation the
   browser gives that a pick registered, but quietened so it reads as a status rather than a control. */
.clm-file input[type="file"] {
    font-size: .78rem;
    color: #9aa0a6;
    max-width: 250px;
}

.clm-file input[type="file"]::file-selector-button {
    margin-right: .55rem;
    padding: .38rem .8rem;
    border: 1px solid #d7dbdf;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-size: .84rem;
    color: #1f2328;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}

.clm-file input[type="file"]::file-selector-button:hover {
    background: #f1f5f9;
    border-color: #c3c9cf;
}

.clm-file input[type="file"]::-webkit-file-upload-button {
    margin-right: .55rem;
    padding: .38rem .8rem;
    border: 1px solid #d7dbdf;
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-size: .84rem;
    color: #1f2328;
    cursor: pointer;
}

/* ---- editor ------------------------------------------------------------------------------------------ */

.clm-editor {
    border: 1px solid #d7dbdf;
    border-left: 3px solid #1b6ec2;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
    background: #fbfcfd;
}

.clm-row {
    display: flex;
    gap: .85rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
}

.clm-row label,
.clm-body-label {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #6b7075;
}

.clm-row label:first-child {
    flex: 1 1 280px;
    min-width: 0;
}

.clm-row input,
.clm-row select,
.clm-body-label textarea {
    font: inherit;
    font-size: .85rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: #1f2328;
    padding: .38rem .55rem;
    border: 1px solid #d7dbdf;
    border-radius: 6px;
    background: #fff;
}

.clm-row input:focus,
.clm-row select:focus,
.clm-body-label textarea:focus {
    outline: none;
    border-color: #1b6ec2;
    box-shadow: 0 0 0 3px rgba(27, 110, 194, .12);
}

.clm-pin {
    width: 5.5rem;
}

.clm-body-label textarea {
    resize: vertical;
    line-height: 1.5;
}

.clm-preview {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .75rem;
    font-size: .8rem;
    color: #6b7075;
}

.clm-preview img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e6e9ec;
}

/* Shown against a stand-in customer: a placeholder explained is never as clear as one filled in. */
.clm-fill {
    margin-top: .6rem;
    font-size: .8rem;
    color: #1f6b34;
    background: #eaf6ec;
    border-radius: 6px;
    padding: .45rem .65rem;
    line-height: 1.45;
}

.clm-actions {
    display: flex;
    gap: .5rem;
    margin-top: .85rem;
}

/* ---- list -------------------------------------------------------------------------------------------- */

.clm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    border: 1px solid #e6e9ec;
    border-radius: 8px;
    overflow: hidden;
}

.clm-table thead th {
    text-align: left;
    padding: .5rem .75rem;
    background: #f7f8f9;
    border-bottom: 1px solid #e6e9ec;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7075;
    white-space: nowrap;
}

.clm-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid #f0f2f4;
    vertical-align: top;
}

.clm-table tbody tr:last-child td {
    border-bottom: none;
}

.clm-table tbody tr:hover {
    background: #fafbfc;
}

/* Numbers read as numbers when they line up, and these columns only ever hold one or two characters. */
.clm-table .num {
    text-align: right;
    width: 4.5rem;
    white-space: nowrap;
}

.clm-table .team {
    width: 9rem;
    color: #6b7075;
    white-space: nowrap;
}

.clm-table .by {
    width: 10rem;
    color: #6b7075;
    white-space: nowrap;
}

.clm-name {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
}

.clm-kind {
    flex: 0 0 auto;
    opacity: .8;
}

.clm-ph {
    font-size: .68rem;
    font-weight: 500;
    color: #1f6b34;
    background: #eaf6ec;
    border-radius: 3px;
    padding: .05rem .3rem;
}

.clm-excerpt {
    color: #6b7075;
    font-size: .78rem;
    margin-top: .2rem;
    line-height: 1.45;
    /* Two lines at most: this is a reminder of what the item says, not the item. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.clm-rowactions {
    white-space: nowrap;
    text-align: right;
    width: 1%;
}

.clm-link {
    border: none;
    background: none;
    padding: 0 .35rem;
    font: inherit;
    font-size: .8rem;
    color: #1b6ec2;
    cursor: pointer;
}

.clm-link:hover {
    text-decoration: underline;
}

.clm-link.danger {
    color: #b00020;
}

/* ---- empty + error ----------------------------------------------------------------------------------- */

.clm-note {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #6b7075;
    font-size: .85rem;
    line-height: 1.6;
    border: 1px dashed #d7dbdf;
    border-radius: 8px;
    background: #fafbfc;
}

.clm-error {
    margin-bottom: .9rem;
    padding: .55rem .8rem;
    border: 1px solid #e0a0a0;
    background: #fdeaec;
    border-radius: 6px;
    font-size: .84rem;
}
/* ---- exploded-view import ---------------------------------------------------------------------------- */
/* A result panel rather than a toast: the counts are worth re-reading while deciding whether the skips
   matter, and a toast is gone before anyone has finished the sentence. */
.clm-import {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin: .6rem 0 .9rem;
    padding: .6rem .8rem;
    border-left: 3px solid var(--rz-success, #2e7d5b);
    background: var(--rz-base-100, #f6faf8);
    font-size: .84rem;
}

.clm-import-detail {
    color: var(--rz-text-secondary-color, #6b7580);
    font-size: .78rem;
}

.clm-import-problems {
    margin-top: .2rem;
    font-size: .78rem;
}

.clm-import-problems summary {
    cursor: pointer;
    color: var(--rz-text-secondary-color, #6b7580);
}

.clm-import-problems ul {
    margin: .35rem 0 0;
    padding-left: 1.1rem;
    max-height: 11rem;
    overflow-y: auto;
}

/* The name of a saved file doubles as its preview control. A button rather than an anchor: there is no URL
   until the bytes have been fetched, and a link with no href is a lie to anything reading the page. */
.clm-name-link {
    font: inherit;
    font-weight: 600;
    padding: 0;
    border: 0;
    background: none;
    color: var(--rz-primary, #1b6ec2);
    cursor: pointer;
    text-align: left;
}

.clm-name-link:hover:not(:disabled) { text-decoration: underline; }

.clm-name-link:disabled { color: var(--rz-text-secondary-color, #6b7580); cursor: default; }

.clm-name-link:focus-visible { outline: 2px solid var(--rz-primary, #1b6ec2); outline-offset: 2px; }
