/**
 * Advanced Post Grid Styles
 */

/* Grid Container */
.apg-container {
    width: 100%;
    box-sizing: border-box;
}

/* Grid Layout */
.apg-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Default 2 columns */
    gap: 20px;
    width: 100%;
}

/* Grid Items */
.apg-grid-item {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.apg-grid-item:hover {
    transform: translateY(-5px);
}

.apg-grid-item-inner {
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Thumbnail */
.apg-thumbnail {
    overflow: hidden;
}

.apg-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
    transition: all 0.3s ease;
}

/* Content Area */
.apg-content {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Title */
.apg-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 600;
}

/* Custom Field */
.apg-custom-field {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.apg-custom-field-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 5px;
}

.apg-custom-field-value {
    font-size: 14px;
    display: flex;
    align-items: center;
}

.apg-custom-field-icon,
.apg-custom-field-value-icon {
    display: inline-flex;
    align-items: center;
}

.apg-icon-before,
.apg-value-icon-before {
    margin-right: 5px;
}

.apg-icon-after,
.apg-value-icon-after {
    margin-left: 5px;
}

/* No Posts Message */
.apg-no-posts {
    text-align: center;
    padding: 30px 0;
    color: #888;
    font-style: italic;
}

/* Popup Styles */
.apg-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.apg-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.apg-popup-content-wrapper {
    position: relative;
    background-color: #fff;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 5px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.apg-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    font-weight: bold;
    color: #000;
    cursor: pointer;
    z-index: 11;
    line-height: 1;
}

.apg-popup-content-inner {
    padding: 30px;
}

.apg-popup-thumbnail {
    text-align: center;
    margin-bottom: 20px;
}

.apg-popup-thumbnail img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.apg-popup-title {
    margin-bottom: 15px;
}

.apg-popup-title h2 {
    margin: 0;
    font-size: 24px;
    line-height: 1.3;
}

.apg-popup-custom-field {
    margin-top: 15px;
}

.apg-popup-custom-field-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 5px;
}

.apg-popup-custom-field-value {
    font-size: 16px;
    display: flex;
    align-items: center;
}

.apg-popup-custom-field-value-icon {
    display: inline-flex;
    align-items: center;
}

/* Responsive Styles */
@media screen and (max-width: 1024px) {
    .apg-grid {
        grid-template-columns: repeat(2, 1fr); /* Tablet default */
    }
}

@media screen and (max-width: 767px) {
    .apg-grid {
        grid-template-columns: 1fr; /* Mobile default */
    }
    
    .apg-popup-content-wrapper {
        width: 95%;
        max-height: 95vh;
    }
    
    .apg-popup-content-inner {
        padding: 20px;
    }
    
    .apg-title {
        font-size: 16px;
    }
}