/* Product & accessory detail pages (e-commerce layout). Prefix: pd- */

:root {
    --pd-red: #ca262b;
    --pd-red-dark: #a91f24;
    --pd-red-soft: #fdf0f0;
    --pd-navy: #010f1c;
    --pd-ink: #1a2330;
    --pd-muted: #6b7480;
    --pd-line: #e9e6e1;
    --pd-bg: #f7f6f3;
    --pd-green: #13804f;
    --pd-amber: #b25e00;
    --pd-radius: 16px;
}

/* ---------- Breadcrumb ---------- */
.pd-crumbs { background: var(--pd-bg); border-bottom: 1px solid var(--pd-line); }
.pd-crumbs ol {
    list-style: none;
    margin: 0;
    padding: 14px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    font-size: 14px;
}
.pd-crumbs li { display: inline-flex; align-items: center; color: var(--pd-muted); }
.pd-crumbs li + li::before { content: "/"; margin: 0 10px; color: #c2bdb4; }
.pd-crumbs a { color: var(--pd-muted); }
.pd-crumbs a:hover { color: var(--pd-red); }
.pd-crumbs [aria-current] { color: var(--pd-ink); font-weight: 600; }

/* ---------- Main layout ---------- */
.pd-main { padding: 36px 0 48px; }

.pd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}

@media (max-width: 991.98px) {
    .pd-layout { grid-template-columns: 1fr; gap: 28px; }
    .pd-main { padding: 20px 0 32px; }
}

/* ---------- Gallery ---------- */
.pd-gallery { display: flex; gap: 14px; position: sticky; top: 24px; min-width: 0; }
.pd-buy { min-width: 0; }

.pd-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 84px;
    flex-shrink: 0;
    max-height: 560px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.pd-thumb {
    width: 84px;
    height: 84px;
    padding: 6px;
    border: 2px solid var(--pd-line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s ease;
}

.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumb:hover { border-color: #cfc8bc; }
.pd-thumb.is-active { border-color: var(--pd-red); }

.pd-stage {
    position: relative;
    flex: 1;
    min-width: 0;
    aspect-ratio: 1 / 1;
    max-height: 560px;
    border-radius: var(--pd-radius);
    background: #fff;
    border: 1px solid var(--pd-line);
    overflow: hidden;
}

.pd-stage-item {
    position: absolute;
    inset: 0;
    display: none;
    cursor: zoom-in;
    padding: 28px;
}

.pd-stage-item.is-active { display: block; }

.pd-stage-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .2s ease;
}

.pd-flag {
    position: absolute;
    z-index: 2;
    top: 16px;
    left: 16px;
    background: var(--pd-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: 999px;
}

.pd-zoom-hint {
    position: absolute;
    z-index: 2;
    right: 14px;
    bottom: 14px;
    font-size: 12px;
    color: var(--pd-muted);
    background: rgba(255, 255, 255, .92);
    padding: 5px 10px;
    border-radius: 999px;
    pointer-events: none;
}

.pd-nav {
    position: absolute;
    z-index: 2;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--pd-line);
    background: rgba(255, 255, 255, .95);
    color: var(--pd-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s ease;
}

.pd-nav.is-prev { left: 12px; }
.pd-nav.is-next { right: 12px; }
.pd-stage:hover .pd-nav, .pd-nav:focus-visible { opacity: 1; }

@media (max-width: 991.98px) {
    .pd-gallery { position: static; flex-direction: column-reverse; }
    .pd-thumbs { flex-direction: row; width: 100%; max-width: 100%; max-height: none; overflow-x: auto; }
    .pd-stage { width: 100%; flex: none; }
    .pd-thumb { width: 68px; height: 68px; }
    .pd-nav { opacity: 1; }
    .pd-zoom-hint { display: none; }
    .pd-stage-item { padding: 16px; }
}

/* ---------- Buy box ---------- */
.pd-buy-inner { position: sticky; top: 24px; }

.pd-category {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pd-red);
    margin-bottom: 10px;
}

.pd-title {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--pd-ink);
    margin: 0 0 10px;
}

.pd-sku { font-size: 14px; color: var(--pd-muted); margin-bottom: 20px; }
.pd-sku strong { color: var(--pd-ink); font-weight: 600; }

.pd-price-box {
    padding: 18px 20px;
    border-radius: var(--pd-radius);
    background: var(--pd-bg);
    margin-bottom: 16px;
}

.pd-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.pd-price-now { font-size: 34px; font-weight: 700; color: var(--pd-ink); line-height: 1; }
.pd-price-was { font-size: 18px; color: var(--pd-muted); text-decoration: line-through; }
.pd-price-save { font-size: 13px; font-weight: 700; color: var(--pd-red); background: var(--pd-red-soft); padding: 4px 10px; border-radius: 999px; }
.pd-price-note { font-size: 13px; color: var(--pd-muted); margin-top: 8px; }

.pd-locked { display: flex; gap: 14px; align-items: flex-start; }
.pd-locked > i { font-size: 22px; color: var(--pd-red); margin-top: 2px; }
.pd-locked strong { display: block; color: var(--pd-ink); font-size: 17px; }
.pd-locked span { color: var(--pd-muted); font-size: 14px; }

.pd-stock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 16px;
}

.pd-stock::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(0, 0, 0, .05); }
.pd-stock.is-in { color: var(--pd-green); }
.pd-stock.is-low { color: var(--pd-amber); }
.pd-stock.is-out { color: var(--pd-red); }

.pd-summary { color: #4a5360; font-size: 15px; line-height: 1.65; margin-bottom: 16px; }
.pd-summary a { color: var(--pd-red); font-weight: 600; white-space: nowrap; }

.pd-pallet {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 14px;
    color: #4a5360;
    border: 1px dashed #d9d3c8;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 18px;
}

.pd-pallet i { color: var(--pd-navy); margin-top: 3px; }

/* Buttons */
.pd-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }

.pd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 54px;
    padding: 0 24px;
    border-radius: 12px;
    border: 2px solid transparent;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    text-decoration: none;
}

.pd-btn-grow { flex: 1 1 200px; }
.pd-btn-block { width: 100%; margin-bottom: 12px; }
.pd-btn-primary { background: var(--pd-red); color: #fff; }
.pd-btn-primary:hover { background: var(--pd-red-dark); color: #fff; }
.pd-btn-primary.is-done { background: var(--pd-green); }
.pd-btn-dark { background: var(--pd-navy); color: #fff; }
.pd-btn-dark:hover { background: #12263b; color: #fff; }
.pd-btn-outline { border-color: var(--pd-navy); color: var(--pd-navy); background: #fff; }
.pd-btn-outline:hover { background: var(--pd-navy); color: #fff; }

.pd-qty {
    display: inline-flex;
    align-items: center;
    height: 54px;
    border: 2px solid var(--pd-line);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.pd-qty button {
    width: 44px;
    height: 100%;
    border: 0;
    background: transparent;
    font-size: 22px;
    color: var(--pd-ink);
    cursor: pointer;
}

.pd-qty button:hover { background: var(--pd-bg); }

.pd-qty input {
    width: 56px;
    height: 100%;
    border: 0;
    text-align: center;
    font-weight: 700;
    font-size: 17px;
    color: var(--pd-ink);
    -moz-appearance: textfield;
}

.pd-qty input::-webkit-outer-spin-button,
.pd-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pd-qty input:focus { outline: none; }

.pd-added {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #e8f6ee;
    color: var(--pd-green);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
}

.pd-added.is-error { background: var(--pd-red-soft); color: var(--pd-red); }
.pd-added a { margin-left: auto; color: inherit; text-decoration: underline; font-weight: 700; }

.pd-perks {
    list-style: none;
    margin: 20px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--pd-line);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.pd-perks li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--pd-muted); line-height: 1.4; }
.pd-perks i { font-size: 20px; color: var(--pd-red); margin-top: 2px; }
.pd-perks strong { display: block; color: var(--pd-ink); font-size: 14px; }
.pd-perks a { color: var(--pd-muted); text-decoration: underline; }

@media (max-width: 575.98px) {
    .pd-title { font-size: 25px; }
    .pd-price-now { font-size: 28px; }
    .pd-perks { grid-template-columns: 1fr; }
    .pd-qty { flex: 0 0 auto; }
}

/* ---------- Tabs ---------- */
.pd-info { padding: 8px 0 48px; }

.pd-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--pd-line);
    margin-bottom: 28px;
    overflow-x: auto;
    scrollbar-width: none;
}

.pd-tabs button {
    border: 0;
    background: none;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 16px;
    color: var(--pd-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    cursor: pointer;
}

.pd-tabs button:hover { color: var(--pd-ink); }
.pd-tabs button.is-active { color: var(--pd-ink); border-bottom-color: var(--pd-red); }

.pd-panel { display: none; }
.pd-panel.is-active { display: block; }

.pd-rich { max-width: 860px; color: #3e4753; font-size: 16px; line-height: 1.75; }
.pd-rich p { margin-bottom: 14px; }
.pd-rich a { color: var(--pd-red); text-decoration: underline; }

/* Specifications: style CKEditor lists / tables as a clean spec sheet */
.pd-spec ul, .pd-spec ol { list-style: none; padding: 0; margin: 0; border: 1px solid var(--pd-line); border-radius: 12px; overflow: hidden; }
.pd-spec li { padding: 12px 16px; border-bottom: 1px solid var(--pd-line); }
.pd-spec li:nth-child(odd) { background: var(--pd-bg); }
.pd-spec li:last-child { border-bottom: 0; }
.pd-spec table { width: 100%; border-collapse: collapse; border: 1px solid var(--pd-line); }
.pd-spec td, .pd-spec th { padding: 12px 16px; border-bottom: 1px solid var(--pd-line); }
.pd-spec tr:nth-child(odd) td { background: var(--pd-bg); }

/* ---------- Related ---------- */
.pd-related { padding: 48px 0 64px; background: var(--pd-bg); }

.pd-related-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.pd-related-head h2 { font-size: 26px; font-weight: 700; margin: 0; color: var(--pd-ink); }
.pd-related-head a { color: var(--pd-red); font-weight: 700; font-size: 15px; white-space: nowrap; }

.pd-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }

.pd-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--pd-radius);
    overflow: hidden;
    border: 1px solid var(--pd-line);
    color: var(--pd-ink);
    transition: transform .15s ease, box-shadow .15s ease;
}

.pd-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(1, 15, 28, .08); color: var(--pd-ink); }

.pd-card-img { display: block; aspect-ratio: 1 / 1; padding: 18px; border-bottom: 1px solid var(--pd-line); }
.pd-card-img img { width: 100%; height: 100%; object-fit: contain; }

.pd-card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.pd-card-title { font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pd-card:hover .pd-card-title { color: var(--pd-red); }
.pd-card-code { font-size: 13px; color: var(--pd-muted); }
.pd-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; }
.pd-card-price { font-weight: 700; font-size: 18px; }
.pd-card-login { font-size: 13px; color: var(--pd-muted); font-weight: 600; }
.pd-card-stock { font-size: 12px; font-weight: 700; }
.pd-card-stock.is-in { color: var(--pd-green); }
.pd-card-stock.is-out { color: var(--pd-red); }

@media (max-width: 1199.98px) { .pd-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767.98px) {
    .pd-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .pd-related-head h2 { font-size: 21px; }
}

/* ---------- Mobile sticky bar ---------- */
.pd-sticky { display: none; }

@media (max-width: 767.98px) {
    .pd-sticky {
        position: fixed;
        z-index: 1040;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid var(--pd-line);
        box-shadow: 0 -8px 24px rgba(1, 15, 28, .08);
        transform: translateY(110%);
        transition: transform .2s ease;
    }

    .pd-sticky.is-visible { transform: none; }
    .pd-sticky-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
    .pd-sticky-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pd-sticky-info span { font-size: 15px; font-weight: 700; color: var(--pd-red); }
    .pd-sticky .pd-btn { height: 46px; padding: 0 18px; font-size: 15px; }
}
