/* ============================================
   Related Post Grid Plugin - Frontend Styles
   ============================================ */

:root {
    --pgs-header-color: #17A2B8;
    --pgs-accent-color: #00C853;
    --pgs-text-color: #333333;
    --pgs-border-color: #00C853;
    --pgs-background-color: #FFFFFF;
    --pgs-hover-color: #FF8C00; /* Orange hover color */
}

/* ============================================
   Related Posts Section
   ============================================ */

.pgs-related-posts-wrapper {
    margin: 40px 0;
    padding: 25px 0;
    max-width: 100%;
}

.pgs-section-header {
    background-color: var(--pgs-header-color);
    color: #FFFFFF;
    padding: 16px 24px;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 25px;
    border-radius: 6px 6px 0 0;
    text-align: center;
    letter-spacing: 0.5px;
}

.pgs-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 25px;
}

.pgs-grid-card {
    background-color: var(--pgs-background-color);
    border: 2px dashed var(--pgs-border-color);
    padding: 24px;
    border-radius: 8px;
    position: relative;
    transition: all 0.3s ease;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pgs-grid-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

.pgs-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--pgs-accent-color);
    color: #FFFFFF;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.pgs-card-title {
    margin: 0 0 16px 0;
    padding-top: 8px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--pgs-text-color);
}

.pgs-card-title a {
    color: var(--pgs-text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.pgs-card-title a:hover {
    color: var(--pgs-hover-color);
}

.pgs-read-more {
    color: var(--pgs-header-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.3s ease;
    display: inline-block;
}

.pgs-read-more:hover {
    color: var(--pgs-hover-color);
    text-decoration: underline;
}

/* ============================================
   No Posts Message
   ============================================ */

.pgs-no-posts {
    text-align: center;
    color: #999999;
    padding: 24px;
    font-style: italic;
    font-size: 16px;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Large tablets and medium desktops (1024px and below) */
@media (max-width: 1024px) {
    .pgs-grid-container {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 20px;
    }

    .pgs-section-header {
        font-size: 20px;
        padding: 14px 20px;
    }

    .pgs-card-title {
        font-size: 18px;
    }

    .pgs-read-more {
        font-size: 15px;
    }
}

/* Tablets and smaller devices (768px and below) */
@media (max-width: 768px) {
    .pgs-related-posts-wrapper {
        margin: 30px 0;
        padding: 20px 0;
    }

    .pgs-grid-container {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .pgs-section-header {
        font-size: 19px;
        padding: 14px 18px;
        margin-bottom: 20px;
    }

    .pgs-grid-card {
        padding: 20px;
        min-height: 145px;
    }

    .pgs-card-title {
        font-size: 18px;
        margin-bottom: 14px;
    }

    .pgs-read-more {
        font-size: 15px;
    }

    .pgs-card-badge {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }
}

/* Mobile devices (480px and below) */
@media (max-width: 480px) {
    .pgs-related-posts-wrapper {
        margin: 25px 0;
        padding: 15px 0;
    }

    .pgs-grid-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .pgs-section-header {
        font-size: 18px;
        padding: 12px 16px;
        margin-bottom: 18px;
    }

    .pgs-grid-card {
        padding: 18px;
        min-height: 135px;
        border-width: 2px;
    }

    .pgs-card-badge {
        width: 34px;
        height: 34px;
        font-size: 14px;
        top: 10px;
        left: 10px;
    }

    .pgs-card-title {
        font-size: 18px;
        margin-bottom: 12px;
        line-height: 1.4;
    }

    .pgs-read-more {
        font-size: 15px;
    }

    .pgs-no-posts {
        font-size: 15px;
        padding: 20px;
    }
}

/* Extra small mobile devices (360px and below) */
@media (max-width: 360px) {
    .pgs-section-header {
        font-size: 17px;
        padding: 11px 14px;
    }

    .pgs-grid-card {
        padding: 16px;
        min-height: 125px;
    }

    .pgs-card-title {
        font-size: 18px;
    }

    .pgs-read-more {
        font-size: 14px;
    }

    .pgs-card-badge {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.pgs-grid-card:focus-within {
    outline: 2px solid var(--pgs-header-color);
    outline-offset: 2px;
}

.pgs-read-more:focus,
.pgs-card-title a:focus {
    outline: 2px solid var(--pgs-header-color);
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .pgs-related-posts-wrapper {
        page-break-inside: avoid;
    }

    .pgs-grid-card {
        page-break-inside: avoid;
    }

    .pgs-grid-container {
        display: block;
    }

    .pgs-grid-card {
        margin-bottom: 20px;
    }
}

/* ============================================
   AdSense Optimization
   ============================================ */

/* Ensure proper spacing for ad placement */
.pgs-related-posts-wrapper {
    clear: both;
    width: 100%;
}

/* Improve readability for better user experience */
.pgs-card-title a,
.pgs-read-more {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Ensure cards are easily clickable on touch devices */
@media (hover: none) and (pointer: coarse) {
    .pgs-grid-card {
        min-height: 150px;
    }

    .pgs-card-title {
        font-size: 18px;
        line-height: 1.5;
    }

    .pgs-read-more {
        padding: 8px 0;
        font-size: 16px;
    }
}
