/* ===== Inventory: star map + what's stored where ===== */

/* Site colors come from main.css; these are just for the map */
:root {
    --space: #121214;

    --mark-station: #f0a500;
    --mark-city: #3fb8a0;
    --mark-outpost: #9bd36b;
}

.inventory {
    max-width: 1500px;
    margin: 0 auto;
    font-family: 'Oxanium', Verdana, sans-serif;
    color: var(--orrs-text);
}

.inv-panel {
    background: var(--orrs-panel);
    border-top: 3px solid var(--orrs-orange);
}

/* ---------- hero ---------- */
.inv-hero {
    position: relative;
    border-top: none;
    clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%);
    padding: 22px 26px;
    margin-bottom: 20px;
}

.inv-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font: 700 28px 'Orbitron', Tahoma, sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--orrs-text);
}

.inv-hero::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: var(--orrs-orange);
}

.inv-title-icon {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: var(--orrs-orange);
    stroke-width: 2;
    stroke-linejoin: round;
}

.inv-search-row {
    display: flex;
    gap: 12px;
}

.inv-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--orrs-bg);
    border: 1px solid var(--orrs-border);
    border-radius: 0;
    padding: 0 14px;
}

.inv-search:focus-within { outline: 2px solid var(--orrs-orange); outline-offset: -1px; }

.inv-search svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--orrs-muted);
    stroke-width: 2;
    flex-shrink: 0;
}

.inv-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--orrs-text);
    font: 500 16px 'Oxanium', Verdana, sans-serif;
    padding: 12px 0;
}

.inv-add-btn { padding: 12px 20px; }

.inv-summary {
    margin-top: 12px;
    color: var(--orrs-muted);
    font-size: 14px;
}

.inv-status {
    color: var(--orrs-muted);
    font-size: 1.1rem;
    padding: 30px 0;
}

.inv-status[hidden], .inv-body[hidden] { display: none; }

/* ---------- layout ---------- */
.inv-body {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
    gap: 20px;
    align-items: start;
}

/* ---------- map ---------- */
.inv-map {
    padding: 14px;
    position: sticky;
    top: 90px;
}

.map-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    min-height: 34px;
}

.map-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.crumb {
    background: none;
    border: none;
    color: var(--orrs-muted);
    font: 600 14px 'Oxanium', Verdana, sans-serif;
    padding: 4px 6px;
    border-radius: 0;
    cursor: pointer;
}

.crumb:hover { color: var(--orrs-text); background: var(--orrs-panel-raised); }
.crumb.is-current { color: var(--orrs-orange); }
.crumb-sep { color: var(--orrs-border); }

.map-up {
    flex-shrink: 0;
    background: var(--orrs-panel-raised);
    border: 1px solid var(--orrs-border);
    color: var(--orrs-text);
    font: 600 13px 'Oxanium', Verdana, sans-serif;
    padding: 6px 12px;
    border-radius: 0;
    cursor: pointer;
}

.map-up:disabled { opacity: 0.4; cursor: default; }

.star-map {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
    background: radial-gradient(ellipse at 50% 45%, #1f2330 0%, var(--space) 70%);
    user-select: none;
    touch-action: manipulation;
}

.map-layer {
    transform-box: view-box;
}

.map-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--orrs-muted);
}

.map-orbit {
    fill: none;
    stroke: rgba(255, 255, 255, 0.14);
    stroke-width: 1;
}

.map-orbit.is-faint { stroke-dasharray: 3 5; }

.map-lane {
    stroke: rgba(143, 184, 255, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 2 7;
}

.map-node { cursor: pointer; outline: none; }
.map-node.is-center { cursor: default; }

.map-hit { fill: transparent; }

.map-node .map-shape { transition: transform 0.15s ease; transform-box: fill-box; transform-origin: center; }
.map-node:not(.is-center):hover .map-shape,
.map-node:not(.is-center):focus-visible .map-shape { transform: scale(1.18); }

.map-node:focus-visible .map-hit { stroke: var(--orrs-gold); stroke-width: 2; stroke-dasharray: 3 3; }

.mark-station { fill: var(--mark-station); stroke: #1c1d20; stroke-width: 1; }
.mark-city { fill: var(--mark-city); stroke: #1c1d20; stroke-width: 1; }
.mark-outpost { fill: var(--mark-outpost); stroke: #1c1d20; stroke-width: 0.8; }

.map-node.on-surface:not(.has-items):not(.is-selected) .map-shape { opacity: 0.7; }

.map-label {
    fill: #d9dce2;
    font: 600 13px 'Oxanium', Verdana, sans-serif;
    paint-order: stroke;
    stroke: rgba(10, 11, 14, 0.85);
    stroke-width: 3px;
    pointer-events: none;
}

.map-label.is-center-label {
    font: 700 17px 'Orbitron', Tahoma, sans-serif;
    fill: #ffffff;
}

.map-node.has-items .map-label { fill: var(--orrs-gold); }

.map-halo {
    fill: none;
    stroke: var(--orrs-orange);
    stroke-width: 2;
    opacity: 0.85;
    animation: halo 2.4s ease-in-out infinite;
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes halo {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 0.35; }
}

.map-selected-ring {
    fill: none;
    stroke: #ffffff;
    stroke-width: 2;
    stroke-dasharray: 4 4;
}

.map-badge { fill: var(--orrs-orange); stroke: #1c1d20; stroke-width: 1.5; }

.map-badge-text {
    fill: #1c1d20;
    font: 700 11px 'Oxanium', Verdana, sans-serif;
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .map-halo { animation: none; }
    .map-node .map-shape { transition: none; }
}

/* ---------- side panel ---------- */
.inv-side {
    padding: 20px;
    min-height: 300px;
}

.inv-message {
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 0;
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid var(--orrs-green);
    color: #c9f5da;
}

.inv-message.is-error {
    background: rgba(231, 76, 60, 0.15);
    border-color: var(--orrs-red);
    color: #ffb4ab;
}

.inv-message[hidden] { display: none; }

.side-head { margin-bottom: 14px; }

.side-title {
    font: 700 22px 'Orbitron', Tahoma, sans-serif;
    color: var(--orrs-text);
    overflow-wrap: anywhere;
}

.side-where {
    margin-top: 4px;
    color: var(--orrs-muted);
    font-size: 14px;
}

.loc-chip {
    display: inline-block;
    margin-bottom: 6px;
    padding: 2px 10px;
    border-radius: 0;
    font: 700 11px 'Oxanium', Verdana, sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--orrs-panel-raised);
    color: var(--orrs-muted);
}

.loc-chip.loc-station { color: var(--mark-station); }
.loc-chip.loc-city { color: var(--mark-city); }
.loc-chip.loc-outpost { color: var(--mark-outpost); }

.side-add { margin-bottom: 8px; }
.side-sync { margin-top: 18px; white-space: normal; text-align: left; }

.side-section { margin-top: 18px; }

.side-heading {
    margin-bottom: 8px;
    font: 700 12px 'Oxanium', Verdana, sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--orrs-muted);
}

.side-empty {
    margin-top: 16px;
    color: var(--orrs-muted);
    line-height: 1.5;
}

/* items */
.item-list { display: flex; flex-direction: column; gap: 8px; }

.item-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 0;
    background: var(--orrs-panel-raised);
    border: 1px solid transparent;
}

.item-row.is-flash { animation: flash 1.8s ease-out 1; border-color: var(--orrs-gold); }

@keyframes flash {
    0% { background: rgba(241, 196, 15, 0.35); }
    100% { background: var(--orrs-panel-raised); }
}

.item-contents {
    margin: 6px 0 0 18px;
    padding-left: 12px;
    border-left: 2px solid var(--orrs-border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-icon {
    width: 34px;
    height: 34px;
    border-radius: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
}

.item-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke-width: 1.8;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.item-icon.type-ship svg { stroke: var(--orrs-orange); }
.item-icon.type-vehicle svg { stroke: #1abc9c; }
.item-icon.type-cargo svg { stroke: var(--orrs-gold); }
.item-icon.type-item svg { stroke: #8fb8ff; }

.item-name {
    font-weight: 700;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.item-nick { font-weight: 500; color: var(--orrs-muted); }

.item-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
    color: var(--orrs-muted);
    font-size: 13px;
}

.item-notes {
    margin-top: 4px;
    font-size: 13px;
    color: #c9ccd2;
    font-style: italic;
    overflow-wrap: anywhere;
}

.cap-bar {
    display: inline-block;
    width: 80px;
    height: 6px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.cap-fill { display: block; height: 100%; background: var(--orrs-green); }
.cap-bar.is-over .cap-fill { background: var(--orrs-red); }

.item-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.item-btn {
    background: none;
    border: 1px solid var(--orrs-border);
    color: var(--orrs-text);
    font: 600 12px 'Oxanium', Verdana, sans-serif;
    padding: 4px 8px;
    border-radius: 0;
    cursor: pointer;
}

.item-btn:hover { border-color: var(--orrs-muted); background: rgba(255, 255, 255, 0.05); }
.item-btn.is-danger { color: #ff7b6b; }
.item-btn.is-danger:hover { border-color: var(--orrs-red); }

/* places */
.place-list { display: flex; flex-direction: column; gap: 6px; }

.place-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name count" "where count";
    align-items: center;
    column-gap: 10px;
    text-align: left;
    width: 100%;
    padding: 9px 12px;
    background: var(--orrs-panel-raised);
    border: 1px solid transparent;
    border-radius: 0;
    color: var(--orrs-text);
    font-family: 'Oxanium', Verdana, sans-serif;
    cursor: pointer;
}

.place-link:hover { border-color: var(--orrs-orange); }
.place-name { grid-area: name; font-weight: 700; font-size: 14px; }
.place-where { grid-area: where; font-size: 12px; color: var(--orrs-muted); }

.place-count {
    grid-area: count;
    min-width: 26px;
    padding: 2px 8px;
    border-radius: 0;
    background: var(--orrs-orange);
    color: #1c1d20;
    font-weight: 700;
    font-size: 12px;
    text-align: center;
}

.place-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.place-chip {
    background: transparent;
    border: 1px solid var(--orrs-border);
    color: #d9dce2;
    font: 600 12px 'Oxanium', Verdana, sans-serif;
    padding: 5px 10px;
    border-radius: 0;
    cursor: pointer;
}

.place-chip:hover { border-color: var(--orrs-muted); }
.place-chip.loc-station { border-left: 3px solid var(--mark-station); }
.place-chip.loc-city { border-left: 3px solid var(--mark-city); }
.place-chip.loc-outpost { border-left: 3px solid var(--mark-outpost); }
.place-chip.has-items { border-color: var(--orrs-orange); color: var(--orrs-gold); background: var(--orrs-orange-soft); }

/* search results */
.result-list { display: flex; flex-direction: column; gap: 6px; }

.result {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    background: var(--orrs-panel-raised);
    border: 1px solid transparent;
    border-radius: 0;
    color: var(--orrs-text);
    font-family: 'Oxanium', Verdana, sans-serif;
    cursor: pointer;
}

.result:hover { border-color: var(--orrs-orange); }
.result-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-name { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.result-path { font-size: 12px; color: var(--orrs-muted); overflow-wrap: anywhere; }

/* ---------- add / edit dialog ---------- */
.type-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.type-picker input { position: absolute; opacity: 0; pointer-events: none; }

.type-picker span {
    display: block;
    text-align: center;
    padding: 10px 6px;
    border-radius: 0;
    border: 1px solid var(--form-border);
    color: var(--form-muted);
    font-weight: 700;
    cursor: pointer;
}

.type-picker input:checked + span {
    border-color: var(--form-accent);
    color: var(--form-text);
    background: rgba(230, 126, 34, 0.15);
}

.type-picker input:focus-visible + span { outline: 2px solid var(--form-accent); outline-offset: 2px; }

.qty-row { display: flex; gap: 8px; }
.qty-row input { flex: 1; min-width: 0; }

.qty-row select {
    width: auto;
    font: 500 15px 'Oxanium', Verdana, sans-serif;
    color: var(--form-text);
    background: var(--form-field);
    border: 1px solid var(--form-border);
    border-radius: 0;
    padding: 0 8px;
    color-scheme: dark;
}

.form-field[hidden] { display: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
    .inv-body { grid-template-columns: minmax(0, 1fr); }
    .inv-map { position: static; }
}

@media (max-width: 600px) {
    .inv-hero { padding: 16px; }
    .inv-title { font-size: 22px; }
    .inv-search-row { flex-direction: column; }
    .inv-side { padding: 14px; }
    .item-row { grid-template-columns: 30px minmax(0, 1fr); }
    .item-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .map-label { font-size: 18px; }
}
