/* ==========================================================================
   Integration Loop Filter — Frontend Styles
   ========================================================================== */

:root {
    --ilf-card-bg: #eef1f6;
    --ilf-text: #0d1b3e;
    --ilf-muted: #3d5a8a;
    --ilf-accent: #1a56db;
    --ilf-ease: 0.18s ease;
}

.ilf-wrapper {
    font-family: inherit;
}

/* ==========================================================================
   Filter bar
   ========================================================================== */

.ilf-filterbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    position: relative;
    z-index: 100;
}

.ilf-filterby-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ilf-text);
    white-space: nowrap;
    margin-right: 2px;
}

/* ==========================================================================
   Custom dropdown — replaces native <select>
   ========================================================================== */

/* Hide native selects — keep them in DOM for accessibility / form value */
.ilf-select {
    display: none;
}

/* The custom dropdown container */
.ilf-dropdown {
    position: relative;
    flex-shrink: 0;
    user-select: none;
}

/* Trigger button — pill shaped */
.ilf-dropdown__trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px 0 18px;
    border: 1.5px solid #dde3ed;
    border-radius: 999px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 500;
    color: var(--ilf-text);
    cursor: pointer;
    white-space: nowrap;
    min-width: 140px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    transition: border-color var(--ilf-ease), box-shadow var(--ilf-ease);
    outline: none;
}

.ilf-dropdown__trigger:hover {
    border-color: #b0bccf;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .09);
}

.ilf-dropdown--open .ilf-dropdown__trigger {
    border-color: var(--ilf-accent);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, .12);
}

/* Label text inside trigger */
.ilf-dropdown__label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chevron icon — rotates on open */
.ilf-dropdown__chevron {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #64748b;
    transition: transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ilf-dropdown--open .ilf-dropdown__chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
.ilf-dropdown__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    max-width: 280px;
    background: #ffffff;
    border: 1.5px solid #dde3ed;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(13, 27, 62, .13), 0 2px 8px rgba(0, 0, 0, .06);
    padding: 6px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    max-height: 300px;
    overflow-y: auto;
}

.ilf-dropdown--open .ilf-dropdown__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Individual option */
.ilf-dropdown__option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--ilf-text);
    cursor: pointer;
    transition: background var(--ilf-ease), color var(--ilf-ease);
    white-space: nowrap;
}

.ilf-dropdown__option:hover {
    background: #f1f5fb;
}

.ilf-dropdown__option--selected {
    background: #eff6ff;
    color: var(--ilf-accent);
    font-weight: 600;
}

/* Checkmark for selected */
.ilf-dropdown__option::after {
    content: '';
    margin-left: auto;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.ilf-dropdown__option--selected::after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 8l4 4 6-7' stroke='%231a56db' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 16px;
}

/* Divider between placeholder and real options */
.ilf-dropdown__divider {
    height: 1px;
    background: #e8ecf2;
    margin: 4px 6px;
}

/* ==========================================================================
   Result count
   ========================================================================== */

.ilf-count {
    font-size: 13px;
    color: #64748b;
    margin-left: auto;
    white-space: nowrap;
    transition: opacity var(--ilf-ease);
}

.ilf-count--loading {
    opacity: 0.4;
}

/* ==========================================================================
   Loading states
   ========================================================================== */

.ilf-dropdown--loading .ilf-dropdown__trigger {
    opacity: 0.6;
    pointer-events: none;
}

#ilf-results {
    transition: opacity 0.2s ease;
}

#ilf-results.ilf-loading {
    opacity: 0.4;
    pointer-events: none;
}

/* ==========================================================================
   Section groups + headings
   ========================================================================== */

.ilf-group {
    margin-bottom: 44px;
}

.ilf-group:last-child {
    margin-bottom: 0;
}

.ilf-section-title {
    margin: 0 0 20px;
    line-height: 1.2;
    border-bottom: none;
    padding-bottom: 0;
}

/* ==========================================================================
   Card Grid
   ========================================================================== */

.ilf-grid {
    display: grid;
    gap: 20px;
}

/* ==========================================================================
   Card
   ========================================================================== */

.ilf-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 24px;
    text-decoration: none;
    color: inherit;
    background: #eef1f6;
    border: none;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(13, 27, 62, .07);
    transition: box-shadow var(--ilf-ease), transform var(--ilf-ease);
    min-height: 220px;
}

.ilf-card:hover {
    box-shadow: 0 8px 28px rgba(13, 27, 62, .13);
    transform: translateY(-3px);
    text-decoration: none;
    color: inherit;
}

.ilf-card__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.ilf-card__logo {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    background: #ffffff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
}

.ilf-card__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.ilf-card__logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ilf-card__logo-placeholder svg {
    width: 36px;
    height: 36px;
}

.ilf-card__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0d1b3e;
    line-height: 1.2;
}

.ilf-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

.ilf-card__desc {
    margin: 0 0 auto;
    font-size: 16px;
    color: #1e3a6e;
    line-height: 1.55;
    padding-bottom: 20px;
}

.ilf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.ilf-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #d6dce8;
    color: #3d5475;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

/* ==========================================================================
   No results / spinner
   ========================================================================== */

.ilf-no-results {
    text-align: center;
    color: #64748b;
    font-size: 15px;
    padding: 56px 0;
    margin: 0;
}

.ilf-loading-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 0;
}

.ilf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #1a56db;
    border-radius: 50%;
    animation: ilf-spin 0.7s linear infinite;
}

@keyframes ilf-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .ilf-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 560px) {
    .ilf-grid {
        grid-template-columns: 1fr !important;
    }

    .ilf-filterbar {
        gap: 8px;
    }

    .ilf-dropdown__trigger {
        min-width: 200px;
        font-size: 13px;
    }

    .ilf-count {
        width: 100%;
        margin-left: 0;
    }

    .ilf-card__title {
        font-size: 17px;
    }

    .ilf-card__desc {
        font-size: 14px;
    }

    .ilf-filterbar .ilf-filterby-label,
    .ilf-count {
        display: none;
    }

    .ilf-filterbar {
        flex-direction: column;
        align-items: center;
    }

    .ilf-section-title {
        font-size: 28px !important;
    }


}