/**
 * SSJ Directory — Public Styles
 *
 * Responsive, theme-agnostic styles for directory listings,
 * single profiles, and foster search.
 *
 * @package SSJ_Directory
 */

/* ── Google Font ────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Variables ──────────────────────────────────────────────────────────── */
:root {
    --ssj-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ssj-primary:      #1a73e8;
    --ssj-primary-dk:   #1557b0;
    --ssj-accent:       #f0b429;
    --ssj-text:         #1d2327;
    --ssj-text-light:   #6b7280;
    --ssj-border:       #e5e7eb;
    --ssj-bg:           #f9fafb;
    --ssj-white:        #ffffff;
    --ssj-radius:       10px;
    --ssj-radius-sm:    6px;
    --ssj-shadow:       0 2px 8px rgba(0,0,0,.08);
    --ssj-shadow-hover: 0 8px 24px rgba(0,0,0,.12);
    --ssj-transition:   all .2s ease;
    --ssj-card-gap:     20px;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
.ssj-directory-wrap,
.ssj-search-wrap,
.ssj-profile-wrap {
    font-family: var(--ssj-font);
    color: var(--ssj-text);
    line-height: 1.6;
}

/* ── Layout Switcher ────────────────────────────────────────────────────────── */
.ssj-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.ssj-toolbar-left  { display: flex; align-items: center; gap: 12px; }
.ssj-toolbar-right { display: flex; align-items: center; gap: 8px; }

.ssj-count {
    font-size: 14px;
    color: var(--ssj-text-light);
}

.ssj-sort-select {
    font-family: var(--ssj-font);
    font-size: 14px;
    padding: 6px 10px;
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius-sm);
    background: var(--ssj-white);
    color: var(--ssj-text);
    cursor: pointer;
}

.ssj-view-toggle {
    display: flex;
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius-sm);
    overflow: hidden;
}
.ssj-view-btn {
    background: var(--ssj-white);
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--ssj-text-light);
    transition: var(--ssj-transition);
    font-size: 16px;
}
.ssj-view-btn.active,
.ssj-view-btn:hover {
    background: var(--ssj-primary);
    color: var(--ssj-white);
}

/* ── Grid Layout ────────────────────────────────────────────────────────────── */
.ssj-entries-grid {
    display: grid;
    gap: var(--ssj-card-gap);
    grid-template-columns: repeat(var(--ssj-columns, 3), 1fr);
}

@media (max-width: 1024px) {
    .ssj-entries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .ssj-entries-grid {
        grid-template-columns: 1fr;
    }
}

/* ── List Layout ────────────────────────────────────────────────────────────── */
.ssj-entries-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ssj-entries-list .ssj-entry-card {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}
.ssj-entries-list .ssj-entry-photo {
    width: 64px;
    height: 64px;
}
.ssj-entries-list .ssj-entry-body { text-align: left; }
.ssj-entries-list .ssj-entry-actions { align-self: center; }

/* ── Entry Card ─────────────────────────────────────────────────────────────── */
.ssj-entry-card {
    background: var(--ssj-white);
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius);
    padding: 24px;
    box-shadow: var(--ssj-shadow);
    transition: var(--ssj-transition);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: inherit;
}
.ssj-entry-card:hover {
    box-shadow: var(--ssj-shadow-hover);
    transform: translateY(-2px);
    border-color: var(--ssj-primary);
    text-decoration: none;
}

/* Featured badge */
.ssj-featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--ssj-accent);
    color: #7c4f0f;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 3px 8px;
    border-radius: 20px;
}

/* Photo */
.ssj-entry-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--ssj-border);
    margin-bottom: 16px;
    flex-shrink: 0;
}
.ssj-entry-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ssj-entry-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ssj-bg);
    color: var(--ssj-text-light);
    font-size: 36px;
}

/* Name & org */
.ssj-entry-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--ssj-text);
    margin: 0 0 4px;
    line-height: 1.3;
}
.ssj-entry-org {
    font-size: 13px;
    color: var(--ssj-text-light);
    margin: 0 0 8px;
}
.ssj-entry-location {
    font-size: 13px;
    color: var(--ssj-text-light);
    margin: 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Category tags */
.ssj-entry-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
}
.ssj-cat-tag {
    background: #eff6ff;
    color: var(--ssj-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    text-decoration: none;
    transition: var(--ssj-transition);
}
.ssj-cat-tag:hover {
    background: var(--ssj-primary);
    color: var(--ssj-white);
}

/* View profile button */
.ssj-entry-btn {
    display: inline-block;
    margin-top: auto;
    padding: 8px 18px;
    background: var(--ssj-primary);
    color: var(--ssj-white);
    border-radius: var(--ssj-radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--ssj-transition);
}
.ssj-entry-btn:hover {
    background: var(--ssj-primary-dk);
    color: var(--ssj-white);
}

/* ── Pagination ─────────────────────────────────────────────────────────────── */
.ssj-pagination {
    margin-top: 32px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}
.ssj-pagination a,
.ssj-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--ssj-text);
    background: var(--ssj-white);
    transition: var(--ssj-transition);
}
.ssj-pagination a:hover {
    background: var(--ssj-primary);
    border-color: var(--ssj-primary);
    color: var(--ssj-white);
}
.ssj-pagination .current {
    background: var(--ssj-primary);
    border-color: var(--ssj-primary);
    color: var(--ssj-white);
}

/* ── Foster Search Form ─────────────────────────────────────────────────────── */
.ssj-search-form {
    background: var(--ssj-white);
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius);
    padding: 24px;
    box-shadow: var(--ssj-shadow);
    margin-bottom: 28px;
}
.ssj-search-form-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--ssj-text);
}
.ssj-search-fields {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}
@media (max-width: 900px) {
    .ssj-search-fields {
        grid-template-columns: 1fr 1fr;
    }
    .ssj-search-btn-wrap {
        grid-column: 1 / -1;
    }
}
@media (max-width: 500px) {
    .ssj-search-fields {
        grid-template-columns: 1fr;
    }
}

.ssj-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ssj-field-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ssj-text-light);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.ssj-field-group input,
.ssj-field-group select {
    font-family: var(--ssj-font);
    font-size: 14px;
    padding: 9px 12px;
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius-sm);
    background: var(--ssj-white);
    color: var(--ssj-text);
    width: 100%;
    transition: var(--ssj-transition);
}
.ssj-field-group input:focus,
.ssj-field-group select:focus {
    outline: none;
    border-color: var(--ssj-primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}

.ssj-search-btn {
    font-family: var(--ssj-font);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    background: var(--ssj-primary);
    color: var(--ssj-white);
    border: none;
    border-radius: var(--ssj-radius-sm);
    cursor: pointer;
    transition: var(--ssj-transition);
    white-space: nowrap;
}
.ssj-search-btn:hover { background: var(--ssj-primary-dk); }

.ssj-search-reset {
    font-size: 13px;
    color: var(--ssj-text-light);
    text-decoration: none;
    margin-top: 12px;
    display: inline-block;
    transition: var(--ssj-transition);
}
.ssj-search-reset:hover { color: var(--ssj-primary); }

/* ── Search Results ─────────────────────────────────────────────────────────── */
.ssj-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}
.ssj-results-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--ssj-text-light);
}
.ssj-results-count strong { color: var(--ssj-text); }

/* No results */
.ssj-no-results {
    text-align: center;
    padding: 60px 20px;
    background: var(--ssj-white);
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius);
    color: var(--ssj-text-light);
}
.ssj-no-results-icon {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
}
.ssj-no-results h3 {
    font-size: 18px;
    color: var(--ssj-text);
    margin-bottom: 8px;
}

/* AJAX loading spinner */
.ssj-loading {
    text-align: center;
    padding: 40px;
    color: var(--ssj-text-light);
    font-size: 15px;
}
.ssj-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--ssj-border);
    border-top-color: var(--ssj-primary);
    border-radius: 50%;
    animation: ssj-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes ssj-spin {
    to { transform: rotate(360deg); }
}

/* ── Single Profile Page ────────────────────────────────────────────────────── */
.ssj-profile-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 16px;
}

.ssj-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 32px;
    padding: 32px;
    background: var(--ssj-white);
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius);
    box-shadow: var(--ssj-shadow);
    margin-bottom: 24px;
}
@media (max-width: 600px) {
    .ssj-profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

.ssj-profile-photo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--ssj-border);
    flex-shrink: 0;
}
.ssj-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ssj-profile-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ssj-bg);
    color: var(--ssj-text-light);
    font-size: 56px;
}

.ssj-profile-info { flex: 1; }

.ssj-profile-name {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--ssj-text);
}
.ssj-profile-org {
    font-size: 16px;
    color: var(--ssj-text-light);
    margin: 0 0 12px;
}

.ssj-profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ssj-profile-section {
    background: var(--ssj-white);
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--ssj-shadow);
}
.ssj-profile-section h3 {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--ssj-text-light);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ssj-border);
}

/* Contact list */
.ssj-contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ssj-contact-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
.ssj-contact-icon {
    width: 18px;
    text-align: center;
    color: var(--ssj-primary);
    flex-shrink: 0;
}
.ssj-contact-list a {
    color: var(--ssj-primary);
    text-decoration: none;
}
.ssj-contact-list a:hover { text-decoration: underline; }

/* Social links */
.ssj-social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.ssj-social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--ssj-border);
    border-radius: var(--ssj-radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--ssj-text);
    transition: var(--ssj-transition);
}
.ssj-social-link:hover {
    border-color: var(--ssj-primary);
    color: var(--ssj-primary);
    background: #eff6ff;
}

/* Biography */
.ssj-profile-bio {
    font-size: 15px;
    line-height: 1.7;
    color: var(--ssj-text);
}

/* Custom fields */
.ssj-custom-fields-table-front {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.ssj-custom-fields-table-front th,
.ssj-custom-fields-table-front td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--ssj-border);
    text-align: left;
}
.ssj-custom-fields-table-front th {
    font-weight: 600;
    color: var(--ssj-text-light);
    width: 40%;
}

/* Back button */
.ssj-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ssj-text-light);
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 20px;
    transition: var(--ssj-transition);
}
.ssj-back-btn:hover { color: var(--ssj-primary); }

/* -- Legacy Front-page Exact Match ----------------------------------------- */

.ssj-legacy-layout {
    font-family: inherit;
    color: #444;
}

.ssj-legacy-separator {
    border: 0;
    border-top: 1px dashed #ccc;
    margin: 30px 0;
}

.ssj-legacy-back-btn {
    display: inline-block;
    background-color: #5cb85c;
    color: #fff !important;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-radius: 3px;
    margin-bottom: 30px;
    transition: background-color 0.2s;
}

.ssj-legacy-back-btn:hover {
    background-color: #4cae4c;
    color: #fff !important;
}

.ssj-legacy-header-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
}

.ssj-legacy-info {
    flex: 1 1 300px;
}

.ssj-legacy-name {
    font-family: Georgia, serif;
    font-size: 32px;
    font-style: italic;
    color: #444;
    background-color: #e5e5e5;
    padding: 5px 15px;
    display: inline-block;
    margin: 0 0 10px 0;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    line-height: 1.2;
}

.ssj-legacy-title {
    font-size: 16px;
    color: #666;
    margin: 0 0 20px 0;
}

.ssj-legacy-meta-table {
    width: 100%;
    max-width: 450px;
    border-collapse: collapse;
    font-size: 14px;
}

.ssj-legacy-meta-table th {
    text-align: left;
    padding: 4px 10px 4px 0;
    font-weight: bold;
    width: 140px;
    border: none;
}

.ssj-legacy-meta-table td {
    padding: 4px 0;
    border: none;
}

.ssj-legacy-photo {
    flex: 0 0 260px;
    text-align: right;
}

.ssj-legacy-photo img {
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ssj-legacy-bio {
    margin-top: 40px;
    font-size: 15px;
    line-height: 1.6;
}

.ssj-legacy-bio-heading {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

