/* Saved company lists (js/lists.js): tick boxes, the selection bar, the list picker, confirmations,
   and the /lists pages. Builds on directory.css variables. */

/* The picker, bar and confirmation also appear on company pages, which don't load directory.css,
   so they carry its palette themselves (same values as body.directory-page there) */
.lists-picker,
.lists-bar,
.lists-toast {
    --ink: #14213a;
    --ink-soft: #4a5568;
    --ink-faint: #5a6780;
    --rule: #e2e5ea;
    --hover: #f6f8fb;
    --brand: #1d5bc4;
    --brand-deep: #164a9f;
    --brand-soft: #e4eefc;
    --display: 'Outfit', 'Inter', system-ui, sans-serif;
}

/* Tick box beside a company */
.dir-select-cell {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.dir-select-body {
    flex: 1;
    min-width: 0;
}
.row-check,
.row-check-all {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 6px 0 0;
    accent-color: var(--brand);
    cursor: pointer;
}
th .dir-select-cell {
    align-items: center;
}
th .row-check-all {
    margin-top: 0;
}

/* Bar along the bottom of the window while rows are ticked */
.lists-bar {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 900;
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: calc(100vw - 32px);
    padding: 10px 12px 10px 18px;
    color: #fff;
    background: var(--ink, #14213a);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(20, 33, 58, 0.25);
    transform: translateX(-50%);
}
.lists-bar[hidden] {
    display: none;
}
.lists-bar-count {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.lists-bar-actions {
    display: flex;
    gap: 8px;
}
.lists-bar .btn {
    white-space: nowrap;
}
/* .btn sets its own display, which would otherwise keep a hidden button on screen as an empty outline */
.lists-bar .btn[hidden] {
    display: none;
}
.lists-bar .btn-primary {
    color: var(--ink, #14213a);
    background: #fff;
    border-color: #fff;
}
.lists-bar .btn-secondary {
    color: #fff;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.45);
}
.lists-bar-clear {
    padding: 4px 8px;
    font: inherit;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    background: none;
    border: 0;
    cursor: pointer;
}
.lists-bar-clear:hover {
    color: #fff;
    text-decoration: underline;
}
/* Room below the page so the bar never covers the last row or the pagination */
body.has-lists-bar {
    padding-bottom: 80px;
}
@media (max-width: 600px) {
    .lists-bar {
        right: 12px;
        left: 12px;
        bottom: 12px;
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 16px;
        transform: none;
    }
}

/* List picker */
.lists-picker {
    width: min(440px, calc(100vw - 32px));
    margin: auto; /* The global reset removes the browser's centring */
    padding: 0;
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(20, 33, 58, 0.2);
}
.lists-picker::backdrop {
    background: rgba(20, 33, 58, 0.35);
}
.lists-picker form {
    padding: 22px 22px 18px;
}
.lists-picker h2 {
    margin: 0 0 6px;
    font-family: var(--display);
    font-size: 20px;
    font-weight: 500;
}
.lists-picker-hint {
    margin: 0;
    font-size: 13px;
    color: var(--ink-faint);
}
.lists-picker-note {
    margin: 0 0 10px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--brand-deep);
    background: var(--brand-soft);
    border-radius: 6px;
}
.lists-picker-options {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    margin: 12px 0 0;
    overflow-y: auto;
    border: 1px solid var(--rule);
    border-radius: 8px;
}
.lists-picker-option {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
}
.lists-picker-option + .lists-picker-option {
    border-top: 1px solid var(--rule);
}
.lists-picker-option:hover {
    background: var(--hover);
}
.lists-picker-option input[type="radio"],
.lists-picker-option input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
    accent-color: var(--brand);
}
.lists-picker-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lists-picker-count {
    font-size: 13px;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}
.lists-picker-new input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    font: inherit;
    font-size: 14px;
    border: 1px solid #b9c0cb;
    border-radius: 6px;
}
.lists-picker-error {
    margin: 10px 0 0;
    font-size: 13px;
    color: #b42318;
}
.lists-picker-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 18px;
}

/* Confirmation after saving */
.lists-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    max-width: min(420px, calc(100vw - 40px));
    padding: 12px 16px;
    font-size: 14px;
    color: #fff;
    background: #1d6b43;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 33, 58, 0.2);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.lists-toast.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.lists-toast a {
    font-weight: 600;
    color: #fff;
}
body.has-lists-bar .lists-toast {
    bottom: 84px;
}

/* /lists: every list */
.lists-new {
    display: flex;
    gap: 8px;
    max-width: 480px;
    margin: 0 0 24px;
}
.lists-new input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    font: inherit;
    font-size: 14px;
    border: 1px solid #b9c0cb;
    border-radius: var(--control-radius, 6px);
}
.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.lists-card {
    position: relative;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lists-card:hover {
    border-color: var(--brand);
    box-shadow: 0 2px 8px rgba(20, 33, 58, 0.06);
}
.lists-card h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.lists-card a {
    color: var(--ink);
    text-decoration: none;
}
.lists-card a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
}
.lists-card-meta {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--ink-faint);
}
.lists-card--builtin {
    background: var(--hover);
}

/* /lists/{id}: one list */
.list-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.list-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.list-back {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--ink-soft);
    text-decoration: none;
}
.list-back:hover {
    color: var(--brand);
}
.list-danger {
    color: #b42318 !important;
}

/* Company page: "Save to list" is a button styled like the other hero actions */
button.company-action {
    font-family: inherit;
    cursor: pointer;
}
