/* ═══════════════════════════════════════════════════════════════
   COMMUNITY PAGE — v2
   ═══════════════════════════════════════════════════════════════ */

.community-page {
    width: min(1120px, 94vw);
    margin: 1.15rem auto 1.6rem;
    position: relative;
    z-index: 1;
}

/* ── Hero Section ────────────────────────────────────────────── */

.community-hero {
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 1.35rem 1.3rem;
    margin-bottom: 1.15rem;
    background:
        radial-gradient(circle at top right, rgba(56, 178, 140, 0.12) 0%, transparent 52%),
        radial-gradient(circle at bottom left, rgba(201, 180, 113, 0.1) 0%, transparent 48%),
        var(--bg-elevated);
}

body.dark .community-hero {
    background:
        radial-gradient(circle at top right, rgba(56, 178, 140, 0.08) 0%, transparent 52%),
        radial-gradient(circle at bottom left, rgba(201, 180, 113, 0.06) 0%, transparent 48%),
        var(--bg-elevated);
}

.community-hero h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.community-hero-lead {
    margin: 0.55rem 0 0;
    color: var(--muted);
    line-height: 1.65;
    max-width: 56ch;
}

.community-halal-note {
    margin: 0.75rem 0 0;
    padding: 0.55rem 0.75rem;
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.55;
    max-width: none;
}

/* ── Disclaimer ─────────────────────────────────────────────── */

.community-disclaimer {
    margin-top: 1.25rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
    font-size: 0.84rem;
    color: var(--muted);
    line-height: 1.65;
}

.community-disclaimer strong {
    color: var(--text);
    font-size: 0.88rem;
}

.community-disclaimer p {
    margin: 0;
}

.community-disclaimer p+p {
    margin-top: 0.45rem;
}

/* ── Search & Filters ────────────────────────────────────────── */

.directory-toolbar {
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.search-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1.1rem;
    font-size: 1.1rem;
    color: var(--muted);
    pointer-events: none;
}

.directory-search-input {
    width: 100%;
    height: 3.4rem;
    padding: 0 1.2rem 0 3rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-elevated);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.98rem;
    font-family: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    outline: none;
}

.directory-search-input::placeholder {
    color: var(--muted);
    opacity: 0.8;
}

.directory-search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(47, 107, 88, 0.16);
}

body.dark .directory-search-input:focus {
    box-shadow: 0 4px 16px rgba(147, 214, 183, 0.16);
}

/* Filter Pills */
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.filter-pill {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 160ms ease;
}

.filter-pill:hover {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.filter-pill.is-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(47, 107, 88, 0.22);
}

body.dark .filter-pill.is-active {
    color: #121916;
    box-shadow: 0 4px 12px rgba(147, 214, 183, 0.22);
}

.directory-no-results {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--bg-elevated);
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

/* ── Segmented Toggle ────────────────────────────────────────── */

.community-toggle {
    display: flex;
    gap: 0.35rem;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    margin-bottom: 1.15rem;
}

.community-toggle-btn {
    flex: 1;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    height: 2.7rem;
    padding: 0 0.9rem;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.community-toggle-btn:hover {
    color: var(--text);
}

.community-toggle-btn.is-active {
    background: rgba(255, 255, 255, 0.55);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(47, 107, 88, 0.1);
}

body.dark .community-toggle-btn.is-active {
    background: rgba(24, 32, 28, 0.78);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ── Card Grid ───────────────────────────────────────────────── */

.community-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}

/* ── Cards ────────────────────────────────────────────────────── */

.community-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.28);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

body.dark .community-card {
    background: rgba(24, 32, 28, 0.45);
}

.community-card:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    box-shadow: 0 12px 32px rgba(47, 107, 88, 0.12);
    transform: translateY(-2px);
}

body.dark .community-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Card body: info + map side by side */
.community-card-body {
    display: flex;
    gap: 0;
    flex: 1;
}

.community-card-info {
    flex: 1;
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header row: name + distance badge */
.community-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.community-card-name {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
}

/* Distance badge */
.community-card-distance {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    white-space: nowrap;
    line-height: 1.4;
}

.community-card-distance-muted {
    color: var(--muted);
    background: color-mix(in srgb, var(--muted) 8%, transparent);
    border-color: color-mix(in srgb, var(--muted) 18%, transparent);
}

.community-card-detail {
    margin: 0.18rem 0 0;
    font-size: 0.86rem;
    color: var(--muted);
    line-height: 1.5;
}

.community-card-specialties {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: var(--text);
    line-height: 1.5;
    opacity: 0.75;
    font-style: italic;
}

/* Embedded map */
.community-card-map {
    flex-shrink: 0;
    width: 180px;
    min-height: 160px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-left: 1px solid var(--border);
}

.community-card-map iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Bottom link bar */
.community-card-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    transition: background 140ms ease;
}

.community-card-link:hover {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* ── Panel Visibility ────────────────────────────────────────── */

.community-panel-hidden {
    display: none;
}

/* ── Empty State ─────────────────────────────────────────────── */

.community-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 320px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        radial-gradient(circle at center, rgba(201, 180, 113, 0.08) 0%, transparent 60%),
        var(--bg-elevated);
    padding: 2rem 1.2rem;
}

.community-empty-icon {
    margin: 0;
    font-size: 2.8rem;
    line-height: 1;
}

.community-empty-text {
    margin: 0.85rem 0 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}

.community-empty-sub {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
    color: var(--muted);
    max-width: 38ch;
    line-height: 1.55;
}

/* ── Responsive: Tablet ──────────────────────────────────────── */

@media (min-width: 640px) {
    .community-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .community-card-map {
        width: 150px;
        min-height: 140px;
    }
}

@media (min-width: 960px) {
    .community-card-map {
        width: 200px;
        min-height: 170px;
    }
}

/* ── Responsive: Mobile ──────────────────────────────────────── */

@media (max-width: 700px) {
    .community-page {
        width: 96vw;
        margin-top: 0.75rem;
    }

    .community-hero {
        padding: 1rem;
        border-radius: 16px;
    }

    .community-toggle-btn {
        font-size: 0.78rem;
        height: 2.7rem;
        padding: 0 0.55rem;
    }

    .community-grid {
        grid-template-columns: 1fr;
    }

    /* On mobile: info + map still side by side, map narrower */
    .community-card-map {
        width: 120px;
        min-height: 130px;
    }

    .community-card-info {
        padding: 0.8rem 0.85rem;
    }

    .community-card-name {
        font-size: 0.98rem;
    }

    .community-card-header {
        flex-direction: column;
        gap: 0.25rem;
    }
}

@media (max-width: 400px) {
    .community-page {
        width: 97vw;
    }

    .community-card-map {
        width: 100px;
        min-height: 110px;
    }

    .community-card-info {
        padding: 0.7rem;
    }
}