/*
 * Profile directory styles (PERF-10), moved out of profile/list.php so the
 * edge and browsers cache them. Linked absolutely from list.php's head, so
 * club's ?embed=1 fragment carries it too.
 */
/* ===========================================
   PAGE HEADER
   =========================================== */
.page-header-section {
    background: var(--light);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
}
.page-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}
.page-header-text h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}
.page-header-text p {
    color: var(--twc-secondary-text, #595F69);
    margin: 0;
    font-size: 0.9375rem;
}
.page-header-actions {
    display: flex;
    gap: 0.75rem;
}

/* ===========================================
   BROWSE FILTERS
   =========================================== */
.browse-section {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}
.browse-filters {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* --- Top row: search + toggle + stats --- */
.bf-top-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.bf-search-group {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.bf-search-icon {
    position: absolute;
    left: 0.875rem;
    color: var(--twc-secondary-text, #595F69);
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1;
}
.bf-search-input {
    padding-left: 2.5rem !important;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
    border-right: none !important;
    height: 42px;
}
.bf-search-input:focus {
    border-color: var(--twc-accent-fill, #0062CC) !important;
    box-shadow: none !important;
}
.bf-search-btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
    height: 42px;
    padding: 0 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
}
.bf-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.bf-filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--dark);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.bf-filter-toggle:hover {
    border-color: var(--twc-accent-fill, #0062CC);
    color: var(--twc-accent-fill, #0062CC);
}
.bf-filter-toggle.active {
    background: var(--twc-accent-fill, #0062CC);
    color: white;
    border-color: var(--twc-accent-fill, #0062CC);
}
.bf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--twc-accent-fill, #0062CC);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}
.bf-filter-toggle.active .bf-badge {
    background: white;
    color: var(--twc-accent-fill, #0062CC);
}

/* --- Filter panel (collapsible) --- */
.bf-filter-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    opacity: 0;
}
.bf-filter-panel.bf-panel-open {
    max-height: 400px;
    opacity: 1;
    padding-top: 0.75rem;
}
.bf-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.bf-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.bf-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--twc-secondary-text, #595F69);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.bf-filter-label i {
    font-size: 0.8rem;
}
.bf-filter-select {
    font-size: 0.875rem !important;
    height: 38px !important;
    padding: 0.375rem 0.75rem !important;
    border-radius: var(--radius-sm) !important;
    border-color: var(--border) !important;
    cursor: pointer;
}
.bf-filter-select:focus {
    border-color: var(--twc-accent-fill, #0062CC) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Autocomplete dropdown for country etc. */
.bf-autocomplete-wrap {
    position: relative;
}
.bf-autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.bf-autocomplete-dropdown.show {
    display: block;
}
.bf-autocomplete-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s;
}
.bf-autocomplete-option:hover {
    background: var(--light);
}



/* --- Active filter chips --- */
.bf-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.75rem;
}
.bf-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--twc-accent-fill-hover, #0052AD);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.bf-chip:hover {
    background: #dbeafe;
    border-color: var(--twc-accent-fill, #0062CC);
    color: var(--twc-accent-fill-hover, #0052AD);
    text-decoration: none;
}
.bf-chip i {
    font-size: 0.75rem;
}
.bf-chip-close {
    font-size: 0.75rem !important;
    opacity: 0.6;
}
.bf-chip:hover .bf-chip-close {
    opacity: 1;
}
.bf-chip-clear {
    background: transparent;
    border-color: var(--border);
    color: var(--twc-secondary-text, #595F69);
}
.bf-chip-clear:hover {
    background: #fef2f2;
    border-color: var(--twc-error-fill, #DC2626);
    color: var(--twc-error-text, #991B1B);
}

/* ===========================================
   PROFILE GRID
   =========================================== */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}
.profile-card {
    display: flex;
    flex-direction: column;
}
.profile-card-footer {
    padding: 0 1.25rem 1.25rem;
    text-align: center;
}
.follow-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.9);
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
    padding: 0;
    line-height: 1;
}
.follow-btn:hover {
    background: white;
    border-color: #6366f1;
    color: var(--twc-accent-fill, #0062CC);
}
.follow-btn.following {
    background: var(--twc-accent-fill, #0062CC);
    border-color: #6366f1;
    color: white;
}
.profile-type-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid currentColor;
}
.ptype-professional { color: var(--twc-accent-fill, #0062CC); background: rgba(99,102,241,0.08); }
.ptype-employer     { color: #0E7490; background: rgba(8,145,178,0.08); }
.ptype-provider     { color: var(--twc-success-text, #14532D); background: rgba(5,150,105,0.08); }

/* ===========================================
   EMPTY STATE
   =========================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-state i.bi-people {
    font-size: 3rem;
    color: var(--secondary);
    opacity: 0.4;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 1200px) {
    .profile-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 992px) {
    .profile-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header-inner { flex-direction: column; align-items: flex-start; }
    .bf-filter-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .profile-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .bf-top-row { flex-wrap: wrap; }
    .bf-search-group { flex: 1 1 100%; order: 1; }
    .bf-actions { flex: 1 1 100%; order: 2; justify-content: space-between; }
    .bf-filter-grid { grid-template-columns: 1fr; }
    .profile-card-body { padding: 2.5rem 0.75rem 0.75rem; }
    .profile-card-name { font-size: 0.9rem; }
    .profile-card-meta { font-size: 0.75rem; }
}
@media (max-width: 480px) {
    .profile-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .page-header-section { padding: 1.25rem 0; }
    .page-header-text h1 { font-size: 1.35rem; }
}

/* ===========================================
   HOVER EYE (replaces the "View Profile" button)
   =========================================== */
.profile-card { position: relative; }
.profile-card-clickable { cursor: pointer; }
.pc-eye { position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 30px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.95); color: #3b5bdb; box-shadow: 0 2px 8px rgba(15,23,42,.2);
    opacity: 0; transform: scale(.8); transition: opacity .16s ease, transform .16s ease; pointer-events: none; }
.pc-eye svg { width: 16px; height: 16px; }
.profile-card:hover .pc-eye, .profile-card:focus .pc-eye, .profile-card:focus-within .pc-eye { opacity: 1; transform: scale(1); }
@media (hover: none) { .pc-eye { opacity: 1; transform: scale(1); } }

/* ===========================================
   GRID / LIST VIEW TOGGLE
   =========================================== */
.bf-viewtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.bf-vt-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 42px;
    border: 0; background: #fff; color: #6b7383; cursor: pointer; padding: 0; transition: background .15s, color .15s; }
.bf-vt-btn + .bf-vt-btn { border-left: 1px solid var(--border); }
.bf-vt-btn svg { width: 16px; height: 16px; }
.bf-vt-btn:hover { background: #f6f7f9; color: #3a4256; }
.bf-vt-btn.active { background: #3b5bdb; color: #fff; }

/* List view: reuse the same card markup laid out horizontally */
.profile-grid.profile-list { display: flex; flex-direction: column; gap: 12px; }
.profile-list .profile-card { flex-direction: row; align-items: center; height: auto; padding: 14px 18px 14px 14px; }
.profile-list .profile-card-header { height: auto; flex: 0 0 auto; background: none; width: 64px; }
.profile-list .profile-card-avatar,
.profile-list .profile-card-avatar-placeholder { position: static; transform: none; bottom: auto; left: auto;
    width: 64px; height: 64px; }
.profile-list .profile-card-body { flex: 1 1 auto; padding: 0 0 0 18px; text-align: left; }
.profile-list .profile-card-meta { justify-content: flex-start; }
.profile-list .profile-card-tags { justify-content: flex-start; }
.profile-list .pc-eye { top: 50%; left: auto; right: 16px; margin-top: -15px; }
.profile-list .follow-btn { top: 14px; right: 16px; }
@media (max-width: 520px) {
    .profile-list .profile-card { padding: 12px; }
    .profile-list .profile-card-body { padding-left: 12px; }
    .profile-list .profile-card-header { width: 52px; }
    .profile-list .profile-card-avatar,
    .profile-list .profile-card-avatar-placeholder { width: 52px; height: 52px; }
}

/* ===========================================
   PROFILE PREVIEW DRAWER (mirrors club /directory)
   =========================================== */
.moat-pmodal { position: fixed; inset: 0; z-index: var(--twc-z-overlay, 1050); display: flex; align-items: stretch; justify-content: flex-end; }
.moat-pmodal[hidden] { display: none; }
.moat-pmodal-backdrop { position: absolute; inset: 0; background: rgba(17,24,39,.5); backdrop-filter: blur(2px); animation: moatPmFade .2s ease; }
.moat-pmodal-dialog { position: relative; background: #fff; width: 440px; max-width: 100%;
    box-shadow: -12px 0 40px rgba(0,0,0,.22); height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
    display: flex; flex-direction: column; overflow: hidden; animation: moatPmSlide .24s cubic-bezier(.22,.61,.36,1); }
@keyframes moatPmSlide { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes moatPmFade { from { opacity: 0; } to { opacity: 1; } }
.moat-pmodal-close { position: absolute; top: 10px; right: 12px; z-index: 3; width: 32px; height: 32px; border: 0;
    background: rgba(255,255,255,.92); border-radius: 50%; font-size: 22px; line-height: 1; color: #3b4252; cursor: pointer;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 5px rgba(0,0,0,.18); }
.moat-pmodal-close:hover { background: #fff; color: #000; }
.moat-pmodal-body { flex: 1 1 auto; overflow: auto; min-height: 120px; }
.moat-pmodal-foot { padding: 14px 22px; border-top: 1px solid #eef0f3; background: #fff; }
.moat-pmodal-actions { display: flex; gap: 8px; }
.moat-pmodal-view { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 8px;
    background: #3b5bdb; color: #fff; text-decoration: none; padding: 12px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.moat-pmodal-view:hover { background: #2f4ac0; color: #fff; text-decoration: none; }
.moat-pmodal-view svg { width: 12px; height: 12px; }
.moat-pmodal-msg-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; background: #fff; color: #3b5bdb;
    border: 1px solid #3b5bdb; border-radius: 10px; padding: 12px 16px; font-weight: 600; font-size: 14px; cursor: pointer; }
.moat-pmodal-msg-btn:hover { background: #eef2ff; }
.moat-pmodal-msg-btn svg { width: 15px; height: 15px; }
.moat-pmodal-compose { margin-top: 12px; }
.moat-pmodal-compose[hidden] { display: none; }
.moat-pmodal-ta { width: 100%; box-sizing: border-box; border: 1px solid #d7dce5; border-radius: 10px; padding: 10px 12px;
    font-size: 13.5px; font-family: inherit; color: #1f2733; resize: vertical; min-height: 84px; }
.moat-pmodal-ta:focus { border-color: #3b5bdb; box-shadow: 0 0 0 3px rgba(59,91,219,.12); }
.moat-pmodal-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.moat-pmodal-note { font-size: 12.5px; color: #6b7383; flex: 1 1 auto; min-width: 0; }
.moat-pmodal-note.err { color: #d33b3b; }
.moat-pmodal-note.ok { color: var(--twc-success-text, #14532D); }
.moat-pmodal-note a { color: #3b5bdb; }
.moat-pmodal-send { flex: 0 0 auto; background: #3b5bdb; color: #fff; border: 0; border-radius: 10px; padding: 9px 18px;
    font-weight: 600; font-size: 13.5px; cursor: pointer; }
.moat-pmodal-send:hover { background: #2f4ac0; }
.moat-pmodal-send:disabled { opacity: .55; cursor: default; }
.pm-cover { height: 96px; background: linear-gradient(120deg,#3b5bdb,#6c8cff); }
.pm-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-head { padding: 0 22px; }
.pm-avatar { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 4px solid #fff; background: #eef1f6;
    margin-top: -42px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 30px;
    color: #3b5bdb; overflow: hidden; }
.pm-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pm-id { margin-top: 12px; min-width: 0; }
.pm-name { font-size: 20px; font-weight: 600; color: #1f2733; line-height: 1.2; }
.pm-role { font-size: 14px; color: #4b5563; margin-top: 3px; }
.pm-loc { font-size: 13px; color: #6b7383; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.pm-loc svg { width: 13px; height: 13px; opacity: .7; flex: none; }
.pm-stats { font-size: 12.5px; color: #6b7383; margin-top: 6px; }
.pm-stats b { color: #1f2733; }
.pm-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 22px 0; }
.pm-badge { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 9999px; }
.pm-badge.green { background: #e7f6ec; color: var(--twc-success-text, #14532D); }
.pm-badge.blue { background: #e8eefe; color: #3b5bdb; }
.pm-badge.grey { background: #eef0f3; color: #5b6472; }
.pm-sec { padding: 16px 22px 0; }
.pm-sec:last-child { padding-bottom: 20px; }
.pm-sec h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--twc-secondary-text, #595F69); margin: 0 0 8px; }
.pm-about { font-size: 13.5px; color: #3b4252; line-height: 1.6; white-space: pre-line; }
.pm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pm-tag { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 6px; background: #f3f5f9; color: #41506b; border: 1px solid #e6e9f0; }
.pm-item { padding: 9px 0; border-bottom: 1px solid #f0f2f5; }
.pm-item:last-child { border-bottom: 0; }
.pm-item-t { font-size: 13.5px; font-weight: 600; color: #1f2733; }
.pm-item-s { font-size: 12.5px; color: #5b6472; margin-top: 1px; }
.pm-item-d { font-size: 12px; color: var(--twc-secondary-text, #595F69); margin-top: 1px; }
.pm-item-x { font-size: 12.5px; color: #4b5563; margin-top: 4px; line-height: 1.5; }
.pm-item-tags { margin-top: 6px; }
.pm-item-tags .pm-tag { font-size: 0.75rem; padding: 3px 8px; }
@media (max-width: 520px) {
    .moat-pmodal-dialog { width: 100%; box-shadow: none; }
    .moat-pmodal-close { top: 8px; right: 8px; }
    .pm-cover { height: 80px; }
    .pm-avatar { width: 72px; height: 72px; margin-top: -38px; font-size: 26px; }
    .pm-head, .pm-badges, .pm-sec { padding-left: 16px; padding-right: 16px; }
    .pm-name { font-size: 18px; }
    .moat-pmodal-foot { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* DS-06/DS-07: one visible focus ring for this stylesheet's scope, from the
   --twc-focus-ring token (a host value wins), and no motion for visitors who
   ask for none. */
#moat-main :focus-visible { outline: var(--twc-focus-ring, 2px solid var(--twc-accent, #0062CC)); outline-offset: var(--twc-focus-offset, 2px); }
@media (prefers-reduced-motion: reduce) {
  #moat-main *, #moat-main *::before, #moat-main *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
