/* ==========================================================================
   Adria Kompas - Custom Field Filter
   Restyled to match the site's own design system (ak-* brand tokens)
   v3: each field is its own separated, rounded/bordered box (matching the
   reference design) instead of one continuous strip with hairlines.
   ========================================================================== */

.custom-field-filter {
    margin-bottom: 2.5rem;
    font-family: "IBM Plex Sans", sans-serif;
}

/* Card wrapper matching .ak-card look */
.ak-filter-card {
    background: #FFFFFF;
    border: 1px solid #D6E4F2;
    border-radius: 18px;
    box-shadow: rgba(12,59,102, 0.35) 0 14px 34px -18px;
    padding: 12px;
}

/* Fields laid out as separate boxes with a gap between them, wrapping on
   smaller screens - no shared outer border/strip anymore. */
.ak-filter-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
}

/* Each field is its own rounded, bordered box */
#field-filter-form .field-group.ak-field-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 200px;
    min-width: 180px;
    padding: 12px 18px;
    margin-bottom: 0;
    border: 1px solid #D6E4F2;
    border-radius: 14px;
    background: #F0F6FB;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

#field-filter-form .field-group.ak-field-box:hover,
#field-filter-form .field-group.ak-field-box:focus-within {
    border-color: #1C9CC4;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(28,156,196,0.14);
}

.ak-field-icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    color: #1565A8;
}

.ak-field-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ak-field-body {
    flex: 1 1 auto;
    min-width: 0;
}

/* Eyebrow-style label, matching .ak-t-h6 */
#field-filter-form .ak-field-box .form-label {
    display: block;
    margin: 0 0 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: #5B6F85;
}

/* Select now sits flush inside its segment - no border/background of its
   own, so the whole strip reads as one search bar instead of N dropdowns */
#field-filter-form .ak-field-box .form-select {
    width: 100%;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #0C3B66;
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0 18px 0 0;
    height: auto;
    line-height: 1.3;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C5C69' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

#field-filter-form .ak-field-box .form-select:focus {
    outline: none;
    box-shadow: none;
}

/* Dropdown list (the <option> panel the browser opens) - styled as far as
   browsers allow native <select> options to be styled. Chromium respects
   background-color/color/padding on <option>; it does NOT allow rounding
   the panel's own corners or a custom hover color (that needs a fully
   custom JS-built dropdown to replace <select> - happy to build one if
   you want the exact rounded/highlighted list from the reference, this
   is the closest a native select can get). */
#field-filter-form .ak-field-box .form-select option {
    padding: 10px 14px;
    background-color: #FFFFFF;
    color: #0C3B66;
    font-weight: 500;
}

#field-filter-form .ak-field-box .form-select option:checked,
#field-filter-form .ak-field-box .form-select option:hover {
    background-color: #EAF2FA;
    color: #0C3B66;
}

/* Actions (buttons) group - sits as the last segment of the same strip */
.ak-filter-actions {
    display: flex;
    gap: 0.6rem;
    flex: 0 0 auto;
    align-items: center;
    padding: 8px;
    margin-bottom: 0;
}

/* Primary CTA button, matching .ak-cta-btn, now icon + label */
#field-filter-form .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(120deg, #0C3B66 0%, #1565A8 55%, #1C9CC4 100%);
    border: 0;
    color: #FFFFFF;
    box-shadow: 0 8px 18px -8px rgba(12,59,102,0.55);
    font-weight: 700;
    font-size: 15px;
    border-radius: 999px;
    padding: 12px 26px;
    height: 48px;
    white-space: nowrap;
    transition: filter 0.2s ease, transform 0.15s ease;
}

.ak-btn-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

#field-filter-form .btn-primary:hover,
#field-filter-form .btn-primary:focus {
    filter: brightness(1.12);
    color: #FFFFFF;
    transform: translateY(-1px);
}

/* Secondary / reset button - outline style */
#field-filter-form .btn-secondary {
    background-color: #FFFFFF;
    border: 2px solid #D6E4F2;
    color: #0C3B66;
    font-weight: 700;
    font-size: 15px;
    border-radius: 999px;
    padding: 12px 24px;
    height: 48px;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#field-filter-form .btn-secondary:hover,
#field-filter-form .btn-secondary:focus {
    background-color: #F0F6FB;
    border-color: #1565A8;
}

/* Desktop: 3 fields per row so labels are not cut; buttons fill the free slot */
@media (min-width: 901px) {
    #field-filter-form .field-group.ak-field-box {
        flex: 1 1 calc(33.333% - 12px);
    }

    .ak-filter-actions {
        flex: 1 1 calc(33.333% - 12px);
        justify-content: flex-start;
        padding: 0 4px;
    }
}

/* Responsive: stack fields and full-width buttons on smaller screens */
@media (max-width: 900px) {
    .ak-filter-card {
        padding: 8px;
    }

    #field-filter-form .field-group.ak-field-box {
        flex: 1 1 calc(50% - 12px);
    }

    .ak-filter-actions {
        flex: 1 1 100%;
        margin-top: 0;
        padding: 4px 8px 8px;
    }

    #field-filter-form .btn-primary,
    #field-filter-form .btn-secondary {
        flex: 1 1 auto;
        justify-content: center;
    }
}

@media (max-width: 560px) {
    #field-filter-form .field-group.ak-field-box {
        flex: 1 1 100%;
    }
}

/* ==========================================================================
   Styled dropdown (see filter.js). Native <select> stays hidden underneath.
   ========================================================================== */
#field-filter-form .ak-field-box.ak-dd-ready { position: relative; }

#field-filter-form .ak-field-box.is-open {
    border-color: #1C9CC4;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(28, 156, 196, 0.14);
}

#field-filter-form .ak-dd-ready .ak-dd-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.ak-dd { position: static; }

.ak-dd-btn {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0 20px 0 0;
    border: 0;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6F85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right center / 14px;
    text-align: left;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: #0C3B66;
    cursor: pointer;
    transition: background-position 0.15s ease;
}

.ak-dd-btn:focus { outline: none; }
.ak-dd-btn:focus-visible { outline: 2px solid #1C9CC4; outline-offset: 4px; border-radius: 4px; }

.ak-dd-btn.is-placeholder { color: #5B6F85; font-weight: 500; }

.ak-dd-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.is-open .ak-dd-btn {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231565A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m18 15-6-6-6 6'/%3E%3C/svg%3E");
}

.ak-dd-list {
    display: none;
    position: absolute;
    z-index: 60;
    top: calc(100% + 8px);
    left: -1px;
    right: -1px;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #FFFFFF;
    border: 1px solid #D6E4F2;
    border-radius: 14px;
    box-shadow: 0 22px 44px -16px rgba(12, 59, 102, 0.38), 0 4px 10px rgba(12, 59, 102, 0.08);
}

.is-open .ak-dd-list {
    display: block;
    animation: ak-dd-in 0.14s ease-out;
}

@keyframes ak-dd-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ak-dd-item {
    position: relative;
    margin: 0;
    padding: 10px 36px 10px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    color: #0C3B66;
    cursor: pointer;
}

.ak-dd-item + .ak-dd-item { margin-top: 2px; }

.ak-dd-item.is-placeholder { color: #5B6F85; font-style: normal; }

.ak-dd-item.is-active { background: #EAF2FA; }

.ak-dd-item.is-selected {
    font-weight: 700;
    color: #1565A8;
    background: #F0F6FB;
}

.ak-dd-item.is-selected.is-active { background: #EAF2FA; }

.ak-dd-item.is-selected:after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 6px;
    height: 11px;
    margin-top: -8px;
    border: solid #1565A8;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ak-dd-list::-webkit-scrollbar { width: 8px; }
.ak-dd-list::-webkit-scrollbar-thumb { background: #D6E4F2; border-radius: 8px; }

/* ==========================================================================
   Results grid
   ========================================================================== */

.filtered-items.grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
    margin-top: 1.5rem;
}

/* Each item - card look matching .ak-card */
.filtered-items .item {
    flex: 1 1 calc(50% - 20px);
    display: flex;
    flex-direction: column;
    background-color: #FFFFFF;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: rgba(12,59,102, 0.25) 0 10px 28px -16px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.filtered-items .item:hover {
    box-shadow: rgba(12,59,102, 0.35) 0 14px 34px -18px;
    transform: translateY(-2px);
}

.filtered-items .item-image img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.filtered-items .item-image:hover img {
    transform: scale(1.05);
}

.filtered-items .item-content {
    padding: 18px 20px 20px;
}

.filtered-items .item-content h3 {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: #0C3B66;
}

.filtered-items .item-content .item-date,
.filtered-items .item-content .item-category {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #5C5C69;
    margin-bottom: 8px;
}

.filtered-items .item-content .item-description {
    font-size: 1rem;
    color: #444;
    margin-bottom: 15px;
}

/* Read More button - coral pill, matching .ak-cta-btn */
.filtered-items .btn-primary {
    display: inline-block;
    background-color: #EE6C4D;
    color: #FFFFFF;
    font-weight: 700;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 999px;
    transition: background-color 0.2s ease;
}

.filtered-items .btn-primary:hover {
    background-color: #d85a3d;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination-wrapper {
    width: 100%;
    margin-top: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-link {
    padding: 0.5rem 1rem;
    border: 1px solid #D6E4F2;
    color: #0C3B66;
    text-decoration: none;
    border-radius: 999px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.page-link:hover {
    background-color: #F0F6FB;
    border-color: #1565A8;
}

.page-link.active {
    background-color: #1565A8;
    color: #FFFFFF;
    border-color: #1565A8;
}

/* Responsive Design */
@media (max-width: 767px) {
    .filtered-items .item {
        flex: 1 1 100%;
    }

    .filtered-items .item-image img {
        height: 300px;
    }
}
