/* =====================================================
   ARCHIVE SOUS-CATÉGORIE — Design cohérent avec /chat/
   Hero court + Chat IA 2/3 + Sidebar 1/3
   Carnet Catalan Pro
   ===================================================== */

/* ── Hero court ──────────────────────────────────────── */
.cc-hero-global--short {
    min-height: 200px !important;
    max-height: 270px !important;
    height: clamp(200px, 22vw, 260px) !important;
}

.cc-hero-global--short .cc-hero-content {
    padding-top: 1.5rem;
    padding-bottom: 1.75rem;
}

.cc-hero-global--short .cc-hero-title {
    font-size: clamp(1.5rem, 3.5vw, 2.4rem);
    margin-bottom: 0.4rem;
}

.cc-hero-global--short .cc-hero-subtitle {
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Page layout ─────────────────────────────────────── */
.cc-subcat-page {
    padding: 2rem 0 5rem;
}

.cc-subcat-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.25rem;
    align-items: start;
    margin-top: 1.5rem;
}

/* ══════════════════════════════════════════════════════
   CHAT PANE — Même look que #cc-chat-wrapper sur /chat/
   ══════════════════════════════════════════════════════ */
.cc-chat-pane {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Header rouge gradient (identique /chat/) ─────────── */
.cc-chat-header {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.cc-chat-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.20);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.cc-chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cc-chat-name {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #fff;
}

.cc-chat-status {
    font-size: 12px;
    opacity: 0.85;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Indicateur "en ligne" */
.cc-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    animation: cc-pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes cc-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Zone messages ────────────────────────────────────── */
.cc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f8f8f8;
    scroll-behavior: smooth;
    min-height: 280px;
    max-height: 420px;
}

.cc-chat-messages::-webkit-scrollbar { width: 4px; }
.cc-chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* ── Bulles ───────────────────────────────────────────── */
.cc-chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.6;
    word-wrap: break-word;
    animation: cc-fadein 0.25s ease;
}

@keyframes cc-fadein {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Bulle IA — blanche avec ombre (identique /chat/) */
.cc-chat-bubble--ai {
    background: #fff;
    color: #2c2c2c;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    align-self: flex-start;
}

/* Bulle user — rouge gradient (identique /chat/) */
.cc-chat-bubble--user {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Liens dans les bulles */
.cc-chat-bubble--ai a {
    color: #c0392b;
    font-weight: 600;
    text-decoration: underline;
}

.cc-chat-bubble--user a {
    color: rgba(255, 255, 255, 0.90);
}

/* ── Indicateur de frappe ─────────────────────────────── */
.cc-chat-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    align-self: flex-start;
    width: fit-content;
}

.cc-chat-typing span {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: cc-bounce 1.2s infinite;
}

.cc-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.cc-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes cc-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1.1); opacity: 1; }
}

/* ── Suggestions rapides ──────────────────────────────── */
.cc-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
    transition: opacity 0.25s ease, height 0.25s ease;
}

.cc-chat-suggestion {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    color: #c0392b;
    background: #fef3f2;
    border: 1px solid rgba(192, 57, 43, 0.22);
    border-radius: 99px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
    white-space: nowrap;
    line-height: 1.5;
}

.cc-chat-suggestion:hover {
    background: rgba(192, 57, 43, 0.12);
    transform: translateY(-1px);
}

/* ── Zone de saisie ───────────────────────────────────── */
.cc-chat-form {
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.cc-chat-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    padding: 11px 18px;
    font-size: 14.5px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #fafafa;
    font-family: inherit;
    color: #2c2c2c;
    min-width: 0;
}

.cc-chat-input:focus {
    border-color: #c0392b;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.10);
}

.cc-chat-input::placeholder {
    color: #bbb;
}

/* Bouton envoyer — cercle rouge (identique /chat/) */
.cc-chat-submit {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(192, 57, 43, 0.35);
}

.cc-chat-submit:hover {
    transform: scale(1.07);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.45);
}

.cc-chat-submit:active {
    transform: scale(0.95);
}

.cc-chat-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR — Carte + Articles récents
   ══════════════════════════════════════════════════════ */
.cc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    position: sticky;
    top: 1.5rem;
}

/* Block sidebar générique */
.cc-sidebar-map-wrap,
.cc-sidebar-recent {
    background: #fff;
    border-radius: 14px;
    border: 1.5px solid #e8e4dd;
    box-shadow: 0 2px 10px rgba(25, 36, 33, 0.06);
    overflow: hidden;
}

.cc-sidebar-title {
    font-family: var(--font-titres, 'Merriweather', serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: #c0392b;
    padding: 12px 16px;
    border-bottom: 1px solid #f0ece5;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Carte mini */
.cc-sidebar-map {
    background: #e8f0f5;
}

#cc-subcat-map {
    width: 100%;
    height: 220px;
}

/* Articles récents */
.cc-sidebar-recent {
    display: flex;
    flex-direction: column;
}

.cc-sidebar-post {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    padding: 10px 14px;
    border-bottom: 1px solid #f5f2ed;
    transition: background 0.18s ease;
}

.cc-sidebar-post:last-child {
    border-bottom: none;
}

.cc-sidebar-post:hover {
    background: #fef3f2;
}

.cc-sidebar-post-img {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8e4dd;
}

.cc-sidebar-post-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0e4e8, #cdd3d8);
    flex-shrink: 0;
}

.cc-sidebar-post-title {
    font-family: var(--font-textes, 'Inter', sans-serif);
    font-size: 0.82rem;
    font-weight: 600;
    color: #2c2c2c;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
    .cc-subcat-layout {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }

    .cc-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .cc-sidebar > * {
        flex: 1 1 280px;
    }

    .cc-hero-global--short {
        height: 190px !important;
        min-height: 170px !important;
    }
}

@media (max-width: 640px) {
    .cc-chat-messages {
        max-height: 320px;
    }

    .cc-chat-bubble {
        max-width: 88%;
    }

    .cc-sidebar {
        flex-direction: column;
    }

    .cc-sidebar > * {
        flex: none;
    }

    .cc-chat-suggestions {
        padding: 8px 12px;
    }
}

/* ── Description sous-catégorie (sidebar) ────────────── */
.cc-subcat-desc {
    background: #fff;
    border-radius: 14px;
    border: 1.5px solid #e8e4dd;
    box-shadow: 0 2px 10px rgba(25, 36, 33, 0.06);
    padding: 14px 16px;
    font-family: var(--font-textes, 'Inter', sans-serif);
    font-size: 0.88rem;
    line-height: 1.65;
    color: #4a4a4a;
}

.cc-subcat-desc p:last-child {
    margin-bottom: 0;
}

/* ── Filtre zones géographiques 2 niveaux (sidebar map) ──────── */
.cc-map-zone-filter {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px 12px 6px;
}

.cc-mf-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}

.cc-mf-row::-webkit-scrollbar {
    display: none;
}

.cc-mf-btn {
    font-family: var(--font-textes, 'Inter', sans-serif);
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 99px;
    border: 1.5px solid #d0ccc6;
    background: #f8f6f2;
    color: #555;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cc-mf-btn:hover {
    border-color: var(--color-primary, #385A70);
    color: var(--color-primary, #385A70);
    background: rgba(56, 90, 112, 0.07);
}

.cc-mf-btn.is-active,
.cc-mf-btn--parent.is-active {
    background: var(--color-primary, #385A70);
    border-color: var(--color-primary, #385A70);
    color: #fff;
}

/* Sous-zones : plus petites, couleur dorée */
.cc-mf-row--child .cc-mf-btn {
    font-size: 10px;
    padding: 3px 8px;
    border-color: #e4dfd8;
    background: #f4f1ec;
    color: #777;
}

.cc-mf-row--child .cc-mf-btn:hover {
    border-color: var(--color-secondary, #C89445);
    color: var(--color-secondary, #C89445);
    background: rgba(200, 148, 69, 0.08);
}

.cc-mf-row--child .cc-mf-btn.is-active {
    background: var(--color-secondary, #C89445);
    border-color: var(--color-secondary, #C89445);
    color: #fff;
}

/* ── Étiquettes zones sur carte Leaflet ───────────────────────── */
.cc-zone-lbl {
    background: rgba(255, 255, 255, 0.88);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-textes, 'Inter', sans-serif);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Pills zones colorées (--zone-c injecté via JS) ────────────── */
.cc-mf-btn--zone {
    border-color: var(--zone-c, var(--color-primary, #385A70));
    color:        var(--zone-c, var(--color-primary, #385A70));
    background:   #f8f6f2;
}

.cc-mf-btn--zone:hover {
    border-color: var(--zone-c, #385A70);
    color:        var(--zone-c, #385A70);
    background:   rgba(56, 90, 112, 0.08);
}

.cc-mf-btn--zone.is-active {
    background:   var(--zone-c, var(--color-primary, #385A70));
    border-color: var(--zone-c, var(--color-primary, #385A70));
    color: #fff;
}
