/* Shop layout + filters (uses variables.css) */
body.post-type-archive-product,
body.tax-product_cat,
body.tax-product_tag {
    background:
        radial-gradient(1200px 620px at 14% 6%, color-mix(in srgb, var(--primary-color) 18%, transparent), transparent 72%),
        radial-gradient(980px 560px at 88% 10%, color-mix(in srgb, var(--primary-color) 14%, transparent), transparent 74%),
        radial-gradient(760px 420px at 52% -8%, color-mix(in srgb, var(--accent-blue) 10%, transparent), transparent 76%),
        var(--bg-dark);
    background-attachment: fixed;
}

.nm-input.nm-shop-price{
    background: none;
}

.nm-shop {
    max-width: 1200px;
    margin: 0 auto;
    color: var(--text-main);
    font-family: var(--font-main);
}

.nm-shop-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: end;
    padding: 22px 0 14px;
}

.nm-shop-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-color);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.nm-shop-hero-title {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 4.1rem);
    font-weight: 900;
    letter-spacing: 0;
    color: var(--text-main);
    line-height: 1;
}

.nm-shop-hero-subtitle {
    max-width: 430px;
    justify-self: end;
    color: var(--text-dim);
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.6;
    text-align: right;
}

.nm-shop-divider {
    height: 1px;
    width: 100%;
    background: var(--secondary-border-color);
    margin: 18px 0 22px;
}

.nm-shop-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
    align-items: start;
}

.nm-shop-filters {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--secondary-border-color);
    border-radius: var(--border-radius);
    padding: 14px;
    position: sticky;
    top: 110px;
}

.nm-shop-filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.nm-shop-filters-title {
    font-weight: 600;
}

.nm-shop-clear {
    background: transparent;
    border: 0;
    color: var(--text-dim);
    cursor: pointer;
    font-weight: 400;
    transition: 0.3s ease-in-out;
}

.nm-shop-clear:hover{
    color: var(--primary-red);
}

.nm-shop-filter-block {
    padding: 12px 0;
    border-top: 1px solid var(--secondary-border-color);
}

.nm-shop-filter-block:first-of-type {
    border-top: 0;
}

.nm-shop-filter-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.nm-shop-filter-content {
    margin-top: 10px;
}

.nm-shop-filter-caret {
    color: var(--text-dim);
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

.nm-shop-filter-block:not(.is-open) .nm-shop-filter-content {
    display: none;
}

.nm-shop-filter-block:not(.is-open) .nm-shop-filter-caret {
    transform: rotate(-90deg);
}

.nm-shop-filter-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.nm-shop-price-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.nm-shop-cat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow: auto;
    padding-right: 6px;
}

.nm-shop-cat {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    gap: 10px;
    align-items: center;
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
}

.nm-shop-cat input {
    accent-color: var(--primary-color);
}

.nm-shop-cat-count {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 700;
}

.nm-shop-main {
    min-width: 0;
}

.nm-shop-topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.nm-shop-searchwrap input[type="search"] {
    width: 100% !important;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--secondary-border-color);
    color: var(--text-main);
    border-radius: 12px;
    padding: 12px 14px;
}

#nm-shop-count, .nm-shop-count {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.nm-shop.is-loading #nm-shop-results {
    opacity: 0.6;
    pointer-events: none;
}

.nm-shop-pagination ul {
    margin-top: 18px;
}

.nm-shop #nm-shop-results .woocommerce-no-products-found {
    margin-top: 10px;
}

.nm-shop #nm-shop-results .woocommerce-no-products-found .woocommerce-info {
    margin: 0;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--secondary-border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.95rem;
}

.nm-shop #nm-shop-results .woocommerce-no-products-found .woocommerce-info::before,
.nm-shop #nm-shop-results .woocommerce-no-products-found .woocommerce-info::after,
.nm-shop #nm-shop-results .woocommerce-no-products-found::before,
.nm-shop #nm-shop-results .woocommerce-no-products-found::after {
    content: none !important;
    display: none !important;
}

/* Product cards */
.nm-shop .products {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.nm-shop .products::before,
.nm-shop .products::after {
    content: none !important;
    display: none !important;
}

.nm-shop .products li.product.nm-product-card {
    width: auto !important;
    margin: 0 !important;
    float: none !important;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--secondary-border-color);
    border-radius: 14px;
    padding: 10px;
    list-style: none;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    transition: 0.3s ease-in-out;
}

.nm-shop .products li.product.nm-product-card:hover{
    border: 1px solid var(--primary-color);
}

.nm-product-thumb {
    display: block;
    border-radius: 12px;
    position: relative;
}

.nm-product-thumb img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
    display: block;
    margin: 0 !important;
    padding-bottom: 5px;
}

.nm-free-gift-badge {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: min(232px, calc(100% - 24px));
    min-height: 42px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    padding: 6px 12px;
    border: 1px solid color-mix(in srgb, var(--accent-green) 46%, var(--secondary-border-color));
    border-radius: 8px;
    background: var(--bg-green);
    color: var(--text-main);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    pointer-events: none;
    text-align: center;
    box-sizing: border-box;
}

.nm-free-gift-badge.is-hidden {
    display: none;
}

.nm-free-gift-badge__label {
    color: var(--accent-green);
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
}

.nm-free-gift-badge__items {
    color: var(--text-main);
    font-size: 0.73rem;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* 1. On passe le corps de la carte en Flexbox au lieu de Grid pour plus de souplesse */
.nm-shop .products li.product.nm-product-card .nm-product-body {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    padding: 2px !important;
}

/* 2. On laisse la div des variations s'adapter parfaitement à son contenu */
.nm-shop .products li.product.nm-product-card .nm-variation-list {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 6px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 5px 0 !important;
}

/* 3. On sécurise la taille du bouton pour écraser les 44px de hauteur forcés par WooCommerce */
.nm-shop .products li.product.nm-product-card .nm-var-btn {
    height: auto !important;
    min-height: 28px !important;
    line-height: 1.2 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.nm-product-title {
    text-align: start;
    margin: 0;
    padding-bottom: 5px;
    line-height: 1.2;
}

.nm-product-title a {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


.nm-var-btn {
    border: 1px solid var(--secondary-border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 400;
    cursor: pointer;
    transition: 0.3s ease-in-out;
}

.nm-var-btn:hover{
    border: 1px solid var(--bg-dark-light);
}

.nm-var-btn.is-active {
    color: var(--text-main);
    border-color: color-mix(in srgb, var(--primary-color) 60%, var(--secondary-border-color));
    background: color-mix(in srgb, var(--primary-color) 22%, transparent);
}

.nm-product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

ul.products li.product .price, ul.products .wc-block-grid__product .price, .wc-block-grid__products li.product .price, .wc-block-grid__products .wc-block-grid__product .price{
    margin-bottom: 0 !important;
}

.nm-product-price {
    display: flex;
    flex-direction: row;
    gap: 7%;
    font-size: 1rem;
    font-weight: 400;
}

.nm-product-price .amount {
    color: var(--text-main);
}

.nm-product-stock {
    font-size: 0.9rem;
    font-weight: 400;
}

.nm-product-stock.is-in { color: var(--accent-green); }
.nm-product-stock.is-out { color: var(--primary-red); }

.nm-free-gift {
    display: grid;
    gap: 8px;
    margin: 6px 0 12px;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--accent-green) 34%, var(--secondary-border-color));
    border-radius: 10px;
    background:
        radial-gradient(280px 120px at 12% 0%, rgba(74, 222, 128, 0.12), transparent 72%),
        rgba(74, 222, 128, 0.045);
}

.nm-free-gift__head {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--accent-green);
    font-size: 0.78rem;
    font-weight: 800;
}

.nm-free-gift__head svg {
    width: 15px;
    height: 15px;
}

.nm-free-gift__items {
    display: grid;
    gap: 6px;
}

.nm-free-gift__item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.nm-free-gift__image {
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
}

.nm-free-gift__item strong,
.nm-free-gift__item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nm-free-gift__item strong {
    color: var(--text-main);
    font-size: 0.78rem;
}

.nm-free-gift__item small {
    color: var(--accent-green);
    font-size: 0.7rem;
}

.nm-free-gift__item.is-out small {
    color: var(--primary-red);
}

.nm-product-actions {
    margin-bottom: 5%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.nm-card-btn {
    border: 1px solid var(--secondary-border-color);
    border-radius: 10px;
    padding: 3px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s ease-in;
}

.nm-card-btn:hover{
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.nm-card-buy {
    background: var(--primary-color);
    color: var(--text-main);
    border-color: transparent;
}

.nm-card-cart {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.nm-card-cart-viewlike {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-opacity-low);
    border-color: var(--secondary-border-color);
}

.nm-card-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.nm-card-view {
    display: block;
    text-align: center;
    border: 1px solid var(--secondary-border-color);
    border-radius: 10px;
    padding: 3px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
    transition: 0.3s ease-in-out;
}

.nm-card-view:hover{
    background-color: var(--bg-dark-light);
    color: var(--text-main);
}

.nm-card-cart-viewlike:hover{
    background-color: var(--bg-dark-light);
    color: var(--text-main);
    border-color: var(--secondary-border-color);
}

.nm-shop-cat-name{
    color: var(--text-dim);
}

/* Category hub */
.nm-category-hub {
    display: grid;
    gap: 18px;
    max-width: 980px;
}

.nm-category-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
}

.nm-category-search {
    min-height: 48px;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--secondary-border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.nm-category-search svg {
    width: 19px;
    height: 19px;
    color: var(--accent-color);
}

.nm-category-search input[type="search"] {
    width: 100%;
    min-height: 46px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-main);
    box-shadow: none;
    outline: none;
}

.nm-category-search input[type="search"]::placeholder {
    color: var(--text-muted);
}

.nm-category-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.nm-category-summary span {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--secondary-border-color);
    border-radius: 999px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 700;
}

.nm-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 300px));
    gap: 14px;
}

.nm-category-card[hidden] {
    display: none;
}

.nm-category-card {
    min-width: 0;
}

.nm-category-card-link {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--secondary-border-color);
    border-radius: 14px;
    background:
        radial-gradient(420px 220px at 18% 0%, color-mix(in srgb, var(--primary-color) 16%, transparent), transparent 72%),
        rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.nm-category-card-link:hover {
    border-color: color-mix(in srgb, var(--primary-color) 62%, var(--secondary-border-color));
    color: var(--text-main);
    transform: translateY(-2px);
}

.nm-category-media {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg-dark-card);
}

.nm-category-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 0.86;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nm-category-card-link:hover .nm-category-media img {
    transform: scale(1.04);
    opacity: 1;
}

.nm-category-count {
    position: absolute;
    right: 12px;
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 52%, var(--secondary-border-color));
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-dark) 82%, transparent);
    color: var(--text-main);
    font-size: 0.78rem;
    font-weight: 800;
    backdrop-filter: blur(12px);
}

.nm-category-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 13px 14px 14px;
}

.nm-category-kicker {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nm-category-title {
    margin-top: 5px;
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.18;
}

.nm-category-description {
    margin-top: 7px;
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.5;
}

.nm-category-products {
    display: none;
}

.nm-category-products span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.25;
}

.nm-category-products span:not(.nm-category-products-label)::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 8px;
    border-radius: 999px;
    background: var(--secondary-border-color);
    vertical-align: 0.1em;
}

.nm-category-products .nm-category-products-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nm-category-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin-top: auto;
    padding-top: 12px;
    color: var(--accent-color);
    font-size: 0.82rem;
    font-weight: 800;
}

.nm-category-action svg {
    width: 17px;
    height: 17px;
    transition: transform 0.2s ease;
}

.nm-category-card-link:hover .nm-category-action svg {
    transform: translateX(3px);
}

.nm-category-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 32px;
    border: 1px solid var(--secondary-border-color);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
}

.nm-category-empty[hidden] {
    display: none;
}

.nm-category-empty svg {
    width: 34px;
    height: 34px;
    color: var(--accent-color);
}

.nm-category-empty h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.2rem;
}

.nm-category-empty p {
    margin: 0;
    color: var(--text-dim);
}

@media (max-width: 980px) {
    .nm-shop-hero {
        grid-template-columns: 1fr;
    }
    .nm-shop-hero-subtitle {
        justify-self: start;
        text-align: left;
    }
    .nm-shop-grid {
        grid-template-columns: 1fr;
    }
    .nm-shop-filters {
        position: relative;
        top: auto;
    }
    .nm-shop-hero-title { font-size: 2.2rem; }
    .nm-shop .products { grid-template-columns: 1fr 1fr; }
    .nm-category-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .nm-shop .products { grid-template-columns: 1fr; }
    .nm-category-tools { grid-template-columns: 1fr; }
    .nm-category-summary { justify-content: flex-start; }
    .nm-category-grid { grid-template-columns: 1fr; }
    .nm-category-card-link { min-height: 0; }
    .nm-product-thumb img { height: 170px; }
    .nm-product-price { font-size: 1.6rem; }
}
.nm-shop-sort {
    position: relative;
}

.nm-shop-sort .woocommerce-ordering {
    margin: 0;
}

/* Custom select (JS-enhanced) */
.nm-select {
    position: relative;
    width: fit-content;
}

/* Prevent a brief flash of the native select before JS enhancement */
html.nm-js .nm-shop .woocommerce-ordering select.orderby {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.nm-select-native {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.nm-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 170px;
    max-width: 220px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--secondary-border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 400;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.nm-select-btn:hover{
    border: 1px solid var(--secondary-border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
}


.nm-select-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nm-select-caret {
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1;
}

.nm-select-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 100%;
    min-width: 220px;
    max-height: 320px;
    overflow: auto;
    background: var(--bg-dark);
    border: 1px solid var(--secondary-border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 8px;
    z-index: 20;
}

.nm-select-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nm-select-opt {
    text-align: left;
    width: 100%;
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 400;
    font-size: 0.8rem;
}

.nm-select-opt:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--secondary-border-color);
}

.nm-select-opt[aria-selected="true"] {
    background: color-mix(in srgb, var(--primary-color) 18%, transparent);
    border-color: color-mix(in srgb, var(--primary-color) 35%, var(--secondary-border-color));
}
