/* Ekwipunek. */
.inventory-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.inventory-current,
.inventory-owned {
    grid-column: 1;
}

/* Przedmioty po prawej obok broni. */
.inventory-magic {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
}

.inventory-current,
.inventory-owned,
.inventory-magic,
.inventory-ad {
    min-width: 0;
    margin-top: 0.875rem;
}

.inventory-current h3,
.inventory-owned h3,
.inventory-magic h3,
.inventory-ad h3 {
    margin: 0.125rem 0 0.5rem;
    font-family: var(--font-title);
    font-size: 1.125rem;
    font-weight: 400;
}

/* --- Aktualna broń --------------------------------------------------------- */
.inventory-current-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--accent);
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px var(--accent);
    background: var(--shop-info-background);
}

.inv-current-icon {
    display: contents;
}

.inventory-current-body {
    min-width: 0;
    flex: 1;
}

.inventory-current-card h4 {
    margin: 0;
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 400;
}

.inventory-current-card .stat-chips {
    margin: 0.375rem 0;
}

.inventory-current-body > span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* --- Karty przedmiotów, broni i umiejętności --------------------------------- */
.inventory-layout .shop-items {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    /* Zapas, zanim skrypt policzy wysokość ~1,5 karty (patrz fitLists w inventory.js). */
    max-height: 15rem;
}

.inv-card {
    display: grid;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.5rem 0.75rem;
    padding: 0.625rem;
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-card-background);
}

.inv-card.is-equipped {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* Ikona: ramka jak w sklepie. Selektor z .inventory-layout wygrywa z .game-icon z hud.css. */
.inventory-layout .inv-card-icon,
.inventory-current-card .inv-card-icon {
    width: 3.25rem;
    height: 3.25rem;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--shop-border-color);
    border-radius: 8px;
    background: var(--shop-info-background);
}

.inventory-layout .inv-card-icon.is-large,
.inventory-current-card .inv-card-icon.is-large {
    width: 4rem;
    height: 4rem;
}

.inv-card-icon img {
    padding: 0;
    box-sizing: border-box;
}

.inv-card-icon .game-icon-glyph {
    font-size: 1.625rem;
}

.inv-card-icon.is-large .game-icon-glyph {
    font-size: 2rem;
}

.inv-card-main {
    min-width: 0;
}

.inv-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.125rem 0.5rem;
}

.inv-card-head h4 {
    margin: 0;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

.inv-badge {
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.inv-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.inv-tag {
    padding: 0.0625rem 0.4375rem;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    background: var(--shop-info-background);
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

.inv-tag.is-ad { color: var(--warn); }
.inv-tag.is-ap { color: var(--rar-rare); }
.inv-tag.is-unique { color: var(--rar-legendary); }

.inv-card .stat-chips {
    margin: 0.375rem 0 0;
    align-items: center;
}

.inv-details-title {
    margin: 0;
    color: var(--text-muted);
}

/* Przyciski akcji: w jednym rzędzie na dole karty. */
.inv-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    grid-column: 1 / -1;
    gap: 0.5rem;
}

.inv-card-actions button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.875rem;
}

.inv-card-actions .inv-tag {
    flex: 1 1 0;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
}

.inv-equip.is-active {
    opacity: 0.7;
}

/* Sprzedaż wymaga potwierdzenia: drugi klik na przycisku w kolorze ostrzegawczym. */
.inv-sell.is-confirm {
    border-color: var(--bad);
    background: rgba(179, 48, 58, 0.9);
    color: #ffffff;
    font-weight: 700;
}

/* --- Sloty -------------------------------------------------------------------- */
.slot-meter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1rem;
    margin: 0 0 0.5rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-info-background);
}

.slot-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slot-label {
    min-width: 1.75rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.slot-pips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* AD to kwadrat, AP to kółko — kolor nie jest jedynym nośnikiem informacji. */
.slot-pip {
    width: 0.875rem;
    height: 0.875rem;
    box-sizing: border-box;
    border: 1px solid var(--shop-border-color);
    border-radius: 3px;
    background: transparent;
}

.slot-pip.is-ad {
    border-color: var(--warn);
    background: var(--warn);
}

.slot-pip.is-ap {
    border-color: var(--rar-rare);
    border-radius: 50%;
    background: var(--rar-rare);
}

.slot-count {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

/* --- Wyszukiwarka, sortowanie i akcje zbiorcze --------------------------------- */
.inv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
}

#inventory-search,
#inventory-sort {
    box-sizing: border-box;
    min-width: 0;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--shop-border-color);
    color: var(--field-text);
    background: var(--field-bg);
}

#inventory-search {
    flex: 1 1 8rem;
}

#inventory-sort {
    flex: 0 1 8rem;
}

.inv-bulk {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0 0.5rem;
}

.inv-bulk-btn {
    flex: 1 1 8rem;
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
}

.inv-bulk .inv-sell.is-confirm {
    flex-grow: 2;
}

/* --- Filtr przedmiotów ---------------------------------------------------------- */
.inv-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0 0 0.5rem;
}

.inv-filter-btn {
    display: inline-flex;
    flex: 1 1 0;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.875rem;
    white-space: nowrap;
}

.inv-filter-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 700;
}

.inv-filter-count {
    font-size: 0.8em;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.inv-empty {
    grid-column: 1 / -1;
    margin: 0.75rem 0;
    color: var(--text-muted);
    text-align: center;
}

.inventory-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

/* Licznik zajętych slotów przy nagłówkach (sklep i ekwipunek). */
.slot-counter {
    margin-left: 0.375rem;
    font-family: system-ui, sans-serif;
    font-size: 0.7em;
    opacity: 0.85;
    white-space: nowrap;
}

/* --- Przycisk „Szczegóły” na karcie ------------------------------------------------ */
.inv-card-actions .inv-details-btn {
    flex: 0 0 100%;
}

/* --- Okno szczegółów (telefon i komputer) ------------------------------------------ */
.inv-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: none;
    background: rgba(0, 0, 0, 0.65);
}

.inv-backdrop.is-open {
    display: block;
}

.inv-modal {
    position: fixed;
    z-index: 20;
    top: 50%;
    right: 0.75rem;
    left: 0.75rem;
    display: none;
    box-sizing: border-box;
    max-width: 26rem;
    max-height: calc(100dvh - 1.5rem);
    margin: 0 auto;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateY(-50%);
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-card-background);
}

.inv-modal.is-open {
    display: block;
}

.inv-modal h3 {
    margin: 0 0 0.25rem;
    text-align: left;
}

.inv-modal .shop-details-title p {
    margin: 0;
}

.inv-modal .shop-details-icon {
    width: 5rem;
    height: 5rem;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--shop-border-color);
    border-radius: 8px;
    background: var(--shop-info-background);
}

.inv-modal .shop-details-icon .game-icon-glyph {
    font-size: 2.5rem;
}

.inv-modal-close {
    flex: none;
}

.inv-modal .shop-details-actions button,
.inv-modal .shop-details-actions .inv-tag {
    min-height: 2.5rem;
}

.inv-modal .shop-details-actions .inv-tag {
    display: grid;
    place-items: center;
}
