/* ============================================
   AFFILIATE PRODUCTS MANAGER - ESTILOS
   ============================================ */

/* === ESTILOS GLOBALES PARA IMÁGENES === */
/* Estos estilos fuerzan el tamaño correcto en todas las imágenes de productos */
.affiliate-product-wrapper img,
.affiliate-products-grid img,
article.affiliate_product img,
.single-affiliate_product img,
.post-type-archive-affiliate_product img {
    max-width: 100% !important;
    height: auto !important;
}

/* === CONTROL DE MINIATURAS EN ARCHIVOS Y LISTADOS === */
.affiliate-thumbnail-wrapper {
    max-width: 300px !important;
    max-height: 300px !important;
    overflow: hidden !important;
    margin: 0 auto 20px auto !important;
    display: block !important;
    border-radius: 8px !important;
}

.affiliate-thumbnail-wrapper img {
    width: 100% !important;
    height: 100% !important;
    max-width: 300px !important;
    max-height: 300px !important;
    object-fit: cover !important;
    display: block !important;
}

/* Estilos para archivos de productos */
.post-type-archive-affiliate_product article.affiliate_product,
.archive.affiliate_product article.affiliate_product,
body.tax-affiliate_product_category article.affiliate_product {
    margin-bottom: 40px !important;
    padding-bottom: 30px !important;
    border-bottom: 1px solid #e0e0e0 !important;
}

.post-type-archive-affiliate_product .post-thumbnail,
.archive.affiliate_product .post-thumbnail,
body.tax-affiliate_product_category .post-thumbnail {
    max-width: 300px !important;
    margin: 0 auto 20px auto !important;
    display: block !important;
}

.post-type-archive-affiliate_product .post-thumbnail img,
.archive.affiliate_product .post-thumbnail img,
body.tax-affiliate_product_category .post-thumbnail img,
.post-type-archive-affiliate_product img.wp-post-image,
.archive.affiliate_product img.wp-post-image,
body.tax-affiliate_product_category img.wp-post-image {
    width: 100% !important;
    max-width: 300px !important;
    max-height: 300px !important;
    height: auto !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 auto !important;
    border-radius: 8px !important;
}

/* === PRODUCTO INDIVIDUAL === */
.affiliate-product-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Título del Producto */
.product-title {
    font-size: 2.2em;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.3;
}

/* Imagen Destacada */
.product-featured-image {
    text-align: center;
    margin-bottom: 30px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-width: 300px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
}

.product-featured-image img {
    width: 100% !important;
    max-width: 300px !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
    max-height: 400px !important;
    object-fit: contain !important;
}

/* Estilos más específicos para sobrescribir el tema */
.affiliate-product-wrapper .product-featured-image img,
.affiliate-product-wrapper img.wp-post-image,
.affiliate-product-wrapper .attachment-large,
.affiliate-product-wrapper .attachment-full {
    width: 100% !important;
    max-width: 300px !important;
    max-height: 400px !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

/* === CAJA RESUMEN === */
.product-summary-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 35px;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 25px;
    align-items: center;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.summary-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-details > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-details .label {
    font-weight: 600;
    opacity: 0.9;
}

.summary-details .value {
    font-size: 1.1em;
    font-weight: 700;
}

.summary-price .value {
    font-size: 1.8em;
    color: #ffd700;
}

.summary-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stars {
    display: inline-flex;
    gap: 2px;
}

.star {
    font-size: 1.2em;
}

.star.full {
    color: #ffd700;
}

.star.half {
    background: linear-gradient(90deg, #ffd700 50%, rgba(255,255,255,0.3) 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.star.empty {
    color: rgba(255,255,255,0.3);
}

.rating-number {
    font-size: 0.9em;
    opacity: 0.8;
}

/* === BOTONES === */
.affiliate-button {
    display: inline-block;
    padding: 14px 32px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.05em;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 2px solid transparent;
}

.affiliate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    background: #f8f9fa;
}

.affiliate-button.primary {
    margin-top: 10px;
}

.affiliate-button.large {
    padding: 18px 50px;
    font-size: 1.2em;
}

/* Resumen Corto */
.product-short-summary {
    background: #f8f9fa;
    padding: 25px;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    margin-bottom: 30px;
    font-size: 1.05em;
    line-height: 1.7;
    color: #495057;
}

/* === PROS Y CONTRAS === */
.pros-cons-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 40px;
}

.pros-box,
.cons-box {
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.pros-box {
    background: #d4edda;
    border-left: 5px solid #28a745;
}

.cons-box {
    background: #f8d7da;
    border-left: 5px solid #dc3545;
}

.pros-box h3,
.cons-box h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.pros-box h3 {
    color: #155724;
}

.cons-box h3 {
    color: #721c24;
}

.pros-box ul,
.cons-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pros-box li,
.cons-box li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    line-height: 1.6;
}

.pros-box li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
    font-size: 1.2em;
}

.cons-box li::before {
    content: "✗";
    position: absolute;
    left: 0;
    color: #dc3545;
    font-weight: bold;
    font-size: 1.2em;
}

/* Descripción Larga */
.product-long-description {
    margin-bottom: 40px;
    font-size: 1.05em;
    line-height: 1.8;
    color: #333;
}

.product-long-description h3 {
    color: #2c3e50;
    margin-top: 30px;
    margin-bottom: 15px;
}

.product-long-description p {
    margin-bottom: 20px;
}

.product-long-description ul,
.product-long-description ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.product-long-description li {
    margin-bottom: 10px;
}

/* Opinión Personal */
.personal-opinion {
    background: #fff3cd;
    border-left: 5px solid #ffc107;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.personal-opinion h3 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.4em;
}

.personal-opinion p {
    color: #533f03;
    line-height: 1.8;
    font-size: 1.05em;
}

/* === FAQs === */
.product-faqs {
    margin-bottom: 40px;
}

.product-faqs h3 {
    color: #2c3e50;
    font-size: 1.6em;
    margin-bottom: 25px;
    text-align: center;
}

.faq-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
}

.faq-question {
    color: #667eea;
    font-size: 1.15em;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.faq-answer {
    color: #495057;
    line-height: 1.7;
    margin: 0;
}

/* Botón Final CTA */
.final-cta {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 15px;
    margin-top: 40px;
}

/* === GRID DE PRODUCTOS === */
.affiliate-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-card-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
    max-width: 100% !important;
    max-height: 100% !important;
}

.product-card:hover .product-card-image img {
    transform: scale(1.05);
}

.product-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.product-card h3 {
    margin: 0;
    font-size: 1.2em;
    color: #2c3e50;
    line-height: 1.4;
}

.card-rating {
    display: flex;
    gap: 3px;
}

.card-rating .star {
    font-size: 1em;
}

.card-price {
    font-size: 1.5em;
    color: #667eea;
    font-weight: 700;
    margin-top: auto;
}

.card-button {
    display: block;
    padding: 12px 20px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.card-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .affiliate-product-wrapper {
        padding: 15px;
    }
    
    .product-title {
        font-size: 1.6em;
    }
    
    .product-featured-image {
        max-width: 100%;
    }
    
    .product-featured-image img {
        max-width: 300px;
        max-height: 350px;
    }
    
    .product-summary-box {
        grid-template-columns: 1fr;
        padding: 20px;
        text-align: center;
    }
    
    .summary-image {
        max-width: 200px;
        margin: 0 auto;
    }
    
    .summary-details > div {
        justify-content: center;
    }
    
    .pros-cons-wrapper {
        grid-template-columns: 1fr;
    }
    
    .affiliate-products-grid {
        grid-template-columns: 1fr;
    }
    
    .affiliate-button.large {
        padding: 16px 40px;
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .product-title {
        font-size: 1.4em;
    }
    
    .product-featured-image img {
        max-width: 280px;
        max-height: 300px;
    }
    
    .product-summary-box {
        padding: 15px;
    }
    
    .summary-price .value {
        font-size: 1.5em;
    }
}

/* === UTILIDADES === */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

/* ============================================
   ESTILOS PARA PÁGINA DE ARCHIVO
   ============================================ */

.affiliate-archive-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.affiliate-archive-container {
    width: 100%;
}

/* Header del archivo */
.archive-header {
    text-align: center;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 3px solid #667eea;
}

.archive-title {
    font-size: 2.5em;
    color: #2c3e50;
    margin-bottom: 15px;
}

.archive-description {
    font-size: 1.1em;
    color: #666;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Grid mejorado para archivo */
.affiliate-archive-wrapper .affiliate-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* Tarjetas de producto mejoradas */
.affiliate-archive-wrapper .product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.affiliate-archive-wrapper .product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.2);
}

.affiliate-archive-wrapper .product-card-image {
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.affiliate-archive-wrapper .product-card-image a {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.affiliate-archive-wrapper .product-card-image img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
}

.affiliate-archive-wrapper .product-card:hover .product-card-image img {
    transform: scale(1.1);
}

.affiliate-archive-wrapper .product-card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.affiliate-archive-wrapper .product-card-title {
    margin: 0;
    font-size: 1.3em;
    line-height: 1.4;
}

.affiliate-archive-wrapper .product-card-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.affiliate-archive-wrapper .product-card-title a:hover {
    color: #667eea;
}

.affiliate-archive-wrapper .card-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.affiliate-archive-wrapper .card-rating .rating-number {
    font-size: 0.9em;
    color: #666;
    margin-left: 5px;
}

.affiliate-archive-wrapper .card-excerpt {
    font-size: 0.95em;
    color: #666;
    line-height: 1.6;
}

.affiliate-archive-wrapper .card-price {
    font-size: 1.8em;
    color: #667eea;
    font-weight: 700;
    margin-top: auto;
}

.affiliate-archive-wrapper .card-store {
    color: #888;
    font-size: 0.9em;
}

.affiliate-archive-wrapper .card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.affiliate-archive-wrapper .card-button,
.affiliate-archive-wrapper .card-button-secondary {
    flex: 1;
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.affiliate-archive-wrapper .card-button {
    background: #667eea;
    color: white;
}

.affiliate-archive-wrapper .card-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.affiliate-archive-wrapper .card-button-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.affiliate-archive-wrapper .card-button-secondary:hover {
    background: #667eea;
    color: white;
}

/* Mensaje de no hay productos */
.no-products-found {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.no-products-found h2 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.no-products-found p {
    color: #666;
    font-size: 1.1em;
}

/* Paginación */
.affiliate-archive-wrapper .pagination {
    margin-top: 50px;
    text-align: center;
}

.affiliate-archive-wrapper nav.navigation {
    margin-top: 40px;
}

.affiliate-archive-wrapper .nav-links {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.affiliate-archive-wrapper .nav-links a,
.affiliate-archive-wrapper .nav-links span {
    padding: 10px 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.affiliate-archive-wrapper .nav-links a:hover,
.affiliate-archive-wrapper .nav-links span.current {
    background: #667eea;
    color: white;
}

/* Responsive para archivo */
@media (max-width: 768px) {
    .archive-title {
        font-size: 1.8em;
    }
    
    .affiliate-archive-wrapper .affiliate-products-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .affiliate-archive-wrapper .product-card-image {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .affiliate-archive-wrapper {
        padding: 20px 15px;
    }
    
    .archive-title {
        font-size: 1.5em;
    }
    
    .affiliate-archive-wrapper .card-actions {
        flex-direction: column;
    }
    
    .affiliate-archive-wrapper .product-card-image {
        height: 220px;
    }
}
