/* ==========================================
   COLLECTORS ATLAS — SHARED DASHBOARD HEADER
========================================== */

.topbar.atlas-header {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        minmax(240px, 1.6fr)
        minmax(135px, .72fr)
        minmax(190px, 1fr)
        48px
        minmax(48px, 140px)
        48px;
    align-items: end;
    gap: 14px;
    width: 100%;
    min-height: 92px;
    height: auto;
    padding: 16px 24px 18px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    overflow: visible;
}

.atlas-header-title {
    min-width: 0;
    align-self: center;
}

.atlas-header-title > span,
.atlas-header-label {
    display: block;
    margin: 0 0 6px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: .75px;
    text-transform: uppercase;
}

.atlas-header-title > span {
    color: var(--primary-hover);
}

.atlas-header-title h1 {
    margin: 0;
    overflow: hidden;
    color: var(--text);
    font-size: clamp(21px, 1.7vw, 28px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.atlas-header-search,
.atlas-header-field {
    display: block;
    min-width: 0;
    margin: 0;
}

/* Keep the Game and Set controls aligned with the Search input row.
   The Search column can be taller when its action buttons are visible. */
.atlas-header-field {
    align-self: start;
}

.atlas-header-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.atlas-header-input-wrap > i {
    position: absolute;
    left: 15px;
    z-index: 1;
    color: var(--primary-hover);
    font-size: 14px;
    pointer-events: none;
}

.atlas-header input,
.atlas-header select {
    width: 100%;
    min-width: 0;
    height: 48px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    background: var(--panel-light);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.atlas-header input {
    padding: 0 15px 0 43px;
}

.atlas-header select {
    padding: 0 38px 0 14px;
    cursor: pointer;
}

.atlas-header input::placeholder {
    color: var(--text-light);
    opacity: .9;
}

.atlas-header input:focus,
.atlas-header select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, .14);
}

.atlas-header-selectors {
    display: contents;
}

.atlas-header-settings,
.atlas-notification-trigger,
.topbar.atlas-header > .atlas-account-trigger {
    width: 48px;
    height: 48px;
    align-self: start;
    margin: 21px 0 0;
    border-radius: 12px;
}

.topbar.atlas-header > .atlas-account-trigger {
    width:100%;
    min-width:48px;
    max-width:140px;
}

.topbar.atlas-header > .atlas-account-trigger [data-account-label] {
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.atlas-secondary-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.position-controls {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
}

@media (max-width: 1280px) {
    .topbar.atlas-header {
        grid-template-columns:
            minmax(170px, .85fr)
            minmax(210px, 1.35fr)
            minmax(125px, .65fr)
            minmax(175px, .9fr)
            48px
            48px
            48px;
        gap: 10px;
        padding-inline: 18px;
    }

    .topbar.atlas-header > .atlas-account-trigger {
        width:48px;
        padding:4px;
    }

    .topbar.atlas-header > .atlas-account-trigger [data-account-label] {
        display:none;
    }
}

@media (max-width: 1040px) {
    .topbar.atlas-header {
        grid-template-columns: minmax(0, 1fr) 145px minmax(180px, .85fr) 48px 48px 48px;
        align-items: end;
    }

    .atlas-header-title {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .topbar.atlas-header {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px 48px 48px;
        padding: 16px 18px 18px;
    }

    .atlas-header-title,
    .atlas-header-search {
        grid-column: 1 / -1;
    }

    .atlas-header-title h1 {
        white-space: normal;
    }

    .atlas-notification-trigger {
        grid-column: 3;
    }

    .topbar.atlas-header > .atlas-account-trigger {
        grid-column: 4;
    }

    .atlas-header-settings {
        grid-column: 5;
    }

    .atlas-secondary-controls,
    .position-controls {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 520px) {
    .topbar.atlas-header {
        grid-template-columns: minmax(0, 1fr) 48px 48px 48px;
    }

    .atlas-header-title,
    .atlas-header-search,
    .atlas-header-field {
        grid-column: 1 / -1;
    }

    .atlas-notification-trigger {
        grid-column: 2;
    }

    .topbar.atlas-header > .atlas-account-trigger {
        grid-column: 3;
    }

    .atlas-header-settings {
        grid-column: 4;
    }
}

/* ==========================================
   UNIVERSAL SEARCH RESULTS
========================================== */

.atlas-header-search-shell {
    position: relative;
    min-width: 0;
    align-self: start;
}

.atlas-header-search-shell .atlas-header-search {
    width: 100%;
}

.atlas-search-dropdown {
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    z-index: 1200;
    width: min(560px, calc(100vw - 42px));
    max-height: min(430px, 62vh);
    overflow: hidden auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .28);
}

.atlas-search-dropdown[hidden] {
    display: none;
}

.atlas-search-results {
    display: grid;
    gap: 4px;
}

.atlas-search-result {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 58px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.atlas-search-result:hover,
.atlas-search-result.active {
    border-color: rgba(124, 92, 252, .34);
    background: rgba(124, 92, 252, .1);
}

.atlas-search-result-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(124, 92, 252, .12);
    color: var(--primary-hover);
    font-size: 13px;
}

.atlas-search-result-copy {
    display: block;
    min-width: 0;
}

.atlas-search-result-copy strong,
.atlas-search-result-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.atlas-search-result-copy strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.atlas-search-result-copy small {
    margin-top: 3px;
    color: var(--text-light);
    font-size: 12px;
}

.atlas-search-result-status {
    display: grid;
    justify-items: end;
    gap: 5px;
    min-width: 118px;
}

.atlas-search-result-status.set-result,
.atlas-search-ownership {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.atlas-search-ownership.owned {
    border-color: rgba(66, 211, 146, .3);
    background: rgba(66, 211, 146, .08);
    color: var(--success);
}

.atlas-search-market-value {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.atlas-search-market-value small {
    color: var(--text-light);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.atlas-search-market-value strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.atlas-search-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 82px;
    color: var(--text-light);
    font-size: 12px;
}

.atlas-search-empty[hidden],
.atlas-search-results[hidden] {
    display: none;
}

.atlas-light-theme .atlas-search-dropdown {
    box-shadow: 0 18px 38px rgba(46, 54, 73, .14);
}

.atlas-light-theme .atlas-search-result:hover,
.atlas-light-theme .atlas-search-result.active {
    background: #f0edff;
}

@media (max-width: 760px) {
    .atlas-header-search-shell {
        grid-column: 1 / -1;
    }

    .atlas-search-dropdown {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .atlas-header-search-shell {
        grid-column: 1 / -1;
    }

    .atlas-search-result {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .atlas-search-result-icon {
        width: 34px;
        height: 34px;
    }

    .atlas-search-result-status {
        grid-column: 2;
        justify-self: start;
        justify-items: start;
    }

    .atlas-search-market-value {
        justify-content: flex-start;
    }
}
