/* =========================================================================
   Church Member Directory – Frontend Styles
   ========================================================================= */

/* ── Variables ──────────────────────────────────────────────────────────── */
.cmd-directory,
.cmd-photo-wall,
.cmd-recent-members,
.cmd-profile-form {
    --cmd-primary: #2563eb;
    --cmd-primary-hover: #1d4ed8;
    --cmd-bg: #f8fafc;
    --cmd-card-bg: #ffffff;
    --cmd-text: #1e293b;
    --cmd-muted: #64748b;
    --cmd-border: #e2e8f0;
    --cmd-radius: 12px;
    --cmd-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --cmd-shadow-hover: 0 4px 12px rgba(0,0,0,.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    color: var(--cmd-text);
}

/* ── Search Bar ─────────────────────────────────────────────────────────── */
.cmd-search-bar {
    margin-bottom: 16px;
}
.cmd-search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.cmd-input {
    padding: 10px 14px;
    border: 1px solid var(--cmd-border);
    border-radius: 8px;
    font-size: 15px;
    flex: 1;
    min-width: 200px;
    transition: border-color .2s;
}
.cmd-input:focus {
    outline: none;
    border-color: var(--cmd-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.cmd-select {
    padding: 10px 14px;
    border: 1px solid var(--cmd-border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    min-width: 140px;
}
.cmd-btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--cmd-primary);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    text-decoration: none !important;
}
.cmd-btn:hover {
    background: var(--cmd-primary-hover);
    transform: translateY(-1px);
}

/* ── Alphabet Filter ────────────────────────────────────────────────────── */
.cmd-alpha-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
}
.cmd-alpha-filter a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--cmd-muted);
    background: var(--cmd-bg);
    transition: all .15s;
}
.cmd-alpha-filter a:hover,
.cmd-alpha-filter a.active {
    background: var(--cmd-primary);
    color: #fff;
}

/* ── Result count ───────────────────────────────────────────────────────── */
.cmd-result-count {
    color: var(--cmd-muted);
    font-size: 14px;
    margin-bottom: 12px;
}

/* ── Member Cards Grid ──────────────────────────────────────────────────── */
.cmd-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.cmd-member-card {
    display: flex;
    gap: 16px;
    background: var(--cmd-card-bg);
    border: 1px solid var(--cmd-border);
    border-radius: var(--cmd-radius);
    padding: 20px;
    box-shadow: var(--cmd-shadow);
    transition: box-shadow .2s, transform .2s;
}
.cmd-member-card:hover {
    box-shadow: var(--cmd-shadow-hover);
    transform: translateY(-2px);
}

.cmd-card-photo {
    flex-shrink: 0;
}
.cmd-card-photo img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--cmd-bg);
}
.cmd-avatar-lg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}

.cmd-card-info {
    flex: 1;
    min-width: 0;
}
.cmd-card-info h3 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
    color: var(--cmd-text);
}
.cmd-family-tag {
    display: inline-block;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}
.cmd-detail {
    margin: 4px 0;
    font-size: 14px;
    color: var(--cmd-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.cmd-detail a {
    color: var(--cmd-primary);
    text-decoration: none;
}
.cmd-detail a:hover {
    text-decoration: underline;
}
.cmd-icon {
    font-size: 14px;
    flex-shrink: 0;
}
.cmd-map-link {
    font-size: 13px;
    color: var(--cmd-primary) !important;
    font-weight: 600;
    text-decoration: none;
}
.cmd-comment {
    margin-top: 8px;
    font-size: 13px;
    color: var(--cmd-muted);
    font-style: italic;
}
.cmd-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--cmd-muted);
    font-size: 16px;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.cmd-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}
.cmd-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--cmd-muted);
    background: var(--cmd-bg);
    transition: all .15s;
}
.cmd-pagination a:hover,
.cmd-pagination a.active {
    background: var(--cmd-primary);
    color: #fff;
}

/* ── Photo Wall ─────────────────────────────────────────────────────────── */
.cmd-photo-wall {
    display: grid;
    grid-template-columns: repeat(var(--cmd-cols, 4), 1fr);
    gap: 16px;
}
@media (max-width: 768px) {
    .cmd-photo-wall { grid-template-columns: repeat(2, 1fr); }
}
.cmd-photo-tile {
    position: relative;
    border-radius: var(--cmd-radius);
    overflow: hidden;
    box-shadow: var(--cmd-shadow);
    transition: transform .2s;
}
.cmd-photo-tile:hover {
    transform: scale(1.03);
}
.cmd-photo-tile img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.cmd-photo-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,.7));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* ── Recent Members ─────────────────────────────────────────────────────── */
.cmd-recent-members h3 {
    text-align: center;
    font-size: 20px;
    margin-bottom: 16px;
}
.cmd-recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    text-align: center;
}
.cmd-recent-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
}
.cmd-recent-card p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

/* ── Profile Form ───────────────────────────────────────────────────────── */
.cmd-profile-form {
    max-width: 520px;
}
.cmd-profile-form label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--cmd-text);
}
.cmd-profile-form .cmd-input {
    display: block;
    width: 100%;
    margin-top: 4px;
    box-sizing: border-box;
}
.cmd-success {
    background: #dcfce7;
    color: #166534;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

/* ── Login Required ─────────────────────────────────────────────────────── */
.cmd-login-required {
    text-align: center;
    padding: 40px 20px;
    background: var(--cmd-bg);
    border-radius: var(--cmd-radius);
    border: 1px solid var(--cmd-border);
}
.cmd-login-required a {
    color: var(--cmd-primary);
    font-weight: 600;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .cmd-members-grid {
        grid-template-columns: 1fr;
    }
    .cmd-member-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .cmd-detail {
        justify-content: center;
    }
    .cmd-search-row {
        flex-direction: column;
    }
    .cmd-input,
    .cmd-select {
        min-width: 100%;
    }
}
