/* ================================================= */
/* CÓDIGO DE PROTEÇÃO (WRAPPER)                      */
/* ================================================= */
.mag-shortcode-wrapper {
    display: block;
    width: 100%;
    height: auto;
    float: none;
    clear: both;
    overflow: hidden;
    padding-bottom: 20px;
    position: relative;
}

/* Estilos do Botão "Avaliar Produto" */
.mag-open-review-form-button {
    background-color: #ffffff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}
.mag-open-review-form-button:hover,
.mag-open-review-form-button:focus {
    background-color: #f0f0f0;
    border-color: #999;
    outline: none;
}

/* Estilos do Pop-up (Modal) de Formulário */
.mag-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}
.mag-modal-overlay.is-open {
    display: flex;
}
.mag-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}
.mag-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
}
.mag-modal-close:hover {
    color: #333;
}
.mag-modal-body {
    margin-top: 15px;
}
.mag-modal-loader {
    text-align: center;
    padding: 30px;
    font-size: 1.1em;
    color: #666;
}

/* Estilos para o Formulário de Avaliação */
.review-form-container h3 { font-size: 1.5em; margin-bottom: 20px; text-align: center; color: #333; }
.product-info-for-review { display: flex; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.product-info-for-review .product-thumbnail img { width: 60px; height: 60px; object-fit: cover; margin-right: 15px; border-radius: 4px; }
.product-info-for-review .product-details .product-title { margin: 0; font-weight: bold; color: #555; }
.comment-form-rating label, .comment-form-comment label, .comment-form-media-upload label, .comment-form-author label, .comment-form-email label { display: block; margin-bottom: 8px; font-weight: 600; color: #444; }
.comment-form-rating select, .comment-form-comment textarea, .comment-form-author input, .comment-form-email input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; box-sizing: border-box; margin-bottom: 15px; font-size: 1em; }
.comment-form-comment { margin-bottom: 5px; }
.mag-char-counter { display: block; text-align: right; font-size: 0.85em; color: #666; margin-bottom: 15px; transition: color 0.3s ease; }
.mag-char-counter.limit-reached { color: #d9534f; font-weight: bold; }
.form-submit .submit { background-color: #007cba; color: #fff; border: none; padding: 12px 25px; border-radius: 5px; cursor: pointer; font-size: 1.1em; transition: background-color 0.3s ease; display: inline-block; width: auto; }
.form-submit .submit:hover { background-color: #005f8f; }
.form-submit .submit:disabled { background-color: #999; cursor: not-allowed; }
#mag-form-feedback { padding: 15px; margin-bottom: 20px; border-radius: 5px; text-align: center; }
.mag-success-message { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.mag-error-message { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.mag-image-preview-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

/* ======================= INÍCIO DA ALTERAÇÃO (Borda Preview) ======================= */
.mag-preview-image { 
    width: 70px; 
    height: 70px; 
    object-fit: cover; 
    border-radius: 5px; 
    border: none; /* <-- Borda removida */
}
/* ======================== FIM DA ALTERAÇÃO (Borda Preview) ========================= */


/* Estilos para o grid de avaliações */
.reviews-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 30px; }
.review-card { border: 1px solid #eee; border-radius: 8px; overflow: hidden; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor: pointer; transition: box-shadow 0.2s ease-in-out; display: flex; flex-direction: column; }
.review-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* ======================= INÍCIO DA ALTERAÇÃO (Proporção Imagem) ======================= */
.review-gallery {
    width: 100%;
    /* padding-bottom: 100%; <-- REMOVIDO para não forçar 1:1 */
    /* position: relative; <-- REMOVIDO */
    /* overflow: hidden; <-- REMOVIDO */
    background-color: #f0f0f0;
    line-height: 0; /* Corrige pequeno espaço em baixo da imagem */
}
.review-gallery img.review-image {
    /* position: absolute; <-- REMOVIDO */
    /* top: 0; <-- REMOVIDO */
    /* left: 0; <-- REMOVIDO */
    width: 100%; /* Imagem ocupa 100% da largura do card */
    height: auto; /* Altura se ajusta automaticamente à proporção da imagem */
    /* object-fit: cover; <-- REMOVIDO */
    display: block;
}
/* ======================== FIM DA ALTERAÇÃO (Proporção Imagem) ========================= */

.review-details { padding: 15px; }
.review-author { font-size: 0.9em; color: #777; margin-top: 0; margin-bottom: 10px; }
.review-author strong { color: #333; }
.verified-purchase { color: #008000; font-weight: bold; }
.review-text { font-size: 0.95em; line-height: 1.5; color: #555; word-wrap: break-word; }
.star-rating { height: 1em; line-height: 1; font-size: 1em; overflow: hidden; position: relative; width: 5.3em; letter-spacing: normal; font-family: "star"; margin-bottom: 10px; }
.star-rating::before { content: "\53\53\53\53\53"; color: #d3ced2; float: left; top: 0; left: 0; position: absolute; }
.star-rating span { overflow: hidden; float: left; top: 0; left: 0; position: absolute; padding-top: 1.5em; }
.star-rating span::before { content: "\53\53\53\53\53"; top: 0; position: absolute; left: 0; color: #f7d23e; }

/* Estilos para o Carrossel/Lightbox */
.mag-carousel-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); z-index: 10000; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
.mag-carousel-modal-overlay.is-open { display: flex; }
.mag-carousel-content { display: flex; max-width: 90vw; max-height: 90vh; width: auto; height: auto; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); overflow: hidden; }
.mag-carousel-image-area { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; background-color: #111; position: relative; width: 100% !important; }
img.mag-carousel-main-image { object-fit: contain; max-width: 100%; max-height: 85vh; display: block; }
.mag-carousel-details-area { flex: 0 0 350px; padding: 30px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; background-color: #f9f9f9; }
.mag-carousel-review-info { flex-grow: 1; }
.mag-carousel-author-line { display: flex; align-items: center; gap: 8px; }
.mag-carousel-author { font-size: 1.1em; font-weight: 600; color: #333; margin-bottom: 8px; }
.mag-carousel-rating { margin-bottom: 15px; }
.mag-carousel-text { color: #444; font-size: 0.95em; line-height: 1.6; max-height: 250px; overflow-y: auto; padding-right: 10px; overflow-wrap: break-word; word-break: break-word; white-space: normal; }
.mag-carousel-text p { margin-top: 0; }
.mag-carousel-close { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 36px; cursor: pointer; color: #fff; line-height: 1; padding: 0; z-index: 10001; text-shadow: 0 0 5px rgba(0,0,0,0.5); }
.mag-carousel-close:hover { color: #ccc; }
.mag-carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0, 0, 0, 0.4); color: #fff; border: none; padding: 10px 15px; font-size: 24px; cursor: pointer; z-index: 10001; border-radius: 4px; user-select: none; transition: background-color 0.2s; }
.mag-carousel-nav:hover { background-color: rgba(0, 0, 0, 0.7); }
.mag-carousel-nav.prev { left: 10px; }
.mag-carousel-nav.next { right: 10px; }
.mag-carousel-thumbnails { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; justify-content: flex-start; }
.mag-carousel-thumbnail { width: 60px; height: 60px; object-fit: cover; border: 2px solid transparent; border-radius: 4px; cursor: pointer; transition: border-color 0.2s ease; }
.mag-carousel-thumbnail.active, .mag-carousel-thumbnail:hover { border-color: #007cba; }

/* ================================================= */
/* NOVOS ESTILOS PARA O FORMULÁRIO DE LOGIN AJAX     */
/* ================================================= */
.mag-login-container h3 {
    text-align: center;
    margin-bottom: 15px;
}
.mag-login-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}
.mag-login-field input[type="text"],
.mag-login-field input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
    margin-bottom: 15px;
    font-size: 1em;
}
#mag-ajax-login-form .comment-form-author,
#mag-ajax-login-form .comment-form-email {
    margin-bottom: 0;
}
#mag-login-feedback {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
    box-sizing: border-box;
}
#mag-login-feedback:empty {
    display: none; 
}


/* ========================================================= */
/* ESTILOS (CÂMERA/GALERIA) */
/* ========================================================= */
.mag-media-button-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px; /* Adiciona espaço antes do preview */
}

.mag-media-button {
    flex: 1; /* Faz os botões dividirem o espaço */
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    text-align: center;
}

.mag-media-button:hover {
    background-color: #e0e0e0;
    border-color: #999;
}


/* ===================================================================
    Media Queries para responsividade (Unificadas)
    =================================================================== */
@media (max-width: 1150px) {
    .mag-carousel-content {
        width: auto;
    }
}

@media (max-width: 768px) {
    .pa45 { /* Seletor do container pai do seu tema */
        overflow-x: hidden !important;
        max-width: 100%;
        box-sizing: border-box;
    }
    .mag-shortcode-wrapper {
        overflow: visible !important; 
        width: 100%;
        padding-bottom: 30px;
    }
    .reviews-grid-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .review-card {
        position: relative;
        z-index: 1;
    }
    
    /* ======================= INÍCIO DA ALTERAÇÃO (Proporção Imagem Mobile) ======================= */
    .review-gallery {
        /* A regra 'width: 100%' da versão desktop já se aplica aqui */
        /* A regra 'line-height: 0' da versão desktop já se aplica aqui */
        /* Removemos o 'aspect-ratio' que estava aqui antes */
    }
    .review-gallery img.review-image {
        /* As regras 'width: 100%' e 'height: auto' da versão desktop já se aplicam */
        object-fit: contain; /* Garante que a imagem caiba, em vez de 'cover' */
    }
    /* ======================== FIM DA ALTERAÇÃO (Proporção Imagem Mobile) ========================= */
    
    .review-details {
        overflow: visible;
        padding-bottom: 25px;
    }
    
    .mag-open-review-form-button { width: 100%; }
    .mag-modal-content { width: 95%; padding: 20px; }
    
    .mag-carousel-modal-overlay.is-open {
        align-items: flex-start;
        overflow-y: auto; 
        padding: 20px 0;
    }
    .mag-carousel-content {
        flex-direction: column;
        width: 90vw; 
        max-width: 500px;
        margin: 0 auto;
        height: auto;
        max-height: none;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
        border-radius: 8px;
        overflow: hidden;
    }
    img.mag-carousel-main-image {
        width: 100%;
        height: auto;
        object-fit: contain;
        max-height: 60vh;
        display: block;
    }
    .mag-carousel-details-area { padding: 20px; }
    .mag-carousel-thumbnails { display: none; }
    .mag-carousel-close {
        top: 10px; right: 10px; color: #fff; background: rgba(0,0,0,0.5);
        width: 32px; height: 32px; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        font-size: 24px; z-index: 10;
    }
    .verified-icon {
        color: #fff; background-color: #00C781; border-radius: 50%;
        width: 18px; height: 18px; display: inline-flex;
        align-items: center; justify-content: center; font-size: 12px; line-height: 1;
    }

    /* AJUSTE DO MODAL FORM (ROLAGEM INTERNA) */
    .mag-modal-overlay {
        align-items: flex-start;
        padding-top: 30px;
        padding-bottom: 30px;
    }
    .mag-modal-content {
        max-height: calc(100vh - 60px);
        overflow-y: auto; 
    }
    .mag-login-required .submit {
        display: inline-block;
        text-decoration: none;
        background-color: #007cba;
        color: #fff;
        border: none;
        padding: 12px 25px;
        border-radius: 5px;
        cursor: pointer;
        font-size: 1.1em;
        transition: background-color 0.3s ease;
    }
    .mag-login-required .submit:hover {
        background-color: #005f8f;
    }
    
    /* Ajuste dos botões de câmera/galeria em telas menores */
    .mag-media-button-container {
        flex-direction: column; /* Empilha os botões verticalmente */
    }
}

/* ========================================================= */
/* *** CÓDIGO ADICIONAL: BOTÃO VERMELHO AO TOCAR *** */
/* ========================================================= */
.mag-open-review-form-button:hover,
.mag-open-review-form-button:active {
  background-color: #D9534F !important; /* Vermelho */
  color: #FFFFFF !important;            /* Texto branco */
  border-color: #B0413E !important;    /* Borda mais escura */
}