/* Sklep. */
.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-soft);
}

#shop-money,
.shop-current-weapon {
    padding: 0.4375rem 0.5625rem;
    border: 1px solid var(--shop-border-color);
    background: var(--shop-info-background);
}

.shop-current-weapon {
    margin-bottom: 0.75rem;
}

/* Układ jak w skinach: filtry | szukajka + lista | podgląd. */
.shop-store-layout {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr) minmax(17rem, 0.85fr);
    gap: 0.625rem 0.75rem;
    margin-top: 0.75rem;
}

/* Panele kart (na telefonie osobne, przesuwane) na komputerze nie istnieją jako pudełka. */
.shop-pane {
    display: contents;
}

.shop-filters {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    align-self: start;
    gap: 0.375rem;
    padding: 0.625rem;
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-card-background);
}

.shop-filters h3 {
    margin: 0 0 0.25rem;
    font-family: var(--font-title);
    font-weight: 400;
}

.shop-filter {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    text-align: left;
}

/* Nazwa | sloty (AD/AP) | liczba przedmiotów; sloty przechodzą do drugiej linii, gdy brakuje miejsca. */
.shop-filter {
    flex-wrap: wrap;
}

.shop-filter > span:first-child {
    flex: 1 1 auto;
}

.shop-filter-slots {
    font-size: 0.8em;
    opacity: 0.85;
}

.shop-filter-count {
    margin-left: auto;
    font-size: 0.8em;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

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

.shop-search-row {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

#shop-search {
    flex: 1 1 12rem;
    box-sizing: border-box;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--shop-border-color);
    color: var(--field-text);
    background: var(--field-bg);
}

#shop-sort {
    flex: 0 1 11rem;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--shop-border-color);
    color: var(--field-text);
    background: var(--field-bg);
}

.shop-list {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 32rem;
    max-height: 32rem;
    gap: 0.875rem;
    overflow-y: auto;
    padding: 0.125rem 0.375rem 0.375rem 0.125rem;
    overscroll-behavior: contain;
    scrollbar-color: var(--shop-border-color) rgba(5, 28, 69, 0.28);
}

.shop-group {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shop-group-title {
    margin: 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--font-title);
    font-weight: 400;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.5rem;
    align-content: start;
}

/* Widok ogólny: jeden poziomo przewijany rząd na kategorię. */
.shop-list:not(.shop-list-filtered) .shop-grid {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: var(--shop-border-color) rgba(5, 28, 69, 0.28);
}

.shop-list:not(.shop-list-filtered) .shop-card {
    flex: 0 0 16rem;
    scroll-snap-align: start;
}

.shop-empty {
    margin: 0.5rem 0;
    text-align: center;
}

/* Tekst po lewej, ikona po prawej stronie karty — ikona nie zwiększa wysokości karty. */
.shop-card {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.5rem;
    align-content: start;
    padding: 0.5rem;
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-card-background);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.shop-card h4,
.shop-card p {
    grid-column: 1;
}

.shop-card h4 {
    min-height: 2.4rem;
    margin: 0.25rem 0 0.25rem;
    font-size: 1.05rem;
}

.shop-card p {
    margin: 0.125rem 0 0;
    font-size: 0.9rem;
}

/* Ikona przedmiotu: prawy dolny róg karty, rozmiar jak ikony umiejętności w walce (.tile-frame). */
.shop-card .shop-card-icon {
    width: 3.25rem;
    height: 3.25rem;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--shop-border-color);
    border-radius: 8px;
    background: var(--shop-info-background);
}

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

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

/* Ikony umiejętności klas są większe niż reszta. */
.shop-card .shop-card-icon.is-large {
    width: 4.5rem;
    height: 4.5rem;
}

.shop-card .shop-card-icon.is-large .game-icon-glyph {
    font-size: 2.25rem;
}

.shop-card-price {
    font-weight: 700;
}

.shop-card-missing,
.shop-card-status {
    color: var(--control-text-color);
}

.shop-card-missing.is-short,
.shop-price-missing.is-short {
    color: var(--bad);
}

.shop-card-unaffordable,
.shop-card-locked {
    opacity: 0.72;
}

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

.shop-card-selected {
    border-color: var(--shop-border-color);
    box-shadow: 0 0 0 2px var(--shop-border-color), 0 0 18px var(--shop-info-background);
    opacity: 1;
    transform: translateY(-2px);
}

.shop-card:focus-visible {
    outline: 2px solid var(--shop-border-color);
    outline-offset: 3px;
}

/* Podgląd wybranego przedmiotu. */
.shop-details {
    grid-column: 3;
    grid-row: 1 / span 2;
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-card-background);
}

/* Nagłówek podglądu: nazwa i kategoria po lewej, ikona po prawej. */
.shop-details-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.shop-details-title {
    flex: 1 1 auto;
    min-width: 0;
}

.shop-details h3 {
    margin: 0 0 0.25rem;
    text-align: left;
}

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

.shop-details-icon-slot:empty {
    display: none;
}

/* Zamykanie i tło są potrzebne tylko, gdy podgląd jest oknem (telefon). */
.shop-details-close,
.shop-backdrop {
    display: none;
}

.shop-details-body {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.shop-details .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);
}

.shop-details .shop-details-icon.is-large {
    width: 6rem;
    height: 6rem;
}

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

.shop-details .shop-details-icon.is-large .game-icon-glyph {
    font-size: 3rem;
}

.shop-price-box {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    padding: 0.4375rem 0.5625rem;
    border: 1px solid var(--shop-border-color);
    border-radius: 6px;
    background: var(--shop-info-background);
}

.shop-price-value {
    font-weight: 700;
}

.shop-stat-rows {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.shop-stat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
}

.shop-stat-row-icon {
    flex: 0 0 auto;
    width: 1.25rem;
    height: 1.25rem;
}

.shop-stat-label {
    flex: 1 1 8rem;
    font-size: 0.9rem;
}

.shop-stat-value {
    font-variant-numeric: tabular-nums;
}

.shop-details-description {
    margin: 0;
}

.shop-details-note {
    margin: 0;
    font-size: 0.875rem;
    opacity: 0.85;
}

.shop-details-actions {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    margin-top: 0.75rem;
}

.shop-details-actions:empty {
    display: none;
}

/* Karty w ekwipunku. */
.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.75rem), 1fr));
    max-height: min(62vh, 34rem);
    gap: 0.5rem;
    overflow-y: auto;
    align-content: start;
    padding: 0.125rem 0.375rem 0.375rem 0.125rem;
    overscroll-behavior: contain;
    scrollbar-color: var(--shop-border-color) rgba(5, 28, 69, 0.28);
}

.shop-item {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 0.5rem;
    border: 1px solid var(--shop-border-color);
    background: var(--shop-card-background);
}

.shop-item h4 {
    min-height: 2.4rem;
    font-size: 1.1rem;
}

.shop-item p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
}

.shop-item .shop-description {
    min-height: 2.625rem;
    color: var(--text-color);
}

.shop-message {
    margin: 0.75rem 0 0.5rem;
}

/* Zakup drogiego przedmiotu: drugi klik potwierdza. */
.shop-details-actions button.is-confirm {
    border-color: var(--bad);
    background: rgba(179, 48, 58, 0.9);
    color: #ffffff;
    font-weight: 700;
}
