/**
 * WooCommerce / Dokan — visual alinhado ao Mercado Gado
 */

body.mg-custom-layout {
    --woocommerce: var(--mg-green, #61ce70);
    --wc-primary: var(--mg-green, #61ce70);
    --wc-primary-text: #fff;
    --wc-secondary: #f0f4f1;
    --wc-secondary-text: #09411e;
    --wc-highlight: var(--mg-green-dark, #09411e);
    --wc-highligh-text: #fff;
    --wc-content-bg: #fff;
    --wc-subtext: #718096;
    --wc-form-border-color: #ddd;
    --wc-form-border-radius: 6px;
    color: #2d3748;
}

/* ── Área principal ── */
body.mg-custom-layout:not(.mg-custom-home) .site-main,
body.mg-custom-layout:not(.mg-custom-home) #content,
body.mg-custom-layout.mg-wc-layout .site-main,
body.mg-custom-layout.mg-wc-layout #content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 14px 40px;
}

body.mg-custom-layout.mg-wc-layout {
    background: #f7faf8;
}

body.mg-custom-layout.single-product {
    overflow-x: hidden;
}

body.mg-custom-layout .page-header,
body.mg-custom-layout .entry-header:not(.woocommerce-products-header),
body.mg-custom-layout.single-product .entry-header {
    display: none;
}

/* ── Breadcrumb ── */
body.mg-custom-layout .woocommerce-breadcrumb {
    margin: -16px -14px 16px;
    padding: 7px 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    color: #718096;
}

body.mg-custom-layout .woocommerce-breadcrumb a {
    color: var(--mg-green-dark, #09411e);
    text-decoration: none;
    font-weight: 500;
}

body.mg-custom-layout .woocommerce-breadcrumb a:hover {
    color: var(--mg-green, #61ce70);
}

/* ── Links gerais ── */
body.mg-custom-layout.woocommerce a,
body.mg-custom-layout.woocommerce-page a {
    color: var(--mg-green-dark, #09411e);
}

body.mg-custom-layout.woocommerce a:hover,
body.mg-custom-layout.woocommerce-page a:hover {
    color: var(--mg-green, #61ce70);
}

body.mg-custom-layout.woocommerce .product_meta a,
body.mg-custom-layout.woocommerce-page .product_meta a {
    color: var(--mg-green-dark, #09411e);
    font-weight: 600;
}

/* ── Produto único ── */
body.mg-custom-layout.single-product .mg-single-product-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body.mg-custom-layout.single-product div.product {
    display: grid;
    grid-template-columns: minmax(0, var(--mg-product-gallery-width, 45%)) minmax(0, 1fr);
    gap: 0;
    align-items: start;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(9, 65, 30, 0.06);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery {
    grid-column: 1;
    grid-row: auto;
    margin: 0;
    float: none !important;
    width: auto !important;
    min-height: 0;
    background: linear-gradient(160deg, #eef4ef 0%, #dfe9e2 100%);
    border-right: 1px solid #eaeaea;
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper,
body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__image {
    min-height: 0;
    max-height: var(--mg-product-gallery-max-height, 360px);
}

/* Flexslider: não sobrescrever largura dos slides (quebra o viewport) */
body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper.flexslider,
body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper.flexslider .woocommerce-product-gallery__image {
    max-height: none;
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper.flexslider .woocommerce-product-gallery__image img {
    width: 100%;
    height: auto;
    max-height: var(--mg-product-gallery-max-height, 360px);
    min-height: 0;
    aspect-ratio: unset;
    object-fit: contain;
    display: block;
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__image img,
body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__image--placeholder img {
    width: 100%;
    height: auto;
    max-height: var(--mg-product-gallery-max-height, 360px);
    min-height: 0;
    aspect-ratio: var(--mg-product-gallery-aspect, 4 / 3);
    object-fit: cover;
    display: block;
}

body.mg-custom-layout.single-product div.product .flex-control-thumbs {
    display: flex;
    gap: 8px;
    padding: 14px 16px 18px;
    margin: 0;
    list-style: none;
    background: rgba(255, 255, 255, 0.55);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

body.mg-custom-layout.single-product div.product .flex-control-thumbs li {
    width: var(--mg-product-gallery-thumb-size, 56px);
    flex: 0 0 var(--mg-product-gallery-thumb-size, 56px);
}

body.mg-custom-layout.single-product div.product .flex-control-thumbs img {
    border-radius: 8px;
    border: 2px solid transparent;
    opacity: 0.75;
    transition: opacity 0.2s, border-color 0.2s;
}

body.mg-custom-layout.single-product div.product .flex-control-thumbs li img.flex-active,
body.mg-custom-layout.single-product div.product .flex-control-thumbs li:hover img {
    opacity: 1;
    border-color: var(--mg-green, #61ce70);
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__trigger {
    display: none !important;
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery .zoomImg {
    display: none !important;
}

/* Evita empilhar todas as fotos (ex.: pedigree) antes do flexslider iniciar */
body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    max-height: var(--mg-product-gallery-max-height, 360px);
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) .woocommerce-product-gallery__image {
    flex: 0 0 100%;
    width: 100% !important;
    max-width: 100% !important;
    scroll-snap-align: start;
}

body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) .woocommerce-product-gallery__image:nth-child(n + 2) {
    width: 100% !important;
}

body.mg-custom-layout.single-product div.product .summary {
    grid-column: 2;
    width: 100% !important;
    float: none !important;
    margin: 0;
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: sticky;
    top: calc(var(--mg-header-height, 42px) + 8px);
    align-self: start;
    max-height: calc(100vh - var(--mg-header-height, 42px) - 16px);
    overflow-y: auto;
}

body.mg-custom-layout.single-product .mg-product-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

body.mg-custom-layout.single-product .mg-product-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    background: #f0faf2;
    color: var(--mg-green-dark, #09411e);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid rgba(97, 206, 112, 0.35);
    transition: background 0.2s, color 0.2s;
}

body.mg-custom-layout.single-product .mg-product-badge:hover {
    background: var(--mg-green, #61ce70);
    color: #fff;
}

body.mg-custom-layout.single-product div.product .product_title {
    font-size: clamp(18px, 2.5vw, 26px);
    font-weight: 800;
    color: #1a202c;
    letter-spacing: -0.02em;
    margin: 0 0 10px;
    line-height: 1.2;
}

body.mg-custom-layout.single-product div.product .summary p.price,
body.mg-custom-layout.single-product div.product .summary span.price {
    display: block;
    color: var(--mg-green-dark, #09411e) !important;
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 800;
    margin: 0 0 14px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #f6fff8 0%, #edf7ef 100%);
    border: 1px solid rgba(97, 206, 112, 0.25);
    border-radius: 10px;
    line-height: 1.2;
}

body.mg-custom-layout.single-product div.product .summary p.price del {
    color: #a0aec0;
    font-weight: 500;
    font-size: 18px;
    margin-right: 8px;
}

body.mg-custom-layout.single-product div.product .summary p.price ins {
    text-decoration: none;
}

body.mg-custom-layout.single-product .mg-product-vendor {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px;
    background: #fafcfb;
    border: 1px solid #eaeaea;
    border-radius: 14px;
}

body.mg-custom-layout.single-product .mg-product-vendor__avatar {
    grid-row: 1 / span 2;
}

body.mg-custom-layout.single-product .mg-product-vendor__avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 4px 14px rgba(9, 65, 30, 0.12);
}

body.mg-custom-layout.single-product .mg-product-vendor__label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #718096;
    margin-bottom: 2px;
}

body.mg-custom-layout.single-product .mg-product-vendor__name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--mg-green-dark, #09411e);
    text-decoration: none;
    line-height: 1.3;
}

body.mg-custom-layout.single-product .mg-product-vendor__name:hover {
    color: var(--mg-green, #61ce70);
}

body.mg-custom-layout.single-product .mg-product-vendor__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 12px;
    color: #718096;
}

body.mg-custom-layout.single-product .mg-product-vendor__rating .star-rating {
    color: #ffc100;
}

body.mg-custom-layout.single-product .mg-product-vendor__phone {
    margin: 4px 0 0;
    font-size: 13px;
    color: #4a5568;
    font-weight: 500;
}

body.mg-custom-layout.single-product .mg-product-vendor__whatsapp {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: 10px;
    background: #25d366 !important;
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

body.mg-custom-layout.single-product .mg-product-vendor__whatsapp:hover {
    background: #1da851 !important;
    color: #fff !important;
    transform: translateY(-1px);
}

body.mg-custom-layout.single-product div.product .woocommerce-product-details__short-description {
    color: #4a5568;
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid #eee;
}

body.mg-custom-layout.single-product div.product .product_meta {
    display: none;
}

body.mg-custom-layout.single-product .dokan-vendor-info-wrap,
body.mg-custom-layout.single-product .mercado-gado-product-vendor-info {
    display: none !important;
}

body.mg-custom-layout.single-product .mg-product-trust {
    list-style: none;
    margin: 18px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid #eee;
    display: grid;
    gap: 10px;
}

body.mg-custom-layout.single-product .mg-product-trust li {
    position: relative;
    padding-left: 26px;
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
}

body.mg-custom-layout.single-product .mg-product-trust li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 1px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--mg-green, #61ce70);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
}

/* ── Botões ── */
body.mg-custom-layout.woocommerce a.button,
body.mg-custom-layout.woocommerce button.button,
body.mg-custom-layout.woocommerce input.button,
body.mg-custom-layout.woocommerce #respond input#submit,
body.mg-custom-layout.woocommerce a.button.alt,
body.mg-custom-layout.woocommerce button.button.alt,
body.mg-custom-layout.woocommerce input.button.alt,
body.mg-custom-layout.woocommerce .single_add_to_cart_button {
    background: var(--mg-green, #61ce70) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    letter-spacing: 0.04em;
    padding: 12px 24px !important;
    transition: background 0.2s, transform 0.15s;
}

body.mg-custom-layout.woocommerce a.button:hover,
body.mg-custom-layout.woocommerce button.button:hover,
body.mg-custom-layout.woocommerce input.button:hover,
body.mg-custom-layout.woocommerce a.button.alt:hover,
body.mg-custom-layout.woocommerce button.button.alt:hover,
body.mg-custom-layout.woocommerce input.button.alt:hover,
body.mg-custom-layout.woocommerce .single_add_to_cart_button:hover {
    background: var(--mg-green-dark, #09411e) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

body.mg-custom-layout.woocommerce a.button.alt.disabled,
body.mg-custom-layout.woocommerce button.button.alt.disabled,
body.mg-custom-layout.woocommerce .single_add_to_cart_button.disabled {
    opacity: 0.55;
    transform: none;
}

/* ── Formulários / quantidade ── */
body.mg-custom-layout.single-product.woocommerce form.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin-top: 0;
    padding: 12px;
    background: #f7faf8;
    border: 1px solid #eaeaea;
    border-radius: 10px;
}

body.mg-custom-layout.single-product.woocommerce form.cart .quantity {
    flex: 0 0 auto;
}

body.mg-custom-layout.single-product.woocommerce form.cart .single_add_to_cart_button {
    flex: 1 1 160px;
    min-height: 42px !important;
    font-size: 12px !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase;
    border-radius: 10px !important;
}

body.mg-custom-layout.woocommerce form.cart {
    margin-top: 8px;
}

body.mg-custom-layout.woocommerce .quantity .qty {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    min-width: 60px;
    min-height: 42px;
    text-align: center;
    background: #fff;
}

body.mg-custom-layout.woocommerce table.variations,
body.mg-custom-layout.woocommerce table.group_table {
    border: 0;
    margin-bottom: 16px;
}

body.mg-custom-layout.woocommerce table.group_table td {
    border: 0;
    padding: 10px 12px;
    vertical-align: middle;
}

body.mg-custom-layout.woocommerce table.group_table tr {
    background: #f7faf8;
    border-radius: 8px;
}

body.mg-custom-layout.woocommerce table.group_table tr:nth-child(even) {
    background: #fff;
}

body.mg-custom-layout.woocommerce table.group_table td:first-child {
    border-radius: 8px 0 0 8px;
}

body.mg-custom-layout.woocommerce table.group_table td:last-child {
    border-radius: 0 8px 8px 0;
}

body.mg-custom-layout.woocommerce table.group_table label a {
    font-weight: 600;
    color: var(--mg-green-dark, #09411e) !important;
}

body.mg-custom-layout.woocommerce table.group_table .woocommerce-grouped-product-list-item__price {
    color: var(--mg-green-dark, #09411e);
    font-weight: 700;
}

body.mg-custom-layout.woocommerce .variations label {
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
}

body.mg-custom-layout.woocommerce .variations select {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 180px;
}

body.mg-custom-layout.woocommerce .reset_variations {
    font-size: 12px;
    color: #718096 !important;
}

/* ── Abas ── */
body.mg-custom-layout.single-product.woocommerce div.product .woocommerce-tabs {
    grid-column: 1 / -1;
    margin: 0;
    padding: 28px 32px 32px;
    border-top: 1px solid #eee;
    background: #fafcfb;
}

body.mg-custom-layout.woocommerce div.product .woocommerce-tabs {
    grid-column: 1 / -1;
    margin-top: 8px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

body.mg-custom-layout.woocommerce div.product .woocommerce-tabs ul.tabs {
    padding: 0;
    margin: 0 0 20px;
    border-bottom: 1px solid #eee;
}

body.mg-custom-layout.woocommerce div.product .woocommerce-tabs ul.tabs li {
    border: 0;
    background: transparent;
    margin: 0 4px 0 0;
    padding: 0;
}

body.mg-custom-layout.woocommerce div.product .woocommerce-tabs ul.tabs li a {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    color: #718096;
    border-radius: 6px 6px 0 0;
    text-decoration: none;
}

body.mg-custom-layout.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
    color: var(--mg-green-dark, #09411e);
    background: #f7faf8;
}

body.mg-custom-layout.woocommerce div.product .woocommerce-Tabs-panel {
    color: #4a5568;
    line-height: 1.65;
    font-size: 15px;
}

/* ── Dokan vendedor ── */
body.mg-custom-layout .dokan-vendor-info-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
    padding: 16px;
    background: #f7faf8;
    border: 1px solid #eaeaea;
    border-radius: 12px;
}

body.mg-custom-layout .dokan-vendor-image img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.mg-custom-layout .dokan-vendor-name h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--mg-green-dark, #09411e);
}

body.mg-custom-layout .dokan-vendor-name a {
    text-decoration: none;
}

body.mg-custom-layout .dokan-vendor-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

body.mg-custom-layout .dokan-vendor-rating .star-rating {
    color: #ffc100;
}

body.mg-custom-layout .dokan-ratings-count {
    margin: 2px 0 0;
    font-size: 12px;
    color: #718096;
}

/* ── Telefone / WhatsApp vendedor (plugin) ── */
body.mg-custom-layout .mercado-gado-vendor-phone,
body.mg-custom-layout .mercado-gado-product-vendor-info {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f7faf8;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    font-size: 14px;
}

body.mg-custom-layout .mercado-gado-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 18px;
    background: #25d366 !important;
    color: #fff !important;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

body.mg-custom-layout .mercado-gado-whatsapp-btn:hover {
    background: #1da851 !important;
    color: #fff !important;
    transform: translateY(-1px);
}

/* ── Listagem / shop ── */
body.mg-custom-layout.woocommerce ul.products,
body.mg-custom-layout.woocommerce-page ul.products {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Clearfix do WooCommerce vira item de grid e desloca o 1º produto */
body.mg-custom-layout.woocommerce ul.products::before,
body.mg-custom-layout.woocommerce ul.products::after,
body.mg-custom-layout.woocommerce-page ul.products::before,
body.mg-custom-layout.woocommerce-page ul.products::after {
    display: none !important;
    content: none !important;
}

body.mg-custom-layout.woocommerce ul.products li.product,
body.mg-custom-layout.woocommerce-page ul.products li.product {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    float: none !important;
    clear: none !important;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
}

body.mg-custom-layout.woocommerce ul.products li.product:hover,
body.mg-custom-layout.woocommerce-page ul.products li.product:hover {
    box-shadow: 0 6px 18px rgba(9, 65, 30, 0.1);
    transform: translateY(-2px);
    border-color: rgba(97, 206, 112, 0.4);
}

body.mg-custom-layout.woocommerce ul.products li.product .woocommerce-loop-product__title,
body.mg-custom-layout.woocommerce-page ul.products li.product .woocommerce-loop-product__title {
    font-size: 12px;
    font-weight: 600;
    color: #2d3748;
    padding: 0 10px;
    line-height: 1.35;
}

body.mg-custom-layout.woocommerce ul.products li.product .price,
body.mg-custom-layout.woocommerce-page ul.products li.product .price {
    color: var(--mg-green-dark, #09411e) !important;
    font-weight: 700;
    font-size: 13px;
    padding: 0 10px 10px;
}

body.mg-custom-layout.woocommerce ul.products li.product a img,
body.mg-custom-layout.woocommerce-page ul.products li.product a img {
    border-radius: 0;
    margin-bottom: 6px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

body.mg-custom-layout.woocommerce ul.products li.product .button,
body.mg-custom-layout.woocommerce-page ul.products li.product .button {
    margin: 0 10px 10px;
    width: calc(100% - 20px);
    text-align: center;
    font-size: 11px;
    padding: 6px 8px;
}

body.mg-custom-layout.woocommerce .woocommerce-result-count,
body.mg-custom-layout.woocommerce .woocommerce-ordering {
    font-size: 14px;
    color: #718096;
}

body.mg-custom-layout.woocommerce .woocommerce-ordering select {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
}

/* ── Produtos relacionados (abaixo do card principal) ── */
body.mg-custom-layout.single-product .mg-single-product-shell > .related.products,
body.mg-custom-layout.single-product .mg-single-product-shell > .upsells.products,
body.mg-custom-layout.single-product .related.products,
body.mg-custom-layout.single-product .upsells.products {
    margin-top: 32px;
    padding: 32px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(9, 65, 30, 0.06);
    width: 100%;
    box-sizing: border-box;
    clear: both;
}

body.mg-custom-layout.woocommerce div.product .related.products,
body.mg-custom-layout.woocommerce div.product .upsells.products {
    grid-column: 1 / -1;
    order: 99;
}

body.mg-custom-layout.single-product .related.products > h2,
body.mg-custom-layout.single-product .upsells.products > h2,
body.mg-custom-layout.woocommerce .related.products > h2,
body.mg-custom-layout.woocommerce .upsells.products > h2 {
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 800;
    color: #1a202c;
    margin: 0 0 24px;
    letter-spacing: -0.02em;
}

body.mg-custom-layout.single-product .related.products ul.products,
body.mg-custom-layout.single-product .upsells.products ul.products {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

body.mg-custom-layout.single-product .related.products ul.products li.product,
body.mg-custom-layout.single-product .upsells.products ul.products li.product {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    float: none !important;
    clear: none !important;
    border-radius: 12px;
}

body.mg-custom-layout.single-product .related.products ul.products li.product .woocommerce-loop-product__link,
body.mg-custom-layout.single-product .upsells.products ul.products li.product .woocommerce-loop-product__link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    text-decoration: none;
}

body.mg-custom-layout.single-product .related.products ul.products li.product a img,
body.mg-custom-layout.single-product .upsells.products ul.products li.product a img {
    width: 100%;
    margin: 0;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

body.mg-custom-layout.single-product .related.products ul.products li.product .woocommerce-loop-product__title,
body.mg-custom-layout.single-product .upsells.products ul.products li.product .woocommerce-loop-product__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    padding: 14px 14px 8px;
    margin: 0;
    color: #2d3748;
}

body.mg-custom-layout.single-product .related.products ul.products li.product .price,
body.mg-custom-layout.single-product .upsells.products ul.products li.product .price {
    display: block;
    margin: 0;
    padding: 0 14px 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--mg-green-dark, #09411e) !important;
    background: none;
    border: 0;
    border-radius: 0;
    line-height: 1.3;
}

body.mg-custom-layout.single-product .related.products ul.products li.product .button,
body.mg-custom-layout.single-product .upsells.products ul.products li.product .button {
    margin: auto 14px 14px;
    width: calc(100% - 28px);
    padding: 10px 12px !important;
    font-size: 13px !important;
    text-align: center;
}

/* ── Notices ── */
body.mg-custom-layout.woocommerce .woocommerce-message,
body.mg-custom-layout.woocommerce .woocommerce-info {
    border-top-color: var(--mg-green, #61ce70);
    background: #f6fff8;
    border-radius: 8px;
}

body.mg-custom-layout.woocommerce .woocommerce-error {
    border-radius: 8px;
}

body.mg-custom-layout.woocommerce .woocommerce-message::before,
body.mg-custom-layout.woocommerce .woocommerce-info::before {
    color: var(--mg-green, #61ce70);
}

/* ── Carrinho / checkout / conta ── */
body.mg-custom-layout.woocommerce-cart .woocommerce,
body.mg-custom-layout.woocommerce-checkout .woocommerce,
body.mg-custom-layout.woocommerce-account .woocommerce {
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 24px rgba(9, 65, 30, 0.06);
}

body.mg-custom-layout.woocommerce table.shop_table {
    border-radius: 8px;
    border: 1px solid #eee;
}

body.mg-custom-layout.woocommerce table.shop_table th {
    background: #f7faf8;
    color: #2d3748;
    font-weight: 600;
}

body.mg-custom-layout.woocommerce .cart-collaterals .cart_totals,
body.mg-custom-layout.woocommerce .checkout_coupon,
body.mg-custom-layout.woocommerce form.checkout {
    border-radius: 12px;
}

body.mg-custom-layout.woocommerce .woocommerce-MyAccount-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

body.mg-custom-layout.woocommerce .woocommerce-MyAccount-navigation li a {
    display: block;
    padding: 10px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

body.mg-custom-layout.woocommerce .woocommerce-MyAccount-navigation li.is-active a,
body.mg-custom-layout.woocommerce .woocommerce-MyAccount-navigation li a:hover {
    background: #f7faf8;
    color: var(--mg-green-dark, #09411e);
}

/* ── Estrelas ── */
body.mg-custom-layout.woocommerce .star-rating {
    color: #ffc100;
}

/* ── Responsivo ── */
@media (max-width: 1100px) {
    body.mg-custom-layout.woocommerce ul.products,
    body.mg-custom-layout.woocommerce-page ul.products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    body.mg-custom-layout.single-product .site-main,
    body.mg-custom-layout.single-product #content,
    body.mg-custom-layout.mg-wc-layout.single-product .site-main,
    body.mg-custom-layout.mg-wc-layout.single-product #content {
        max-width: 100%;
        width: 100%;
        padding: 10px 12px 32px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    body.mg-custom-layout.single-product .woocommerce-breadcrumb {
        margin: 0 0 10px;
        padding: 8px 10px;
        font-size: 11px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    body.mg-custom-layout.single-product .mg-single-product-shell {
        overflow: visible;
    }

    /* Flex column evita coluna implícita do grid que escondia o .summary */
    body.mg-custom-layout.single-product div.product {
        display: flex !important;
        flex-direction: column;
        grid-template-columns: unset;
        overflow: visible !important;
        border-radius: 12px;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-product-gallery {
        order: 1;
        flex: none;
        grid-column: unset !important;
        grid-row: unset !important;
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        border-right: 0;
        border-bottom: 1px solid #eaeaea;
        opacity: 1 !important;
    }

    /* Flexslider ativo (galeria com múltiplas fotos) */
    body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper.flexslider {
        display: block !important;
        max-height: none;
    }

    body.mg-custom-layout.single-product div.product .flex-viewport {
        overflow: hidden !important;
        width: 100% !important;
        max-height: none;
    }

    body.mg-custom-layout.single-product div.product .flex-viewport .woocommerce-product-gallery__wrapper.flexslider .woocommerce-product-gallery__image img {
        width: 100% !important;
        height: auto !important;
        max-height: min(var(--mg-product-gallery-max-height, 360px), 320px);
        min-height: 0;
        aspect-ratio: unset !important;
        object-fit: contain !important;
        display: block !important;
        opacity: 1 !important;
        background: #eef4ef;
    }

    /* Fallback swipe quando o flexslider não inicializa */
    body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        max-height: min(var(--mg-product-gallery-max-height, 360px), 280px);
        min-height: 0;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) .woocommerce-product-gallery__image {
        flex: 0 0 100%;
        width: 100% !important;
        max-width: 100% !important;
        scroll-snap-align: start;
        display: block !important;
        min-height: 0;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) .woocommerce-product-gallery__image img {
        max-height: min(var(--mg-product-gallery-max-height, 360px), 260px);
        min-height: 0;
        width: 100%;
        height: auto;
        aspect-ratio: auto;
        object-fit: contain;
        background: #eef4ef;
    }

    body.mg-custom-layout.single-product div.product .flex-control-thumbs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 12px 12px;
    }

    /* Galeria mobile nativa (sem Flexslider) */
    body.mg-custom-layout.single-product .woocommerce-product-gallery.mg-gallery-mobile .woocommerce-product-gallery__wrapper {
        display: flex !important;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
        max-width: 100% !important;
        max-height: min(var(--mg-product-gallery-max-height, 360px), 320px);
        transform: none !important;
        margin: 0 !important;
    }

    body.mg-custom-layout.single-product .woocommerce-product-gallery.mg-gallery-mobile .woocommerce-product-gallery__image {
        flex: 0 0 100%;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100%;
        scroll-snap-align: start;
        box-sizing: border-box;
    }

    body.mg-custom-layout.single-product .woocommerce-product-gallery.mg-gallery-mobile .woocommerce-product-gallery__image a {
        display: block;
        width: 100%;
    }

    body.mg-custom-layout.single-product .woocommerce-product-gallery.mg-gallery-mobile .woocommerce-product-gallery__image img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: min(var(--mg-product-gallery-max-height, 360px), 320px);
        object-fit: contain !important;
        aspect-ratio: unset !important;
        background: #eef4ef;
    }

    body.mg-custom-layout.single-product div.product .summary {
        order: 2;
        flex: none;
        grid-column: unset !important;
        grid-row: unset !important;
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        position: static !important;
        top: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 16px 14px 20px;
        box-sizing: border-box;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-tabs {
        order: 3;
        flex: none;
        grid-column: unset !important;
        width: 100%;
        padding: 20px 14px 24px;
        box-sizing: border-box;
    }

    /* Descrição completa visível no mobile (sem abas) */
    body.mg-custom-layout.single-product div.product .woocommerce-tabs ul.tabs {
        display: none;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-tabs .woocommerce-Tabs-panel {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        padding: 0;
        margin: 0 0 16px;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-tabs .woocommerce-Tabs-panel:last-child {
        margin-bottom: 0;
    }

    body.mg-custom-layout.single-product div.product .woocommerce-product-details__short-description {
        margin-bottom: 12px;
        font-size: 0.9375rem;
        line-height: 1.55;
        color: #4a5568;
    }

    body.mg-custom-layout.single-product div.product .product_title {
        font-size: 1.125rem;
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }

    body.mg-custom-layout.single-product div.product .summary p.price,
    body.mg-custom-layout.single-product div.product .summary span.price {
        font-size: 1.25rem;
        padding: 10px 12px;
    }

    body.mg-custom-layout.single-product .mg-product-vendor {
        padding: 10px;
    }

    body.mg-custom-layout.single-product .mg-single-product-shell > .related.products,
    body.mg-custom-layout.single-product .mg-single-product-shell > .upsells.products,
    body.mg-custom-layout.single-product .related.products,
    body.mg-custom-layout.single-product .upsells.products {
        padding: 20px 14px;
        margin-top: 16px;
    }

    body.mg-custom-layout.single-product .related.products ul.products,
    body.mg-custom-layout.single-product .upsells.products ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    body.mg-custom-layout.woocommerce ul.products,
    body.mg-custom-layout.woocommerce-page ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    body.mg-custom-layout.woocommerce ul.products li.product .woocommerce-loop-product__title,
    body.mg-custom-layout.woocommerce-page ul.products li.product .woocommerce-loop-product__title {
        font-size: 12px;
        padding: 0 8px;
    }

    body.mg-custom-layout.woocommerce ul.products li.product .price,
    body.mg-custom-layout.woocommerce-page ul.products li.product .price {
        font-size: 12px;
        padding: 0 8px 8px;
    }

    body.mg-custom-layout.woocommerce ul.products li.product .button,
    body.mg-custom-layout.woocommerce-page ul.products li.product .button {
        margin: 0 8px 8px;
        width: calc(100% - 16px);
        font-size: 11px;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    body.mg-custom-layout.single-product div.product .flex-viewport .woocommerce-product-gallery__image img,
    body.mg-custom-layout.single-product div.product .woocommerce-product-gallery__wrapper:not(.flexslider) .woocommerce-product-gallery__image img {
        max-height: 220px;
    }

    body.mg-custom-layout.single-product .mg-product-vendor__whatsapp {
        width: 100%;
        box-sizing: border-box;
    }

    body.mg-custom-layout.woocommerce ul.products,
    body.mg-custom-layout.woocommerce-page ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
}
