:root {
    --sidebarWidth: 0px;
}

body {
    background-color: hsl(0, 0%, 92%);
}

.downloads-content {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 30px 24px 60px;
    box-sizing: border-box;
}

/* ── Intro ─────────────────────────────────────────────────────────────── */
.downloads-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 34px;
}

.downloads-intro p {
    margin: 0;
    flex: 1 1 460px;
    color: var(--darkBlue);
    font-size: 1.02rem;
    line-height: 1.55;
}

.downloads-error {
    color: #a4262c;
    font-size: 1rem;
}

/* ── Section headings ──────────────────────────────────────────────────── */
.downloads-section {
    margin: 40px 0 6px;
    font-size: 1.25rem;
    color: var(--darkBlue);
    border-bottom: 2px solid #cfd8dd;
    padding-bottom: 8px;
}

.downloads-section:first-of-type {
    margin-top: 0;
}

.downloads-section-note {
    margin: 10px 0 0;
    font-size: 0.88rem;
    color: #52626b;
    line-height: 1.5;
}

.downloads-section-note a {
    color: var(--lightBlue);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 22px;
    margin-top: 20px;
}

.download-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #d6dee3;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 20px 22px 22px;
    box-sizing: border-box;
}

.download-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.06rem;
    color: var(--darkBlue);
    line-height: 1.3;
}

.download-card-desc {
    margin: 0;
    font-size: 0.89rem;
    color: #444;
    line-height: 1.5;
}

.download-card code,
.shape-detail code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.85em;
    background: #eef2f4;
    border-radius: 3px;
    padding: 1px 4px;
}

/* Stats line — pushed to the bottom so buttons line up across a row */
.download-stats {
    list-style: none;
    margin: 16px 0 18px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 0.82rem;
    color: #52626b;
    margin-top: auto;
    padding-top: 16px;
}

.download-stats strong {
    color: var(--darkBlue);
    font-size: 0.95rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.download-action {
    align-self: flex-start;
    display: inline-block;
    padding: 9px 20px;
    font-family: "Times";
    font-size: 0.98rem;
    font-weight: bold;
    line-height: 1;
    color: var(--fontGrey);
    background: var(--darkBlue);
    border: 2px solid var(--darkBlue);
    border-radius: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
}

.download-action:hover {
    background: var(--hoverblue);
    border-color: var(--hoverblue);
    color: var(--fontGrey);
}

.download-action:disabled {
    background: #b7c2c8;
    border-color: #b7c2c8;
    cursor: not-allowed;
}

.download-action-all {
    align-self: center;
    flex: 0 0 auto;
    padding: 12px 26px;
    font-size: 1.05rem;
}

.download-reset {
    padding: 9px 18px;
    font-family: "Times";
    font-size: 0.95rem;
    font-weight: bold;
    line-height: 1;
    color: var(--darkBlue);
    background: transparent;
    border: 2px solid var(--darkBlue);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.15s ease-in-out, color 0.15s ease-in-out;
}

.download-reset:hover {
    background: var(--darkBlue);
    color: var(--fontGrey);
}

/* ── Custom download card ──────────────────────────────────────────────── */
.custom-download-card {
    margin-top: 20px;
    background: #ffffff;
    border: 1px solid #d6dee3;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 22px 24px 24px;
    box-sizing: border-box;
}

.custom-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px 20px;
    margin: 20px 0 18px;
}

.custom-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.custom-field label,
.custom-field .custom-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #52626b;
}

.custom-field select,
.custom-field input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 0.92rem;
    font-family: inherit;
    color: #222;
    background: #fbfcfd;
    border: 1px solid #b7c2c8;
    border-radius: 4px;
}

.custom-field select:focus,
.custom-field input[type="search"]:focus {
    outline: none;
    border-color: var(--lightBlue);
    box-shadow: 0 0 0 2px rgba(31, 104, 135, 0.15);
}

/* ── Multi-select ──────────────────────────────────────────────────────── */
.multiselect {
    position: relative;
}

.multiselect-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 0.92rem;
    font-family: inherit;
    text-align: left;
    color: #222;
    background: #fbfcfd;
    border: 1px solid #b7c2c8;
    border-radius: 4px;
    cursor: pointer;
}

.multiselect.is-open .multiselect-control,
.multiselect-control:focus {
    outline: none;
    border-color: var(--lightBlue);
    box-shadow: 0 0 0 2px rgba(31, 104, 135, 0.15);
}

.multiselect.has-selection .multiselect-control {
    border-color: var(--lightBlue);
    background: #f2f8fb;
}

.multiselect-summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-summary.is-placeholder {
    color: #8d9aa2;
}

.multiselect-caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6a7880;
    transition: transform 0.15s ease-in-out;
}

.multiselect.is-open .multiselect-caret {
    transform: rotate(180deg);
}

.multiselect-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--lightBlue);
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
    padding: 8px;
    box-sizing: border-box;
}

/* `display: flex` above outranks the browser's `[hidden] { display: none }`,
   so the closed state has to be stated explicitly. Same for the chip list. */
.multiselect-panel[hidden],
.multiselect-chips[hidden] {
    display: none;
}

/* Opened upwards when there is not enough room below the control. */
.multiselect-panel.drops-up {
    top: auto;
    bottom: calc(100% + 4px);
}

.multiselect-search {
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 0.88rem;
    font-family: inherit;
    border: 1px solid #b7c2c8;
    border-radius: 4px;
}

.multiselect-search:focus {
    outline: none;
    border-color: var(--lightBlue);
}

.multiselect-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
    padding: 8px 2px;
    border-bottom: 1px solid #e3e9ec;
}

.multiselect-action {
    padding: 0;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--lightBlue);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

.multiselect-action:hover {
    color: var(--darkBlue);
}

.multiselect-options {
    flex: 1 1 auto;
    min-height: 0;
    list-style: none;
    margin: 0;
    padding: 4px 0 0;
    overflow-y: auto;
}

.multiselect-options li {
    margin: 0;
}

.multiselect-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    font-size: 0.87rem;
    font-family: inherit;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    color: #222;
    line-height: 1.35;
    border-radius: 3px;
    cursor: pointer;
}

.multiselect-options label:hover {
    background: #eef5f9;
}

.multiselect-options input {
    flex: 0 0 auto;
    margin: 0;
}

.multiselect-empty {
    margin: 8px 6px 4px;
    font-size: 0.85rem;
    color: #8d9aa2;
}

/* Chips spell out the current selection without reopening the panel. */
.multiselect-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
    max-height: 92px;
    overflow-y: auto;
}

.multiselect-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 4px 2px 8px;
    font-size: 0.78rem;
    color: var(--darkBlue);
    background: #e3f0f6;
    border: 1px solid #bcd7e4;
    border-radius: 11px;
    max-width: 100%;
}

.multiselect-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-chip-remove {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
    color: var(--lightBlue);
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.multiselect-chip-remove:hover {
    color: #ffffff;
    background: var(--lightBlue);
}

/* ── Row-shape chooser ─────────────────────────────────────────────────── */
.custom-shape {
    margin: 0;
    padding: 14px 16px 12px;
    border: 1px solid #dde4e8;
    border-radius: 6px;
    background: #fafcfd;
}

.custom-shape legend {
    padding: 0 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #52626b;
}

.shape-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 7px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.shape-option:hover {
    background: #eef5f9;
}

.shape-option input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.shape-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.shape-title {
    font-size: 0.92rem;
    color: #222;
    line-height: 1.35;
}

.shape-detail {
    font-size: 0.82rem;
    color: #6a7880;
    line-height: 1.4;
}

.shape-detail strong {
    color: var(--darkBlue);
}

.shape-note {
    margin: 6px 6px 0;
    font-size: 0.82rem;
    color: #6a7880;
    line-height: 1.5;
}

.custom-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e3e9ec;
}

.custom-summary {
    font-size: 0.95rem;
    color: #52626b;
}

.custom-summary strong {
    color: var(--darkBlue);
    font-size: 1.12rem;
}

.custom-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (max-width: 600px) {
    .downloads-content {
        padding: 20px 14px 40px;
    }

    .downloads-intro {
        gap: 18px;
    }

    .download-action-all {
        align-self: stretch;
        text-align: center;
    }

    .custom-footer {
        align-items: stretch;
    }

    .custom-actions {
        justify-content: flex-end;
    }
}
