/**
 * Estilos do Frontend - YTI&W e-Marketplace
 *
 * @version 1.6.7
 */

/* ==========================================================================
   CORREÇÃO VISUAL DE TÍTULO DUPLICADO E MARGEM EXCESSIVA (COMPATIBILIDADE COM TEMAS)
   ========================================================================== */
/* Solução para a margem excessiva: Zera a margem superior do container principal da nossa página de arquivo. */
.ytiw-emktp-archive-product,
.ytiw-emktp-archive-product #primary, /* NOVO: Alvo do container principal do tema (ex: Astra) */
.ytiw-emktp-archive-product main#main { /* NOVO: Alvo da tag main do tema */
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Oculta os títulos H1 ou page-header gerados pelo tema no CPT archive, caso o filtro PHP falhe.
   Especialmente temas como Astra, OceanWP, ou o tema do cliente. */
.ytiw-emktp-archive-product .page-header:empty {
    padding: 0 !important;
    margin: 0 !important;
    height: 0;
    line-height: 0;
    border: none;
    visibility: hidden;
}

/* Garante que o container padrão que o tema usa para o título de arquivo não cause margem excessiva quando vazio */
.archive.post-type-archive-ytiw_mktp_product .page-header,
.archive.tax-ytiw_mktp_category .page-header {
    /* Força a anulação de espaço para o container vazio, se o tema o estiver renderizando vazio */
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0;
    line-height: 1;
}

/* O elemento com o nosso título customizado (para que ele não seja afetado por regras genéricas) */
.ytiw-emktp-custom-archive-header {
    /* CORREÇÃO AGRESSIVA: Zera o padding e a margem superior para colar o título no topo */
    padding-top: 0 !important; 
    margin-top: 0 !important;
    padding-bottom: 0 !important; /* Garantir que o padding inferior também não crie espaço */
    
    /* Mantém o espaçamento e a linha divisória inferior */
    margin-bottom: 25px; 
    border-bottom: 1px solid #eee;
}

/* Garante que o nosso H1 customizado comece no lugar certo */
.ytiw-emktp-custom-archive-header .page-title {
    /* Garante que o título interno não tenha margem superior */
    margin-top: 0 !important;
    margin-bottom: 0;
}
/* ==========================================================================
   LISTAGEM DE PRODUTOS (Arquivo e Shortcode)
   ========================================================================== */

/* Novo: Wrapper para Filtro e Carrinho */
.ytiw-emktp-archive-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap; /* Permite quebrar linha em telas menores */
    gap: 15px;
}


/* Novo: Barra de Filtro de Categoria */
.ytiw-emktp-category-filter {
    /* Remove a borda e o espaçamento inferior, pois agora estão no wrapper */
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.ytiw-emktp-category-filter ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ytiw-emktp-category-filter li a {
    display: block;
    padding: 8px 15px;
    background-color: #f0f4f8;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.3s, color 0.3s;
}

.ytiw-emktp-category-filter li a:hover {
    background-color: #e1e8ed;
}

.ytiw-emktp-category-filter li a.active {
    background-color: #0073aa;
    color: #ffffff;
}


.ytiw-emktp-products-wrapper {
    display: grid;
    /* Adapta o número de colunas à largura da tela */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.ytiw-emktp-product {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
    height: 100%;
}

.ytiw-emktp-product:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.ytiw-emktp-product-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    background-color: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ytiw-emktp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ytiw-emktp-placeholder-image {
    width: 50px;
    height: 50px;
    background-color: #ccc;
    border-radius: 50%;
}

/* Título do produto na listagem (tamanho ajustado) */
.ytiw-emktp-archive-product .ytiw-emktp-product-title,
.ytiw-emktp-products-wrapper .ytiw-emktp-product-title {
    font-size: 1.2em;
    margin: 15px 15px 5px 15px;
    padding: 0;
    line-height: 1.3;
}

.ytiw-emktp-product-title a {
    text-decoration: none;
    color: inherit;
}

.ytiw-emktp-product-content {
    flex-grow: 1;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #555;
    padding: 0 15px;
}

.ytiw-emktp-product-price {
    font-size: 1.4em;
    font-weight: 700;
    color: #27ae60;
    margin: 0 15px 15px 15px;
    text-align: left;
}

.ytiw-emktp-product-actions {
    padding: 0 15px 15px 15px;
    text-align: left;
}

.ytiw-emktp-buy-button {
    display: inline-block;
    background-color: #0073aa;
    color: #ffffff !important;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.95em;
    transition: background-color 0.3s;
    border: none;
    cursor: pointer;
}

.ytiw-emktp-buy-button:hover {
    background-color: #005177 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   ELEMENTOS DE NAVEGAÇÃO SUPERIOR (Carrinho no Topo)
   ========================================================================== */
.ytiw-emktp-cart-link-top {
    font-weight: 600;
    text-decoration: none;
    color: #27ae60; /* Cor de destaque (verde) para o carrinho */
    transition: color 0.3s;
    white-space: nowrap; /* Impede que o texto quebre */
    /* Remove flutuação, margens e padding desnecessários, pois o flexbox cuidará disso */
    float: none;
    padding: 0;
    margin: 0;
}

.ytiw-emktp-cart-link-top:hover {
    color: #16a085;
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Ajustes para a página de Produto Individual (SINGLE PRODUCT)
   -------------------------------------------------------------------------- */
/* Garante que o link "Voltar" flutue à esquerda para dividir o espaço com o link do carrinho */
.ytiw-emktp-single-product .ytiw-emktp-back-to-shop-link {
    display: inline-block;
    float: left; /* Flutua para o lado oposto do link do carrinho */
    margin-top: 15px; 
    margin-right: 20px; /* Garante um espaço entre os links */
}

/* Limpa o float após o par de links (Voltar para a Loja e Ver Carrinho) */
.ytiw-emktp-single-product .ytiw-emktp-category-strip {
    clear: both;
    margin-top: 0;
}

/* --------------------------------------------------------------------------
   Ajustes para a página de Arquivo de Produtos (ARCHIVE PRODUCT)
   -------------------------------------------------------------------------- */
/* Garante que o filtro de categorias comece abaixo do link flutuado */
.ytiw-emktp-archive-product .ytiw-emktp-category-filter {
    clear: both;
}


/* ==========================================================================
   PÁGINA DE PRODUTO INDIVIDUAL (SINGLE PRODUCT)
   ========================================================================== */

/* Novo: Botão Voltar na Página de Produto Individual */
/* A regra de posicionamento e float foi movida para o bloco "ELEMENTOS DE NAVEGAÇÃO SUPERIOR" */
.ytiw-emktp-back-to-shop-link {
    /* Mantido o estilo visual, mas ajustada a posição */
    padding: 8px 15px;
    background-color: #f0f4f8;
    color: #0073aa;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.3s;
    /* Removido o margin-top e display: inline-block para usar o float em cima */
}

.ytiw-emktp-back-to-shop-link:hover {
    background-color: #e1e8ed;
}

/* Faixa de Categoria */
.ytiw-emktp-category-strip {
    background-color: #f0f4f8;
    padding: 10px 20px;
    margin-bottom: 25px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
}

.ytiw-emktp-category-strip a {
    color: #0073aa;
    text-decoration: none;
}

.ytiw-emktp-category-strip a:hover {
    text-decoration: underline;
}

/* Título na página individual (tamanho grande mantido aqui) */
.ytiw-emktp-single-product .ytiw-emktp-product-title {
    font-size: 2em;
    margin-bottom: 20px;
}

/* Layout de Duas Colunas (Galeria e Detalhes) */
.ytiw-emktp-product-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.ytiw-emktp-product-gallery-wrap {
    display: flex;
    flex-direction: column;
}

.ytiw-emktp-main-image {
    border: 1px solid #e0e0e0;
    margin-bottom: 15px;
    overflow: hidden;
    max-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ytiw-emktp-main-image img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.ytiw-emktp-placeholder-main {
    width: 100%;
    height: 400px;
    background-color: #f0f0f0;
}

.ytiw-emktp-gallery-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ytiw-emktp-thumb {
    width: 80px;
    height: 80px;
    border: 1px solid #ccc;
    cursor: pointer;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.ytiw-emktp-thumb:hover {
    opacity: 1;
    border-color: #0073aa;
}

.ytiw-emktp-product-details {
    padding-top: 10px;
}

.ytiw-emktp-product-price-box {
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #f9f9f9;
    margin-bottom: 20px;
    position: relative; /* Para a notificação */
}

.ytiw-emktp-single-product .ytiw-emktp-product-price {
    display: block;
    font-size: 2.2em;
    margin-bottom: 15px;
}

.ytiw-emktp-buy-button.button {
    width: 100%;
    text-align: center;
    padding: 12px 20px;
    box-sizing: border-box;
    font-size: 1.1em;
}

.ytiw-emktp-short-description {
    font-size: 1.1em;
    color: #333;
    line-height: 1.6;
}

.ytiw-emktp-product-full-description {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* Notificação "Adicionado ao Carrinho" */
.ytiw-emktp-added-to-cart-notice {
    background-color: #f0f9eb;
    border: 1px solid #82c91e;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}
.ytiw-emktp-added-to-cart-notice .notice-text {
    display: block;
    color: #4b840c;
    font-weight: 600;
    margin-bottom: 10px;
}
.ytiw-emktp-added-to-cart-notice .notice-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.ytiw-emktp-added-to-cart-notice .button {
    padding: 8px 12px;
    font-size: 0.9em;
    text-decoration: none;
    border-radius: 3px;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid;
}
/* Estilo ajustado para garantir contraste no botão "Ver Carrinho" (mantendo o verde) */
.ytiw-emktp-added-to-cart-notice .view-cart-button {
    background-color: #4b840c;
    border-color: #4b840c;
    color: #fff !important;
}
.ytiw-emktp-added-to-cart-notice .view-cart-button:hover {
    background-color: #386609;
}
/* ESTILO CORRIGIDO: Força o fundo e a cor da fonte para resolver o problema de tema escuro e baixo contraste. */
.ytiw-emktp-added-to-cart-notice .continue-shopping-button {
    background-color: #4b840c; /* Força fundo igual ao Ver Carrinho para consistência no pop-up */
    border-color: #4b840c;
    color: #ffffff !important; /* Mudar cor da fonte para branco */
}
.ytiw-emktp-added-to-cart-notice .continue-shopping-button:hover {
    background-color: #386609;
    border-color: #386609;
}


/* ==========================================================================
   PÁGINA DO CARRINHO
   ========================================================================== */

.ytiw-emktp-cart-wrapper {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
}

.ytiw-emktp-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.ytiw-emktp-cart-table th,
.ytiw-emktp-cart-table td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    text-align: left;
}

.ytiw-emktp-cart-table th {
    background-color: #f9f9f9;
    font-weight: 600;
}

/* Coluna Quantidade (centralizada) */
.ytiw-emktp-cart-table .product-quantity {
    width: 100px;
    text-align: center;
}

/* Estilo para o campo de input de quantidade */
.ytiw-emktp-cart-table .input-text.qty {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Coluna Subtotal (alinhada à direita) */
.ytiw-emktp-cart-table .product-subtotal {
    width: 120px;
    text-align: right;
    font-weight: bold;
}

.ytiw-emktp-cart-table .product-remove {
    width: 30px;
    text-align: center;
}

.ytiw-emktp-cart-table .product-remove a {
    color: #fa5252;
    text-decoration: none;
    font-size: 1.5em;
    font-weight: bold;
}
.ytiw-emktp-cart-table .product-remove a:hover {
    color: #c92a2a;
}

/* Ajusta o rodapé para o total */
.ytiw-emktp-cart-table tfoot td {
    text-align: right;
    font-size: 1.2em;
    /* colspan será maior agora (col-span=4) */
}
.ytiw-emktp-cart-table tfoot th {
    font-weight: bold;
    text-align: right;
    /* colspan será maior agora (col-span=4) */
}

.ytiw-emktp-cart-actions {
    text-align: right;
    display: flex; /* Permite alinhar botões */
    justify-content: space-between; /* Alinha o botão "Continuar Comprando" à esquerda e o outro à direita */
    align-items: center;
    padding-top: 20px; /* Adiciona espaço acima dos botões */
}

/* NOVO ESTILO: Garante que o botão de continuar comprando seja azul, com cantos arredondados e fonte branca,
   harmonizando com o botão de Finalizar Compra. Usaremos a cor principal (#0073aa) */
.ytiw-emktp-cart-actions .ytiw-emktp-continue-button {
    background-color: #0073aa; /* Cor azul primária, como o Finalizar Compra */
    color: #ffffff !important; /* Fonte branca para alto contraste */
    border: none;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px; /* Cantos arredondados (4px) como o botão principal */
    font-weight: bold;
    font-size: 0.95em;
    transition: background-color 0.3s;
    cursor: pointer;
    box-shadow: none; /* Remove qualquer sombra indesejada */
}
.ytiw-emktp-cart-actions .ytiw-emktp-continue-button:hover {
    background-color: #005177; /* Cor de hover do botão principal */
}


.ytiw-emktp-cart-empty {
    text-align: center;
    padding: 40px;
    border: 2px dashed #e0e0e0;
}

/* ==========================================================================
   CHECKOUT
   ========================================================================== */

.ytiw-emktp-checkout-wrapper {
    max-width: 700px;
    margin: 20px auto;
    padding: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #fff;
}

.ytiw-emktp-checkout-wrapper h3,
.ytiw-emktp-checkout-wrapper h4 {
    margin-top: 0;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.ytiw-emktp-checkout-review {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
}

.ytiw-emktp-checkout-review-table {
    width: 100%;
    border-collapse: collapse;
}

.ytiw-emktp-checkout-review-table td {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.ytiw-emktp-checkout-review-table tfoot th,
.ytiw-emktp-checkout-review-table tfoot td {
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
    font-size: 1.2em;
    font-weight: bold;
}

.ytiw-emktp-checkout-review-table tfoot td {
    text-align: right;
}

.ytiw-emktp-payment-methods {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.ytiw-emktp-payment-methods li {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.ytiw-emktp-payment-methods li:last-child {
    border-bottom: none;
}

.ytiw-emktp-payment-methods .payment-description {
    display: block;
    margin-left: 25px;
    font-size: 0.9em;
    color: #555;
}

/* ==========================================================================
   PÁGINA DE PEDIDO RECEBIDO (ORDER RECEIVED)
   ========================================================================== */
.ytiw-emktp-order-received-wrapper {
    max-width: 700px;
    margin: 20px auto;
}

.ytiw-emktp-order-received-message {
    padding: 20px;
    border-radius: 6px;
    border-left-width: 5px;
    border-left-style: solid;
}

.ytiw-emktp-order-received-message h3 {
    margin-top: 0;
    font-size: 1.5em;
}

/* Estilo para Sucesso */
.ytiw-emktp-success {
    background-color: #f0f9eb;
    border-color: #82c91e;
    color: #555;
}
.ytiw-emktp-success h3 {
    color: #4b840c;
}

/* Estilo para Pendente/Processando */
.ytiw-emktp-pending {
    background-color: #fff9db;
    border-color: #fcc419;
    color: #555;
}
.ytiw-emktp-pending h3 {
    color: #e6a700;
}

/* Estilo para Erro/Falha */
.ytiw-emktp-error {
    background-color: #fff5f5;
    border-color: #fa5252;
    color: #555;
}
.ytiw-emktp-error h3 {
    color: #c92a2a;
}