/* =============================================
   People Filter – styles  (list-view + autocomplete)
   ============================================= */

*, *::before, *::after { box-sizing: border-box; }

#people-filter-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
    color: #222;
}

/* ================================================
   Filter Panel
   ================================================ */
#people-filter-form {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 28px 32px 24px;
    margin-bottom: 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.pf-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 22px;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pf-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: #3b82f6;
    border-radius: 2px;
}

/* field grid */
.pf-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px 18px;
    margin-bottom: 20px;
}

.pf-field label {
    display: block;
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    margin-bottom: 5px;
}

.pf-field input[type="text"],
.pf-field input[type="number"],
.pf-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    font-size: 0.92rem;
    background: #f8fafc;
    color: #1a202c;
    transition: border-color .18s, box-shadow .18s;
    appearance: none;
    -webkit-appearance: none;
}

.pf-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.pf-field input:focus,
.pf-field select:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* age range */
.pf-field--range .pf-range {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pf-field--range .pf-range input { flex: 1; width: 0; }
.pf-field--range .pf-range span  { color: #94a3b8; font-size: 1.1rem; flex-shrink: 0; }

/* Name field wrapper – relative for autocomplete dropdown */
.pf-name-wrap { position: relative; }

/* ---- Autocomplete dropdown ---- */
#pf-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 9999;
    max-height: 260px;
    overflow-y: auto;
    display: none;
}

.pf-ac-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.92rem;
    color: #1a202c;
    transition: background .12s;
    border-bottom: 1px solid #f1f5f9;
}
.pf-ac-item:last-child { border-bottom: none; }
.pf-ac-item:hover,
.pf-ac-item.pf-ac-active {
    background: #eff6ff;
    color: #1d4ed8;
}
.pf-ac-highlight { font-weight: 700; color: #2563eb; }

/* ---- Buttons ---- */
.pf-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.pf-btn {
    padding: 10px 26px;
    border: none;
    border-radius: 7px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s, transform .1s, box-shadow .18s;
    letter-spacing: .02em;
}
.pf-btn:active { transform: scale(.97); }

.pf-btn--primary {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,.3);
}
.pf-btn--primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 14px rgba(59,130,246,.4);
}

.pf-btn--secondary {
    background: #f1f5f9;
    color: #475569;
}
.pf-btn--secondary:hover { background: #e2e8f0; }

/* ================================================
   Results area
   ================================================ */
#people-filter-results { position: relative; min-height: 80px; }

#pf-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.88rem;
    color: #64748b;
}
#pf-results-header strong { color: #1a202c; font-size: 1rem; }

/* ---- List items ---- */
#pf-results-list { display: flex; flex-direction: column; gap: 14px; }

.pf-item {
    display: flex;
    gap: 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    transition: box-shadow .2s, border-color .2s, transform .15s;
    text-decoration: none;
    color: inherit;
    align-items: flex-start;
}
.pf-item:hover {
    box-shadow: 0 6px 22px rgba(0,0,0,.09);
    border-color: #bfdbfe;
    transform: translateY(-1px);
}

/* Photo */
.pf-item__photo {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #e2e8f0;
}
.pf-item__photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.pf-item__photo-placeholder {
    font-size: 2rem;
    color: #93c5fd;
    line-height: 1;
}

/* Content */
.pf-item__body { flex: 1; min-width: 0; }

.pf-item__name {
    font-size: 1.08rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pf-item__name a {
    color: inherit;
    text-decoration: none;
}
.pf-item__name a:hover { color: #2563eb; text-decoration: underline; }

/* Badge row */
.pf-item__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.pf-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.pf-badge--gender    { background: #dbeafe; color: #1d4ed8; }
.pf-badge--age       { background: #dcfce7; color: #15803d; }
.pf-badge--nat       { background: #fef9c3; color: #854d0e; }
.pf-badge--religion  { background: #f3e8ff; color: #7e22ce; }
.pf-badge--marital   { background: #ffe4e6; color: #be123c; }

/* Meta row */
.pf-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.83rem;
    color: #64748b;
}
.pf-item__meta-entry { display: flex; align-items: center; gap: 4px; }
.pf-item__meta-entry svg { flex-shrink: 0; opacity: .7; }
.pf-item__meta-label { font-weight: 600; color: #475569; margin-right: 3px; }

/* Reason row – full width, truncated */
.pf-item__reason {
    margin-top: 8px;
    font-size: 0.82rem;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.pf-item__reason strong { color: #475569; }

/* Right column – date */
.pf-item__aside {
    flex-shrink: 0;
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.pf-item__date {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: nowrap;
}
.pf-item__date strong { display: block; font-size: 0.86rem; color: #475569; }
.pf-item__view-btn {
    display: inline-block;
    padding: 5px 14px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
    white-space: nowrap;
}
.pf-item__view-btn:hover { background: #dbeafe; }

/* ---- Pagination ---- */
#pf-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-top: 28px;
    flex-wrap: wrap;
}
.pf-page-btn {
    padding: 7px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    color: #475569;
    transition: background .14s, border-color .14s, color .14s;
}
.pf-page-btn:hover:not(:disabled) { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; }
.pf-page-btn.pf-page-btn--active  { background: #3b82f6; color: #fff; border-color: #3b82f6; font-weight: 700; }
.pf-page-btn:disabled              { opacity: .4; cursor: not-allowed; }

/* ---- Loading spinner ---- */
#pf-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.75);
    border-radius: 12px;
    z-index: 10;
}
.pf-spinner {
    width: 44px; height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: pf-spin .7s linear infinite;
}
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* ---- No results ---- */
#pf-no-results {
    text-align: center;
    padding: 56px 20px;
    color: #94a3b8;
}
#pf-no-results svg { margin-bottom: 12px; opacity: .35; }
#pf-no-results p { font-size: 1.05rem; margin: 0; }

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 680px) {
    #people-filter-form { padding: 18px 16px; }
    .pf-fields { grid-template-columns: 1fr 1fr; }
    .pf-item { flex-wrap: wrap; }
    .pf-item__photo { width: 60px; height: 60px; }
    .pf-item__aside { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (max-width: 420px) {
    .pf-fields { grid-template-columns: 1fr; }
    .pf-item__badges { gap: 4px; }
}
