/* =============================================================================
   destinations-drawer.css - Destinations drawer (filters, search, table)
   Builds on the .cab-drawer chrome in ship-context-bar.css; markup comes from
   src/destinationsDrawer.js.
   ============================================================================= */

.cab-drawer--destinations {
    --dest-cols: minmax(0, 1fr) 9.5rem 6.5rem 7rem 8rem;
}

/* ── Controls: type chips · search ───────────────────────────────────────── */

.dest-controls {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    /* Same inset as the framed header/body (frame-skin.css). */
    padding: var(--space-xs) calc(var(--space-sm) + var(--frame-edge, 0px) * 0.35);
    border-bottom: 1px solid rgba(197, 160, 89, 0.1);
}

.dest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.dest-chip {
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(197, 160, 89, 0.15);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.12s,
        border-color 0.12s,
        color 0.12s;
}

.dest-chip:hover {
    color: var(--text-primary);
    border-color: rgba(197, 160, 89, 0.35);
}

.dest-chip.is-active {
    color: var(--gold);
    background: rgba(197, 160, 89, 0.12);
    border-color: rgba(197, 160, 89, 0.6);
}

.dest-count {
    color: var(--text-tertiary);
}

.dest-chip.is-active .dest-count {
    color: inherit;
    opacity: 0.8;
}

.dest-search {
    flex: 1 1 10rem;
    min-width: 8rem;
    margin-left: auto;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: var(--radius-sm);
    outline: none;
}

.dest-search:focus {
    border-color: rgba(197, 160, 89, 0.55);
}

/* Gold clear (×) button - same glyph as .bl-search in shipyard-library.css. */
.dest-search::-webkit-search-cancel-button {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    margin-left: var(--space-2xs);
    background: center / contain no-repeat
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath stroke='%23c5a059' stroke-width='1.5' stroke-linecap='round' d='M2 2l8 8M10 2 2 10'/%3E%3C/svg%3E");
    cursor: pointer;
}

.dest-search::placeholder {
    color: var(--text-tertiary);
}

/* ── Table ─────────────────────────────────────────────────────────────────── */

.dest-table-head,
.cab-drawer--destinations .dest-row {
    display: grid;
    grid-template-columns: var(--dest-cols);
    align-items: center;
    gap: var(--space-sm);
}

/* Sticky first row of the scrolling body; same padding as .cab-drawer-row. */
.dest-table-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: var(--space-2xs) var(--space-sm);
    background: var(--frame-panel-fill, rgba(8, 12, 18, 0.97));
    border-bottom: 1px solid rgba(197, 160, 89, 0.1);
}

.dest-th {
    padding: 0;
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    text-align: left;
    background: none;
    border: none;
}

button.dest-th {
    cursor: pointer;
}

button.dest-th:hover {
    color: var(--text-primary);
}

.dest-sort-dir {
    font-size: 0.7em;
    color: var(--gold);
}

.cab-drawer--destinations .dest-body {
    max-height: 360px;
}

.dest-col-name {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.dest-row-desc {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dest-row.is-undiscovered .cab-row-name {
    color: var(--text-tertiary);
    letter-spacing: 0.1em;
}

.dest-col-type {
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    min-width: 0;
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

.dest-type-icon {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    object-fit: contain;
    opacity: 0.85;
}

.dest-col-loc {
    font-family: var(--font-body);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}

.cab-drawer--destinations .dest-col-dist {
    min-width: 0;
}

.dest-col-action {
    display: flex;
    justify-content: flex-end;
}

.dest-col-action .cab-row-btn {
    width: 100%;
}

/* Narrow screens: keep Name, Distance and the action. */
@media (max-width: 767px) {
    .cab-drawer--destinations {
        --dest-cols: minmax(0, 1fr) 5.5rem 6.5rem;
    }

    .cab-drawer--destinations .dest-col-type,
    .cab-drawer--destinations .dest-col-loc {
        display: none;
    }

    .dest-search {
        flex-basis: 100%;
        margin-left: 0;
    }
}
