/**
 * Módulos Avançados para WooCommerce - Frontend Styles
 *
 * Estilos para as páginas de produto no frontend.
 * 
 * @package WC_Advanced_Modules
 * @version 2.2
 */

/* ==========================================================================
   SEÇÕES GERAIS DOS MÓDULOS
   ========================================================================== */

.wcam-module-section {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
}

.wcam-main-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 2px solid #ff4747;
    padding-bottom: 10px;
}

/* ==========================================================================
   BANNER DE COMPROMISSO
   ========================================================================== */

.wcam-commitment-banner {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 25px;
}

.wcam-commitment-banner:hover {
    background-color: #f1f3f5;
}

.wcam-commitment-banner-icon {
    font-size: 20px;
    margin-right: 10px;
    color: #28a745;
}

.wcam-commitment-banner-text {
    flex-grow: 1;
    font-size: 14px;
    color: #495057;
}

.wcam-commitment-banner-arrow {
    font-size: 18px;
    color: #6c757d;
}

/* ==========================================================================
   POP-UP DE COMPROMISSO
   ========================================================================== */

.wcam-commitment-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wcam-commitment-popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wcam-commitment-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #fff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.wcam-commitment-popup-overlay.active .wcam-commitment-popup {
    transform: translateY(0);
}

.wcam-popup-header {
    padding: 10px 20px 15px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.wcam-popup-handle {
    width: 40px;
    height: 4px;
    background-color: #ccc;
    border-radius: 2px;
    margin: 0 auto 10px;
}

.wcam-popup-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wcam-popup-nav {
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fa;
    -webkit-overflow-scrolling: touch;
}

.wcam-popup-nav::-webkit-scrollbar {
    display: none;
}

.wcam-popup-nav-item {
    display: inline-block;
    padding: 8px 16px;
    margin-right: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcam-popup-nav-item.active {
    background-color: #333;
    color: #fff;
    border-color: #333;
}

.wcam-popup-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    scroll-behavior: smooth;
}

.wcam-popup-content-section {
    margin-bottom: 25px;
}

.wcam-popup-content-section h3 {
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 10px;
}

.wcam-popup-content-section p {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin: 0;
}

.wcam-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.wcam-icon-grid img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    background: #f5f5f5;
    padding: 2px;
}

/* Bloqueia scroll do body quando popup está aberto */
body.wcam-popup-open {
    overflow: hidden;
}

/* ==========================================================================
   RESUMO DE AVALIAÇÕES
   ========================================================================== */

.wcam-reviews-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.wcam-summary-overview {
    flex: 2;
    display: flex;
    justify-content: center;
}

.wcam-average-rating {
    display: flex;
    align-items: center;
    gap: 15px;
}

.wcam-average-rating-value {
    font-size: 3em;
    font-weight: 700;
    color: #333;
}

.wcam-average-rating-stars .star-rating {
    font-size: 18px;
    color: #ffb300;
}

.wcam-total-reviews {
    font-size: 0.9em;
    color: #777;
}

.wcam-summary-bars {
    flex: 3;
    min-width: 220px;
}

.wcam-rating-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}

.wcam-star-label {
    color: #555;
    font-size: 14px;
}

.wcam-star-label span {
    color: #ffb300;
}

.wcam-bar {
    flex-grow: 1;
    height: 10px;
    background-color: #eee;
    border-radius: 5px;
    overflow: hidden;
}

.wcam-filled-bar {
    height: 100%;
    background-color: #ffb300;
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
}

.wcam-rating-percentage {
    font-size: 12px;
    color: #777;
    min-width: 30px;
    text-align: right;
}

.wcam-rating-count {
    font-size: 12px;
    color: #777;
    min-width: 25px;
    text-align: right;
    font-weight: 500;
}

/* ==========================================================================
   INFORMAÇÕES DO VENDEDOR
   ========================================================================== */

.wcam-vendor-info-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.wcam-vendor-info-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wcam-vendor-info-left .avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.wcam-vendor-details {
    display: flex;
    flex-direction: column;
}

.wcam-vendor-name {
    font-weight: 700;
    font-size: 16px;
}

.wcam-vendor-product-count {
    font-size: 13px;
    color: #666;
}

.wcam-vendor-visit-btn {
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    color: #333 !important;
    border: 2px solid #ddd;
    transition: all 0.2s ease;
}

.wcam-vendor-visit-btn:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

/* ==========================================================================
   PRODUTOS RELACIONADOS
   ========================================================================== */

.wcam-related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.wcam-related-product-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
    animation: wcamFadeIn 0.5s forwards;
}

@keyframes wcamFadeIn {
    to {
        opacity: 1;
    }
}

.wcam-related-product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wcam-related-product-link {
    text-decoration: none;
    color: inherit;
    display: contents;
}

.wcam-related-product-image {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    aspect-ratio: 1 / 1;
}

.wcam-related-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wcam-related-product-item:hover .wcam-related-product-image img {
    transform: scale(1.05);
}

.wcam-related-product-info {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.wcam-related-product-title {
    font-size: 13px;
    font-weight: 400;
    color: #666;
    margin: 0 0 5px;
    line-height: 1.4;
    height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wcam-related-product-rating .star-rating {
    font-size: 12px;
    height: 1.2em;
    width: 5.5em;
    margin-bottom: 5px;
}

.wcam-related-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin-top: auto;
    margin-bottom: 8px;
}

.wcam-related-product-price del,
.wcam-related-product-price .from {
    display: none !important;
}

.wcam-related-product-price ins {
    text-decoration: none;
    background: none;
}

.wcam-related-product-actions {
    padding: 0 10px 10px;
}

.wcam-related-product-actions .button {
    width: 100% !important;
    background: #f0f0f0 !important;
    color: #333 !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 8px 10px !important;
    transition: all 0.2s ease;
}

.wcam-related-product-actions .button:hover {
    background: #e5e5e5 !important;
}

/* Estado de carregamento do botão adicionar ao carrinho */
.wcam-related-product-actions .ajax_add_to_cart.loading {
    opacity: 0.7;
    position: relative;
    color: transparent !important;
}

.wcam-related-product-actions .ajax_add_to_cart.loading::after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid #333;
    border-right-color: transparent;
    border-radius: 50%;
    animation: wcam-spin 0.8s linear infinite;
}

@keyframes wcam-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Área de carregamento de mais produtos */
.wcam-related-loading-more {
    text-align: center;
    padding: 20px;
    width: 100%;
    grid-column: 1 / -1;
}

.wcam-related-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid #f0f0f0;
    border-top-color: #333;
    border-radius: 50%;
    animation: wcam-spin 0.8s linear infinite;
}

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */

@media (max-width: 768px) {
    .wcam-related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .wcam-reviews-summary {
        flex-direction: column;
    }
    
    .wcam-vendor-info-section {
        flex-direction: column;
        text-align: center;
    }
    
    .wcam-vendor-info-left {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .wcam-module-section {
        padding: 15px;
    }
    
    .wcam-commitment-banner {
        padding: 8px 12px;
    }
    
    .wcam-commitment-banner-text {
        font-size: 13px;
    }
}
