/**
 * Newsroom Faceted Search Styles
 * Version: 1.2.1
 */

.newsroom-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 0px;
}

.newsroom-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Filter Bar (top) */
.nfs-filter-sidebar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nfs-filter-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    flex: 1 1 640px;
    gap: 16px;
    margin: 0;
}

.nfs-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.nfs-field-keyword {
    flex: 2 1 240px;
}

.nfs-field-year {
    flex: 0 1 150px;
}

.nfs-field-types {
    flex: 0 1 190px;
}

.nfs-filter-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: #1a1a1a;
}

/* Keyword Search */
.nfs-keyword-search {
    position: relative;
}

.nfs-filter-sidebar .nfs-keyword-input,
.nfs-filter-sidebar .nfs-select,
.nfs-filter-sidebar .nfs-dropdown-trigger {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    line-height: 42px;
    color: #1a1a1a;
    transition: border-color 0.2s;
}

.nfs-filter-sidebar .nfs-keyword-input {
    padding-right: 40px;
}

.nfs-filter-sidebar .nfs-select {
    cursor: pointer;
}

.nfs-filter-sidebar .nfs-keyword-input:focus,
.nfs-filter-sidebar .nfs-select:focus,
.nfs-dropdown[open] .nfs-dropdown-trigger {
    outline: none;
    border-color: #018867;
}

.nfs-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* Types dropdown */
.nfs-dropdown {
    position: relative;
}

.nfs-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.nfs-dropdown-trigger::-webkit-details-marker {
    display: none;
}

.nfs-dropdown-trigger::marker {
    content: '';
}

.nfs-dropdown-chevron {
    flex-shrink: 0;
    color: #666;
    transition: transform 0.2s;
}

.nfs-dropdown[open] .nfs-dropdown-chevron {
    transform: rotate(180deg);
}

.nfs-dropdown-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    box-sizing: border-box;
    min-width: 100%;
    width: max-content;
    max-width: 320px;
    max-height: 280px;
    overflow-y: auto;
    padding: 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Checkbox Filters */
.nfs-filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nfs-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    user-select: none;
}

.nfs-filter-option input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #018867;
}

.nfs-filter-count {
    color: #999;
    font-size: 13px;
    margin-left: auto;
    padding-left: 12px;
}

/* Actions */
.nfs-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.nfs-btn {
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    white-space: nowrap;
}

.nfs-btn-primary {
    height: 44px;
    background: #D1E05F;
    color: #23403B;
    border: 2px solid #D1E05F;
}

.nfs-btn-primary:hover,
.nfs-btn-primary:focus {
    background: #0D954A;
    border-color: #0D954A;
    color: #fff !important;
}

.nfs-btn-secondary {
    background: transparent;
    color: #018867;
    border: none;
    padding: 8px 10px;
}

.nfs-btn-secondary:hover {
    text-decoration: underline;
}

/* View toggle */
.nfs-view-toggle {
    display: inline-flex;
    margin-left: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.nfs-filter-sidebar .nfs-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 44px;
    height: 42px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nfs-filter-sidebar .nfs-view-btn + .nfs-view-btn {
    border-left: 1px solid #ddd;
}

.nfs-filter-sidebar .nfs-view-btn:hover {
    background: #0D954A;
    color: #fff;
}

.nfs-filter-sidebar .nfs-view-btn:focus-visible {
    outline: 2px solid #018867;
    outline-offset: -2px;
}

.newsroom-container[data-nfs-view="row"] .nfs-filter-sidebar .nfs-view-btn[data-view="row"],
.newsroom-container[data-nfs-view="list"] .nfs-filter-sidebar .nfs-view-btn[data-view="list"] {
    background: #D1E05F;
    color: #23403B;
}

.newsroom-container[data-nfs-view="row"] .nfs-filter-sidebar .nfs-view-btn[data-view="row"]:hover,
.newsroom-container[data-nfs-view="list"] .nfs-filter-sidebar .nfs-view-btn[data-view="list"]:hover {
    background: #0D954A;
    color: #fff;
}

/* Results Area */
.nfs-results-area {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nfs-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.nfs-results-count {
    font-size: 16px;
    color: #666;
}

.nfs-results-count strong {
    color: #1a1a1a;
}

/* Post Cards: list view (default) */
.nfs-posts-grid {
    display: flex;
    flex-direction: column;
    gap: 30px 20px;
}

.nfs-post-card {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.nfs-post-card:hover {
    border-color: #018867;
    box-shadow: none;
}

.nfs-post-thumbnail {
    width: 100%;
    height: 160px;
    border-radius: 6px;
    overflow: hidden;
    background: #f0f0f0;
}

.nfs-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.nfs-post-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nfs-post-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nfs-post-category {
    display: inline-block;
    padding: 4px 12px;
    background: white;
    color: #018867;
    border: 1.5px solid #018867;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nfs-post-date {
    font-size: 14px;
    color: #666;
}

.nfs-post-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    color: #1a1a1a;
    margin: 0;
}

.nfs-post-card:hover .nfs-post-title {
    color: #018867;
}

.nfs-post-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-top: 5px;
}

/* Post Cards: row view (3 columns, default) */
.newsroom-container[data-nfs-view="row"] .nfs-posts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 30px 20px;
}

.newsroom-container[data-nfs-view="row"] .nfs-post-card {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 16px;
}

.newsroom-container[data-nfs-view="row"] .nfs-post-thumbnail {
    height: auto;
    aspect-ratio: 16 / 10;
}

.newsroom-container[data-nfs-view="row"] .nfs-post-title {
    font-size: 18px;
}

.newsroom-container[data-nfs-view="row"] .nfs-post-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.newsroom-container[data-nfs-view="row"] .nfs-post-excerpt {
    display: none;
}

/* No Results */
.nfs-no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.nfs-no-results h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #333;
}

/* Pagination */
.nfs-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.nfs-page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nfs-pagination a.nfs-page-link {
    color: #444;
}

.nfs-pagination a.nfs-page-link:hover,
.nfs-pagination a.nfs-page-link:focus {
    border-color: #0D954A;
    color: #fff !important;
    background: #0D954A;
}

.nfs-pagination a.nfs-page-link.current,
.nfs-pagination a.nfs-page-link.current:hover,
.nfs-pagination a.nfs-page-link.current:focus {
    background: #D1E05F;
    color: #23403B !important;
    border-color: #D1E05F;
}

.nfs-page-dots {
    padding: 0 8px;
    color: #999;
}

/* Active Filters */
.nfs-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.nfs-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e6f5f0;
    border: 1px solid #018867;
    border-radius: 20px;
    font-size: 13px;
    color: #018867;
}

.nfs-filter-badge-remove {
    cursor: pointer;
    font-weight: bold;
    color: #018867;
    text-decoration: none;
}

.nfs-filter-badge-remove:hover {
    color: #016d52;
}

/* Responsive */
@media (max-width: 1024px) {
    .nfs-post-card {
        grid-template-columns: 200px 1fr;
    }

    .nfs-post-thumbnail {
        height: 140px;
    }

    .newsroom-container[data-nfs-view="row"] .nfs-posts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .newsroom-container[data-nfs-view="row"] .nfs-post-card {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .nfs-filter-sidebar {
        flex-direction: column;
        align-items: stretch;
    }

    .nfs-filter-form {
        flex: 1 1 auto;
        flex-direction: column;
        align-items: stretch;
    }

    .nfs-field-keyword,
    .nfs-field-year,
    .nfs-field-types {
        flex: 0 0 auto;
    }

    .nfs-filter-actions {
        justify-content: space-between;
    }

    .nfs-view-toggle {
        align-self: flex-end;
        margin-left: 0;
    }

    .nfs-post-card {
        grid-template-columns: 1fr;
    }

    .nfs-post-thumbnail {
        height: 200px;
    }

    .newsroom-container[data-nfs-view="row"] .nfs-post-thumbnail {
        height: auto;
    }

    .nfs-results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .nfs-pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    /* Both views collapse to one column here, so the toggle has no effect */
    .nfs-view-toggle {
        display: none;
    }

    .newsroom-container[data-nfs-view="row"] .nfs-posts-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}
