/* ═══════════════════════════════════════════════════════════════════════
   Annonces Hub — Page annonces.php (Onglets + Feed social)
   Charte AmourCatho : bordeaux #8B1E5C / #5C1340
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --ach-bordeaux:        #8B1E5C;
    --ach-bordeaux-dark:   #5C1340;
    --ach-bordeaux-light:  #B8478A;
    --ach-bg:              #F8F9FA;
    --ach-cat-cate:        #2D8659;
    --ach-cat-onct:        #C97B3A;
    --ach-cat-liturg:      #2C5282;
    --ach-cat-solid:       #8B7AB8;
    --ach-cat-urgent:      #D14343;
    --ach-text:            #1a2035;
    --ach-text-muted:      #64748b;
    --ach-border:          #e2e8f0;
    --ach-shadow-sm:       0 1px 3px rgba(0,0,0,.06);
    --ach-shadow-md:       0 4px 12px rgba(0,0,0,.08);
    --ach-shadow-lg:       0 12px 32px rgba(139,30,92,.18);
    --ach-radius:          14px;
    --ach-radius-sm:       10px;
}

/* ───────────── Hero ───────────── */
.ach-hero {
    background: linear-gradient(135deg, var(--ach-bordeaux) 0%, var(--ach-bordeaux-dark) 100%);
    color: #fff;
    /* +var(--header-height) car le header est position:fixed (80px) */
    padding: calc(var(--header-height, 80px) + 40px) 24px 48px;
    position: relative;
    overflow: hidden;
    margin-top: 0;
}
.ach-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 200"><text x="50%" y="55%" font-size="180" font-family="serif" fill="rgba(255,255,255,0.07)" text-anchor="middle" dominant-baseline="middle">%E2%99%A5</text></svg>') center/contain no-repeat;
    pointer-events: none;
}
.ach-hero-inner {
    max-width: 960px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.ach-hero h1 {
    font-family: Georgia, 'Playfair Display', serif;
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -.5px;
}
.ach-hero p {
    font-size: 15px;
    opacity: .92;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ach-hero p i { font-size: 14px; }

/* ───────────── Tabs sticky ───────────── */
.ach-tabs-wrap {
    background: #fff;
    border-bottom: 1px solid var(--ach-border);
    position: sticky;
    /* Sous le header fixe (80px) sans le chevaucher */
    top: var(--header-height, 80px);
    z-index: 50;
    box-shadow: var(--ach-shadow-sm);
}
.ach-tabs {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 12px;
    scrollbar-width: none;
}
.ach-tabs::-webkit-scrollbar { display: none; }
.ach-tab {
    flex: 0 0 auto;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ach-text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-family: inherit;
}
.ach-tab:hover { color: var(--ach-bordeaux); }
.ach-tab.active {
    color: var(--ach-bordeaux);
    border-bottom-color: var(--ach-bordeaux);
}
.ach-tab-count {
    background: var(--ach-bg);
    color: var(--ach-text-muted);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 2px;
}
.ach-tab.active .ach-tab-count {
    background: var(--ach-bordeaux);
    color: #fff;
}

/* ───────────── Filtres (chips catégories) ───────────── */
.ach-filters {
    max-width: 960px;
    margin: 16px auto 0;
    padding: 0 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.ach-search {
    flex: 1;
    min-width: 220px;
    padding: 10px 16px 10px 38px;
    border: 1px solid var(--ach-border);
    border-radius: 22px;
    font-size: 13.5px;
    background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="%2364748b"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') 14px center no-repeat;
    outline: none;
    transition: border .15s, box-shadow .15s;
    font-family: inherit;
}
.ach-search:focus {
    border-color: var(--ach-bordeaux);
    box-shadow: 0 0 0 3px rgba(139,30,92,.15);
}
.ach-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    scrollbar-width: none;
    flex: 1 1 100%;
}
.ach-chips::-webkit-scrollbar { display: none; }
.ach-chip {
    flex: 0 0 auto;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid var(--ach-border);
    border-radius: 18px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ach-text);
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}
.ach-chip:hover { background: var(--ach-bg); }
.ach-chip.active {
    background: var(--ach-bordeaux);
    color: #fff;
    border-color: var(--ach-bordeaux);
}
.ach-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.ach-chip.urgent {
    border-color: var(--ach-cat-urgent);
    color: var(--ach-cat-urgent);
}
.ach-chip.urgent.active {
    background: var(--ach-cat-urgent);
    color: #fff;
}
.ach-chip-caret {
    font-size: 10px;
    opacity: .55;
    margin-left: 2px;
    transition: transform .15s;
}
.ach-chip.active .ach-chip-caret {
    transform: rotate(180deg);
    opacity: .9;
}

/* ───────────── Sous-catégories (apparait au clic d'un parent) ───────────── */
.ach-subchips {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(139,30,92,0.05) 0%, rgba(139,30,92,0.02) 100%);
    border: 1px solid rgba(139,30,92,0.08);
    border-radius: 14px;
    flex: 1 1 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(139,30,92,0.25) transparent;
    animation: ach-subchips-in .2s ease-out;
}
.ach-subchips::-webkit-scrollbar { height: 4px; }
.ach-subchips::-webkit-scrollbar-thumb { background: rgba(139,30,92,0.25); border-radius: 4px; }
.ach-subchips::-webkit-scrollbar-track { background: transparent; }
@keyframes ach-subchips-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ach-subchip {
    flex: 0 0 auto;
    padding: 7px 14px;
    background: #fff;
    border: 1px solid #e9d6e2;
    border-radius: 16px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ach-text);
    cursor: pointer;
    transition: all .15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
    line-height: 1.2;
}
.ach-subchip:hover {
    background: #fff5fa;
    border-color: var(--ach-bordeaux-light);
    transform: translateY(-1px);
}
.ach-subchip.active {
    background: var(--ach-bordeaux);
    color: #fff;
    border-color: var(--ach-bordeaux);
    box-shadow: 0 2px 6px rgba(139,30,92,0.25);
}
.ach-subchip.active .ach-chip-dot { box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }
.ach-subchip[data-subcat=""] {
    /* "Toutes" — sans dot, fond legerement gris */
    background: #f8f4f6;
    font-style: italic;
    color: var(--ach-text-muted);
}
.ach-subchip[data-subcat=""].active {
    background: var(--ach-bordeaux);
    color: #fff;
    font-style: normal;
}
.ach-subchip .ach-chip-dot {
    width: 7px;
    height: 7px;
}

/* Sur grand ecran, autoriser le wrap pour eviter le scroll horizontal inutile */
@media (min-width: 768px) {
    .ach-subchips {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

/* ───────────── Container feed ───────────── */
.ach-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

/* ───────────── Card annonce (feed) ───────────── */
.ach-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
@media (min-width: 768px) {
    .ach-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
}
.ach-card {
    background: #fff;
    border-radius: var(--ach-radius);
    overflow: hidden;
    box-shadow: var(--ach-shadow-sm);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}
.ach-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ach-shadow-lg);
}
.ach-card-head {
    padding: 12px 14px 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ach-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ach-bordeaux), var(--ach-bordeaux-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.ach-card-paroisse-block { flex: 1; min-width: 0; }
.ach-card-paroisse {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--ach-text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ach-card-time {
    font-size: 11.5px;
    color: var(--ach-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ach-card-fav {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--ach-text-muted);
    font-size: 18px;
    transition: color .15s, transform .15s;
}
.ach-card-fav:hover { transform: scale(1.15); }
.ach-card-fav.active { color: var(--ach-bordeaux); }

.ach-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    overflow: hidden;
}
.ach-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
    display: block;
}
.ach-card:hover .ach-card-media img { transform: scale(1.04); }
.ach-card-media-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(139,30,92,.15);
    font-size: 60px;
}
.ach-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    background: rgba(255,255,255,.95);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.ach-card-badge-urgent {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--ach-cat-urgent);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(209,67,67,.4);
    animation: ach-pulse 2s infinite;
}
@keyframes ach-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
.ach-card-distance {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 3px 9px;
    background: rgba(0,0,0,.75);
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(6px);
}

.ach-card-body {
    padding: 12px 16px 4px;
}
.ach-card-title {
    font-family: Georgia, 'Playfair Display', serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--ach-text);
    margin: 0 0 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ach-card-desc {
    font-size: 13px;
    color: var(--ach-text-muted);
    line-height: 1.45;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ach-card-event {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--ach-bordeaux);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ach-card-foot {
    padding: 10px 14px 12px;
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.ach-card-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    color: var(--ach-text-muted);
    background: transparent;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 6px;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.ach-card-stat:hover { background: var(--ach-bg); color: var(--ach-text); }
.ach-card-stat.active { color: var(--ach-bordeaux); font-weight: 700; }
.ach-card-stat i { font-size: 14px; }
.ach-card-stat-spacer { flex: 1; }

/* ───────────── Empty state ───────────── */
.ach-empty {
    text-align: center;
    padding: 60px 24px;
    background: #fff;
    border-radius: var(--ach-radius);
    border: 2px dashed var(--ach-border);
    color: var(--ach-text-muted);
}
.ach-empty i {
    display: block;
    font-size: 56px;
    opacity: .35;
    margin-bottom: 12px;
    color: var(--ach-bordeaux);
}
.ach-empty .title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ach-text);
    margin-bottom: 6px;
}
.ach-empty .desc { font-size: 14px; }
.ach-empty a {
    color: var(--ach-bordeaux);
    font-weight: 600;
    text-decoration: none;
}
.ach-empty a:hover { text-decoration: underline; }

/* ───────────── Loader / charger plus ───────────── */
.ach-loader {
    text-align: center;
    padding: 30px;
    color: var(--ach-text-muted);
}
.ach-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--ach-border);
    border-top-color: var(--ach-bordeaux);
    border-radius: 50%;
    animation: ach-spin 0.8s linear infinite;
}
@keyframes ach-spin { to { transform: rotate(360deg); } }
.ach-load-more {
    display: block;
    margin: 24px auto 0;
    padding: 12px 32px;
    background: var(--ach-bordeaux);
    color: #fff;
    border: none;
    border-radius: 22px;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(139,30,92,.25);
}
.ach-load-more:hover {
    background: var(--ach-bordeaux-dark);
    box-shadow: 0 6px 18px rgba(139,30,92,.35);
    transform: translateY(-1px);
}
.ach-load-more:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ───────────── Highlight (when navigated from notification) ───────────── */
.ach-card.ach-highlight {
    animation: ach-highlight 2.5s ease-out;
}
@keyframes ach-highlight {
    0%   { box-shadow: 0 0 0 4px rgba(139,30,92,.6); }
    100% { box-shadow: var(--ach-shadow-sm); }
}

/* ───────────── Toast ───────────── */
.ach-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ach-text);
    color: #fff;
    padding: 12px 22px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 30px rgba(0,0,0,.3);
    z-index: 1000;
    opacity: 0;
    transition: all .25s;
    pointer-events: none;
}
.ach-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.ach-toast.success { background: #15803d; }
.ach-toast.error   { background: #b91c1c; }
