/* ==========================================================================
   APBC Behaviourist Directory — Frontend Styles
   ========================================================================== */

:root {
    --abd-primary:       #2F7BB1;
    --abd-primary-dark:  #235C85;
    --abd-primary-soft:  #e8f1f8;
    --abd-white:         #ffffff;
    --abd-text:          #111827;
    --abd-muted:         #828282;
    --abd-border:        #d1d5db;
    --abd-radius:        30px;
    --abd-radius-sm:     8px;
    --abd-shadow:        0 2px 8px rgba(47,123,177,.12);
}

.apbcsd-wrap {
    font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    color: var(--abd-text);
    line-height: 1.55;
}

.apbcsd-wrap * { box-sizing: border-box; }
.apbcsd-wrap button { font: inherit; cursor: pointer; }
.apbcsd-wrap input, .apbcsd-wrap select { font: inherit; }

.apbcsd-container {
    max-width: 1170px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.apbcsd-hero {
    background: var(--abd-primary);
    color: var(--abd-white);
    padding: 60px 0;
}
.apbcsd-hero h1 {
    color: var(--abd-white);
    font-size: 42px;
    font-weight: 700;
    margin: 0 0 12px;
    line-height: 1.2;
}
.apbcsd-hero p {
    color: #cfe2f3;
    margin: 0;
    font-size: 18px;
}

/* ── Filter section ─────────────────────────────────────────────────────── */
.apbcsd-filter {
    background: var(--abd-white);
    padding: 36px 0 8px;
    border-bottom: 1px solid var(--abd-border);
}
.apbcsd-filter label {
    display: block;
    color: var(--abd-primary-dark);
    font-weight: 500;
    font-size: 14px;
    margin: 0 0 8px;
}

.apbcsd-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.apbcsd-row-2 { margin-top: 4px; }
.apbcsd-col-3 { flex: 1 1 230px; }
.apbcsd-col-6 { flex: 2 1 460px; }

.apbcsd-filter input[type="text"],
.apbcsd-filter select {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1.5px solid var(--abd-primary);
    border-radius: var(--abd-radius);
    background: var(--abd-white);
    color: var(--abd-text);
    font-size: 15px;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .15s, box-shadow .15s;
}
.apbcsd-filter select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%232F7BB1' stroke-width='2' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 44px;
    cursor: pointer;
}
.apbcsd-filter input:focus,
.apbcsd-filter select:focus {
    border-color: var(--abd-primary-dark);
    box-shadow: 0 0 0 3px rgba(47,123,177,.15);
}
.apbcsd-filter input::placeholder { color: #aab4be; }

/* ── Filter actions ─────────────────────────────────────────────────────── */
.apbcsd-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 8px 0 36px;
}
.apbcsd-btn-primary {
    background: var(--abd-primary);
    color: var(--abd-white);
    border: 0;
    border-radius: var(--abd-radius);
    padding: 14px 44px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: .01em;
    transition: background .15s;
}
.apbcsd-btn-primary:hover { background: var(--abd-primary-dark); }
.apbcsd-btn-link {
    background: transparent;
    border: 0;
    color: var(--abd-primary);
    font-size: 15px;
    font-weight: 500;
    padding: 0;
    text-decoration: none;
}
.apbcsd-btn-link:hover { text-decoration: underline; }

/* ── Map section ────────────────────────────────────────────────────────── */
.apbcsd-map-section {
    background: #f0f4f7;
    padding: 0;
}
.apbcsd-map {
    width: 100%;
    height: 460px;
    background: #dde7ef;
    overflow: hidden;
    transition: height .3s ease;
}
.apbcsd-map.is-hidden { height: 0; }
.apbcsd-map-toggle {
    position: absolute;
    right: 36px;
    top: 20px;
    background: var(--abd-white);
    border: 0;
    border-radius: var(--abd-radius);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--abd-primary);
    box-shadow: var(--abd-shadow);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background .15s;
}
.apbcsd-map-toggle:hover { background: var(--abd-primary-soft); }
.apbcsd-icon-map { font-size: 16px; }

/* ── Results section ────────────────────────────────────────────────────── */
.apbcsd-results { padding: 48px 0 80px; background: #f7f9fb; }
.apbcsd-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.apbcsd-count {
    margin: 0;
    font-size: 14px;
    color: var(--abd-muted);
}
.apbcsd-count strong { color: var(--abd-text); font-weight: 700; }

/* ── Loading spinner ────────────────────────────────────────────────────── */
.apbcsd-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--abd-muted);
}
.apbcsd-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--abd-border);
    border-top-color: var(--abd-primary);
    border-radius: 50%;
    animation: abd-spin .7s linear infinite;
}
@keyframes abd-spin { to { transform: rotate(360deg); } }

/* ── Grid ───────────────────────────────────────────────────────────────── */
.apbcsd-grid {
    display: grid;
    gap: 36px 28px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* ── Member card ────────────────────────────────────────────────────────── */
.apbcsd-card {
    text-align: center;
    background: var(--abd-white);
    border-radius: 16px;
    padding: 28px 20px 24px;
    box-shadow: 0 1px 4px rgba(47,123,177,.08);
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.apbcsd-card:hover {
    box-shadow: 0 6px 20px rgba(47,123,177,.14);
    transform: translateY(-2px);
}

/* Circular avatar with blue ring */
.apbcsd-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--abd-primary);
    box-shadow: 0 0 0 5px var(--abd-white), 0 0 0 7px var(--abd-primary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.apbcsd-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.apbcsd-initials {
    color: var(--abd-white);
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1;
}

.apbcsd-card h3 {
    color: var(--abd-primary-dark);
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.3;
}

.apbcsd-role {
    color: var(--abd-primary);
    font-size: 13.5px;
    margin: 0 0 6px;
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.apbcsd-role-info {
    display: inline-flex;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--abd-primary);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-style: italic;
    cursor: help;
    color: var(--abd-primary);
    flex-shrink: 0;
}

.apbcsd-location {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12.5px;
    color: var(--abd-muted);
    margin: 0 0 4px;
}
.apbcsd-location svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.apbcsd-distance {
    font-size: 12.5px;
    color: var(--abd-primary);
    font-weight: 500;
    margin: 2px 0 14px;
}

/* Icon buttons */
.apbcsd-icons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 16px;
}
.apbcsd-icons a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--abd-white);
    border: 1.5px solid var(--abd-primary);
    color: var(--abd-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.apbcsd-icons a:hover { background: var(--abd-primary); color: var(--abd-white); }
.apbcsd-icons svg { width: 16px; height: 16px; }

/* View profile button */
.apbcsd-view {
    display: inline-block;
    padding: 10px 28px;
    border-radius: var(--abd-radius);
    background: var(--abd-primary);
    color: var(--abd-white);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s;
    margin-top: auto;
}
.apbcsd-view:hover { background: var(--abd-primary-dark); color: var(--abd-white); }

/* ── Empty / no results ─────────────────────────────────────────────────── */
.apbcsd-empty-msg {
    text-align: center;
    color: var(--abd-muted);
    padding: 40px 20px;
    background: var(--abd-white);
    border: 1px dashed var(--abd-border);
    border-radius: 12px;
    margin: 0;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.apbcsd-pager {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}
.apbcsd-page-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--abd-muted);
    background: var(--abd-white);
    border: 1px solid var(--abd-border);
    transition: background .15s, color .15s;
}
.apbcsd-page-btn:hover { color: var(--abd-text); border-color: var(--abd-primary); }
.apbcsd-page-btn.is-active { background: var(--abd-primary); color: var(--abd-white); border-color: var(--abd-primary); }
.apbcsd-page-ellipsis { padding: 8px 4px; color: var(--abd-muted); font-size: 14px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .apbcsd-hero { padding: 40px 0; }
    .apbcsd-hero h1 { font-size: 30px; }
    .apbcsd-col-3, .apbcsd-col-6 { flex: 1 1 100%; }
    .apbcsd-map { height: 320px; }
    .apbcsd-map-toggle { right: 14px; top: 12px; }
    .apbcsd-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
    .apbcsd-avatar { width: 90px; height: 90px; }
    .apbcsd-initials { font-size: 26px; }
}
