/**
 * TypechoPay — Shop & Product Card Styles
 *
 * All classes use the typechopay- prefix to avoid theme conflicts.
 * Themes can override by placing usr/themes/当前主题/typechopay/style.css
 * or by targeting these class names directly.
 */

:root {
    --typechopay-primary: #2563eb;
    --typechopay-primary-hover: #1d4ed8;
    --typechopay-danger: #ef4444;
    --typechopay-success: #10b981;
    --typechopay-muted: #6b7280;
    --typechopay-border: #e5e7eb;
    --typechopay-bg: #fff;
    --typechopay-soft-bg: #f8fafc;
    --typechopay-radius: 8px;
}

/* ===== Article Product Panel ===== */
.typechopay-product-panel {
    display: grid;
    grid-template-columns: minmax(120px, 220px) minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
    border: 1px solid var(--typechopay-border);
    border-radius: var(--typechopay-radius);
    background: var(--typechopay-bg);
    margin: 1.5em 0;
    overflow: hidden;
}

.typechopay-product-panel__cover {
    min-height: 180px;
    background: var(--typechopay-soft-bg);
}

.typechopay-product-panel__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.typechopay-product-panel__main {
    padding: 20px;
}

.typechopay-product-panel__label {
    display: inline-block;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--typechopay-primary);
    background: #eff6ff;
    padding: 3px 9px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.typechopay-product-panel__title {
    margin: 0 0 8px;
    font-size: 1.35em;
    line-height: 1.35;
}

.typechopay-product-panel__desc {
    margin: 0 0 14px;
    color: var(--typechopay-muted);
    line-height: 1.6;
}

.typechopay-product-panel__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    margin-bottom: 16px;
}

.typechopay-product-panel__price {
    font-size: 1.45em;
    font-weight: 700;
    color: var(--typechopay-danger);
}

.typechopay-product-panel__sold,
.typechopay-product-panel__stock {
    color: var(--typechopay-muted);
    font-size: 0.92em;
}

.typechopay-product-panel__stock {
    color: var(--typechopay-success);
}

.typechopay-product-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.typechopay-product-panel__buy,
.typechopay-button--secondary {
    display: inline-block;
    padding: 9px 22px;
    font-size: 0.92em;
    font-weight: 600;
    color: #fff;
    background: var(--typechopay-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}

.typechopay-product-panel__buy:hover,
.typechopay-button--secondary:hover {
    background: var(--typechopay-primary-hover);
    color: #fff;
    text-decoration: none;
}

.typechopay-button--disabled,
.typechopay-button--disabled:hover {
    cursor: not-allowed;
    background: #9ca3af;
}

.typechopay-status--soldout .typechopay-product-panel__stock {
    color: var(--typechopay-danger);
}

/* ===== Theme Post Badge ===== */
.typechopay-post-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    padding: 3px 8px;
    border: 1px solid #fecaca;
    border-radius: 4px;
    background: #fff7ed;
    color: #991b1b;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
}

.typechopay-post-badge__label,
.typechopay-post-badge__price,
.typechopay-post-badge__stock {
    white-space: nowrap;
}

.typechopay-post-badge__price {
    color: var(--typechopay-danger);
}

.typechopay-post-badge__stock {
    color: var(--typechopay-muted);
    font-weight: 500;
}

.typechopay-post-badge.typechopay-status--soldout {
    border-color: #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
}

/* ===== Shop Grid ===== */
.typechopay-shop {
    margin: 1.5em 0;
}

.typechopay-shop__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.typechopay-shop__empty {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 0.95em;
}

/* ===== Product Card ===== */
.typechopay-card {
    border: 1px solid var(--typechopay-border);
    border-radius: var(--typechopay-radius);
    overflow: hidden;
    background: var(--typechopay-bg);
    transition: box-shadow 0.2s, transform 0.2s;
}

.typechopay-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.typechopay-card__cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--typechopay-soft-bg);
}

.typechopay-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.typechopay-card__body {
    padding: 16px;
}

.typechopay-card__category {
    display: inline-block;
    font-size: 0.75em;
    color: #6366f1;
    background: #eef2ff;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.typechopay-card__title {
    margin: 0 0 8px;
    font-size: 1.1em;
    font-weight: 600;
    line-height: 1.4;
    color: #111;
}

.typechopay-card__price {
    font-size: 1.25em;
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 8px;
}

.typechopay-card__stock {
    font-size: 0.85em;
    color: #10b981;
    margin-bottom: 8px;
}

.typechopay-card__summary {
    font-size: 0.9em;
    color: var(--typechopay-muted);
    line-height: 1.5;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.typechopay-card__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.typechopay-card__buy {
    display: inline-block;
    padding: 8px 20px;
    font-size: 0.9em;
    font-weight: 600;
    color: #fff;
    background: var(--typechopay-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.typechopay-card__buy:hover {
    background: var(--typechopay-primary-hover);
}

.typechopay-card__buy:active {
    background: #1d4ed8;
}

/* ===== Pay Box (existing) ===== */
.typechopay-box {
    border: 1px solid var(--typechopay-border);
    border-radius: var(--typechopay-radius);
    padding: 20px;
    margin: 1.5em 0;
    background: #fafafa;
}

.typechopay-box strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.typechopay-amount {
    display: block;
    font-size: 1.3em;
    font-weight: 700;
    color: #ef4444;
    margin-bottom: 12px;
}

.typechopay-form {
    display: inline;
}

.typechopay-form button {
    padding: 8px 20px;
    font-size: 0.9em;
    font-weight: 600;
    color: #fff;
    background: var(--typechopay-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 4px;
}

.typechopay-form button:hover {
    background: var(--typechopay-primary-hover);
}

/* ===== Status Messages ===== */
.typechopay-owned {
    padding: 12px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    color: #065f46;
    font-weight: 600;
}

.typechopay-locked {
    padding: 12px 16px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    color: #92400e;
}

.typechopay-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .typechopay-product-panel {
        grid-template-columns: 1fr;
    }

    .typechopay-product-panel__cover {
        min-height: 160px;
        aspect-ratio: 16 / 9;
    }

    .typechopay-shop__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .typechopay-shop__grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
