/* ============================================================
   Shop Styles — juewa 主题统一风格
   设计语言：monochrome / 极简 / 暗黑模式
   间距统一使用主题 .p-4 类，CSS 中不再自定义 padding
   ============================================================ */

/* --- Product Grid --- */
.shop-container {
    max-width: var(--outer-container-width, 780px);
    margin: 0 auto;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.shop-grid.p-4,
.shop-lookup.p-4 {
    max-width: none;
}
.shop-grid.p-4 {
    margin: 0;
}

/* --- Product Card --- */
.product-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.product-card:hover {
    border-color: var(--color-primary);
}

.product-card-cover {
    width: 100%;
    aspect-ratio: 3/2;
    object-fit: cover;
    background: var(--color-background-muted, rgba(0,0,0,0.04));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    font-size: 2.5rem;
    border-bottom: 1px solid var(--color-border);
}

.product-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.product-card-name {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-foreground);
    margin: 0;
    line-height: 1.3;
}

.product-card-tagline {
    font-size: 0.8rem;
    color: var(--color-muted);
    line-height: 1.45;
    flex: 1;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--color-border);
}

.product-card-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-foreground);
    font-family: var(--font-mono);
}

.product-card-price .currency {
    font-size: 0.75rem;
    font-weight: 500;
}

.product-card-buy {
    padding: 0.35rem 0.85rem;
    background: var(--color-primary);
    color: var(--color-primary-foreground);
    border: none;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: opacity 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.product-card-buy:hover {
    opacity: 0.85;
}

.product-card-buy:disabled {
    background: var(--color-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.product-card-bought-badge {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    background: var(--color-background-muted);
    color: var(--color-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ============================================================
   Detail Modal — 产品详情预览
   ============================================================ */
.shop-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: shopFadeIn 0.15s ease;
    padding: 1.5rem;
}

.shop-detail-modal {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.shop-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    color: var(--color-foreground);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: opacity 0.15s ease;
}

.shop-detail-close:hover {
    opacity: 0.7;
}

.shop-detail-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 0;
    overflow: hidden;
}

.shop-detail-gallery {
    background: var(--color-background);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--color-border);
    position: relative;
    min-height: 400px;
}

.shop-detail-gallery img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.shop-detail-info {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.shop-detail-info h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-foreground);
    line-height: 1.35;
}

.shop-detail-info .shop-detail-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-foreground);
    font-family: var(--font-mono);
}

.shop-detail-info .shop-detail-desc {
    font-size: 0.88rem;
    color: var(--color-foreground);
    line-height: 1.7;
    flex: 1;
}

.shop-detail-info .shop-detail-desc img {
    max-width: 100%;
    height: auto;
    margin: 0.5rem 0;
}

.shop-detail-info .shop-detail-desc p {
    margin: 0.5rem 0;
}

.shop-detail-info .shop-detail-meta {
    font-size: 0.75rem;
    color: var(--color-muted);
    border-top: 1px solid var(--color-border);
    padding-top: 0.75rem;
}

.shop-detail-buy {
    width: 100%;
    padding: 0.7rem 1.5rem;
    background: var(--color-primary);
    color: var(--color-primary-foreground);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: opacity 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.shop-detail-buy:hover {
    opacity: 0.85;
}

.shop-detail-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--color-muted);
}

@media (max-width: 700px) {
    .shop-detail-body {
        grid-template-columns: 1fr;
    }

    .shop-detail-gallery {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        min-height: 250px;
        max-height: 40vh;
    }

    .shop-detail-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* ============================================================
   Purchase Modal — 支付弹窗
   ============================================================ */
.shop-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: shopFadeIn 0.15s ease;
    padding: 1.5rem;
}

@keyframes shopFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.shop-modal {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    max-width: 440px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.shop-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.shop-modal-header h3 {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.shop-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--color-muted);
    line-height: 1;
    padding: 0;
    transition: color 0.15s ease;
}

.shop-modal-close:hover {
    color: var(--color-foreground);
}

.shop-modal-body label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--color-foreground);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.shop-modal-body input[type="email"],
.shop-modal-body input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    outline: none;
    margin-bottom: 1rem;
    box-sizing: border-box;
    background: var(--color-background);
    color: var(--color-foreground);
    font-family: var(--font-sans);
}

.shop-modal-body input:focus {
    border-color: var(--color-primary);
}

.shop-payment-methods {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.shop-payment-method {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--color-border);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-sans);
    background: var(--color-background);
    color: var(--color-foreground);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.shop-payment-method:hover {
    border-color: var(--color-primary);
}

.shop-payment-method.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-primary-foreground);
}

.shop-submit-btn {
    width: 100%;
    padding: 0.65rem;
    background: var(--color-primary);
    color: var(--color-primary-foreground);
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: opacity 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.shop-submit-btn:hover {
    opacity: 0.85;
}

.shop-submit-btn:disabled {
    background: var(--color-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* --- Payment QR / Redirect --- */
.shop-payment-zone {
    text-align: center;
    padding: 0.5rem 0;
}

.shop-payment-zone h4 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.shop-qrcode {
    display: inline-block;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid var(--color-border);
    margin-bottom: 0.5rem;
}

.shop-qrcode img {
    display: block;
    max-width: 180px;
    max-height: 180px;
}

.shop-payment-tip {
    font-size: 0.78rem;
    color: var(--color-muted);
    margin: 0.25rem 0 0;
}

.shop-payment-link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--color-primary);
    color: var(--color-primary-foreground);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: opacity 0.15s ease;
}

.shop-payment-link:hover {
    opacity: 0.85;
}

/* --- Delivery Result --- */
.shop-result {
    text-align: center;
    padding: 0.5rem 0;
}

.shop-result-success {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

.shop-result h4 {
    margin: 0.4rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.shop-result-code {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: 1px dashed var(--color-border);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 0.5rem 0;
    word-break: break-all;
    color: var(--color-foreground);
}

.shop-result-link {
    display: inline-block;
    margin: 0.4rem 0;
    color: var(--color-foreground);
    font-weight: 600;
    word-break: break-all;
}

.shop-result-order {
    font-size: 0.75rem;
    color: var(--color-muted);
    margin: 0.4rem 0 0;
}

/* --- Order Lookup --- */
.shop-lookup {
    margin-top: 3rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    text-align: center;
}

.shop-lookup h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-foreground);
}

.shop-lookup-row {
    display: flex;
    gap: 0.5rem;
    max-width: 380px;
    margin: 0 auto;
}

.shop-lookup-row input {
    flex: 1;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    outline: none;
    background: var(--color-background);
    color: var(--color-foreground);
    font-family: var(--font-sans);
}

.shop-lookup-row input:focus {
    border-color: var(--color-primary);
}

.shop-lookup-row button {
    padding: 0.5rem 1.1rem;
    background: var(--color-primary);
    color: var(--color-primary-foreground);
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    transition: opacity 0.15s ease;
}

.shop-lookup-row button:hover {
    opacity: 0.85;
}

.shop-lookup-result {
    margin-top: 0.75rem;
    text-align: left;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--color-foreground);
}

.shop-lookup-result code {
    font-family: var(--font-mono);
    background: var(--color-background-muted);
    padding: 0.15em 0.35em;
}

/* --- Empty State --- */
.shop-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-muted);
}

/* --- Loading Spinner --- */
.shop-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: shopSpin 0.6s linear infinite;
}

@keyframes shopSpin {
    to { transform: rotate(360deg); }
}

/* --- Card Quick Buy (on product card, small shortcut) --- */
.product-card-quick-buy {
    margin-left: 0.5rem;
    padding: 0.25rem 0.65rem;
    background: transparent;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    font-size: 0.68rem;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.product-card-quick-buy:hover {
    border-color: var(--color-primary);
    color: var(--color-foreground);
}
