/* =============================================================================
   VOID GROUND - MERCHANT SHOP (EMPORIUM PASAR)
   Theme: Old School Renaissance Manuscript / Parchment Codex
   Layout: 2 Rows x 5 Columns (10 Items per Page) with Symmetrical Pagination
   ============================================================================= */

/* --- Shop Modal Overlay --- */
.merchant-shop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #100804 url('assets/wood-table.jpg') center center / cover no-repeat;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 64px;
    box-sizing: border-box;
}

.merchant-shop-overlay.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* --- Shop Manuscript Sheet Container (+10% Enlarged: max-width 1740px, max-height 990px) --- */
.merchant-shop-sheet {
    position: relative;
    width: 100% !important;
    max-width: 1740px !important; /* Scaled +10% from 1584px */
    height: 96% !important;
    max-height: 990px !important; /* Scaled +10% from 902px */
    min-height: 0;
    background: #f4ecd8 url('assets/deckle-paper.jpg') repeat;
    background-size: cover;
    border: 3px double #78350f;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75), inset 0 0 60px rgba(120, 53, 15, 0.25);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    color: #2b1807;
    animation: shopSheetIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes shopSheetIn {
    0% { transform: scale(0.96) translateY(12px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Close Button (+15% Scaling, Flex-Centered & Symmetrical) */
.shop-close-btn {
    position: static;
    width: 39px;
    height: 39px;
    background: #451a03;
    border: 2px solid #8c5d2e;
    border-radius: 50%;
    color: #fef3c7;
    font-size: 23px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    z-index: 10;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.shop-close-btn:hover {
    background: #78350f;
    border-color: #d97706;
    transform: rotate(90deg) scale(1.08);
}

/* --- Shop Header --- */
.shop-header {
    padding: 12px 28px;
    min-height: 60px;
    box-sizing: border-box;
    border-bottom: 2px solid #8c5d2e;
    box-shadow: 0 1px 0 rgba(255, 230, 180, 0.45);
    background: rgba(254, 243, 199, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.shop-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    flex-shrink: 0;
}

.shop-title-area {
    display: flex;
    align-items: center;
    margin: 0;
}

.shop-subtitle {
    display: none !important;
}

.shop-title {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 24.5px;
    font-weight: 900;
    letter-spacing: 1.2px;
    color: #3b1b06;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-stamp {
    font-size: 20px;
    color: #b45309;
}

.shop-balance-display {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    background: rgba(69, 26, 3, 0.08);
    padding: 0 18px;
    height: 39px;
    box-sizing: border-box;
    border-radius: 22px;
    border: 1.5px solid rgba(120, 53, 15, 0.35);
}

.shop-balance-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 17px;
    font-weight: 800;
    color: #451a03;
}

#shop-modal-crystal-pill {
    display: none !important;
}

.shop-balance-icon {
    width: 29px;
    height: 29px;
    object-fit: contain;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* --- Shop Navigation Tabs (+15% Scaling) --- */
.shop-tabs-bar {
    display: flex;
    background: rgba(43, 24, 7, 0.05);
    border-bottom: 1.5px solid #d97706;
    padding: 0 24px;
    gap: 6px;
    flex-shrink: 0;
}

.shop-tab-btn {
    padding: 12px 25px;
    background: transparent;
    border: none;
    border-bottom: 3.5px solid transparent;
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 15.5px;
    font-weight: 800;
    letter-spacing: 0.7px;
    color: #78350f;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 9px;
}

.shop-tab-btn:hover {
    color: #b45309;
    background: rgba(180, 83, 9, 0.08);
}

.shop-tab-btn.active {
    color: #451a03;
    border-bottom: 3.5px solid #b45309;
    background: rgba(254, 243, 199, 0.85);
}

.shop-tab-count {
    background: #78350f;
    color: #fef3c7;
    font-size: 12px;
    padding: 3px 9px;
    border-radius: 12px;
}

/* --- Viewport & Content Area --- */
.shop-content-viewport {
    flex: 1;
    overflow-y: hidden;
    padding: 14px 22px;
    display: flex;
    flex-direction: column;
}

/* --- Grid Items Layout: 1 Row x 4 Columns (4 Items / Page, Large Readable Format) --- */
.shop-cards-grid-5x2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

/* Fallback for 6x2 layout */
.shop-cards-grid-6x2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

/* --- Compact Single Shop Card --- */
.shop-card-compact {
    background: rgba(255, 255, 255, 0.82);
    border: 1.5px solid #d97706;
    border-radius: 8px;
    padding: 14px 12px 14px;
    box-shadow: 0 4px 12px rgba(69, 26, 3, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    box-sizing: border-box;
}

.shop-card-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(69, 26, 3, 0.16);
    background: rgba(255, 255, 255, 0.96);
    border-color: #b45309;
}

/* Card Visual Header */
.shop-compact-visual {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 2px;
    flex-shrink: 0;
    overflow: hidden;
}

.shop-mat-icon-box {
    width: 124px;
    height: 124px;
    background: transparent;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(43, 23, 8, 0.18);
    overflow: hidden;
}

.shop-mat-img {
    width: 124px;
    height: 124px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    transition: transform 0.22s ease;
}

.shop-card-compact:hover .shop-mat-img {
    transform: scale(1.06);
}

/* --- Chemical Storage Identical Bottle Graphic --- */
.shop-bottle-container {
    width: 96px;
    height: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-bottle-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.shop-bottle-stack-badge {
    position: absolute;
    top: 1px;
    right: 2px;
    background: #2b1f13;
    border: 1px solid #bfa068;
    color: #f7eed8;
    font-size: 8px;
    font-weight: 700;
    font-family: 'Cinzel', Georgia, serif;
    padding: 0 4px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    z-index: 5;
    pointer-events: none;
    letter-spacing: 0.3px;
}

.shop-bottle-stack-badge.max {
    background: #5c1813;
    border-color: #ffd875;
    color: #ffd875;
    box-shadow: 0 0 6px rgba(255, 216, 117, 0.5);
}

.shop-molecule-preview {
    position: absolute;
    top: 56px;
    left: 50%;
    width: 0;
    height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}

.shop-molecule-preview .molecule {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) scale(0.38) !important;
    transform-origin: center center !important;
    pointer-events: none !important;
    margin: 0 !important;
}

/* Card Text Info */
.shop-compact-title {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 16.5px;
    font-weight: 800;
    color: #3b1b06;
    margin: 2px 0 1px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    flex-shrink: 0;
}

.shop-compact-formula {
    font-family: monospace;
    font-size: 17.5px;
    font-weight: 900;
    color: #1e3a8a;
    line-height: 1.15;
    margin: 2px 0;
    flex-shrink: 0;
}

.shop-compact-meta-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 2px;
    flex-shrink: 0;
}

.shop-compact-badge {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.tier-normal { background: #e2e8f0; color: #334155; border: 1px solid #94a3b8; }
.tier-great { background: #e0f2fe; color: #0369a1; border: 1px solid #38bdf8; }
.tier-rare { background: #fef3c7; color: #b45309; border: 1px solid #f59e0b; }
.tier-very_rare { background: #f3e8ff; color: #7e22ce; border: 1px solid #c084fc; }
.tier-legend { background: #fce7f3; color: #be185d; border: 1px solid #f472b6; }

.shop-compact-stock {
    font-size: 13px;
    color: #78350f;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.shop-compact-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 16.5px;
    font-weight: 800;
    color: #451a03;
    font-family: 'Cinzel', serif;
    background: rgba(120, 53, 15, 0.08);
    padding: 7px 10px;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(140, 93, 46, 0.35);
    margin: 2px 0;
    flex-shrink: 0;
}

.shop-coin-micro {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Stepper Compact - Enlarged to be symmetrical with bottom button */
.shop-compact-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    margin: 4px 0;
    flex-shrink: 0;
}

.stepper-btn-sm {
    width: 40px;
    height: 38px;
    background: #78350f;
    border: none;
    border-radius: 4px;
    color: #fef3c7;
    font-size: 19px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.12s ease;
}

.stepper-btn-sm:hover:not(:disabled) {
    background: #b45309;
}

.stepper-btn-sm:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.stepper-input-sm {
    width: 64px;
    height: 38px;
    text-align: center;
    font-size: 16.5px;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
    font-variant-numeric: tabular-nums;
    border: 1.5px solid #b45309;
    border-radius: 4px;
    background: #fff;
    color: #2b1807;
    padding: 0;
    box-sizing: border-box;
}

.stepper-btn-max-sm {
    height: 38px;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #9a3412;
    border: none;
    border-radius: 4px;
    color: #fef3c7;
    cursor: pointer;
    letter-spacing: 0.6px;
    transition: background 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stepper-btn-max-sm:hover:not(:disabled) {
    background: #c2410c;
}

/* Card Middle Description / Lore Box - Expands to fill available space */
.shop-compact-desc {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;
    font-style: normal;
    color: #3b220c;
    line-height: 1.5;
    letter-spacing: 0.15px;
    background: rgba(120, 53, 15, 0.04);
    border: 1px dashed rgba(180, 83, 9, 0.35);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 5px 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 72px;
    flex: 1 1 auto;
    overflow-y: auto;
}

/* Card Bottom Action */
.shop-compact-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(180, 83, 9, 0.2);
    flex-shrink: 0;
}

.shop-compact-total {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 21px; /* Scaled +50% from 14px */
    font-weight: 900;
    color: #451a03;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.shop-compact-total .shop-coin-micro {
    width: 24px; /* Scaled +50% from 16px */
    height: 24px;
}

.shop-action-btn-sm {
    width: 100%;
    min-height: 46px;
    padding: 14px 8px;
    border: 1px solid #78350f;
    border-radius: 5px;
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 16.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.12s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.shop-btn-buy {
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
    color: #f0fdf4;
    border-color: #14532d;
}

.shop-btn-buy:hover:not(:disabled) {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 2px 6px rgba(22, 101, 52, 0.4);
}

.shop-btn-sell {
    background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
    color: #fef3c7;
    border-color: #451a03;
}

.shop-btn-sell:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #9a3412 100%);
    box-shadow: 0 2px 6px rgba(180, 83, 9, 0.4);
}

.shop-action-btn-sm:disabled {
    background: #94a3b8 !important;
    border-color: #64748b !important;
    color: #e2e8f0 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* --- Pagination Bar (+15% Scaling) --- */
.shop-pagination-bar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border-top: 1.5px solid #d97706;
    background: rgba(254, 243, 199, 0.5);
    flex-shrink: 0;
    padding: 0 24px;
}

.shop-page-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #78350f;
    border: 1.5px solid #b45309;
    color: #fef3c7;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
    transition: all 0.15s ease;
}

.shop-page-nav-btn:hover:not(:disabled) {
    background: #b45309;
    transform: scale(1.08);
}

.shop-page-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.shop-pagination-info {
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 14px;
    font-weight: 700;
    color: #451a03;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-page-text {
    font-weight: 800;
}

.shop-items-text {
    display: none !important;
}

/* Empty State */
.shop-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #78350f;
    font-family: 'Georgia', serif;
    gap: 10px;
}

.shop-empty-icon {
    font-size: 38px;
    color: #b45309;
}

.shop-empty-title {
    font-family: 'Cinzel', serif;
    font-size: 16px;
    font-weight: 800;
    color: #451a03;
    margin: 0;
}

.shop-empty-desc {
    font-size: 12px;
    font-style: italic;
    max-width: 440px;
    line-height: 1.45;
    margin: 0;
}

/* Toast Notification Da Vinci */
.shop-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: #2b1807;
    border: 2px solid #b45309;
    color: #fef3c7;
    padding: 10px 22px;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    pointer-events: none;
}

.shop-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* --- Tab 4: Buy Commodity (Google Play Store IAP) --- */
.shop-commodity-card {
    border: 1.5px solid #b45309;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.90) 0%, rgba(254, 243, 199, 0.75) 100%);
    box-shadow: 0 4px 12px rgba(69, 26, 3, 0.12);
}

.shop-commodity-card:hover {
    border-color: #d97706;
    box-shadow: 0 8px 20px rgba(180, 83, 9, 0.22);
}

.shop-commodity-icon-box {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(43, 23, 8, 0.18);
    overflow: hidden;
    flex-shrink: 0;
}

.shop-commodity-img {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    box-sizing: border-box;
    transition: transform 0.22s ease;
}

.shop-commodity-card:hover .shop-commodity-img {
    transform: scale(1.06);
}

.shop-commodity-contents {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    margin: 4px 0;
    box-sizing: border-box;
    min-height: 80px;
    justify-content: center;
    align-items: center;
}

.shop-commodity-item-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(120, 53, 15, 0.08);
    border: 1px solid rgba(180, 83, 9, 0.32);
    border-radius: 5px;
    padding: 4px 10px;
    font-family: 'Cinzel', 'Georgia', serif;
    font-size: 18.4px; /* Scaled +60% from 11.5px */
    font-weight: 800;
    color: #451a03;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.shop-commodity-item-pill.single-highlight {
    padding: 10px 12px;
    font-size: 22.4px; /* Scaled +60% from 14px */
    background: rgba(180, 83, 9, 0.12);
    border-color: rgba(180, 83, 9, 0.45);
    border-radius: 6px;
}

.shop-commodity-pill-icon {
    width: 26px; /* Scaled +60% from 16px */
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.shop-commodity-item-pill.single-highlight .shop-commodity-pill-icon {
    width: 35px; /* Scaled +60% from 22px */
    height: 35px;
}

.shop-btn-commodity-buy {
    background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%);
    color: #f0fdf4;
    border: 1px solid #047857;
    font-size: 16.5px;
    font-weight: 900;
    letter-spacing: 0.6px;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.32);
    min-height: 46px;
    padding: 12px 10px;
}

.shop-btn-commodity-buy:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
    color: #ffffff;
}

.shop-btn-commodity-buy:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(5, 150, 105, 0.25);
}

/* Ornate Border & Accent for Starter Pack (1x Purchase Limit) */
.shop-commodity-card.shop-commodity-starter-pack {
    border: 2px solid #d97706 !important;
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.96) 0%, rgba(253, 230, 138, 0.78) 100%) !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.35), 0 4px 10px rgba(43, 23, 8, 0.18) !important;
    position: relative;
}

.shop-commodity-card.shop-commodity-starter-pack::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 1px dashed rgba(180, 83, 9, 0.45);
    border-radius: 4px;
    pointer-events: none;
}

/* Claimed (Purchased) One-Time Commodity State */
.shop-commodity-card.claimed {
    opacity: 0.72;
    filter: grayscale(0.25);
}

.shop-btn-commodity-buy.claimed,
.shop-btn-commodity-buy:disabled {
    background: #78716c !important;
    border-color: #57534e !important;
    color: #f5f5f4 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
}
