/**
 * Post Card Widget Styles
 * 
 * Main stylesheet for the post card widget
 * 
 * @package Avifauna_Elementor_Extended
 * @since 1.0.0
 */


/* Main Wrapper */

.avifauna-post-cards-wrapper {
    width: 100%;
}


/* Filter Styles */

.avifauna-post-filter-container {
    margin-bottom: 30px;
    text-align: center;
}


/* Hide dropdown by default on desktop */

.avifauna-post-filter-dropdown {
    display: none;
}

.avifauna-post-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.avifauna-post-filter-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    color: #666666;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 4px 8px 0;
    min-height: 44px;
    justify-content: center;
}

.avifauna-post-filter-button:hover {
    background: #e8e8e8;
    color: #333333;
    border-color: #d0d0d0;
}

.avifauna-post-filter-button.active {
    background: #ACC800;
    color: #ffffff;
    border-color: #ACC800;
}

.avifauna-post-filter-button:focus {
    outline: 2px solid #ACC800;
    outline-offset: 2px;
}

.avifauna-post-filter-count {
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.8;
}


/* Filter responsive */

@media (max-width: 991px) {
    .avifauna-post-filter-container {
        position: relative;
    }
    .avifauna-post-filter-buttons {
        display: none;
    }
    .avifauna-post-filter-dropdown {
        display: block;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        position: relative;
    }
    .avifauna-post-filter-select {
        width: 100%;
        padding: 12px 16px;
        background: #ffffff;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        font-size: 14px;
        font-weight: 500;
        color: #333333;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 40px;
    }
    .avifauna-post-filter-select:focus {
        outline: 2px solid #ACC800;
        outline-offset: 2px;
        border-color: #ACC800;
    }
    .avifauna-post-filter-select:hover {
        border-color: #d0d0d0;
    }
}

@media (max-width: 768px) {
    .avifauna-post-filter-dropdown {
        max-width: 250px;
    }
    /* Maintain grid layout on tablets */
    .avifauna-post-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}


/* Loading States */

.avifauna-featured-posts-container.loading,
.avifauna-post-cards-container.loading {
    position: relative;
    min-height: 200px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ACC800;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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


/* Error States */

.avifauna-post-cards-error {
    text-align: center;
    padding: 40px 20px;
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin: 20px 0;
}


/* Featured Posts Container */

.avifauna-featured-posts-container {
    display: block;
    margin-bottom: 30px;
    width: 100%;
}


/* Regular Posts Container */

.avifauna-post-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    min-height: 0;
    /* Prevent layout shift */
}


/* Ensure layout consistency during filtering */

.avifauna-post-cards-container:empty {
    display: none;
}

.avifauna-featured-posts-container:empty {
    display: none;
}


/* Individual Card Styles */

.avifauna-post-card {
    position: relative;
    background: #FDFDFD;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure consistent sizing */
    min-height: 300px;
}


/* Featured Card Styles */

.avifauna-post-card-featured {
    display: flex;
    flex-direction: row;
    width: 100%;
    background: #FDFDFD;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid #E6D5E3;
}


/* Image Styles */

.avifauna-post-card-image {
    position: relative;
    height: 100%;
    min-height: 200px;
    max-height: 10rem;
    border-radius: 30px;
    overflow: hidden;
    -webkit-border-radius: 30px;
    -moz-border-radius: 30px;
    -ms-border-radius: 30px;
    -o-border-radius: 30px;
}

.avifauna-post-card-featured .avifauna-post-card-image {
    flex: 0 0 45%;
    height: 100%;
    min-height: 300px;
    max-height: 28.75rem;
    border-radius: 30px 0px 0px 30px;
    position: relative;
    -webkit-border-radius: 30px 0px 0px 30px;
    -moz-border-radius: 30px 0px 0px 30px;
    -ms-border-radius: 30px 0px 0px 30px;
    -o-border-radius: 30px 0px 0px 30px;
}

.avifauna-post-card-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.avifauna-post-card-image a {
    display: block;
    width: 100%;
    height: 100%;
}


/* Image Overlay */

.avifauna-post-card-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient( 180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.3) 100%);
    z-index: 1;
}


/* Category Badge Styles */

.avifauna-post-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.avifauna-post-card-category-featured {
    background: #ACC800;
    color: #ffffff;
    font-weight: 700;
}


/* Category Position Classes */

.avifauna-category-top-right {
    left: auto;
    right: 12px;
}

.avifauna-category-bottom-left {
    top: auto;
    bottom: 12px;
}

.avifauna-category-bottom-right {
    top: auto;
    bottom: 12px;
    left: auto;
    right: 12px;
}


/* Content Styles */

.avifauna-post-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.avifauna-post-card-featured .avifauna-post-card-content {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}


/* Meta Styles */

.avifauna-post-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    text-transform: unset;
    letter-spacing: 0.3px;
}

.avifauna-post-date {
    color: #666666;
}

.avifauna-post-meta-category {
    color: #ACC800;
    font-weight: 600;
}

.avifauna-post-meta-category::before {
    content: '•';
    margin-right: 8px;
    color: #ddd;
}

.avifauna-post-card-featured .avifauna-post-card-meta {
    margin-bottom: 16px;
    align-items: center;
    gap: 12px;
}

.avifauna-post-card-featured .avifauna-post-date {
    color: #F4A261;
    font-weight: 600;
    font-size: 14px;
}

.avifauna-post-card-featured .avifauna-post-meta-category {
    background: #ACC800;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    /* text-transform: unset; */
    letter-spacing: 0.5px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    -ms-border-radius: 4px;
    -o-border-radius: 4px;
}

.avifauna-post-card-featured .avifauna-post-meta-category::before {
    display: none;
}


/* Title Styles */

.avifauna-post-card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #333333;
}

.avifauna-post-card-title a {
    color: inherit;
    text-decoration: none;
}

.avifauna-post-card-featured .avifauna-post-card-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    color: #2C5545;
    margin-bottom: 16px;
}


/* Button Styles */

.avifauna-post-card-button-wrapper {
    margin-top: 16px;
    display: flex;
    justify-content: flex-start;
}

.avifauna-post-card-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: transparent;
    border: none;
    color: #ACC800;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-transform: normal;
    letter-spacing: 0.3px;
    cursor: pointer;
}

.avifauna-post-card-button:focus {
    outline: 2px solid #ACC800;
    outline-offset: 2px;
}

.avifauna-post-card-button-text {
    background: transparent;
}

.avifauna-post-card-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ACC800;
    color: #ffffff;
    font-size: 12px;
}


/* Featured Post Excerpt */

.avifauna-post-card-featured .avifauna-post-card-excerpt {
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
    margin-bottom: 24px;
}

.avifauna-post-card-featured .avifauna-post-card-button-wrapper {
    margin-top: 0;
}

.avifauna-post-card-featured .avifauna-post-card-button {
    background: transparent;
    color: #ACC800;
    padding: 0;
    border-radius: 0;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.avifauna-post-card-featured .avifauna-post-card-button-text {
    background: transparent;
    color: inherit;
}

.avifauna-post-card-featured .avifauna-post-card-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ACC800;
    color: #ffffff;
    font-size: 12px;
}


/* Hover Effects Removed */


/* No Posts Message */

.avifauna-post-cards-no-posts {
    text-align: center;
    padding: 40px 20px;
    color: #666666;
    font-style: italic;
}


/* Screen Reader Text */

.screen-reader-text {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    width: 1px !important;
    height: 1px !important;
    overflow: hidden;
    word-wrap: normal !important;
}


/* Skip Link */

.avifauna-skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000000;
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 100000;
}

.avifauna-skip-link:focus {
    top: 6px;
}


/* Focus Styles */

.avifauna-post-card:focus-within {
    outline: 2px solid #ACC800;
    outline-offset: 2px;
}

.avifauna-post-card-title a:focus {
    outline: 2px solid #ACC800;
    outline-offset: 2px;
    border-radius: 2px;
}


/* Responsive Design */

@media (max-width: 1024px) {
    .avifauna-post-cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .avifauna-featured-posts-container {
        margin-bottom: 24px;
    }
}

@media (max-width: 768px) {
    .avifauna-post-cards-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .avifauna-featured-posts-container {
        margin-bottom: 20px;
    }
    .avifauna-post-card-image {
        min-height: 180px;
    }
    .avifauna-post-card-featured {
        flex-direction: column;
    }
    .avifauna-post-card-featured .avifauna-post-card-image {
        flex: none;
        height: auto;
        min-height: 250px;
    }
    .avifauna-post-card-content {
        padding: 16px;
    }
    .avifauna-post-card-featured .avifauna-post-card-content {
        padding: 24px;
    }
    .avifauna-post-card-featured .avifauna-post-card-title {
        font-size: 24px;
    }
    .avifauna-post-card-featured .avifauna-post-card-excerpt {
        font-size: 14px;
    }
    .avifauna-post-card-title {
        font-size: 15px;
    }
    .avifauna-post-card-featured .avifauna-post-card-title {
        font-size: 18px;
    }
    .avifauna-post-card-meta {
        font-size: 12px;
        gap: 6px;
    }
    .avifauna-post-card-button {
        font-size: 13px;
    }
    .avifauna-post-card-button-icon {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    /* Single column layout on mobile */
    .avifauna-post-cards-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .avifauna-post-card-image {
        min-height: 160px;
    }
    .avifauna-post-card-featured .avifauna-post-card-image {
        min-height: 200px;
    }
    .avifauna-post-card-content {
        padding: 14px;
    }
    .avifauna-post-card-featured .avifauna-post-card-content {
        padding: 20px;
    }
    .avifauna-post-card-featured .avifauna-post-card-title {
        font-size: 20px;
    }
    .avifauna-post-card-featured .avifauna-post-card-excerpt {
        font-size: 13px;
        margin-bottom: 16px;
    }
    .avifauna-post-card-category {
        font-size: 10px;
        padding: 4px 8px;
    }
    .avifauna-post-card-meta {
        font-size: 11px;
        gap: 4px;
    }
    .avifauna-post-card-button {
        font-size: 12px;
    }
    .avifauna-post-card-button-wrapper {
        margin-top: 12px;
    }
    .avifauna-post-card-button-icon {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }
}


/* Accessibility Styles */

@media (prefers-reduced-motion: reduce) {
    /* All animations already removed */
}

@media (prefers-contrast: high) {
    .avifauna-post-card {
        border: 1px solid #000000;
    }
    .avifauna-post-card-category {
        background: #000000;
        color: #ffffff;
    }
    .avifauna-post-card-category-featured {
        background: #000000;
        color: #ffffff;
        border: 2px solid #ffffff;
    }
    .avifauna-post-card-button-icon {
        background: #000000;
        border: 1px solid #ffffff;
    }
}


/* Print Styles */

@media print {
    .avifauna-post-cards-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .avifauna-post-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #cccccc;
    }
    .avifauna-post-card-image {
        height: auto;
        max-height: 200px;
    }
    .avifauna-post-card:hover {
        transform: none;
        box-shadow: none;
    }
}