/**
 * Climate News Filter Styles
 * Matches original Elementor design exactly
 */

/* Filter Container */
.dce-filter-container {
    margin: 0 0 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Filter Form */
.dce-filter-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
    align-items: end;
}

@media (max-width: 768px) {
    .dce-filter-form {
        grid-template-columns: 1fr;
    }
}

/* Filter Field */
.dce-filter-field {
    display: flex;
    flex-direction: column;
}

.dce-filter-field label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
    display: block;
}

.dce-filter-field select {
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background-color: #ffffff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M5 8l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
}

.dce-filter-field select:hover {
    border-color: #999;
}

.dce-filter-field select:focus {
    outline: none;
    border-color: #5A8C8C;
    box-shadow: 0 0 0 1px #5A8C8C;
}

/* Filter Actions */
.dce-filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

@media (max-width: 768px) {
    .dce-filter-actions {
        grid-column: 1;
        flex-direction: column;
        align-items: stretch;
    }
}

.dce-filter-actions button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

/* Use tile colors for filter buttons */
.dce-filter-submit {
    background-color: #5A8C8C;
    color: #ffffff;
    flex: 1;
}

.dce-filter-submit:hover {
    opacity: 0.85;
}

.dce-filter-reset {
    background-color: #E5D3C3;
    color: #2c3e50;
}

.dce-filter-reset:hover {
    opacity: 0.85;
}

/* Posts Grid - Alternating Tile Layout */
.dce-posts-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 20px;
    margin-top: 30px;
}

/* Pattern: 35%, 65%, 65%, 35%, then repeat */
.dce-posts-grid .dce-post-card:nth-child(4n+1) {
    grid-column: span 7;
}

.dce-posts-grid .dce-post-card:nth-child(4n+2) {
    grid-column: span 13;
}

.dce-posts-grid .dce-post-card:nth-child(4n+3) {
    grid-column: span 13;
}

.dce-posts-grid .dce-post-card:nth-child(4n+4) {
    grid-column: span 7;
}

@media (max-width: 1024px) {
    .dce-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dce-posts-grid .dce-post-card {
        grid-column: span 1 !important;
    }
}

@media (max-width: 768px) {
    .dce-posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Post Cards - Colorful Design */
.dce-post-card {
    padding: 35px 30px;
    border-radius: 0;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease;
    position: relative;
}

.dce-post-card:hover {
    transform: translateY(-2px);
}

/* Color Variations */
.dce-post-card--coral {
    background-color: #E89A7E;
    color: #1a1a1a;
}

.dce-post-card--mint {
    background-color: #B4D4D4;
    color: #1a1a1a;
}

.dce-post-card--sand {
    background-color: #E5D3C3;
    color: #1a1a1a;
}

.dce-post-card--navy {
    background-color: #2C4F54;
    color: #ffffff;
}

.dce-post-card--teal {
    background-color: #5A8C8C;
    color: #ffffff;
}

.dce-post-card--peach {
    background-color: #EDB88B;
    color: #1a1a1a;
}

/* Light background cards - dark text */
.dce-post-card--coral .dce-post-card__title a,
.dce-post-card--mint .dce-post-card__title a,
.dce-post-card--sand .dce-post-card__title a,
.dce-post-card--peach .dce-post-card__title a {
    color: #1a1a1a;
}

.dce-post-card--coral .dce-post-card__date,
.dce-post-card--mint .dce-post-card__date,
.dce-post-card--sand .dce-post-card__date,
.dce-post-card--peach .dce-post-card__date {
    color: #333333;
}

.dce-post-card--coral .dce-post-card__link,
.dce-post-card--mint .dce-post-card__link,
.dce-post-card--sand .dce-post-card__link,
.dce-post-card--peach .dce-post-card__link {
    color: #1a1a1a;
    border-bottom-color: #1a1a1a;
}

/* Dark background cards - white text */
.dce-post-card--navy .dce-post-card__title,
.dce-post-card--teal .dce-post-card__title {
    color: #ffffff;
}

.dce-post-card--navy .dce-post-card__title a,
.dce-post-card--teal .dce-post-card__title a {
    color: #ffffff !important;
}

.dce-post-card--navy .dce-post-card__date,
.dce-post-card--teal .dce-post-card__date {
    color: #ffffff !important;
}

.dce-post-card--navy .dce-post-card__link,
.dce-post-card--teal .dce-post-card__link {
    color: #ffffff !important;
    border-bottom-color: #ffffff !important;
}

/* Post Card Title */
.dce-post-card__title {
    margin: 0 0 12px 0;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.35;
}

.dce-post-card__title a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.dce-post-card__title a:hover {
    opacity: 0.75;
}

/* Post Card Date */
.dce-post-card__date {
    font-size: 13px;
    margin: 0 0 25px 0;
    font-weight: 400;
}

/* Post Card Link */
.dce-post-card__link {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    transition: opacity 0.2s ease;
    margin-top: auto;
    align-self: flex-start;
    width: auto;
}

.dce-post-card__link:hover {
    opacity: 0.7;
}

/* No Posts Message */
.dce-no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #666;
    background: #f5f5f5;
    border-radius: 4px;
}

/* Loading Overlay */
.dce-filter-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dce-filter-loader.active {
    opacity: 1;
    visibility: visible;
}

.dce-filter-loader__content {
    text-align: center;
}

.dce-filter-loader__spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #5A8C8C;
    border-radius: 50%;
    animation: dce-spin 0.8s linear infinite;
}

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

.dce-filter-loader__text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    margin: 0;
}

/* Accessibility */
.dce-filter-field select:focus-visible,
.dce-filter-actions button:focus-visible {
    outline: 2px solid #5A8C8C;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .dce-filter-form {
        display: none;
    }

    .dce-post-card {
        break-inside: avoid;
    }
}
