/* 商品详情 PDP — 对齐 aion2-kinah-detail.html（头尾用 marketplace 壳） */

/* -------------------------------------------------------------------------- */
/* Tokens + page shell                                                         */
/* -------------------------------------------------------------------------- */

.pdp {
    --pdp-line: var(--color-border, #e5e7eb);
    --pdp-muted: var(--color-muted-foreground, #6b7280);
    --pdp-ink: var(--color-foreground, #111214);
    --pdp-ink-2: var(--color-ink-2, #3c4043);
    --pdp-bg: var(--color-background, #f6f7f9);
    --pdp-brand: var(--color-brand, #e23a2e);
    --pdp-brand-dark: var(--color-brand-dark, #c22f24);
}

.pdp-band {
    background: linear-gradient(180deg, var(--color-brand-soft, #fff2ef) 0%, color-mix(in srgb, var(--color-brand-soft, #fff4f2) 40%, var(--color-card, #fff)) 190px, var(--pdp-bg) 420px);
    padding-bottom: 3.25rem;
}

.pdp-wrap {
    width: 100%;
    max-width: var(--max-width-mall, 1440px);
    margin-inline: auto;
    padding-inline: var(--spacing-gutter, 1.25rem);
}

.pdp-title {
    margin: 0;
    padding: 1.625rem 0 1.25rem;
    font-size: clamp(1rem, 0.8rem + 1.6vw, 2.125rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.2;
    color: var(--pdp-ink);
}

.pdp-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 24.5rem;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.625rem;
}

/* -------------------------------------------------------------------------- */
/* Spec / description card                                                     */
/* -------------------------------------------------------------------------- */

.pdp-card {
    background: var(--color-card, #fff);
    border-radius: 1rem;
    padding: 1.75rem;
}

.pdp-card > h2 {
    margin: 0 0 1.375rem;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-ink-2, #4b5058);
}

.pdp-card > h2 em {
    font-style: normal;
    font-size: 1.125rem;
    color: var(--pdp-muted);
}

.pdp-spec {
    display: flex;
    flex-direction: column;
}

.pdp-spec-row {
    display: grid;
    grid-template-columns: 11.875rem 1fr;
    gap: 1.125rem;
    padding: 1rem 0.25rem;
    border-bottom: 1px solid var(--pdp-line);
}

.pdp-spec-row:last-child {
    border-bottom: 0;
    padding-bottom: 0.25rem;
}

.pdp-spec-k {
    color: var(--pdp-muted);
    font-size: 0.9375rem;
}

.pdp-spec-k::after {
    content: " :";
    color: var(--color-footer-muted, #c4c8ce);
}

.pdp-spec-v {
    min-width: 0;
    font-size: 0.9375rem;
    color: var(--pdp-ink);
}

.pdp-spec-v strong {
    font-weight: 600;
}

.pdp-details {
    max-height: 11.625rem;
    overflow-y: auto;
    padding-right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--pdp-ink-2);
    scrollbar-width: thin;
    scrollbar-color: var(--pdp-brand) var(--color-muted, #edeef1);
}

.pdp-details p {
    margin: 0;
}

.pdp-details-html {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.pdp-details-html p {
    margin: 0;
}

.pdp-gallery {
    display: grid;
    gap: 0.75rem;
}

.pdp-gallery-item {
    display: block;
    overflow: hidden;
    border: 1px solid var(--pdp-line);
    border-radius: 0.625rem;
    background: var(--color-muted, #f7f8fa);
}

.pdp-gallery-item img {
    display: block;
    width: 100%;
    object-fit: cover;
}

.pdp-details::-webkit-scrollbar {
    width: 6px;
}

.pdp-details::-webkit-scrollbar-track {
    background: var(--color-muted, #edeef1);
    border-radius: 3px;
}

.pdp-details::-webkit-scrollbar-thumb {
    background: var(--pdp-brand);
    border-radius: 3px;
}

/* -------------------------------------------------------------------------- */
/* Buy panel                                                                   */
/* -------------------------------------------------------------------------- */

.pdp-buy-col {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
    position: sticky;
    top: 7rem;
    /* View 滚回购买区时避开固定头栏（与 sticky top 一致） */
    scroll-margin-top: 7rem;
}

.pdp-buy {
    background: var(--color-card, #fff);
    border: 1px solid color-mix(in srgb, var(--color-brand, #e23a2e) 22%, var(--color-card, #fff));
    border-radius: 1rem;
    padding: 1.5rem;
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.pdp-buy.is-flash {
    border-color: var(--pdp-brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand, #e23a2e) 16%, transparent);
}

.pdp-uprice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.875rem;
    font-size: 0.875rem;
}

.pdp-uprice span:first-child {
    color: var(--pdp-muted);
}

.pdp-uprice b {
    font-weight: 600;
    color: var(--pdp-ink);
}

.pdp-qty {
    display: flex;
    align-items: center;
    height: 3rem;
    background: var(--color-card, #fff);
    border: 1px solid var(--pdp-line);
    border-radius: 0.625rem;
    overflow: hidden;
}

.pdp-qty button {
    width: 2.75rem;
    height: 100%;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
    color: var(--pdp-muted);
    cursor: pointer;
}

.pdp-qty button:hover:not([disabled]) {
    background: var(--color-muted, #f2f3f5);
    color: var(--pdp-ink);
}

.pdp-qty input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    text-align: center;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    background: transparent;
}

.pdp-qu {
    padding: 0 0.375rem;
    font-size: 0.8125rem;
    color: var(--pdp-muted);
    font-weight: 600;
}

.pdp-qty-hint {
    margin: 0.5rem 0.125rem 0;
    font-size: 0.78125rem;
    color: var(--pdp-muted);
}

.pdp-qty-hint.is-warn {
    color: var(--pdp-brand);
}

.pdp-kv {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid color-mix(in srgb, var(--color-brand, #e23a2e) 18%, var(--color-card, #fff));
}

.pdp-kv-k {
    font-size: 1rem;
    font-weight: 700;
}

.pdp-kv-v {
    font-size: 0.8125rem;
    color: var(--pdp-muted);
}

.pdp-kv-v b {
    font-size: 1.4375rem;
    font-weight: 700;
    color: var(--pdp-brand);
    letter-spacing: -0.025em;
    margin-right: 0.1875rem;
}

.pdp-kv-sm {
    margin-top: 0.5rem;
    padding-top: 0;
    border-top: 0;
    font-size: 0.8125rem;
    color: var(--pdp-muted);
}

.pdp-kv-sm .pdp-kv-k {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--pdp-muted);
}

.pdp-kv-sm .pdp-kv-v b {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pdp-ink-2);
    margin-right: 0.125rem;
}

.pdp-btn-buy,
.pdp-btn-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 3.125rem;
    margin-top: 0.875rem;
    border-radius: 0.75rem;
    font-size: 1.0625rem;
    font-weight: 700;
    cursor: pointer;
}

.pdp-btn-buy {
    border: 0;
    background: var(--pdp-brand);
    color: var(--color-brand-foreground, #fff);
}

.pdp-btn-buy:hover {
    background: var(--pdp-brand-dark);
}

.pdp-btn-cart {
    border: 1px solid var(--pdp-line);
    background: var(--color-card, #fff);
    color: var(--pdp-ink);
}

.pdp-btn-cart:hover {
    background: var(--color-muted, #f7f8fa);
    border-color: var(--color-border, #c9cdd4);
}

.pdp-btn-cart:disabled,
.pdp-bb-cart:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* -------------------------------------------------------------------------- */
/* Seller card                                                                 */
/* -------------------------------------------------------------------------- */

.pdp-seller {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: var(--color-card, #fff);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
}

.pdp-av {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    object-fit: cover;
    background: var(--color-muted, #eef0f3);
    flex: 0 0 auto;
}

.pdp-s-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--pdp-ink);
}

.pdp-s-lvl {
    font-size: 0.8125rem;
    color: var(--pdp-muted);
}

.pdp-chat {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 2.5rem;
    padding: 0 0.875rem;
    border-radius: 0.625rem;
    border: 1px solid color-mix(in srgb, var(--color-positive, #00b67a) 30%, var(--color-card, #fff));
    background: color-mix(in srgb, var(--color-positive, #00b67a) 8%, var(--color-card, #fff));
    color: var(--color-positive, #1f7a4d);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.pdp-chat:hover {
    background: color-mix(in srgb, var(--color-positive, #00b67a) 10%, var(--color-card, #fff));
}

/* -------------------------------------------------------------------------- */
/* Other sellers                                                               */
/* -------------------------------------------------------------------------- */

.pdp-osel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pdp-line);
}

.pdp-osel-head h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-ink-2, #4b5058);
}

.pdp-osort {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdp-osort-k {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pdp-muted);
    white-space: nowrap;
}

.pdp-osort-ctl {
    min-width: 9.5rem;
    position: relative;
    z-index: 5;
}

.pdp-osort-select.select {
    width: 100%;
    overflow: visible;
}

.pdp-osort-select .select-btn {
    min-height: 2.25rem;
    font-size: 0.875rem;
}

/* 触发器较窄，菜单按文案撑开，避免 Price / Delivery 被 ellipsis 截断 */
.pdp-osort-select .select-menu {
    width: max-content;
    min-width: 100%;
    max-width: min(22rem, calc(100vw - 2rem));
    right: 0;
    left: auto;
}

.pdp-osort-select .select-label {
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
}

/* 7 列：卖家 | 配送方式 | 时效 | 库存 | 起购 | 单价 | View */
.pdp-srow {
    display: grid;
    grid-template-columns:
        minmax(10.5rem, 1.25fr)
        minmax(9rem, 1.35fr)
        minmax(5rem, 0.7fr)
        minmax(5rem, 0.7fr)
        minmax(6rem, 0.8fr)
        minmax(6.5rem, 0.85fr)
        auto;
    gap: 0.875rem 1rem;
    align-items: center;
    padding: 1.25rem 0.125rem;
    border-top: 1px solid var(--pdp-line);
}

.pdp-srow:hover {
    background: var(--color-muted, #fafbfc);
}

.pdp-srow:first-of-type {
    border-top: 0;
}

.pdp-srow > * {
    min-width: 0;
}

.pdp-s-id {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.pdp-srow .pdp-av {
    width: 2.5rem;
    height: 2.5rem;
}

.pdp-s-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
    min-width: 0;
}

.pdp-srow .pdp-s-name {
    font-size: 0.9375rem;
    width: 100%;
}

.pdp-srow .pdp-s-lvl {
    font-size: 0.75rem;
}

.pdp-cell-k {
    display: block;
    font-size: 0.75rem;
    color: var(--pdp-muted);
}

.pdp-cell-v {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    color: var(--pdp-ink);
}

.pdp-cell-price .pdp-cell-v {
    font-weight: 700;
    color: var(--pdp-brand);
}

.pdp-unit {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--pdp-muted);
}

.pdp-tag {
    display: inline-block;
    max-width: 100%;
    margin-top: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    background: var(--color-muted, #f1f3f5);
    color: var(--pdp-ink-2);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pdp-s-pick {
    margin-left: 0;
    justify-self: end;
    min-width: auto;
}

.pdp-btn-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    height: 2.25rem;
    padding: 0 0.875rem;
    border: 1px solid var(--pdp-brand);
    border-radius: 0.5rem;
    background: var(--color-card, #fff);
    color: var(--pdp-brand);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.pdp-btn-pick svg {
    flex: 0 0 auto;
}

.pdp-btn-pick:hover {
    background: var(--color-brand-soft, #fff2ef);
}

.pdp-osel-more {
    display: flex;
    justify-content: center;
    padding: 1rem 0 0.25rem;
}

.pdp-btn-more {
    min-width: 10rem;
    height: 2.5rem;
    padding: 0 1.25rem;
    border: 1px solid var(--pdp-line);
    border-radius: 0.625rem;
    background: var(--color-card, #fff);
    color: var(--pdp-ink);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.pdp-btn-more:hover:not(:disabled) {
    border-color: var(--pdp-brand);
    color: var(--pdp-brand);
}

.pdp-btn-more:disabled {
    opacity: 0.65;
    cursor: wait;
}

/* -------------------------------------------------------------------------- */
/* Mobile sticky buy bar                                                       */
/* -------------------------------------------------------------------------- */

.pdp-buybar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    background: var(--color-card, #fff);
    border-top: 1px solid var(--pdp-line);
    box-shadow: 0 -6px 22px color-mix(in srgb, var(--color-foreground, #111214) 12%, transparent);
    padding: 0.625rem 0.875rem calc(0.625rem + env(safe-area-inset-bottom));
    align-items: center;
    gap: 0.625rem;
}

.pdp-bb-qty {
    display: flex;
    align-items: center;
    height: 2.75rem;
    border: 1px solid var(--pdp-line);
    border-radius: 0.5625rem;
    flex: 0 0 auto;
}

.pdp-bb-qty button {
    width: 2.125rem;
    height: 100%;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
    color: var(--pdp-muted);
    padding: 0;
    cursor: pointer;
}

.pdp-bb-qty input {
    width: 2rem;
    border: 0;
    outline: 0;
    text-align: center;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    background: transparent;
}

.pdp-bb-u {
    padding-right: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pdp-muted);
}

.pdp-bb-tot {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.pdp-bb-k {
    font-size: 0.6875rem;
    color: var(--pdp-muted);
}

.pdp-bb-v {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--pdp-brand);
    white-space: nowrap;
}

.pdp-bb-cart {
    flex: 0 0 auto;
    width: 2.875rem;
    height: 2.875rem;
    border: 1px solid var(--pdp-line);
    border-radius: 0.625rem;
    background: var(--color-card, #fff);
    color: var(--pdp-ink);
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
}

.pdp-bb-cart:hover {
    background: var(--color-muted, #f7f8fa);
    border-color: var(--color-border, #c9cdd4);
}

.pdp-bb-buy {
    flex: 1 1 auto;
    height: 2.875rem;
    border: 0;
    border-radius: 0.625rem;
    background: var(--pdp-brand);
    color: var(--color-brand-foreground, #fff);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.pdp-bb-buy:hover {
    background: var(--pdp-brand-dark);
}

/* qty / buybar 共用：数字输入去 spinner、步进禁用态 */
.pdp-qty input,
.pdp-bb-qty input {
    -moz-appearance: textfield;
}

.pdp-qty input::-webkit-outer-spin-button,
.pdp-qty input::-webkit-inner-spin-button,
.pdp-bb-qty input::-webkit-outer-spin-button,
.pdp-bb-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pdp-qty button[disabled],
.pdp-bb-qty button[disabled] {
    opacity: 0.35;
}

.pdp-qty button[disabled] {
    cursor: not-allowed;
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
    .pdp-srow {
        grid-template-columns:
            minmax(10rem, 1.2fr)
            minmax(7rem, 1fr)
            minmax(4.5rem, 0.7fr)
            minmax(4.5rem, 0.7fr)
            minmax(5.5rem, 0.8fr)
            minmax(5.5rem, 0.85fr)
            auto;
        gap: 0.75rem;
    }
}

@media (max-width: 1080px) {
    .pdp-grid {
        display: block;
    }

    .pdp-buy-col {
        position: static;
        margin-top: 1rem;
    }
}

@media (max-width: 900px) {
    .pdp-buybar {
        display: flex;
    }

    .pdp {
        padding-bottom: 0;
    }

    .pdp-btn-buy {
        display: none;
    }

    .pdp-band {
        padding-bottom: 2rem;
    }

    .pdp-card,
    .pdp-buy {
        padding: 1.25rem;
    }

    .pdp-spec-row {
        grid-template-columns: 1fr;
        gap: 0.375rem;
        padding: 0.9375rem 0.125rem;
    }

    .pdp-spec-k::after {
        content: "";
    }

    .pdp-osel-head h2 {
        font-size: 1.25rem;
    }

    .pdp-osort {
        width: 100%;
        margin-left: 0;
    }

    .pdp-osort-ctl {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    .pdp-srow {
        grid-template-columns: 1fr 1fr;
        gap: 0.875rem 1rem;
        align-items: start;
        padding: 1.25rem 0.125rem;
    }

    .pdp-s-id {
        grid-column: 1 / -1;
    }

    .pdp-cell-price {
        grid-column: 1 / 2;
    }

    .pdp-s-pick {
        grid-column: 1 / -1;
        justify-self: stretch;
        margin-left: 0;
    }

    .pdp-btn-pick {
        width: 100%;
        justify-content: center;
    }

    .pdp-seller {
        flex-wrap: wrap;
    }

    .pdp-chat {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pdp * {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
