/**
 * ProductPlayGrid Simple CSS
 * Styles for masonry grid layout without voting
 * Version: 1.0.0
 */

/* Main Container */
.ppg-masonry-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Masonry Grid - Using Flexbox Approach */
.ppg-masonry-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
}

/* Masonry Items */
.ppg-masonry-item {
    width: calc(20% - 16px);
    margin-bottom: 20px;
    break-inside: avoid;
    display: block;
}

/* Card Styling */
.ppg-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e1e5e9;
    width: 100%;
}

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

/* Card Image Container */
.ppg-card-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.ppg-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* No Image Placeholder */
.ppg-no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.ppg-no-image-text {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Date Badge */
.ppg-date-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: bold;
    backdrop-filter: blur(10px);
}

.ppg-date-text {
    display: flex;
    align-items: center;
}

/* Card Header */
.ppg-card-header {
    padding: 16px 16px 8px;
}

.ppg-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ppg-card-meta {
    font-size: 12px;
    color: #8e8e8e;
    margin-bottom: 8px;
}

.ppg-author {
    font-style: italic;
}

/* Card Content */
.ppg-card-content {
    padding: 0 16px 12px;
}

.ppg-card-excerpt {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Actions */
.ppg-card-actions {
    padding: 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Read More Button */
.ppg-read-more-btn {
    display: block;
    width: 100%;
    background: #007cba;
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ppg-read-more-btn:hover {
    background: #005a8b;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.3);
}

.ppg-read-more-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.ppg-read-more-btn:active {
    transform: translateY(0);
}

/* Amazon Affiliate Button */
.ppg-amazon-btn {
    display: block;
    width: 100%;
    background: #ff9500;
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(255, 149, 0, 0.2);
}

.ppg-amazon-btn:hover {
    background: linear-gradient(45deg, #ff9500, #ffb84d);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 149, 0, 0.4);
}

.ppg-amazon-btn:focus {
    outline: 2px solid #ff9500;
    outline-offset: 2px;
}

.ppg-amazon-btn:active {
    transform: translateY(0);
    background: #e6850e;
}

/* Amazon Button Icon */
.ppg-amazon-btn:before {
    content: "🛒 ";
    margin-right: 6px;
    font-size: 16px;
}

/* Amazon Button Shine Effect */
.ppg-amazon-btn:after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.ppg-amazon-btn:hover:after {
    left: 100%;
}

/* Button States from JavaScript */
.ppg-read-more-btn.button-hovered {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 124, 186, 0.4);
}

.ppg-amazon-btn.button-hovered {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 149, 0, 0.5);
}

.ppg-read-more-btn.clicked {
    transform: scale(0.95);
    transition: transform 0.15s ease;
}

.ppg-amazon-btn.amazon-clicked {
    transform: scale(0.98) rotateZ(2deg);
    transition: transform 0.2s ease;
    background: #ffb84d;
}

/* Card Button Hover Enhancement */
.ppg-card.card-button-hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

/* Ensure buttons are visible and properly spaced */
.ppg-card-actions > * {
    flex-shrink: 0;
}

/* Special styling when both buttons are present */
.ppg-card-actions .ppg-read-more-btn + .ppg-amazon-btn {
    margin-top: 0; /* Remove any extra margin since we use gap */
}

/* Amazon button priority styling */
.ppg-amazon-btn {
    order: 2; /* Amazon button appears second */
    font-weight: 700; /* Slightly bolder */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid transparent;
}

.ppg-amazon-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

/* Read More button when Amazon button is present */
.ppg-card-actions:has(.ppg-amazon-btn) .ppg-read-more-btn {
    background: #2c3e50;
    order: 1;
}

.ppg-card-actions:has(.ppg-amazon-btn) .ppg-read-more-btn:hover {
    background: #1a252f;
}

/* Fallback for browsers that don't support :has() */
.ppg-card-actions .ppg-read-more-btn {
    background: #2c3e50;
}

.ppg-card-actions .ppg-read-more-btn:hover {
    background: #1a252f;
}

/* Pagination */
.ppg-pagination {
    margin-top: 40px;
    text-align: center;
    padding: 20px 0;
    clear: both;
}

.ppg-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #007cba;
    text-decoration: none;
    transition: all 0.3s ease;
}

.ppg-pagination .page-numbers:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.ppg-pagination .page-numbers.current {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ppg-masonry-item {
        width: calc(25% - 15px);
    }
}

@media (max-width: 900px) {
    .ppg-masonry-grid {
        gap: 16px;
    }
    
    .ppg-masonry-item {
        width: calc(33.333% - 11px);
    }
}

@media (max-width: 600px) {
    .ppg-masonry-container {
        padding: 15px;
    }
    
    .ppg-masonry-grid {
        gap: 12px;
    }
    
    .ppg-masonry-item {
        width: calc(50% - 6px);
    }
    
    .ppg-card-image-container {
        height: 150px;
    }
    
    .ppg-card-title {
        font-size: 15px;
    }
    
    .ppg-card-excerpt {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }
}

@media (max-width: 400px) {
    .ppg-masonry-item {
        width: 100%;
    }
    
    .ppg-card-image-container {
        height: 200px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ppg-card,
    .ppg-read-more-btn,
    .ppg-card-image,
    .ppg-masonry-item {
        transition: none !important;
        transform: none !important;
    }
}

/* Loading Animation */
.ppg-masonry-container.loading {
    opacity: 0.7;
}

.ppg-masonry-container.loading .ppg-card {
    pointer-events: none;
}

/* Print Styles */
@media print {
    .ppg-masonry-grid {
        display: block !important;
    }
    
    .ppg-masonry-item {
        width: 100% !important;
        margin-bottom: 20px;
        break-inside: avoid;
    }
    
    .ppg-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .ppg-pagination {
        display: none;
    }
}

/* Card Styling */
.ppg-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e1e5e9;
}

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

/* Card Image Container */
.ppg-card-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.ppg-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* No Image Placeholder */
.ppg-no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
}

.ppg-no-image-text {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Date Badge */
.ppg-date-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: bold;
    backdrop-filter: blur(10px);
}

.ppg-date-text {
    display: flex;
    align-items: center;
}

/* Card Header */
.ppg-card-header {
    padding: 16px 16px 8px;
}

.ppg-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ppg-card-meta {
    font-size: 12px;
    color: #8e8e8e;
    margin-bottom: 8px;
}

.ppg-author {
    font-style: italic;
}

/* Card Content */
.ppg-card-content {
    padding: 0 16px 12px;
}

.ppg-card-excerpt {
    font-size: 14px;
    color: #6c757d;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Actions */
.ppg-card-actions {
    padding: 16px;
    border-top: 1px solid #f0f0f0;
}

/* Read More Button */
.ppg-read-more-btn {
    display: block;
    width: 100%;
    background: #007cba;
    color: white;
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.ppg-read-more-btn:hover {
    background: #005a8b;
    color: white;
    text-decoration: none;
}

.ppg-read-more-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Pagination */
.ppg-pagination {
    margin-top: 40px;
    text-align: center;
    padding: 20px 0;
}

.ppg-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #007cba;
    text-decoration: none;
    transition: all 0.3s ease;
}

.ppg-pagination .page-numbers:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.ppg-pagination .page-numbers.current {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ppg-masonry-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    @supports not (grid-template-rows: masonry) {
        .ppg-masonry-item {
            width: calc(25% - 15px);
        }
    }
}

@media (max-width: 900px) {
    .ppg-masonry-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-gap: 16px;
    }
    
    @supports not (grid-template-rows: masonry) {
        .ppg-masonry-item {
            width: calc(33.333% - 11px);
        }
    }
}

@media (max-width: 600px) {
    .ppg-masonry-container {
        padding: 15px;
    }
    
    .ppg-masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 12px;
    }
    
    @supports not (grid-template-rows: masonry) {
        .ppg-masonry-item {
            width: calc(50% - 6px);
        }
    }
    
    .ppg-card-image-container {
        height: 150px;
    }
    
    .ppg-card-title {
        font-size: 15px;
    }
    
    .ppg-card-excerpt {
        font-size: 13px;
        -webkit-line-clamp: 3;
    }
}

@media (max-width: 400px) {
    .ppg-masonry-grid {
        grid-template-columns: 1fr;
    }
    
    @supports not (grid-template-rows: masonry) {
        .ppg-masonry-item {
            width: 100%;
        }
    }
    
    .ppg-card-image-container {
        height: 200px;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ppg-card,
    .ppg-read-more-btn,
    .ppg-card-image,
    .ppg-masonry-item {
        transition: none !important;
        transform: none !important;
    }
}

/* Loading Animation */
.ppg-masonry-container.loading {
    opacity: 0.7;
}

.ppg-masonry-container.loading .ppg-card {
    pointer-events: none;
}

/* Print Styles */
@media print {
    .ppg-masonry-grid {
        display: block !important;
    }
    
    .ppg-masonry-item {
        width: 100% !important;
        margin-bottom: 20px;
        break-inside: avoid;
    }
    
    .ppg-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .ppg-pagination {
        display: none;
    }
}