/**
 * MVMP Products Catalogue
 * Front-end shortcode: [mvmp_products]
 */

.mvmp-products {
    --mvmp-cols: 3;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 0;
}

/* Search bar */
.mvmp-products__search {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}
.mvmp-products__search input[type="search"] {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}
.mvmp-products__search select {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.95rem;
}
.mvmp-products__search button {
    padding: 10px 20px;
    background: #6c47ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.mvmp-products__search button:hover { background: #5538e0; }
.mvmp-products__clear {
    color: #64748b;
    text-decoration: none;
    font-size: 0.88rem;
}
.mvmp-products__clear:hover { color: #6c47ff; }

.mvmp-products__result-meta {
    color: #64748b;
    font-size: 0.92rem;
    margin: 0 0 16px;
}

/* Empty state */
.mvmp-products__empty {
    text-align: center;
    padding: 50px 20px;
    color: #64748b;
}
.mvmp-products__empty p { font-size: 1rem; margin: 6px 0; }

/* Grid */
.mvmp-products__grid {
    display: grid;
    grid-template-columns: repeat(var(--mvmp-cols), 1fr);
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}
@media (max-width: 900px) { .mvmp-products__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .mvmp-products__grid { grid-template-columns: 1fr; } }

/* Card */
.mvmp-product-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.mvmp-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    border-color: #c7baff;
}
.mvmp-product-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
}
.mvmp-product-card__media {
    aspect-ratio: 4/3;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.mvmp-product-card__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.mvmp-product-card__placeholder { font-size: 2.5rem; opacity: 0.4; }

.mvmp-product-card__body { padding: 14px 16px; }
.mvmp-product-card__name {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mvmp-product-card__brand {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0 0 8px;
}
.mvmp-product-card__barcode {
    font-size: 0.74rem;
    color: #94a3b8;
    margin: 0;
}
.mvmp-product-card__barcode code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.74rem;
}
.mvmp-product-card__price {
    margin: 8px 0 0;
    font-size: 0.86rem;
    color: #475569;
}
.mvmp-product-card__price strong { color: #6c47ff; }

/* Pagination */
.mvmp-products__pagination {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}
.mvmp-products__pagination .page-numbers {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    text-decoration: none;
    font-size: 0.92rem;
}
.mvmp-products__pagination .page-numbers:hover { border-color: #6c47ff; color: #6c47ff; }
.mvmp-products__pagination .page-numbers.current {
    background: #6c47ff;
    color: #fff;
    border-color: #6c47ff;
}

/* ── Detail view ─────────────────────────────────────────────────── */

.mvmp-product-detail {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 0;
}

.mvmp-product-detail__back {
    display: inline-block;
    margin-bottom: 16px;
    color: #6c47ff;
    text-decoration: none;
    font-size: 0.92rem;
}
.mvmp-product-detail__back:hover { text-decoration: underline; }

.mvmp-product-detail__hero {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
    margin-bottom: 32px;
    padding: 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}
@media (max-width: 700px) {
    .mvmp-product-detail__hero { grid-template-columns: 1fr; }
}

.mvmp-product-detail__img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #f8fafc;
    border-radius: 10px;
}

.mvmp-product-detail__name { font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; }
.mvmp-product-detail__brand { font-size: 1rem; color: #64748b; margin: 0 0 14px; }
.mvmp-product-detail__category,
.mvmp-product-detail__barcode,
.mvmp-product-detail__unit { font-size: 0.88rem; color: #475569; margin: 4px 0; }
.mvmp-product-detail__barcode code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}
.mvmp-product-detail__desc { color: #475569; line-height: 1.6; margin: 14px 0; }

.mvmp-product-detail__where {
    font-size: 1.2rem;
    margin: 0 0 14px;
}

.mvmp-product-detail__no-stock {
    color: #64748b;
    font-style: italic;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.mvmp-product-prices {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}
.mvmp-product-prices th {
    background: #f8fafc;
    padding: 12px 14px;
    font-weight: 700;
    text-align: left;
    font-size: 0.86rem;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}
.mvmp-product-prices td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.92rem;
}
.mvmp-product-prices tr:last-child td { border-bottom: 0; }
.mvmp-product-prices__price { font-weight: 700; color: #6c47ff; }
.mvmp-product-prices__yes  { color: #10b981; font-size: 1.1rem; }
.mvmp-product-prices__no   { color: #ef4444; font-size: 1.1rem; }

/* ── Search-only widget ──────────────────────────────────────────── */

.mvmp-search-only {
    display: flex;
    gap: 8px;
    max-width: 480px;
}
.mvmp-search-only input[type="search"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.mvmp-search-only button {
    padding: 10px 20px;
    background: #6c47ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
