/* Focused Database search-workspace refresh. The rest of index.html keeps its legacy layout. */

.database-search-wizard {
    --wizard-ink: #17233a;
    --wizard-muted: #5e7189;
    --wizard-line: #dbe5ef;
    --wizard-line-soft: #e8eef4;
    --wizard-blue: #2e6de6;
    --wizard-blue-dark: #2058c6;
    --wizard-blue-soft: #eef4ff;
    --wizard-page: #f7fafc;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    box-sizing: border-box;
    color: var(--wizard-ink);
    max-width: 720px;
    padding: 28px !important;
}

.database-wizard-heading {
    display: block;
    margin: 0 0 20px;
}

.database-wizard-instruction {
    color: var(--wizard-muted);
    font-size: 0.76rem;
    line-height: 1.4;
    margin: 7px 0 0;
}

.database-wizard-instruction[hidden] {
    display: none;
}

.database-wizard-context {
    align-items: stretch;
    column-gap: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 18px;
    min-height: 0;
}

.database-search-wizard .database-wizard-context[hidden] {
    display: none !important;
}

.database-wizard-context-item {
    appearance: none;
    align-items: center;
    background: #ffffff;
    border: 1px solid #c4d8fb;
    border-radius: 11px;
    box-sizing: border-box;
    color: var(--wizard-blue-dark);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 750;
    justify-content: center;
    line-height: 1.2;
    max-width: min(240px, calc(100% - 12px));
    min-height: 44px;
    min-width: 96px;
    overflow: visible;
    padding: 9px 14px;
    position: relative;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 7px rgba(37, 74, 127, 0.06);
}

.database-wizard-context-label {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.database-wizard-context-item[data-context-step="1"] {
    grid-column: 1;
}

.database-wizard-context-item[data-context-step="2"] {
    grid-column: 2;
}

.database-wizard-context-item[data-context-step="3"] {
    grid-column: 3;
}

.database-wizard-context-item[data-context-step="4"] {
    grid-column: 4;
}

.database-wizard-context-item[data-has-next="true"]::after {
    color: var(--wizard-muted);
    content: '›';
    font-size: 1.15rem;
    line-height: 1;
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.database-search-wizard .database-wizard-context-item {
    margin: 0 !important;
}

.database-wizard-context-item:hover,
.database-wizard-context-item:focus-visible {
    background: var(--wizard-blue-soft);
    border-color: #8fb5f4;
    outline: none;
    transform: translateY(-1px);
}

.database-wizard-context-separator {
    display: none;
}

#databaseSearchWizard.database-search-wizard .search-title {
    color: var(--wizard-ink);
    font-size: var(--clash-font-title, 24px);
    font-weight: 780;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0;
}

.database-wizard-progress {
    align-items: center;
    border-bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 18px;
    padding-bottom: 0;
}

.database-wizard-progress-step {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    color: var(--wizard-muted);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.78rem;
    gap: 7px;
    grid-row: 1;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    text-align: left;
    width: 100% !important;
    z-index: 1;
}

.database-wizard-progress-step > span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.database-wizard-progress-step[data-wizard-step="1"] {
    grid-column: 1;
}

.database-wizard-progress-step[data-wizard-step="2"] {
    grid-column: 2;
}

.database-wizard-progress-step[data-wizard-step="3"] {
    grid-column: 3;
}

.database-wizard-progress-step[data-wizard-step="4"] {
    grid-column: 4;
}

.database-search-wizard.search-container .database-wizard-progress-step {
    margin: 0 !important;
}

.database-wizard-progress-step:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.database-wizard-progress-step:not(:disabled):hover {
    color: var(--wizard-ink);
}

.database-wizard-progress-number {
    align-items: center;
    background: #f4f7fb;
    border: 1px solid var(--wizard-line);
    border-radius: 50%;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    height: 26px;
    justify-content: center;
    width: 26px;
}

.database-wizard-progress-step.is-current {
    color: var(--wizard-blue-dark);
    font-weight: 800;
}

.database-wizard-progress-step.is-current .database-wizard-progress-number,
.database-wizard-progress-step.is-complete .database-wizard-progress-number {
    background: var(--wizard-blue);
    border-color: var(--wizard-blue);
    color: #ffffff;
}

.database-wizard-progress-step.is-complete:not(.is-current) {
    color: var(--wizard-blue-dark);
}

.database-wizard-progress-line {
    align-self: center;
    background: var(--wizard-line);
    display: block;
    grid-row: 1;
    height: 1px;
    margin-left: 106px;
    min-width: 0;
    pointer-events: none;
    z-index: 0;
}

.database-wizard-progress-line[data-wizard-line="1"] {
    grid-column: 1;
}

.database-wizard-progress-line[data-wizard-line="2"] {
    grid-column: 2;
}

.database-wizard-progress-line[data-wizard-line="3"] {
    grid-column: 3;
}

.database-wizard-progress [hidden] {
    display: none !important;
}

.database-wizard-panel {
    display: none !important;
    margin: 0;
}

.database-wizard-panel.is-visible {
    display: block !important;
}

.data-type-cards {
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
}

.database-search-wizard.search-container .data-type-card {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--wizard-line);
    border-radius: 13px;
    color: var(--wizard-ink);
    cursor: pointer;
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin: 0 !important;
    min-height: 66px;
    min-width: 0;
    padding: 10px 12px 10px 14px;
    position: relative;
    text-align: left;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
    width: 100% !important;
}

.database-search-wizard.search-container .data-type-card::before {
    background: #2f73dc;
    border-radius: 0 3px 3px 0;
    bottom: 11px;
    content: '';
    left: -1px;
    position: absolute;
    top: 11px;
    width: 3px;
}

.database-search-wizard.search-container .data-type-card:nth-child(2)::before {
    background: #148976;
}

.database-search-wizard.search-container .data-type-card:nth-child(3)::before {
    background: #8557c8;
}

.database-search-wizard .data-type-copy {
    min-width: 0;
}

.database-search-wizard .data-type-card:hover {
    border-color: #9eb9e2;
    box-shadow: 0 6px 16px rgba(37, 74, 127, 0.09);
    transform: translateX(2px);
}

.database-search-wizard .data-type-card.is-active {
    background: var(--wizard-blue-soft);
    border-color: var(--wizard-blue);
    box-shadow: inset 0 0 0 1px rgba(46, 109, 230, 0.14);
}

.database-search-wizard .data-type-card strong,
.database-search-wizard .data-type-card small {
    display: block;
    min-width: 0;
}

.database-search-wizard .data-type-card strong {
    font-size: 0.82rem;
    line-height: 1.2;
}

.database-search-wizard .data-type-card small {
    color: var(--wizard-muted);
    font-size: 0.7rem;
    line-height: 1.3;
    margin-top: 3px;
    overflow-wrap: anywhere;
}

.database-search-wizard .data-type-icon {
    align-items: center;
    background: #edf4ff;
    border: 0;
    border-radius: 9px;
    color: #2f73dc;
    display: inline-flex;
    flex: 0 0 auto;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.database-search-wizard .data-type-card:nth-child(2) .data-type-icon {
    background: #eaf8f5;
    color: #148976;
}

.database-search-wizard .data-type-card:nth-child(3) .data-type-icon {
    background: #f4edfb;
    color: #8557c8;
}

.database-search-wizard .data-type-svg {
    display: block;
    fill: none;
    height: 23px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
    width: 23px;
}

.database-search-wizard .data-type-action {
    align-items: center;
    background: #f2f6fb;
    border-radius: 999px;
    color: #315d9b;
    display: inline-flex;
    font-size: 0.65rem;
    font-weight: 760;
    gap: 6px;
    justify-content: center;
    min-width: 72px;
    padding: 7px 10px;
    transition: background 160ms ease, color 160ms ease;
}

.database-search-wizard .data-type-card:hover .data-type-action,
.database-search-wizard .data-type-card:focus-visible .data-type-action,
.database-search-wizard .data-type-card.is-active .data-type-action {
    background: var(--wizard-blue);
    color: #ffffff;
}

.database-wizard-native-select {
    height: 1px !important;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px !important;
}

.database-species-cards {
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr);
}

.database-search-wizard.search-container .database-species-card {
    align-items: center;
    appearance: none;
    background: #ffffff;
    border: 1px solid var(--wizard-line);
    border-radius: 13px;
    color: var(--wizard-ink);
    cursor: pointer;
    display: grid;
    gap: 12px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin: 0 !important;
    min-height: 66px;
    min-width: 0;
    padding: 10px 12px 10px 14px;
    position: relative;
    text-align: left;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
    width: 100% !important;
}

.database-search-wizard.search-container .database-species-card::before {
    background: #2f73dc;
    border-radius: 0 3px 3px 0;
    bottom: 11px;
    content: '';
    left: -1px;
    position: absolute;
    top: 11px;
    width: 3px;
}

.database-search-wizard.search-container .database-species-card:nth-child(2)::before {
    background: #148976;
}

.database-search-wizard.search-container .database-species-card:nth-child(3)::before {
    background: #c87824;
}

.database-search-wizard.search-container .database-species-card:nth-child(4)::before {
    background: #8557c8;
}

.database-search-wizard .database-species-card:hover {
    border-color: #9eb9e2;
    box-shadow: 0 6px 16px rgba(37, 74, 127, 0.09);
    transform: translateX(2px);
}

.database-search-wizard .database-species-card.is-active {
    background: var(--wizard-blue-soft);
    border-color: var(--wizard-blue);
    box-shadow: inset 0 0 0 1px rgba(46, 109, 230, 0.14);
}

.database-species-mark {
    align-items: center;
    background: #edf4ff;
    border: 0;
    border-radius: 9px;
    color: #2f73dc;
    display: inline-flex;
    flex: 0 0 auto;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.database-species-card:nth-child(2) .database-species-mark {
    background: #eaf8f5;
    color: #148976;
}

.database-species-card:nth-child(3) .database-species-mark {
    background: #fff3e8;
    color: #c87824;
}

.database-species-card:nth-child(4) .database-species-mark {
    background: #f4edfb;
    color: #8557c8;
}

.database-search-wizard .species-svg {
    display: block;
    fill: none;
    height: 32px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.35;
    width: 32px;
}

.database-search-wizard .species-eye {
    fill: currentColor;
    stroke: none;
}

.database-search-wizard .species-svg-worm {
    overflow: visible;
    stroke: none;
}

.database-search-wizard .species-svg-worm .worm-body {
    fill: currentColor;
    stroke: currentColor;
    stroke-linejoin: round;
    stroke-width: 0.45;
}

.database-search-wizard .database-species-card strong,
.database-search-wizard .database-species-card small {
    display: block;
    min-width: 0;
}

.database-search-wizard .database-species-copy {
    min-width: 0;
}

.database-search-wizard .database-species-card strong {
    font-size: 0.84rem;
    line-height: 1.2;
}

.database-search-wizard .database-species-card small {
    color: var(--wizard-muted);
    font-size: 0.7rem;
    line-height: 1.35;
    margin-top: 4px;
}

.database-search-wizard .database-species-action {
    align-items: center;
    background: #f2f6fb;
    border-radius: 999px;
    color: #315d9b;
    display: inline-flex;
    font-size: 0.65rem;
    font-weight: 760;
    gap: 6px;
    justify-content: center;
    min-width: 72px;
    padding: 7px 10px;
    transition: background 160ms ease, color 160ms ease;
}

.database-search-wizard .database-species-card:hover .database-species-action,
.database-search-wizard .database-species-card:focus-visible .database-species-action,
.database-search-wizard .database-species-card.is-active .database-species-action {
    background: var(--wizard-blue);
    color: #ffffff;
}

.database-dataset-step {
    margin: 0;
}

.database-dataset-heading {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.database-dataset-help {
    color: var(--wizard-muted);
    font-size: 0.78rem;
    line-height: 1.45;
    margin: 0 0 14px;
}

.database-dataset-count {
    background: #f4f7fb;
    border: 1px solid var(--wizard-line);
    border-radius: 999px;
    color: var(--wizard-muted);
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 9px;
    white-space: nowrap;
}

.database-dataset-filter {
    align-items: center;
    background: #ffffff;
    border: 1px solid #c8d6e5;
    border-radius: 9px;
    display: flex;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0 10px;
}

.database-dataset-filter:focus-within {
    border-color: var(--wizard-blue);
    box-shadow: 0 0 0 3px rgba(46, 109, 230, 0.12);
}

.database-dataset-filter-icon {
    color: var(--wizard-blue);
    font-size: 1.05rem;
    line-height: 1;
}

.database-dataset-filter input {
    background: transparent;
    border: 0;
    box-sizing: border-box;
    color: var(--wizard-ink);
    font-size: 0.86rem;
    min-height: 40px;
    min-width: 0;
    outline: 0;
    padding: 8px 0;
    width: 100%;
}

.database-dataset-options {
    background: #ffffff;
    border: 1px solid var(--wizard-line);
    border-radius: 11px;
    max-height: 230px;
    overflow-y: auto;
    padding: 4px;
}

.database-search-wizard.search-container .database-dataset-option {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--wizard-ink);
    cursor: pointer;
    display: flex;
    font-size: 0.81rem;
    gap: 12px;
    justify-content: space-between;
    margin: 0 !important;
    min-height: 41px;
    padding: 9px 10px;
    text-align: left;
    width: 100% !important;
}

.database-dataset-option > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.database-dataset-option-arrow {
    color: var(--wizard-blue);
    flex: 0 0 auto;
    font-size: 1rem;
    font-weight: 700;
}

.database-search-wizard .database-dataset-option:hover,
.database-search-wizard .database-dataset-option:focus-visible {
    background: var(--wizard-blue-soft);
    outline: 0;
}

.database-search-wizard .database-dataset-option[aria-selected="true"] {
    background: var(--wizard-blue-soft);
    color: var(--wizard-blue-dark);
    font-weight: 800;
}

.database-search-wizard.search-container .database-dataset-option-all {
    background: #f3f7ff;
    border: 1px solid #c4d8fb !important;
    color: var(--wizard-blue-dark);
    font-weight: 700;
}

.database-search-wizard.search-container .database-dataset-option-all:hover,
.database-search-wizard.search-container .database-dataset-option-all:focus-visible {
    background: var(--wizard-blue-soft);
}

.database-dataset-empty {
    background: #f8fafc;
    border: 1px dashed var(--wizard-line);
    border-radius: 10px;
    color: var(--wizard-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    margin: 0;
    padding: 14px;
}

.database-dataset-selection {
    align-items: baseline;
    background: var(--wizard-blue-soft);
    border: 1px solid #c4d8fb;
    border-radius: 9px;
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 11px;
}

.database-search-wizard .database-dataset-selection[hidden],
.database-search-wizard .database-dataset-empty[hidden] {
    display: none !important;
}

.database-dataset-selection span {
    color: var(--wizard-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.database-dataset-selection strong {
    color: var(--wizard-blue-dark);
    font-size: 0.81rem;
    overflow-wrap: anywhere;
}

.database-visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.database-wizard-form-line,
.database-search-wizard section.database-wizard-form-line {
    align-items: start;
    display: grid !important;
    gap: 14px;
    grid-template-columns: 145px minmax(0, 1fr);
    margin: 0 0 16px !important;
}

.database-wizard-form-line .step-label {
    color: var(--wizard-ink);
    font-size: 0.8rem;
    line-height: 1.35;
    padding-top: 11px;
    width: auto !important;
}

.database-search-wizard .uniform-width,
.database-search-wizard .field-stack.uniform-width {
    box-sizing: border-box;
    max-width: none !important;
    width: 100% !important;
}

.database-search-wizard select.uniform-width,
.database-search-wizard input.uniform-width,
.database-search-wizard textarea.uniform-width {
    background: #ffffff;
    border: 1px solid #c8d6e5;
    border-radius: 9px;
    box-sizing: border-box;
    color: var(--wizard-ink);
    font-size: 0.92rem;
    min-height: 42px;
    padding: 9px 11px;
}

.database-search-wizard textarea.uniform-width {
    height: auto;
    line-height: 1.4;
    resize: vertical;
}

/* Keep every search control aligned with the full-width dataset filter. */
#databaseSearchWizard .database-wizard-panel .field-stack.uniform-width,
#databaseSearchWizard .database-wizard-panel input.uniform-width,
#databaseSearchWizard .database-wizard-panel textarea.uniform-width {
    box-sizing: border-box;
    max-width: none !important;
    width: 100% !important;
}

.database-search-wizard select.uniform-width:focus,
.database-search-wizard input.uniform-width:focus,
.database-search-wizard textarea.uniform-width:focus {
    border-color: var(--wizard-blue);
    box-shadow: 0 0 0 3px rgba(46, 109, 230, 0.12);
    outline: 0;
}

.database-search-wizard .field-stack {
    gap: 7px;
    margin: 0 !important;
    padding: 0 !important;
}

.database-search-wizard input.uniform-width::placeholder,
.database-search-wizard textarea.uniform-width::placeholder {
    color: #8190a5;
    opacity: 1;
}

.database-search-wizard .intersection-option {
    align-items: center;
    color: var(--wizard-ink);
    display: flex;
    font-size: 0.79rem;
    gap: 7px;
    margin: 2px 0 0;
}

.database-search-wizard .intersection-option input {
    margin: 0;
}

.database-search-wizard .intersection-help {
    color: var(--wizard-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.database-search-wizard .database-wizard-primary-action {
    align-items: center;
    background: var(--wizard-blue);
    border: 0;
    border-radius: 9px;
    box-shadow: 0 7px 16px rgba(46, 109, 230, 0.2);
    color: #ffffff;
    display: inline-flex;
    font-size: 0.87rem;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    margin: 2px 0 0 159px !important;
    min-height: 43px;
    padding: 10px 16px;
    transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
    width: auto !important;
}

.database-search-wizard .database-wizard-primary-action:hover {
    background: var(--wizard-blue-dark);
    box-shadow: 0 9px 20px rgba(46, 109, 230, 0.27);
    transform: translateY(-1px);
}

.database-search-wizard .term-chip-list {
    margin: 0;
}

@media screen and (max-width: 850px) {
    .database-search-wizard {
        max-width: 100%;
        padding: 0 !important;
    }

    .database-wizard-progress {
        column-gap: 0;
    }

    .database-wizard-progress-step {
        font-size: 0.72rem;
    }

    .database-wizard-progress-step > span:last-child {
        display: none;
    }

    .database-wizard-context-item {
        max-width: calc(100% - 10px);
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
    }

    .database-wizard-progress-line {
        margin-left: 36px;
        min-width: 0;
    }

    .database-dataset-heading {
        display: block;
    }

    .database-dataset-count {
        display: inline-flex;
        margin: -4px 0 12px;
    }

    .database-wizard-form-line,
    .database-search-wizard section.database-wizard-form-line {
        gap: 7px;
        grid-template-columns: 1fr;
    }

    .database-wizard-form-line .step-label {
        padding-top: 0;
    }

    .database-search-wizard .database-wizard-primary-action {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

@media screen and (max-width: 520px) {
    .database-search-wizard.search-container .data-type-card {
        gap: 10px;
        padding-right: 10px;
    }

    .database-search-wizard .data-type-action,
    .database-search-wizard .database-species-action {
        min-width: 0;
        padding: 7px 9px;
    }
}
