/* ===================================================================
   EVE Mission Hub Finder – public/css/emh-public.css
   =================================================================== */

.emh-app {
    --bg0:       #08101a;
    --bg1:       #0d1825;
    --bg2:       #111f30;
    --bg3:       #16283a;
    --row-even:  #0d1825;
    --row-odd:   #101e2e;
    --border:    #1c2e42;
    --border-hi: #2a4460;
    --text:      #c8d8e8;
    --text-dim:  #7090aa;
    --text-faint:#405060;
    --accent:    #3a9fff;
    --accent-dim:#1a5aae;
    --gold:      #c8a840;
    --green:     #2dba6a;
    --orange:    #d88020;
    --red:       #d84040;
    --purple:    #9060e0;

    position:    relative;
    background:  var(--bg0);
    color:       var(--text);
    border:      1px solid var(--border);
    border-radius: 8px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size:   1.1rem;
    line-height: 1.6;
    overflow:    hidden;
}

.emh-notice { padding: .75rem 1.25rem; border-radius: 5px; margin: .5rem 0; }
.emh-notice-warn { background: #1a1000; border: 1px solid #705010; color: #d09040; }

/* ── Loader ──────────────────────────────────────────────────────── */
.emh-loader {
    position: absolute; inset: 0;
    background: rgba(8,16,26,.92);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; border-radius: 8px;
}
.emh-loader-inner { text-align: center; color: var(--text-dim); }
.emh-spinner-large {
    width: 48px; height: 48px;
    border: 4px solid var(--border-hi);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: emh-spin 1s linear infinite;
    margin: 0 auto .75rem;
}
@keyframes emh-spin { to { transform: rotate(360deg); } }

/* ── Toolbar ─────────────────────────────────────────────────────── */
.emh-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--bg1);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap; gap: .5rem;
}
.emh-toolbar-left  { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.emh-toolbar-right { display: flex; align-items: center; gap: .5rem; }

.emh-app-title { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.emh-record-count { font-size: 1.05rem; color: var(--text-dim); }

.emh-view-toggle { display: flex; }
.emh-view-btn {
    background: var(--bg2); border: 1px solid var(--border);
    color: var(--text-dim); padding: .35rem .8rem; font-size: 1rem; cursor: pointer; transition: all .15s;
}
.emh-view-btn:first-child { border-radius: 4px 0 0 4px; }
.emh-view-btn:last-child  { border-radius: 0 4px 4px 0; border-left: none; }
.emh-view-btn.active      { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.emh-view-btn:hover:not(.active) { border-color: var(--border-hi); color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.emh-btn {
    background: var(--bg2); border: 1px solid var(--border-hi);
    border-radius: 4px; color: var(--text); cursor: pointer;
    font-size: 1rem; padding: .45rem .9rem; transition: all .15s;
}
.emh-btn:hover { border-color: var(--accent); color: var(--accent); }
.emh-btn-reset { color: var(--text-dim); }
.emh-btn-reset:hover { color: var(--orange); border-color: var(--orange); }

/* ── Filter panel ────────────────────────────────────────────────── */
.emh-filter-panel {
    background: var(--bg1); border-bottom: 1px solid var(--border);
    padding: .85rem 1.1rem; transition: all .25s;
}
.emh-filter-panel.emh-panel-hidden { display: none; }

.emh-filter-row {
    display: flex; flex-wrap: wrap; gap: .75rem 1.5rem;
    align-items: flex-start; margin-bottom: .6rem;
}
.emh-filter-row:last-child { margin-bottom: 0; }
.emh-filter-row-hub { border-top: 1px solid var(--border); padding-top: .6rem; margin-top: .2rem; }

.emh-filter-selects-col {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.emh-filter-selects-col .emh-filter-group { gap: .2rem; }
.emh-filter-search-col { flex: 0 1 280px; display: flex; flex-direction: column; gap: .4rem; }
.emh-filter-search-col > .emh-filter-group { gap: .2rem; }
.emh-filter-narrow { min-width: 180px; }

.emh-app label:not(.emh-check-pill):not(.emh-label-inline) {
    font-size: .95rem; font-weight: 700; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: .06em;
}
.emh-label-hint { font-weight: 400; text-transform: none; color: var(--text-faint); letter-spacing: 0; }

.emh-app input[type="search"] {
    background: var(--bg0); border: 1px solid var(--border-hi);
    border-radius: 4px; color: var(--text); padding: .5rem .75rem;
    font-size: 1.1rem; width: 100%; outline: none; box-sizing: border-box;
}
.emh-app input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(58,159,255,.15); }

.emh-app select {
    background: var(--bg0); border: 1px solid var(--border-hi);
    border-radius: 4px; color: var(--text); padding: .45rem .6rem;
    font-size: 1.05rem; min-width: 160px; outline: none;
}
.emh-app select:focus { border-color: var(--accent); }
.emh-app select option { background: #0d1825; color: var(--text); }

.emh-check-group { display: flex; flex-wrap: wrap; gap: .35rem; }
.emh-check-group.emh-check-vertical { flex-direction: column; gap: .25rem; }
.emh-check-pill {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; padding: .25rem .7rem;
    font-size: 1rem; cursor: pointer; transition: all .15s;
    color: var(--text-dim); white-space: nowrap;
}
.emh-check-pill:has(input:checked) { background: var(--accent-dim); border-color: var(--accent); color: #fff; }
.emh-check-pill input { display: none; }

.emh-level-1:has(input:checked) { background: #10304a; border-color: #4090c0; color: #9dd0f0; }
.emh-level-2:has(input:checked) { background: #103020; border-color: #30a060; color: #80d0a0; }
.emh-level-3:has(input:checked) { background: #301a00; border-color: #a07020; color: #e0c060; }
.emh-level-4:has(input:checked) { background: #300808; border-color: #a02020; color: #f08080; }
.emh-level-5 { border-color: #707080; color: #d0d0e0; }
.emh-level-5:has(input:checked) { background: #1e1e22; border-color: #9090a0; color: #f0f0f8; }

.emh-hub-options-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.emh-label-inline { font-size: .97rem; color: var(--text-dim); display: flex; align-items: center; gap: .4rem; }
.emh-num-small {
    background: var(--bg0); border: 1px solid var(--border-hi);
    border-radius: 3px; color: var(--text); width: 50px;
    padding: .2rem .4rem; font-size: 1rem;
}

.emh-range-wrap { display: flex; align-items: center; gap: .5rem; }
.emh-app input[type="range"] {
    -webkit-appearance: none; flex: 1; min-width: 80px; height: 5px;
    border-radius: 2px; background: var(--border-hi); outline: none; cursor: pointer;
}
.emh-app input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px;
    border-radius: 50%; background: var(--accent); cursor: pointer;
}
.emh-highsec-only { transition: opacity .2s; }
.emh-filter-disabled { opacity: .35; pointer-events: none; }


/* Hub options row embedded under search */
.emh-hub-inline .emh-hub-options-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

/* Selects column — label + dropdown rows aligned in a grid */
.emh-filter-selects-col {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: .6rem;
    row-gap: .35rem;
    align-items: center;
}
.emh-filter-selects-col > .emh-filter-group { display: contents; }
.emh-select-row {
    display: contents;
}
.emh-select-row label {
    white-space: nowrap;
    text-align: right;
}
.emh-filter-selects-col select { width: 100%; min-width: 160px; }

/* Unified Location block: sec sub-cards stacked vertically */
.emh-sec-block { min-width: 260px; }
.emh-sec-cards {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

/* Each sec class is its own mini-card */
.emh-sec-card {
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: .4rem .6rem;
    background: var(--bg2);
    transition: border-color .15s, background .15s;
}
.emh-sec-card:has(input:checked) { background: var(--bg3); border-color: var(--border-hi); }
.emh-sec-card-highsec:has(input:checked) { border-color: #2a6040; background: #0a180e; }
.emh-sec-card-lowsec:has(input:checked)  { border-color: #604018; background: #18100a; }
.emh-sec-card-nullsec:has(input:checked) { border-color: #602020; background: #180a0a; }

.emh-sec-card-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
}
.emh-sec-card-label input { cursor: pointer; width: 15px; height: 15px; }
.emh-sec-name { font-weight: 700; }

/* Jumps row inside highsec card — only visible when highsec checked */
.emh-jumps-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .4rem;
    padding-top: .4rem;
    border-top: 1px solid var(--border);
}
.emh-jumps-row-label { font-size: .95rem; color: var(--text-dim); white-space: nowrap; }

.emh-range-val { font-size: 1.05rem; color: var(--accent); min-width: 2rem; font-weight: 700; text-align: right; }

.emh-storyline-inline {
    font-size: .88rem;
    color: var(--gold);
    font-weight: 600;
    white-space: normal;  /* allow wrapping on narrow screens */
}
.emh-storyline-near {
    color: #80b880;
}
.emh-count-hint { font-weight: 400; color: var(--text-faint); font-size: .83rem; }

/* ── Results area ────────────────────────────────────────────────── */
.emh-results-area { padding: .75rem 1rem; }

.emh-empty, .emh-error {
    background: var(--bg1); border: 1px solid var(--border);
    border-radius: 6px; padding: 1.5rem; text-align: center; color: var(--text-dim);
}
.emh-error { border-color: #501010; color: var(--red); }

.emh-hub-count { font-size: .97rem; color: var(--text-dim); margin-bottom: .5rem; }
.emh-truncate-notice {
    background: #1a1a00; border: 1px solid #505000;
    border-radius: 5px; padding: .5rem .75rem;
    font-size: .8rem; color: var(--gold); margin-top: .5rem; text-align: center;
}

/* ── Hub / Station cards ─────────────────────────────────────────── */
.emh-hub-list { display: flex; flex-direction: column; gap: .5rem; }

.emh-hub-card {
    background: var(--bg1); border: 1px solid var(--border);
    border-radius: 7px; overflow: hidden; transition: border-color .15s;
}
.emh-hub-card.expanded      { border-color: var(--border-hi); }
.emh-hub-card.emh-hub-highlight { border-left: 3px solid var(--gold); }

.emh-hub-header {
    display: flex; align-items: center; gap: .6rem;
    padding: .65rem .85rem; cursor: pointer; user-select: none;
}
.emh-hub-header:hover { background: #131f2e; }

.emh-hub-rank { font-size: 1.05rem; font-weight: 700; color: var(--text-faint); min-width: 2.2rem; }

.emh-hub-meta { flex: 1; min-width: 200px; }
.emh-hub-station-name { font-size: 1.2rem; font-weight: 700; color: var(--text); line-height: 1.25; }
.emh-hub-system-line  { display: flex; align-items: center; gap: .4rem; margin-top: .15rem; flex-wrap: wrap; }
.emh-system-name      { font-size: .9rem; color: var(--text-dim); }
.emh-sec-class-label  { font-size: .83rem; color: var(--text-faint); }

/* Security status */
.emh-sec { font-size: .88rem; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.sec-hi-hi { background: #082008; color: #40cc40; }
.sec-hi    { background: #142008; color: #90cc30; }
.sec-lo    { background: #1e1200; color: var(--orange); }
.sec-null  { background: #1a0505; color: var(--red); }
.sec-wh    { background: #140a28; color: var(--purple); }

.emh-hub-badges { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.emh-badge { font-size: .88rem; font-weight: 600; padding: 3px 9px; border-radius: 10px; white-space: nowrap; }
.emh-badge-dist    { background: #0a1e30; border: 1px solid #1a3a58; color: var(--accent); }
.dist-very-safe    { background: #071a0a; border-color: #1a5228; color: var(--green) !important; }
.dist-safe         { background: #0a1a0e; border-color: #204a30; color: #6bcfa0 !important; }
.dist-medium       { background: #1e1500; border-color: #604800; color: var(--gold) !important; }
.dist-close        { background: #1e0808; border-color: #601010; color: var(--red) !important; }
.dist-na           { background: var(--bg2); border: 1px solid var(--border); color: var(--text-faint) !important; }
.emh-badge-faction { background: #0e1a28; border: 1px solid #1e3050; color: #a8c8e8; }

/* Level badges */
.emh-lbadge { font-size: 1rem; font-weight: 700; padding: 2px 7px; border-radius: 3px; display: inline-block; }
.emh-level-1 { background: #0a1e2e; color: #5090c0; }
.emh-level-2 { background: #0a1e0a; color: #40a860; }
.emh-level-3 { background: #1e1400; color: var(--gold); }
.emh-level-4 { background: #1e0808; color: #cc5050; }

.emh-dbadge { font-size: 1.05rem; background: #0e1e30; border: 1px solid #1a3050; color: #80a8c8; padding: 1px 6px; border-radius: 3px; }
.emh-score  { font-size: .97rem; color: var(--text-faint); margin-left: auto; }

.emh-toggle-arrow { color: var(--text-faint); font-size: .9rem; transition: transform .2s; }
.emh-hub-card.expanded .emh-toggle-arrow { transform: rotate(180deg); }

/* Hub body */
.emh-hub-body { padding: 0 .85rem .85rem; }

.emh-hub-station-section { margin-top: .75rem; border-top: 1px solid var(--border); padding-top: .5rem; }
.emh-hub-station-section:first-child { border-top: none; margin-top: .25rem; }
.emh-hub-station-label {
    font-size: 1rem; font-weight: 600; color: var(--text-dim);
    margin-bottom: .3rem; display: flex; align-items: center; gap: .5rem;
}
.emh-agent-pill {
    font-size: .9rem; background: #1a2e45; color: var(--accent);
    padding: 1px 7px; border-radius: 10px; font-weight: 600;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.emh-table {
    width: 100%; border-collapse: collapse;
    font-size: .95rem; margin-top: .4rem;
}

.emh-table thead tr { background: #091420; }
.emh-table th {
    text-align: left; color: #7090aa;
    font-size: .88rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    padding: .35rem .5rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

/* Both row variants: JS sets background-color and color as inline styles */
.emh-table tbody tr:hover td { background-color: #1a2e44 !important; color: #c8d8e8 !important; }

/* Flat table */
.emh-table-wrap { overflow-x: auto; border-radius: 5px; border: 1px solid var(--border); }
.emh-table-flat th { cursor: pointer; }
.emh-table-flat th:hover { color: var(--accent); }
.emh-table-flat .sort-asc, .emh-table-flat .sort-desc { color: var(--accent); }
.emh-cell-small { font-size: .93rem; color: var(--text-dim); max-width: 220px; }

/* Agent type + locator pills */
.emh-type-pill {
    font-size: .95rem; background: var(--bg3); color: #7090a8;
    padding: 1px 5px; border-radius: 3px; white-space: nowrap;
}
.emh-locator-tag {
    font-size: .85rem; background: #1a1040; color: #9070d0;
    padding: 0 4px; border-radius: 3px; vertical-align: middle;
}

/* Sec-class text in flat table */
.emh-secclass-highsec { color: var(--green); }
.emh-secclass-lowsec  { color: var(--orange); }
.emh-secclass-nullsec { color: var(--red); }
.emh-secclass-wormhole{ color: var(--purple); }

/* Distance colour in flat table */
.dist-very-safe { color: var(--green) !important; }
.dist-safe      { color: #6bcfa0 !important; }
.dist-medium    { color: var(--gold) !important; }
.dist-close     { color: var(--red) !important; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .emh-filter-row { gap: .5rem; }
    .emh-hub-header { padding: .5rem .6rem; }
    .emh-hub-badges { gap: .25rem; }
    .emh-table th, .emh-table td { padding: .25rem .3rem; font-size: .83rem; }
    .emh-hub-meta   { min-width: 160px; }
}

/* ── Min-agents stepper + scope pills ───────────────────────────────────── */
.emh-min-agents-pill {
    display: inline-flex; align-items: center; gap: 0;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; overflow: hidden;
    white-space: nowrap;
}
.emh-min-agents-label {
    padding: .25rem .65rem;
    font-size: .88rem; color: var(--text-dim);
    border-right: 1px solid var(--border);
}
.emh-min-agents-btn {
    background: none; border: none; color: var(--text-dim);
    font-size: 1rem; line-height: 1; padding: .25rem .55rem;
    cursor: pointer; transition: color .15s, background .15s;
}
.emh-min-agents-btn:hover { color: #fff; background: var(--accent-dim); }
.emh-min-agents-val {
    min-width: 1.6rem; text-align: center;
    font-size: .95rem; font-weight: 600; color: var(--text);
    padding: 0 .1rem;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.emh-scope-pills {
    display: inline-flex; gap: .3rem;
}
.emh-scope-pill {
    display: inline-flex; align-items: center;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 12px; padding: .25rem .7rem;
    font-size: .88rem; color: var(--text-dim);
    cursor: pointer; transition: all .15s; white-space: nowrap;
    user-select: none;
}
.emh-scope-pill:hover { border-color: var(--accent); color: var(--text); }
.emh-scope-pill.emh-scope-pill-active {
    background: var(--accent-dim); border-color: var(--accent); color: #fff;
}
