/*
 * Endodontic tools storefront.
 * Layout and interaction primitives deliberately reuse the mature /buy/ UI.
 */

body.endosim-page {
    --endo-media-bg: color-mix(in srgb, var(--surface-muted) 86%, #ffffff);
}

.endo-tools-shell {
    padding-bottom: calc(var(--shell-nav-offset) + 8.5rem);
}

.endo-tools-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
    padding: 1.08rem 0;
    border-bottom: 1px solid var(--border-color);
}

.endo-tools-intro > div {
    min-width: 0;
    display: grid;
    gap: 0.28rem;
}

.endo-tools-intro h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.28rem, 3vw, 1.72rem);
    line-height: 1.65;
    font-weight: 940;
}

.endo-tools-intro p {
    margin: 0;
    max-width: 720px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.95;
}

.endo-tools-reference {
    margin-top: 0.35rem;
}

.endo-tools-reference__badge {
    flex: 0 0 auto;
    padding: 0.28rem 0.58rem;
    border-radius: 999px;
    background: var(--commerce-accent-soft);
    color: var(--commerce-accent-strong);
    font-size: 0.72rem;
    font-weight: 860;
    white-space: nowrap;
}

.endo-tools-filters {
    margin-top: -0.1rem;
}

.endo-tools-market {
    margin-top: 0.25rem;
}

.endo-tools-feed {
    align-items: stretch;
}

.endo-tools-card {
    position: relative;
    min-width: 0;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.endo-tools-card.is-selected {
    background: color-mix(in srgb, var(--commerce-accent-soft) 28%, transparent);
}

.endo-tools-card__hero {
    background: var(--endo-media-bg);
    overflow: hidden;
}

.endo-tools-card__hero img {
    object-fit: contain !important;
    padding: 0.42rem;
    background: #ffffff;
}

.endo-tools-card__placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(135deg, transparent 38%, color-mix(in srgb, var(--border-color) 70%, transparent) 39% 41%, transparent 42%),
        var(--endo-media-bg);
}

.endo-tools-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.26rem;
    margin-top: 0.12rem;
}

.endo-tools-tag {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0.18rem 0.46rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-solid);
    color: var(--text-secondary);
    font-size: 0.66rem;
    font-weight: 760;
    line-height: 1.3;
}

.endo-tools-code {
    width: fit-content;
    max-width: 100%;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.7;
}

.endo-tools-card__purchase {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-top: auto;
    padding-top: 0.32rem;
}

.endo-tools-price {
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 940;
    line-height: 1.5;
    white-space: nowrap;
}

.endo-tools-stepper {
    display: inline-grid;
    grid-template-columns: 34px minmax(34px, auto) 34px;
    align-items: center;
    min-height: 36px;
    border: 1px solid var(--border-color-strong);
    border-radius: 8px;
    background: var(--surface-solid);
    overflow: hidden;
}

.endo-tools-stepper button {
    width: 34px;
    height: 36px;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
}

.endo-tools-stepper button:active {
    background: var(--commerce-accent-soft);
    color: var(--commerce-accent-strong);
}

.endo-tools-qty {
    min-width: 34px;
    text-align: center;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 880;
    font-variant-numeric: tabular-nums;
}

.endo-tools-empty {
    grid-column: 1 / -1;
}

.endo-tools-notes {
    margin-top: 0.2rem;
}

.endo-tools-cart-dock .buy-primary-btn {
    min-height: 44px;
}

@media (min-width: 860px) {
    .endo-tools-card__hero {
        width: 112px;
        height: 112px;
    }
}

@media (max-width: 720px) {
    .endo-tools-shell {
        padding-top: 0.65rem;
        padding-bottom: calc(var(--shell-nav-offset) + 10.5rem);
    }

    .endo-tools-intro {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 0.72rem;
        padding-block: 0.72rem 0.92rem;
    }

    .endo-tools-intro h2 {
        font-size: 1.24rem;
    }

    .endo-tools-intro p {
        font-size: 0.8rem;
        line-height: 1.85;
    }

    .endo-tools-intro .buy-primary-btn {
        width: 100%;
    }

    .endo-tools-reference {
        align-items: flex-start;
    }

    .endo-tools-feed {
        grid-template-columns: 1fr !important;
    }

    .endo-tools-card {
        width: 100%;
        min-width: 0;
    }

    .endo-tools-card__hero {
        width: 92px;
        height: 92px;
    }

    .endo-tools-card__purchase {
        align-items: flex-end;
    }

    .endo-tools-price {
        font-size: 0.9rem;
    }
}

@media (max-width: 420px) {
    .endo-tools-tag:nth-child(n+3) {
        display: none;
    }

    .endo-tools-stepper {
        grid-template-columns: 32px minmax(30px, auto) 32px;
    }

    .endo-tools-stepper button {
        width: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .endo-tools-card {
        transition: none;
    }
}

/* Keep the compact commerce row deterministic in RTL: content stays wide and media stays fixed. */
.endo-tools-card {
    direction: ltr;
    grid-template-columns: minmax(0, 1fr) 112px !important;
}

.endo-tools-card .buy-item-card__body {
    grid-column: 1;
    grid-row: 1;
    direction: rtl;
    text-align: right;
    min-width: 0;
}

.endo-tools-card .endo-tools-card__hero {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

.endo-tools-card .buy-item-card__title,
.endo-tools-card .buy-item-card__desc {
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .endo-tools-card {
        grid-template-columns: minmax(0, 1fr) 92px !important;
    }
}

.endo-tools-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.endo-tools-more-wrap .buy-secondary-btn {
    min-width: min(100%, 260px);
}

.endo-tools-card .buy-item-card__title[dir="ltr"] {
    text-align: left;
    unicode-bidi: isolate;
}
