/**
 * Product Roundup Block Styles
 * 
 * Wirecutter-inspired clean, professional styling
 * 
 * @package Affiliate_Products_Core
 * @since 2.1.2
 */

.apc-product-roundup-block {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto 3rem;
}

/* Header Styles */
.apc-prb-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
}

.apc-prb-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 1rem;
    line-height: 1.2;
}

.apc-prb-intro {
    font-size: 1.125rem;
    color: #6b7280;
    max-width: 800px;
    margin: 0 auto;
}

.apc-prb-intro p {
    margin: 0;
}

/* Products Container */
.apc-prb-products {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Individual Product Styles */
.apc-prb-product {
    margin-bottom: 3rem;
}

/* Wirecutter-Style Card */
.apc-prb-product-card {
    position: relative;
    background: #fff;
    border: 3px solid #3b82f6;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
    margin-bottom: 2rem;
}

.apc-prb-product-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* Highlighted Product Card */
.apc-prb-product-card.apc-prb-highlighted {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
    border-color: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.apc-prb-product-card.apc-prb-highlighted:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25);
}

/* Adjust category badge for highlighted cards */
.apc-prb-product-card.apc-prb-highlighted .apc-prb-category-badge {
    background: #f59e0b;
}

/* Product Header */
.apc-prb-product-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.apc-prb-category-badge {
    position: absolute;
    top: -12px;
    left: 2rem;
    background: #3b82f6;
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    z-index: 1;
}

.apc-prb-product-tagline {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.apc-prb-product-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.75rem;
    line-height: 1.3;
}

.apc-prb-underlined {
    text-decoration: underline;
    text-decoration-color: #3b82f6;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

/* Rating Styles */
.apc-prb-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.apc-prb-stars {
    color: #fbbf24;
    font-size: 1.125rem;
    line-height: 1;
}

.apc-star {
    display: inline-block;
}

.apc-star-full {
    color: #fbbf24;
}

.apc-star-half {
    background: linear-gradient(90deg, #fbbf24 50%, #d1d5db 50%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.apc-star-empty {
    color: #d1d5db;
}

.apc-prb-rating-text {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Default Card Content Layout (Stacked) */
.apc-prb-product-card {
    display: flex;
    flex-direction: column;
}

/* Product Media */
.apc-prb-product-media {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.apc-prb-product-image {
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.apc-prb-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.apc-prb-price-from {
    text-align: center;
    background: #f3f4f6;
    padding: 0.75rem;
    border-radius: 8px;
}

.apc-prb-price-label {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.apc-prb-price-amount {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

/* Card Info */
.apc-prb-card-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.apc-prb-product-summary {
    font-size: 1rem;
    color: #4b5563;
    line-height: 1.7;
}

.apc-prb-product-summary p {
    margin: 0 0 1rem;
}

.apc-prb-product-summary p:last-child {
    margin-bottom: 0;
}

/* Long Description Outside Card */
.apc-prb-long-description {
    font-size: 1rem;
    color: #374151;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.apc-prb-long-description p {
    margin: 0 0 1.25rem;
}

.apc-prb-long-description p:last-child {
    margin-bottom: 0;
}

/* Retailers Section */
.apc-prb-retailers-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem;
}

.apc-prb-retailer-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Style existing CTA buttons in the roundup context */
.apc-prb-cta-list .apc-cta {
    margin-bottom: 0.75rem;
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
    border-radius: 6px;
}

.apc-prb-cta-list .apc-cta:last-child {
    margin-bottom: 0;
}

/* Promotional text styling in Product Roundup */
.apc-prb-cta-list .apc-extra-cta-text {
    color: #4b5563;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-style: italic;
}

.apc-prb-cta-list .apc-extra-text-active {
    margin-bottom: 1rem;
}

.apc-prb-cta-list .apc-extra-text-active:last-child {
    margin-bottom: 0;
}

/* SIDE-BY-SIDE LAYOUT (WIRECUTTER STYLE) */
.apc-prb-side_by_side .apc-prb-product-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto 1fr;
    gap: 1.5rem;
    padding: 2rem;
    min-height: 280px;
    align-items: start;
}

.apc-prb-side_by_side .apc-prb-product-header {
    grid-column: 1 / -1;
    text-align: left;
    margin-bottom: 1rem;
}

.apc-prb-side_by_side .apc-prb-product-image {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
}

.apc-prb-side_by_side .apc-prb-product-content {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.apc-prb-side_by_side .apc-prb-product-main {
    flex: 1;
    margin-bottom: 1.5rem;
}

.apc-prb-side_by_side .apc-prb-retailers {
    margin-top: auto;
}

.apc-prb-side_by_side .apc-prb-category-badge {
    left: 1rem;
    top: -8px;
}

/* Pros and Cons */
.apc-prb-pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.apc-prb-pros,
.apc-prb-cons {
    padding: 1.25rem;
    border-radius: 8px;
}

.apc-prb-pros {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.apc-prb-cons {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.apc-prb-pros-title,
.apc-prb-cons-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.apc-prb-pros-title {
    color: #059669;
}

.apc-prb-cons-title {
    color: #dc2626;
}

.apc-prb-pros-content,
.apc-prb-cons-content {
    font-size: 0.875rem;
    line-height: 1.5;
}

.apc-prb-pros-content p,
.apc-prb-cons-content p {
    margin: 0 0 0.5rem;
}

.apc-prb-pros-content p:last-child,
.apc-prb-cons-content p:last-child {
    margin-bottom: 0;
}

/* Style existing list markup from database */
.apc-prb-pros-content ul,
.apc-prb-cons-content ul {
    margin: 0;
    padding-left: 1.25rem;
    list-style: none;
}

.apc-prb-pros-content ul li,
.apc-prb-cons-content ul li {
    position: relative;
    margin-bottom: 0.5rem;
}

.apc-prb-pros-content ul li::before {
    content: "✓";
    position: absolute;
    left: -1.25rem;
    color: #059669;
    font-weight: bold;
}

.apc-prb-cons-content ul li::before {
    content: "✗";
    position: absolute;
    left: -1.25rem;
    color: #dc2626;
    font-weight: bold;
}

/* Methodology Section */
.apc-prb-methodology {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.apc-prb-methodology-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem;
}

.apc-prb-methodology-content {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.6;
}

.apc-prb-methodology-content p {
    margin: 0 0 1rem;
}

.apc-prb-methodology-content p:last-child {
    margin-bottom: 0;
}

/* Admin Placeholder */
.apc-block-placeholder {
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    font-style: italic;
    margin: 1rem 0;
}

.apc-block-placeholder p {
    margin: 0.5rem 0;
}

.apc-block-placeholder p:first-child {
    font-weight: 600;
    font-size: 1.1em;
    color: #374151;
}

/* Ensure admin preview shows properly in block editor */
.wp-block[data-type="acf/apc-product-roundup"] .apc-prb-empty {
    min-height: 150px;
}

.wp-block[data-type="acf/apc-product-roundup"] .apc-prb-product-card {
    margin-bottom: 2rem;
}

/* Admin-specific styling for better visibility */
.edit-post-visual-editor .apc-prb-product-card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
}

.edit-post-visual-editor .apc-prb-product-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
    .apc-prb-title {
        font-size: 2rem;
    }
    
    .apc-prb-card-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .apc-prb-product-media {
        order: -1;
    }
    
    .apc-prb-category-badge {
        position: static;
        display: inline-block;
        margin-bottom: 1rem;
    }
    
    .apc-prb-pros-cons {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .apc-prb-cta-list .apc-cta {
        margin-bottom: 0.5rem;
    }
    
    /* Side-by-side layout becomes stacked on mobile */
    .apc-prb-side_by_side .apc-prb-product-card {
        grid-template-columns: 1fr;
        gap: 1rem;
        min-height: auto;
    }
    
    .apc-prb-side_by_side .apc-prb-product-image {
        grid-column: 1;
        text-align: center;
    }
    
    .apc-prb-side_by_side .apc-prb-product-content {
        grid-column: 1;
    }
    
    .apc-prb-side_by_side .apc-prb-product-header {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .apc-prb-side_by_side .apc-prb-category-badge {
        position: static;
        display: inline-block;
        margin-bottom: 1rem;
    }
    
    /* Adjust highlighted card on mobile */
    .apc-prb-product-card.apc-prb-highlighted {
        background: #fef9e7;
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    }
}

@media (max-width: 480px) {
    .apc-product-roundup-block {
        margin-bottom: 2rem;
    }
    
    .apc-prb-product {
        padding: 1.5rem;
    }
    
    .apc-prb-title {
        font-size: 1.75rem;
    }
    
    .apc-prb-product-title {
        font-size: 1.5rem;
    }
    
    .apc-prb-header {
        margin-bottom: 2rem;
    }
    
    .apc-prb-products {
        gap: 2rem;
    }
}