.shop-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--background-color);
}

.shop-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 80px; /* Space for bottom nav */
}

.user-balance-display {
    background: linear-gradient(135deg, var(--primary-color, #007aff), var(--secondary-color, #5856d6));
    color: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: baseline;
    font-weight: bold;
}

.user-balance-display span:first-child {
    margin-right: auto;
    font-size: 1.1em;
}

.user-balance-display .currency-symbol {
    font-size: 1.2em;
    margin-right: 4px;
}

.user-balance-display .amount {
    font-size: 2em;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.product-item {
    background-color: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s;
    cursor: pointer;
}

.product-item:active {
    transform: scale(0.98);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background-color: #f0f0f0;
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

.product-name {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

/* 商城头部按钮样式已迁移到 header.css 中的 .header-action-btn */
.shop-container .header .cart-btn {
    position: relative; /* Keep relative positioning for the badge */
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ff3b30;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px; /* Slightly larger */
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--background-color); /* Add border to separate from icon */
    box-sizing: border-box;
}

.product-price {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1em;
}

/* Product Card Quantity Control */
.product-quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-to-cart-btn-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, background-color 0.2s;
}

.add-to-cart-btn-small:active {
    transform: scale(0.9);
}

.quantity-control-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-secondary);
    border-radius: 14px;
    padding: 2px;
}

.quantity-btn-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background-color: transparent; /* Or slight background */
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.quantity-btn-small:active {
    background-color: rgba(0,0,0,0.1);
}

.quantity-display-small {
    min-width: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 0 4px;
}

.delete-product-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.product-item:hover .delete-product-btn {
    opacity: 1;
}

/* Modal specific styles */
#add-product-modal .modal-body,
#cart-modal .modal-body {
    padding: 20px;
}

/* Cart Item Styles */
.cart-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.cart-item-info {
    flex: 1;
    overflow: hidden; /* Prevent text overflow */
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    color: var(--primary-color);
    font-size: 0.9em;
    font-weight: 500;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

/* Bag/Inventory Styles */
.bag-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 4px;
}

.bag-item {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    position: relative;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.bag-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.bag-item-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    background-color: var(--bg-secondary);
}

.bag-item-count {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.bag-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bag-item-actions {
    width: 100%;
}

.send-gift-btn-small {
    width: 100%;
    background-color: #ff2d55;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.send-gift-btn-small:hover {
    opacity: 0.9;
}

.send-gift-btn-small:active {
    transform: scale(0.98);
}

/* Contact Selection for Gifting */
.gift-contact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.gift-contact-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.gift-contact-item:hover {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

.gift-contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-right: 16px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.gift-contact-info {
    flex: 1;
    text-align: left;
}

.gift-contact-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 2px;
}

.gift-contact-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.quantity-btn:active {
    background-color: var(--bg-secondary);
    transform: scale(0.95);
}

.quantity-display {
    min-width: 24px;
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
}

.cart-summary {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-primary);
}

.checkout-btn {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.checkout-btn:active {
    transform: scale(0.98);
}

.empty-cart-message {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

#add-product-modal .form-group {
    margin-bottom: 20px;
}

#add-product-modal label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

#add-product-modal input[type="text"],
#add-product-modal input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--input-text);
    box-sizing: border-box;
}

#add-product-modal input:focus {
    border-color: var(--accent-blue);
    outline: none;
}

.product-upload-preview {
    width: 100%;
    height: 200px;
    background-color: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    border: 2px dashed #ddd;
    position: relative;
}

.product-upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none; /* Initially hidden */
}

.product-upload-preview.has-image img {
    display: block;
}

.product-upload-preview.has-image .upload-placeholder {
    display: none;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #999;
    gap: 8px;
}


/* Transfer Bubble Styles */
.message-bubble.transfer-bubble {
    background: linear-gradient(135deg, #ff9500, #ffcc00);
    color: #fff;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
}

.message.sent .message-bubble.transfer-bubble {
    background: linear-gradient(135deg, #ff9500, #ffcc00);
    color: white;
}

.message.received .message-bubble.transfer-bubble {
    background: #fff;
    border: 2px solid #ff9500;
    color: #ff9500;
}

/* Gift Bubble Styles */
.message-bubble.gift-bubble {
    background: linear-gradient(135deg, #ff2d55, #ff375f);
    color: #fff;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
}

.message.sent .message-bubble.gift-bubble {
    background: linear-gradient(135deg, #ff2d55, #ff375f);
    color: white;
}

.message.received .message-bubble.gift-bubble {
    background: linear-gradient(135deg, #ff2d55, #ff375f);
    border: none;
    color: white;
}

.gift-icon {
    font-size: 1.5em;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message.received .gift-icon {
    background: rgba(255,255,255,0.2);
    color: white;
}

.gift-info {
    display: flex;
    flex-direction: column;
}

.gift-title {
    font-size: 1.1em;
    margin-bottom: 2px;
}

.gift-desc {
    font-size: 0.8em;
    opacity: 0.9;
    font-weight: normal;
}

/* Retro Skin Adaptation */
/* Retro Skin Adaptation (iOS 6 Style) */
body.retro-skin .shop-container {
    background-color: transparent;
    background-image: none;
}

/* Shelf-like Product Grid */
body.retro-skin .product-grid {
    gap: 20px;
    padding-bottom: 20px;
}

body.retro-skin .product-item {
    background-color: #f8f8f8;
    border: 1px solid #a0a0a0;
    border-radius: 8px;
    box-shadow:
        0 2px 5px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.8); /* Inner Highlight */
    overflow: hidden;
    position: relative;
    transition: transform 0.1s;
}

body.retro-skin .product-item:active {
    transform: scale(0.98);
    box-shadow:
        0 1px 2px rgba(0,0,0,0.3),
        inset 0 1px 3px rgba(0,0,0,0.1);
}

/* Wood/Shelf texture behind products optional, stick to clean card for now */
body.retro-skin .product-image {
    border-bottom: 1px solid #dcdcdc;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8);
    background-color: #fff;
}

body.retro-skin .product-info {
    background: linear-gradient(to bottom, #f0f0f0, #e0e0e0);
    padding: 10px;
}

body.retro-skin .product-name {
    color: #333;
    font-weight: bold;
    text-shadow: 0 1px 0 #fff;
    margin-bottom: 6px;
}

body.retro-skin .product-price {
    color: #333;
    font-weight: bold;
    text-decoration: none;
    text-shadow: 0 1px 0 #fff;
}

/* Passbook Style Balance Display */
body.retro-skin .user-balance-display {
    background: linear-gradient(to bottom, #5ca7f8, #3b83f3); /* Blue Pass style */
    border: 1px solid #2a6bce;
    border-radius: 10px;
    box-shadow:
        0 2px 6px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.4),
        inset 0 0 20px rgba(0,0,0,0.1);
    color: white;
    margin-top: 10px;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

/* Dashed cut line for Passbook feel */
body.retro-skin .user-balance-display::before {
    content: '';
    position: absolute;
    top: 12px; bottom: 12px; left: 12px; right: 12px;
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 6px;
    pointer-events: none;
}

body.retro-skin .user-balance-display .amount {
    letter-spacing: -1px;
}

/* Retro Buttons */
body.retro-skin .add-to-cart-btn-small {
    background: linear-gradient(to bottom, #f7f7f7, #d5d5d5);
    border: 1px solid #a3a3a3;
    color: #333;
    text-shadow: 0 1px 0 #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
}

body.retro-skin .add-to-cart-btn-small:active {
    background: linear-gradient(to bottom, #d5d5d5, #f7f7f7);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

body.retro-skin .quantity-control-group {
    background: #dcdcdc;
    border-radius: 14px;
    border: 1px solid #bbb;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    padding: 2px;
}

body.retro-skin .quantity-btn-small {
    color: #333;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

body.retro-skin .quantity-display-small {
    color: #333;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* Bubbles - Restore standard retro bubble style */
body.retro-skin .message-bubble.transfer-bubble,
body.retro-skin .message-bubble.gift-bubble {
    border: 1px solid #c8c8c8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    border-radius: 18px;
    background: linear-gradient(to bottom, #fcfcfc, #e1e1e1);
    color: black;
    text-shadow: 0 1px 0 #fff;
}

body.retro-skin .message-bubble.transfer-bubble::before,
body.retro-skin .message-bubble.gift-bubble::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 18px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.1) 100%);
    pointer-events: none;
}

body.retro-skin .message.sent .message-bubble.transfer-bubble,
body.retro-skin .message.sent .message-bubble.gift-bubble {
    background: linear-gradient(to bottom, #5ca7f8, #3b83f3);
    color: white;
    border: none;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
}


/* Y2K Skin Adaptation - QQ Zone / Dynamics Style */
body.y2k-skin .shop-container {
    background-color: #f0f4f8; /* Soft Blue Bg like Dynamics */
}

body.y2k-skin .product-item {
    background-color: #ffffff;
    border: 1px solid #dceaf5;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    backdrop-filter: none;
    transition: all 0.2s ease;
}

body.y2k-skin .product-item:active {
    transform: scale(0.98);
    box-shadow: none;
}

body.y2k-skin .user-balance-display {
    background: #ffffff;
    border: 1px solid #dceaf5;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #333;
    font-weight: inherit;
    font-family: inherit;
}

body.y2k-skin .user-balance-display .amount {
    font-weight: inherit;
    font-family: inherit;
    color: #3b83f3; /* Bright Blue */
}

body.y2k-skin .product-name {
    color: #333;
    text-shadow: none;
    font-weight: bold;
    font-family: inherit;
}

body.y2k-skin .product-price {
    color: #3b83f3; /* Bright Blue */
    font-family: inherit;
}

/* Y2K Skin - Add Product Button (Dynamics Style) */
body.y2k-skin .add-product-btn {
    background-color: #3b83f3;
    border: 1px solid #2a6bce;
    border-radius: 4px;
    color: #ffffff;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: none;
    margin-right: 0;
}

body.y2k-skin .add-to-cart-btn-small {
    background-color: #3b83f3;
    border-radius: 4px;
}

body.y2k-skin .add-product-btn:active {
    background-color: #2a6bce;
    border-color: #2a6bce;
}

body.y2k-skin .cart-btn {
    color: #3b83f3;
}

body.y2k-skin .bag-btn {
    color: #3b83f3;
}

body.y2k-skin .message-bubble.transfer-bubble {
    background-color: #ffffff;
    border: 1px solid #dceaf5;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #333;
    backdrop-filter: none;
}

body.y2k-skin .message-bubble.gift-bubble {
    background-color: #ffffff;
    border: 1px solid #dceaf5;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: #333;
    backdrop-filter: none;
}


/* Proxy Pay Message Input */
.proxy-pay-message-container {
    padding: 0 16px 16px 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.proxy-pay-message-container label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.9em;
}

#proxy-pay-message-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--input-text);
    box-sizing: border-box;
    resize: vertical;
    font-family: inherit;
}

#proxy-pay-message-input:focus {
    border-color: var(--accent-blue);
    outline: none;
}
/* Desktop/Widescreen Styles */
@media (min-width: 768px) {
    .shop-content {
        padding: 32px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 24px;
    }

    .bag-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}