/* Native-style item shop layout (sidebar + toolbar + list rows). */

/* Fixed viewport: matches client WebWindow.py (WEB_WIDTH x WEB_HEIGHT). */
:root {
    --shop-vp-w: 1016px;
    --shop-vp-h: 655px;
    --shop-row-h: 50px;
    --shop-pager-h: 34px;
}

.shop-shell {
    position: relative;
    z-index: 10;
    min-height: calc(100vh - 90px);
    padding: 1.25rem;
    box-sizing: border-box;
}

.shop-panel {
    max-width: 1280px;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(8, 18, 36, 0.92) 0%, rgba(5, 10, 22, 0.96) 100%);
    border: 1px solid rgba(43, 108, 224, 0.35);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.shop-topbar {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr minmax(200px, 280px);
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.35);
    border-bottom: 1px solid rgba(43, 108, 224, 0.25);
    flex-shrink: 0;
}

.shop-topbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.shop-inline-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid rgba(43, 108, 224, 0.45);
    background: rgba(15, 30, 58, 0.85);
    color: var(--text-main, #e8edf7);
    text-decoration: none;
    font-size: 0.85rem;
}

.shop-inline-back:hover {
    background: rgba(43, 108, 224, 0.25);
    color: #fff;
}

.shop-balance-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
}

.shop-balance-pill .bal-dr { color: var(--gold, #f7bd48); }
.shop-balance-pill .bal-dm { color: var(--silver, #a8b4c8); margin-left: 10px; font-size: 0.8rem; }

.shop-toolbar {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.shop-tb-btn {
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(43, 108, 224, 0.45);
    background: rgba(15, 30, 58, 0.85);
    color: var(--text-main, #e8edf7);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.shop-tb-btn:hover {
    background: rgba(43, 108, 224, 0.2);
    border-color: rgba(96, 165, 250, 0.6);
}

.shop-tb-btn.active {
    background: rgba(43, 108, 224, 0.28);
    border-color: rgb(43, 108, 224);
}

.shop-tb-btn.shop-tb-buy {
    background: linear-gradient(180deg, rgba(34, 120, 70, 0.9), rgba(22, 90, 52, 0.95));
    border-color: rgba(72, 200, 120, 0.5);
}

.shop-tb-btn.shop-tb-buy:hover {
    background: linear-gradient(180deg, rgba(42, 140, 82, 0.95), rgba(28, 100, 58, 1));
}

.shop-search-wrap {
    position: relative;
}

.shop-search-wrap input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.2rem;
    border-radius: 8px;
    border: 1px solid rgba(43, 108, 224, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-main, #e8edf7);
    font-family: inherit;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.shop-search-wrap input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.shop-search-wrap i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #8b9bb8);
    font-size: 0.85rem;
    pointer-events: none;
}

.shop-body {
    display: grid;
    grid-template-columns: 148px 1fr;
    min-height: 480px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.shop-sidebar {
    padding: 8px 6px;
    background: rgba(0, 0, 0, 0.25);
    border-right: 1px solid rgba(43, 108, 224, 0.2);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.shop-cat-btn {
    width: 100%;
    padding: 0.5rem 0.35rem;
    border: 1px solid rgba(43, 108, 224, 0.35);
    border-radius: 6px;
    background: rgba(12, 24, 48, 0.75);
    color: var(--text-main, #dce6f5);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.15;
    flex-shrink: 0;
}

.shop-cat-btn:hover,
.shop-cat-btn.active {
    background: rgba(43, 108, 224, 0.22);
    border-color: rgba(96, 165, 250, 0.65);
    color: #fff;
}

.shop-main {
    padding: 6px 8px 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.shop-item-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.shop-row {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(43, 108, 224, 0.18);
    position: relative;
    min-height: var(--shop-row-h);
    max-height: var(--shop-row-h);
    box-sizing: border-box;
}

.shop-row:last-child {
    border-bottom: none;
}

.shop-row-hot {
    position: absolute;
    top: -3px;
    left: -3px;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    font-size: 0.5rem;
    font-weight: 800;
    padding: 1px 7px 1px 4px;
    clip-path: polygon(0 0, 100% 0, 82% 100%, 0 100%);
    letter-spacing: 0.35px;
    display: none;
    z-index: 3;
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.shop-row.is-hot .shop-row-hot,
.shop-row.has-offer .shop-row-hot {
    display: block;
}

.shop-row-icon {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(43, 108, 224, 0.25);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    overflow: visible;
}

.shop-row-icon img {
    max-width: 40px;
    max-height: 40px;
}

.shop-row-count {
    position: absolute;
    right: 2px;
    bottom: 1px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 2px #000, 0 1px 2px #000;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
}

#buyModal .item-icon {
    position: relative;
}

.shop-modal-count {
    font-size: 0.95rem;
    right: 6px;
    bottom: 4px;
}

.shop-row-info {
    min-width: 0;
}

.shop-row-name {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--gold, #f0c66a);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-row-price {
    font-size: 0.78rem;
    color: var(--text-muted, #a8b4c8);
}

.shop-row-price .price-old {
    text-decoration: line-through;
    color: #e57373;
    margin-right: 4px;
}

.shop-row-price .price-pct {
    color: #81c784;
    margin-right: 6px;
}

.shop-row-price .price-now {
    color: var(--gold, #f7bd48);
    font-weight: 700;
}

.shop-row-meta {
    font-size: 0.68rem;
    color: var(--text-muted, #8b9bb8);
    margin-top: 1px;
    display: none;
}

.shop-row-buy {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: linear-gradient(180deg, #3d9e5a, #2d7a44);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.shop-row-buy:hover {
    filter: brightness(1.08);
}

.shop-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted, #8b9bb8);
    font-size: 0.85rem;
}

.shop-pager {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 4px 0 2px;
    flex-shrink: 0;
    border-top: 1px solid rgba(43, 108, 224, 0.15);
}

.shop-pager.visible {
    display: flex;
}

.shop-pager-btn {
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    border-radius: 6px;
    border: 1px solid rgba(43, 108, 224, 0.4);
    background: rgba(15, 30, 58, 0.9);
    color: var(--text-main, #e8edf7);
    cursor: pointer;
    font-family: inherit;
}

.shop-pager-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.shop-pager-info {
    font-size: 0.72rem;
    color: var(--text-muted, #8b9bb8);
    min-width: 72px;
    text-align: center;
}

.shop-purchases-wrap {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
}

.shop-purchases-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main, #e8edf7);
    margin-bottom: 8px;
    padding: 4px 2px 0;
}

.shop-purchases {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    table-layout: fixed;
}

.shop-purchases th,
.shop-purchases td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(43, 108, 224, 0.15);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shop-purchases th {
    color: var(--text-muted, #8b9bb8);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.shop-purchases td.price-cell {
    color: var(--gold, #f7bd48);
    font-weight: 600;
}

/* ---- Fixed viewport (ingame CEF + homepage kiosk) ---- */
html.shop-fixed-root,
html.shop-fixed-root body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden !important;
}

body.shop-fixed {
    overflow: hidden !important;
    background: #05080f;
}

body.shop-fixed .navbar,
body.shop-fixed .dynamic-footer,
body.shop-fixed #particles-js,
body.shop-fixed .particles,
body.shop-fixed .bg-overlay {
    display: none !important;
}

body.shop-fixed .shop-shell {
    min-height: 0;
    height: 100vh;
    width: 100vw;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

body.shop-fixed .shop-panel {
    width: var(--shop-vp-w);
    height: var(--shop-vp-h);
    max-width: var(--shop-vp-w);
    max-height: var(--shop-vp-h);
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

body.shop-fixed .shop-body {
    min-height: 0;
}

body.shop-fixed.shop-ingame .shop-topbar {
    grid-template-columns: minmax(155px, 200px) minmax(0, 1fr) minmax(155px, 210px);
    padding: 10px 12px;
    gap: 8px;
}

body.shop-fixed.shop-ingame .shop-inline-back {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

body.shop-fixed.shop-ingame .shop-toolbar {
    flex-wrap: nowrap;
    gap: 4px;
}

body.shop-fixed.shop-ingame .shop-tb-btn {
    padding: 0.42rem 0.5rem;
    font-size: 0.68rem;
}

body.shop-fixed.shop-ingame .shop-search-wrap {
    grid-column: auto;
}

body.shop-fixed.shop-ingame .shop-balance-pill {
    font-size: 0.78rem;
    padding: 6px 10px;
}

body.shop-fixed.shop-ingame .shop-search-wrap input {
    font-size: 0.78rem;
    padding: 0.48rem 0.65rem 0.48rem 2rem;
}

body.shop-fixed.shop-vp-small:not(.shop-ingame) .shop-topbar {
    grid-template-columns: 1fr 1fr;
    padding: 8px 10px;
    gap: 6px;
}

body.shop-fixed.shop-vp-small .shop-search-wrap {
    grid-column: 1 / -1;
}

body.shop-fixed.shop-vp-small .shop-tb-btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.68rem;
}

body.shop-fixed.shop-vp-small .shop-balance-pill {
    font-size: 0.78rem;
    padding: 6px 8px;
}

body.shop-fixed.shop-vp-small .shop-sidebar {
    grid-template-columns: 1fr;
    width: 118px;
}

body.shop-fixed.shop-vp-small .shop-cat-btn {
    font-size: 0.65rem;
    padding: 0.4rem 0.25rem;
}

body.shop-fixed.shop-ingame .shop-shell {
    align-items: stretch;
    justify-content: stretch;
}

body.shop-fixed.shop-ingame .shop-panel {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
}

.shop-kiosk-back {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 20;
    font-size: 0.75rem;
    opacity: 0.6;
    color: #8b9bb8;
    text-decoration: none;
}

.shop-kiosk-back:hover {
    opacity: 1;
    color: #fff;
}

.shop-buy-qty-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
}

.shop-buy-qty-label {
    font-size: 0.9rem;
    color: var(--text-muted, #8b9bb8);
}

.shop-buy-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.shop-buy-qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(43, 108, 224, 0.45);
    background: rgba(15, 30, 58, 0.85);
    color: var(--text-main, #e8edf7);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.shop-buy-qty-btn:hover {
    background: rgba(43, 108, 224, 0.25);
}

.shop-buy-qty-controls input {
    width: 52px;
    text-align: center;
    padding: 0.4rem 0.25rem;
    border-radius: 6px;
    border: 1px solid rgba(43, 108, 224, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text-main, #e8edf7);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    -moz-appearance: textfield;
}

.shop-buy-qty-controls input::-webkit-outer-spin-button,
.shop-buy-qty-controls input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media (max-width: 900px) {
    body:not(.shop-fixed) .shop-topbar {
        grid-template-columns: 1fr;
    }
    body:not(.shop-fixed) .shop-body {
        grid-template-columns: 1fr;
    }
}
