/**
 * User lists: the lists hub of each module (components/lists-hub/*) and the page of a list
 * (components/list-page/*). Built on the page band, module nav,
 * buttons, chips and list tiles of media-kit.css.
 *
 * Uses only the semantic tokens declared in layout-site/master.css, so it renders in every theme.
 * Behavior: public/js/components/lists-hub.js and list-page.js.
 */

/* ================== HUB: BAND ACTIONS ================== */
.lists-hub-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 26px;
}

.lists-hub-intro {
    flex-basis: 100%;
    margin: 0 0 6px;
    font-size: 14px;
    line-height: 20px;
    color: var(--text-2);
}

/* ================== HUB: TOOLBAR ================== */
.lists-hub-body {
    padding-top: 36px;
}

.lists-hub-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
    margin-bottom: 24px;
}

.lists-hub-search {
    position: relative;
    flex: 0 1 380px;
    min-width: 220px;
}

.lists-hub-search > i {
    position: absolute;
    top: 50%;
    left: 15px;
    font-size: 13px;
    color: var(--text-2);
    transform: translateY(-50%);
    pointer-events: none;
}

.lists-hub-search .form-control {
    min-height: 42px;
    padding-left: 40px;
    border: 1px solid var(--field-line);
    border-radius: 21px;
    background-color: var(--field-bg);
    font-size: 14px;
    color: var(--text-1);
}

.lists-hub-search .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.lists-hub-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ================== HUB: OWNED LIST TILE ================== */
.list-tile-item[hidden] {
    display: none;
}

.list-tile.is-owned {
    position: relative;
}

/* The name link covers the tile; the controls sit above it */
.list-tile-link {
    color: var(--text-1);
    text-decoration: none;
}

.list-tile-link::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.list-tile-link:hover {
    color: var(--accent);
}

.list-tile-link:focus-visible {
    outline: none;
}

.list-tile-link:focus-visible::after {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.list-tile.is-owned .list-tile-meta {
    margin-top: 0;
}

.list-tile-controls {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.list-tile-actions {
    display: flex;
    gap: 2px;
}

/* ================== HUB: COLLABORATIVE LISTS (M-015) ================== */
/* The pending invites (components/lists-hub/invites) above the lists and "Shared with me"
   (components/lists-hub/shared) below them */
.lists-hub-invites {
    padding-top: 36px;
}

.lists-hub-invites .section-head-badge {
    font-variant-numeric: tabular-nums;
}

.collab-invite {
    gap: 14px;
}

.collab-invite-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.collab-invite .module-label {
    font-size: 11px;
    color: var(--text-2);
}

.collab-invite-from,
.collab-tile-owner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    line-height: 18px;
    color: var(--text-2);
}

.collab-invite-from .account-avatar {
    --avatar-size: 24px;
}

.collab-tile-owner .account-avatar {
    --avatar-size: 22px;
}

.collab-invite-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.lists-hub-shared {
    padding-top: var(--section-gap);
}

/* ================== HUB: EMPTY ================== */
.lists-hub-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 520px;
    margin: 0 auto;
    padding: 36px 16px 20px;
    text-align: center;
    color: var(--text-2);
}

.lists-hub-empty-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--accent-soft);
    font-size: 28px;
    color: var(--accent);
}

.lists-hub-empty-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-1);
}

.lists-hub-empty p {
    margin: 0 0 10px;
    font-size: 14.5px;
    line-height: 22px;
}

/* ================== HUB: FRIENDS' LISTS ================== */
.lists-hub-friends {
    padding-top: var(--section-gap);
    padding-bottom: 80px;
}

.friend-lists-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friend-lists {
    border-radius: var(--radius);
    background: var(--surface-1);
    box-shadow: inset 0 0 0 1px var(--line);
}

.friend-lists-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    list-style: none;
    cursor: pointer;
}

.friend-lists-summary::-webkit-details-marker {
    display: none;
}

.friend-lists-summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius);
}

.friend-lists-summary .account-avatar {
    --avatar-size: 40px;
}

.friend-lists-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.friend-lists-name {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-1);
}

.friend-lists-meta {
    font-size: 12.5px;
    color: var(--text-2);
}

.friend-lists-chevron {
    font-size: 12px;
    color: var(--text-2);
    transition: transform 0.2s ease;
}

.friend-lists[open] .friend-lists-chevron {
    transform: rotate(180deg);
}

.friend-lists-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 4px 18px 18px;
}

.friend-lists-body .list-tiles {
    width: 100%;
}

/* ================== LIST PAGE: BAND ================== */
/* components/list-page/page.blade.php: identity and controls on the left, the finder on the right */
.list-band-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 452px;
    align-items: start;
    gap: 28px 64px;
    margin-top: 26px;
}

.list-band-main {
    min-width: 0;
}

.list-identity {
    --list-color: var(--module, var(--accent));
    display: flex;
    align-items: center;
    gap: 22px;
}

.list-identity-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--list-color) 22%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--list-color) 45%, transparent);
    font-size: 32px;
    color: color-mix(in srgb, var(--list-color) 65%, #fff);
}

.list-identity-text {
    min-width: 0;
}

.list-identity .page-band-title {
    white-space: normal;
    overflow-wrap: anywhere;
}

.list-identity-count {
    margin: 10px 0 0;
    font-size: 14px;
    color: var(--text-2);
}

.list-band-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    margin-top: 26px;
}

.list-band-controls .privacy-switch {
    margin-right: 6px;
}

/* ================== LIST PAGE: TITLES ================== */
.list-collection {
    padding-top: 40px;
    padding-bottom: 80px;
}

.list-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 12px;
}

.list-toolbar .section-head-title {
    margin: 0;
}

.list-toolbar-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.list-toolbar-controls .lists-hub-search {
    flex: 0 1 260px;
}

/* With the "in my library" filter (M-045) the four controls do not fit beside the heading: they take the line below */
.list-toolbar:has(#filterLibrarySelect) .list-toolbar-controls {
    flex-basis: 100%;
}

/* How many titles the filters leave, while they hide some (M-045) */
.list-filter-count {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-2);
}

.list-sort.form-select {
    width: auto;
    min-height: 42px;
    padding-left: 16px;
    border: 1px solid var(--field-line);
    border-radius: 21px;
    background-color: var(--field-bg);
    font-size: 14px;
    color: var(--text-1);
}

/* Reorder notice above the titles */
.list-notice {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin: 0 0 26px;
    padding: 14px 18px;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
    border-radius: var(--radius);
    background: var(--accent-soft);
}

.list-notice-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    font-size: 15px;
    color: var(--accent);
}

.list-notice-text p {
    margin: 0;
    font-size: 13.5px;
    line-height: 20px;
    color: var(--text-2);
}

.list-notice-text .list-notice-title {
    margin-bottom: 2px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-1);
}

.list-entry {
    position: relative;
    min-width: 0;
    list-style: none;
}

.list-grid {
    margin: 0;
    padding: 0;
}

.list-entry[hidden] {
    display: none;
}

.list-entry.is-dragging {
    opacity: 0.4;
}

/* Handle and remove sit in a column on the right of the cover, below the favorite star (or the quick add of a
   collaborative list): the top left belongs to the situation and the other chips (P-444) */
.list-entry-tools {
    position: absolute;
    top: 54px;
    right: 12px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.list-entry-tool {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(11, 11, 14, 0.72);
    backdrop-filter: blur(4px);
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.list-entry-handle {
    cursor: grab;
}

.list-entry-remove:hover {
    background: var(--danger);
}

.list-entry-tool:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* With a mouse the tools show on hover; touch screens and keyboard focus always show them */
@media (hover: hover) {
    .list-entry-tool {
        opacity: 0;
    }

    .list-entry:hover .list-entry-tool,
    .list-entry:focus-within .list-entry-tool {
        opacity: 1;
    }
}

/* The title that has just changed position (list-page.js) */
.list-entry.is-moved .library-card-cover {
    animation: list-entry-moved 1.8s ease-out;
}

@keyframes list-entry-moved {
    0%,
    40% {
        box-shadow: 0 0 0 3px var(--accent);
    }

    100% {
        box-shadow: 0 0 0 3px transparent;
    }
}

/* "Change position" dialog (components/list-page/move-dialog), over the shared site-dialog skin */
.list-move-ends {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}

.list-move-label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
}

.list-move-row {
    display: flex;
    gap: 10px;
}

.list-move-row .site-dialog-input {
    flex: 1;
    min-width: 0;
    font-variant-numeric: tabular-nums;
}

.list-move-dialog .site-dialog-helper.is-error {
    color: var(--danger);
}

/* ================== PUBLIC LIST ================== */
/* site/public/public-list.blade.php: the list page without the owner's tools; the finder column
   becomes a side panel for the visitor */
.list-page.is-public .list-band-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: center;
}

.list-owner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 0;
    font-size: 14px;
    color: var(--text-2);
}

.list-owner .account-avatar {
    --avatar-size: 30px;
}

.list-owner strong,
.list-owner a {
    font-weight: 600;
    color: var(--text-1);
}

.list-owner a {
    text-decoration: none;
}

.list-owner a:hover,
.list-owner a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
}

.public-list-aside {
    padding: 24px 26px 26px;
    border-radius: var(--radius);
    background: var(--surface-1);
    box-shadow: inset 0 0 0 1px var(--line);
}

.public-list-aside-title {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}

.public-list-aside-label {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-2);
}

.public-list-aside-text {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-2);
}

.public-list-aside-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.public-list-overlap {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 6px 0 12px;
    font-variant-numeric: tabular-nums;
}

.public-list-overlap-value {
    font-family: var(--font-display);
    font-weight: var(--font-display-weight);
    font-size: 44px;
    line-height: 1;
    color: var(--text-1);
}

.public-list-overlap-total {
    font-size: 16px;
    color: var(--text-2);
}

.public-list-overlap-bar {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--surface-3);
}

.public-list-overlap-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* ================== LIST FORM (create / edit) ================== */
.list-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 720px) minmax(260px, 340px);
    align-items: start;
    gap: 40px;
    padding-top: 40px;
    padding-bottom: 80px;
}

.list-form-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.list-form-group > legend {
    float: left;
    width: 100%;
    margin-bottom: 12px;
}

.list-form-group > legend + * {
    clear: both;
}

.icon-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 10px;
}

.icon-option {
    display: grid;
    place-items: center;
    height: 48px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--field-bg);
    font-size: 17px;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.icon-option:hover {
    border-color: var(--text-2);
    color: var(--text-1);
}

.icon-option[aria-checked="true"] {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.icon-option:focus-visible,
.color-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.color-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-option {
    position: relative;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-option:hover {
    transform: scale(1.08);
}

.color-option[aria-checked="true"] {
    box-shadow: 0 0 0 3px var(--surface-1), 0 0 0 5px var(--text-1);
}

.color-option[aria-checked="true"]::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.4' d='M4 8.5l2.6 2.5L12 5.5'/%3e%3c/svg%3e") center / 16px no-repeat;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.list-form-preview {
    position: sticky;
    top: calc(var(--site-header-h, 58px) + 24px);
}

.list-form-preview .list-tile {
    min-height: 150px;
}

/* ================== RESPONSIVE ================== */
@media (max-width: 1199.98px) {
    .list-band-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 991.98px) {
    .list-form-layout,
    .list-page.is-public .list-band-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .list-form-preview {
        position: static;
        order: -1;
    }
}

@media (max-width: 767.98px) {
    .lists-hub-body {
        padding-top: 28px;
    }

    .list-identity {
        gap: 16px;
    }

    .list-identity-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
        font-size: 24px;
    }

    .list-collection {
        padding-top: 28px;
        padding-bottom: 56px;
    }

    .list-toolbar-controls {
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    /* Below the smaller star of the phone (components/library.css) */
    .list-entry-tools {
        top: 46px;
        right: 8px;
    }

    .list-entry-tool {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .list-toolbar-controls .lists-hub-search {
        flex: 1 1 100%;
    }

    .list-sort.form-select {
        flex: 1;
    }

    .lists-hub-search {
        flex-basis: 100%;
    }

    .lists-hub-actions .kit-button {
        flex: 1 1 auto;
    }

    .lists-hub-friends {
        padding-bottom: 56px;
    }
}
