/* ==========================================================================
   GB Search Filter — Frontend Styles v3
   Card design: image top, badge below image, large bold title, arrow CTA
   ========================================================================== */

:root {
    --gbsf-border: #e8ecf0;
    --gbsf-text: #0a0f1e;
    --gbsf-muted: #94a3b8;
    --gbsf-radius: 999px;
    --gbsf-bg: #ffffff;
    --gbsf-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    --gbsf-ease: 0.18s ease;

    --gsf-text: #1e293b;
    --gsf-accent: #1a56db;
    --gsf-ease: 0.2s ease;

}

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

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

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

/* Trigger button — pill shaped */
.gsf-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(--gsf-text);
    cursor: pointer;
    white-space: nowrap;
    min-width: 140px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    transition: border-color var(--gsf-ease), box-shadow var(--gsf-ease);
    outline: none;
}

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

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

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

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

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

/* Dropdown panel */
.gsf-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;
}

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

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

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

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

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

.gsf-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 */
.gsf-dropdown__divider {
    height: 1px;
    background: #e8ecf2;
    margin: 4px 6px;
}

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

.gbsf-wrapper {
    font-family: inherit;
    margin-bottom: 48px;
}

.gbsf-form {
    margin: 0;
}

.gbsf-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Search input */
.gbsf-field--search {
    position: relative;
    flex: 0 0 auto;
    width: 240px;
}

.gbsf-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--gbsf-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.gbsf-input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 38px;
    border: 1.5px solid var(--gbsf-border);
    border-radius: var(--gbsf-radius);
    background: var(--gbsf-bg);
    font-size: 14px;
    color: var(--gbsf-text);
    box-shadow: var(--gbsf-shadow);
    transition: border-color var(--gbsf-ease), box-shadow var(--gbsf-ease);
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.gbsf-input:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, .15);
}

.gbsf-input::placeholder {
    color: var(--gbsf-muted);
}

.gbsf-input--loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%23e2e8f0' stroke-width='2'/%3E%3Cpath d='M12 2a10 10 0 0 1 10 10' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 12 12' to='360 12 12' dur='.7s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 15px;
    background-position: right 13px center;
    padding-right: 36px;
}

/* Type dropdown */
.gbsf-field--select {
    position: relative;
    flex: 0 0 auto;
}

.gbsf-select {
    height: 40px;
    padding: 0 34px 0 16px;
    border: 1.5px solid var(--gbsf-border);
    border-radius: var(--gbsf-radius);
    background: var(--gbsf-bg);
    font-size: 14px;
    color: var(--gbsf-text);
    box-shadow: var(--gbsf-shadow);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--gbsf-ease);
    min-width: 120px;
}

.gbsf-select:focus {
    border-color: #94a3b8;
}

.gbsf-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--gbsf-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

/* Status */
.gbsf-status {
    display: none;
    font-size: 13px;
    color: var(--gbsf-muted);
    margin-top: 14px;
}

.gbsf-status--visible {
    display: block;
}

.gbsf-status--error {
    color: #e53e3e;
}

/* ==========================================================================
   Results region
   ========================================================================== */

.gbsf-results-region {
    margin-top: 32px;
}

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

/* .gbsf-grid columns/gap injected dynamically via wp_add_inline_style */
.gbsf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* ==========================================================================
   Card  — matches screenshot exactly:
   ┌─────────────────────┐
   │  IMAGE (dark bg)    │  ← rounded top corners
   ├─────────────────────┤
   │ [BADGE PILL]        │  ← coloured, sits below image inside white area
   │                     │
   │  Big bold title     │
   │                     │
   │                  →  │  ← arrow circle, bottom right
   └─────────────────────┘
   ========================================================================== */

.gbsf-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 16px rgba(0, 0, 0, .07);
    transition: box-shadow .22s, transform .22s;
    cursor: pointer;
}

.gbsf-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, .13);
    transform: translateY(-3px);
}

/* ── Image block ── */
.gbsf-card__image-link {
    display: block;
    text-decoration: none;
    flex-shrink: 0;
}

.gbsf-card__image {
    /* aspect-ratio injected dynamically */
    aspect-ratio: 16/10;
    overflow: hidden;
    background: #0f1633;
    /* dark navy fallback — matches screenshot */
    display: block;
}

.gbsf-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.gbsf-card:hover .gbsf-card__image img {
    /*transform: scale(1.04);*/
}

/* Dark placeholder matching screenshot aesthetic */
.gbsf-card__image--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1633;
}

.gbsf-card__image--empty svg {
    width: 100%;
    height: auto;
}

/* ── Card body (white area) ── */
.gbsf-card__body {
    padding: 20px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

/* ── Badge — below image, above title ── */
.gbsf-card__badge {
    /* Structural only — all stylistic props (font-size, font-weight,
       padding, border-radius, letter-spacing, text-transform)
       are injected via wp_add_inline_style() from plugin settings
       so they are NOT set here to avoid specificity conflicts. */
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    white-space: nowrap;
    line-height: 1;
    /* bg/color set inline per-card from badge settings */
}

/* ── Title — large, bold, dark ── */
.gbsf-card__title {
    margin: 0;
    /* font-size/color injected dynamically */
    font-size: 22px;
    font-weight: 800;
    line-height: 1.25;
    color: #0a0f1e;
    flex: 1;
}

.gbsf-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--gbsf-ease);
}

.gbsf-card__title a:hover {
    color: #1a56db;
}

/* ── Footer row — arrow only, right-aligned ── */
.gbsf-card__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 4px;
}

/* Arrow circle button — matches screenshot */
.gbsf-card__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #0a0f1e;
    text-decoration: none;
    transition: background var(--gbsf-ease), color var(--gbsf-ease), transform var(--gbsf-ease);
    flex-shrink: 0;
}

.gbsf-card__arrow svg {
    width: 18px;
    height: 18px;
}

.gbsf-card:hover .gbsf-card__arrow {
    background: #0a0f1e;
    color: #ffffff;
    transform: translateX(2px);
}

/* No results */
.gbsf-no-results {
    text-align: center;
    color: var(--gbsf-muted);
    font-size: 15px;
    padding: 56px 0;
    margin: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
    .gbsf-field--search {
        width: 100%;
    }

    .gbsf-select {
        width: 100%;
    }

    .gbsf-row {
        flex-direction: column;
        align-items: stretch;
    }

    .gbsf-grid {
        grid-template-columns: 1fr;
    }

    .gbsf-card__title {
        font-size: 18px;
    }
}