/* 04-product-detail.css: breadcrumbs, gallery, buy panel, offer rows, spec table,
   certification cards, disclosure blocks, related products. */

.product-page {
    padding-top: 20px;
    padding-bottom: 48px;
}

/* ---------- breadcrumbs ---------- */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.breadcrumb-sep {
    color: var(--border-strong);
}

.breadcrumbs span[aria-current="page"] {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ---------- top: gallery + buy panel ---------- */

.product-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 40px;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gallery-main {
    aspect-ratio: 4 / 3;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.gallery-placeholder {
    color: var(--brand-200);
    font-size: 5rem;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 72px;
    height: 72px;
    padding: 4px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    overflow: hidden;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-thumb:hover {
    border-color: var(--brand-200);
}

.gallery-thumb.active {
    border-color: var(--brand-500);
}

/* ---------- buy panel ---------- */

.buy-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    align-self: start;
}

.buy-brand {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.buy-title {
    font-size: 1.5rem;
    line-height: 1.25;
}

.buy-sku {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.buy-certs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sourcing-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 0.82rem;
    font-weight: 600;
}

/* ---------- offer rows ---------- */

.offer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.offer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.offer-row:hover {
    border-color: var(--brand-200);
}

.offer-row.selected {
    border-color: var(--brand-500);
    background: var(--brand-50);
}

.offer-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.offer-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.offer-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.offer-stock {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.offer-stock.in-stock {
    color: var(--success);
    font-weight: 600;
}

.offer-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    white-space: nowrap;
}

.offer-price .price {
    font-size: 1.05rem;
}

.offer-quote {
    font-weight: 600;
    color: var(--brand-600);
    font-size: 0.92rem;
}

/* ---------- per-unit detail ---------- */

.unit-detail {
    padding: 16px;
}

.unit-detail h3 {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.unit-facts {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.unit-facts i {
    color: var(--brand-600);
    margin-right: 4px;
}

.unit-photos {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.unit-photos img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ---------- warranty add-on + actions ---------- */

.warranty-addon {
    padding: 10px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.buy-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.buy-actions .btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* tooltip on the disabled Add to Cart */
.tooltip-wrap {
    position: relative;
    display: block;
}

.tooltip-wrap::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--brand-900);
    color: var(--text-on-brand);
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10;
}

.tooltip-wrap:hover::after,
.tooltip-wrap:focus-within::after {
    opacity: 1;
}

.buy-assurances {
    list-style: none;
    margin: 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.buy-assurances i {
    color: var(--brand-600);
    margin-right: 6px;
}

/* ---------- lower sections ---------- */

.product-section {
    margin-bottom: 36px;
}

.product-section > h2 {
    margin-bottom: 14px;
}

.product-description {
    max-width: 760px;
    font-size: 1rem;
    line-height: 1.7;
}

.spec-table-wrap,
.policy-table-wrap {
    overflow-x: auto;
}

.spec-table {
    width: 100%;
    max-width: 760px;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.92rem;
}

.spec-table th,
.spec-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.spec-table tbody tr:nth-child(odd) {
    background: var(--bg-subtle);
}

.spec-table tbody tr:last-child th,
.spec-table tbody tr:last-child td {
    border-bottom: none;
}

.spec-table th {
    color: var(--brand-900);
    font-weight: 600;
    width: 38%;
    min-width: 140px;
}

.spec-table thead th {
    background: var(--brand-50);
    width: auto;
}

.cert-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.cert-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.cert-card p {
    font-size: 0.9rem;
    margin: 0;
}

.in-box-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-secondary);
}

.in-box-list i {
    color: var(--success);
    margin-right: 8px;
}

.disclosure-block {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 20px 24px;
    max-width: 760px;
}

.disclosure-block h2 {
    font-size: 1.05rem;
    color: var(--warning);
    margin-bottom: 8px;
}

.disclosure-block p {
    margin: 0;
    font-size: 0.92rem;
}

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

/* ---------- desktop ---------- */

@media (min-width: 900px) {
    .product-top {
        grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
        align-items: start;
    }

    .buy-panel {
        position: sticky;
        top: 96px;
    }

    .buy-title {
        font-size: 1.7rem;
    }
}
