/* Advanced Posts Display Styles */

@import url('https://fonts.googleapis.com/css2?family=Aspekta:wght@400;500;600;700&display=swap');

.apd-wrapper {
    min-height: 100vh;
    padding: 40px 20px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.apd-posts-grid-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Search and Filter Header */
.apd-search-filter-header {
    /* background: #ffffff; */
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); */
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    margin: 0 auto 30px;
    /* max-width: 100%; */
    width: 100%;
    box-sizing: border-box;
    /* overflow: hidden; */
    justify-content: space-between;
}
.apd-search-input-wrapper {
    width: 35%;
    min-width: 0;
    position: relative;
}

.apd-search-input-wrapper input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #E1E5E8;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.apd-search-input-wrapper::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 25px;
    background-image: url("data:image/svg+xml,%3Csvg width='25' height='25' viewBox='0 0 25 25' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.043 18.0469L22.6833 22.6872' stroke='%23858D97' stroke-width='1.54676' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M20.6197 11.3431C20.6197 6.21755 16.4647 2.0625 11.3392 2.0625C6.21365 2.0625 2.05859 6.21755 2.05859 11.3431C2.05859 16.4686 6.21365 20.6237 11.3392 20.6237C16.4647 20.6237 20.6197 16.4686 20.6197 11.3431Z' stroke='%23858D97' stroke-width='1.54676' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 1;
    pointer-events: none;
}

.apd-search-input-wrapper input:focus {
    border-color: #00d0fa;
}


.apd-filter-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: end;
    width: 35%;
    min-width: 0;
    box-sizing: border-box;
}

.apd-type-filter {
    padding: 12px 35px 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0.773438 0.773887L6.23134 6.23179C6.57506 6.57551 6.74692 6.74737 6.96049 6.74737C7.17405 6.74737 7.34591 6.57551 7.68964 6.23179L13.1475 0.773887' stroke='%23858D97' stroke-width='1.54676' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    outline: none;
    transition: border-color 0.3s;
    width: 10%;
    box-sizing: border-box;
}
input.apd-search-input {
    padding-left: 2rem !important;
    border: 1px solid #E1E5E8 !important;
    border-radius: 8px !important;

}
.apd-year-filter {
    padding: 12px 35px 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0.773438 0.773887L6.23134 6.23179C6.57506 6.57551 6.74692 6.74737 6.96049 6.74737C7.17405 6.74737 7.34591 6.57551 7.68964 6.23179L13.1475 0.773887' stroke='%23858D97' stroke-width='1.54676' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    outline: none;
    transition: border-color 0.3s;
    width: 15%;
    box-sizing: border-box;
}

.apd-filter-select {
    /* padding: 12px 35px 12px 15px; */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='8' viewBox='0 0 14 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0.773438 0.773887L6.23134 6.23179C6.57506 6.57551 6.74692 6.74737 6.96049 6.74737C7.17405 6.74737 7.34591 6.57551 7.68964 6.23179L13.1475 0.773887' stroke='%23858D97' stroke-width='1.54676' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    width: 37%;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.apd-filter-select:focus {
    border-color: #00d0fa;
}

.apd-search-button,
button.apd-search-button {
    padding: 12px 24px;
    background: #00d0fa !important;
    background-color: #00d0fa !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, background-color 0.3s;
    /* flex: 0 0 10%; */
    /* width: 10%; */
    white-space: nowrap;
    box-sizing: border-box;
    /* margin-left: auto; */
}

.apd-search-button:hover,
button.apd-search-button:hover {
    background: #00b8e0 !important;
    background-color: #00b8e0 !important;
    color: #ffffff !important;
}

.apd-search-button:active,
.apd-search-button:focus,
button.apd-search-button:active,
button.apd-search-button:focus {
    background: #00d0fa !important;
    background-color: #00d0fa !important;
    color: #ffffff !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Posts Grid */
.apd-posts-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Grid Columns */
.apd-posts-grid.apd-col-1 {
    grid-template-columns: 1fr;
}

.apd-posts-grid.apd-col-2 {
    grid-template-columns: repeat(2, 1fr);
}

.apd-posts-grid.apd-col-3 {
    grid-template-columns: repeat(3, 1fr);
}

.apd-posts-grid.apd-col-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Post Card */
.apd-post-card {
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}



.apd-post-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 20px;
    background: #e0e0e0;
}

.apd-post-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apd-post-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #083c54;
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.apd-post-content {
    padding: 20px;
}

.apd-post-date {
    color: #5C6366;
    font-size: 18px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin-bottom: 10px;
}

.apd-post-title {
    font-size: 28px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    color: #094358;
    margin-bottom: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apd-post-title a {
    color: inherit;
    text-decoration: none !important;
    transition: color 0.3s;
}


.apd-read-more-link {
    color: #3FA5B8;
    text-decoration: none !important;
    font-size: 20px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: 0;
    transition: gap 0.3s;
}


.apd-read-more-link::after {
    content: '';
    display: inline-block;
    width: 49px;
    height: 23px;
    margin-left: 8px;
    background-image: url("data:image/svg+xml,%3Csvg width='49' height='23' viewBox='0 0 49 23' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 9.54688C0.671573 9.54688 0 10.2184 0 11.0469C0 11.8753 0.671573 12.5469 1.5 12.5469V11.0469V9.54688ZM48.5607 12.1075C49.1464 11.5217 49.1464 10.572 48.5607 9.98621L39.0147 0.440273C38.4289 -0.145514 37.4792 -0.145514 36.8934 0.440273C36.3076 1.02606 36.3076 1.97581 36.8934 2.56159L45.3787 11.0469L36.8934 19.5322C36.3076 20.1179 36.3076 21.0677 36.8934 21.6535C37.4792 22.2393 38.4289 22.2393 39.0147 21.6535L48.5607 12.1075ZM1.5 11.0469V12.5469H47.5V11.0469V9.54688H1.5V11.0469Z' fill='%2341BECA'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.3s;
    vertical-align: middle;
}

.apd-read-more-link:hover::after {
    transform: translateX(5px);
}

/* Load More Button */
.apd-load-more-wrapper {
    text-align: center;
    margin-top: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.apd-load-more-wrapper[style*="display: none"] {
    display: none !important;
    margin: 0;
    padding: 0;
    height: 0;
    overflow: hidden;
}

.apd-load-more-button {
    background: #3FA5B8;
    color: #fff;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.apd-load-more-button:hover {
    background: #00d0fa;
    color: #ffffff;
    transform: translateY(-2px);
}

.apd-load-more-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.apd-loading-spinner {
    display: none;
    margin: 20px auto;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #00d0fa;
    border-radius: 50%;
    animation: apd-spin 1s linear infinite;
}

@keyframes apd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.apd-no-posts {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
    font-family: 'Aspekta', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 1024px) {
    .apd-posts-grid.apd-col-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .apd-search-filter-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .apd-search-input-wrapper {
        min-width: 100%;
        flex: 1 1 100%;
        width: 100%;
    }

    .apd-filter-wrapper {
        flex: 1 1 100%;
        width: 100%;
        gap: 8px;
    }

    .apd-type-filter,
    .apd-year-filter {
        flex: 1;
        min-width: 0;
        width: auto;
    }

    .apd-search-button {
        flex: 1;
        min-width: 0;
        width: auto;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .apd-posts-grid.apd-col-2,
    .apd-posts-grid.apd-col-3,
    .apd-posts-grid.apd-col-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .apd-search-filter-header {
        padding: 15px 20px;
    }

    .apd-filter-wrapper {
        flex-direction: column;
        width: 100%;
    }

    .apd-filter-select,
    .apd-search-button {
        width: 100%;
    }
    
    .apd-search-button:focus,
    .apd-search-button:active {
        background: #00d0fa !important;
        color: #ffffff !important;
    }
}