/**
 * mod_qm_halaqat — Quran-circles board cards.
 * Scoped under .qm-halaqat (no collision with SPPB's global .card / .sppb-btn).
 * RTL / Arabic. Matches the site design language: stroke (no shadows), brand
 * green #315b4d + gold #b18f5d, soft hairline var(--qm-border-soft).
 * Responsive grid: 1 col mobile, 2 tablet, 3 desktop ([data-cols] pins a count).
 */

.qm-halaqat {
    box-sizing: border-box;
    width: 100%;
    display: grid;
    gap: var(--qm-gap, 24px);
    grid-template-columns: 1fr;
    margin: 0;
    padding: 0;
    --qmh-green: var(--qm-green, #315b4d);
    --qmh-green-d: #234a3e;
    --qmh-gold: var(--qm-gold, #b18f5d);
    --qmh-ink: #2c3a34;
    --qmh-muted: #6a7c74;
    --qmh-stroke: var(--qm-border-soft, #dfe5e8);
    --qmh-line: #eef2f0;
}

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

@media (min-width: 680px) { .qm-halaqat { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) {
    .qm-halaqat { grid-template-columns: repeat(3, 1fr); }   /* desktop: 3 across full width */
    .qm-halaqat[data-cols="1"] { grid-template-columns: 1fr; }
    .qm-halaqat[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
    .qm-halaqat[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
    .qm-halaqat[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 679px) { .qm-halaqat { grid-template-columns: 1fr !important; } }

/* ---- Card (stroke, no shadow) ---- */
.qm-halaqat .card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--qmh-stroke);
    border-radius: 16px;
    padding: 1.6rem 1.5rem 1.5rem;
    text-align: right;
    box-shadow: none;
    overflow: hidden;                       /* clip the top accent to the rounded corners */
    transition: border-color 0.18s ease, transform 0.18s ease;
}

/* gold→green accent strip hugging the top edge (clipped by overflow:hidden) */
.qm-halaqat .card::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--qmh-green), var(--qmh-gold));
}

.qm-halaqat .card:hover {
    border-color: var(--qmh-green);
    transform: translateY(-2px);
}

/* Optional heading (a field with Heading = Yes) */
.qm-halaqat .card h3 {
    margin: 0.15rem 0 1rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--qmh-green-d);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(177, 143, 93, 0.4);
}

/* Info rows */
.qm-halaqat .card p {
    margin: 0;
    padding: 0.6rem 0;
    font-size: 0.96rem;
    line-height: 1.75;
    color: var(--qmh-ink);
    border-bottom: 1px solid var(--qmh-line);
    word-break: break-word;
}

.qm-halaqat .card p strong {
    color: var(--qmh-muted);
    font-weight: 700;
    margin-left: 0.4rem;
}

.qm-halaqat .card p.status {
    border-bottom: 0;
    margin-bottom: 1.15rem;
    padding-bottom: 0;
}

.qm-halaqat .card p.status .qm-badge { vertical-align: middle; }

/* Status pill with a leading dot */
.qm-halaqat .qm-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.5;
}

.qm-halaqat .qm-badge::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.qm-halaqat .qm-badge.is-ok { background: #e7f5ed; color: #1b7a43; }
.qm-halaqat .qm-badge.is-stopped { background: #fbeae9; color: #c02d1c; }

/* ---- Join button (full width, bottom-aligned, rule colour inline) ---- */
.qm-halaqat .sppb-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    margin-top: auto;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.98rem;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    box-shadow: none;
    cursor: pointer;                        /* anchor has no href now — keep the hand cursor */
    transition: filter 0.15s ease, transform 0.08s ease;
    /* Anti-copy: no text selection, no iOS/Android long-press "copy/open" callout */
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.qm-halaqat .sppb-btn > .text { color: inherit; }

/* button icon (inline SVG brand mark, or a Font Awesome <i>) */
.qm-halaqat .sppb-btn .qm-ic {
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 auto;
    fill: currentColor;
}
.qm-halaqat .sppb-btn i { font-size: 1.02em; line-height: 1; }

.qm-halaqat a.sppb-btn:hover { filter: brightness(1.08); transform: translateY(-1px); color: #fff; }
.qm-halaqat a.sppb-btn:active { transform: translateY(0); }
.qm-halaqat a.sppb-btn:focus-visible { outline: 2px solid var(--qmh-gold); outline-offset: 2px; }

.qm-halaqat .sppb-btn.disabled {
    background: #f0f3f1;
    color: #8a948f;
    border: 1px solid var(--qmh-stroke);
    cursor: not-allowed;
}

/* ---- Messages ---- */
.qm-halaqat .qm-halaqat-empty,
.qm-halaqat .qm-halaqat-error {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.1rem;
    color: var(--qmh-muted);
    padding: 2.25rem 1rem;
    background: #fff;
    border: 1px solid var(--qmh-stroke);
    border-radius: 14px;
}

.qm-halaqat .qm-halaqat-error { color: #c02d1c; border-color: #f0d4d0; }

@media (max-width: 480px) {
    .qm-halaqat .card { padding: 1.4rem 1.25rem 1.3rem; }
}
