/* ============================================================
   AI PAGINA
   ============================================================ */
.ask-header {
    margin: 0 0 20px;
    text-align: left;
}
html[dir="rtl"] .ask-header { text-align: right; }
.ask-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 6px;
}
.ask-subtitle {
    font-size: 1.05rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

/* ============================================================
   HOE WERKT HET — inklapbaar instructieblok
   ============================================================ */
.ask-how {
    margin: 0 0 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88rem;
    color: #4b5563;
    line-height: 1.5;
}
.ask-how summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.ask-how summary::before {
    content: 'ⓘ';
    font-size: 1rem;
    line-height: 1;
}
.ask-how summary::-webkit-details-marker { display: none; }
.ask-how[open] summary::before {
    content: 'ⓘ';
}

.ask-how-list {
    margin: 10px 0 0;
    padding: 0 0 0 20px;
    list-style-position: outside;
}
.ask-how-list li {
    margin: 4px 0;
}
.ask-how-list li::marker {
    color: var(--primary-color);
}
.ask-how-tip {
    color: #6b7280;
    font-style: italic;
}

html[dir="rtl"] .ask-how {
    border-left: none;
    border-right: 3px solid var(--primary-color);
}
html[dir="rtl"] .ask-how-list {
    padding: 0 20px 0 0;
}

/* ============================================================
   CONTAINER
   ============================================================ */
.ask-container {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    padding: 20px;
    min-height: 400px;
}

.ask-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
    min-height: 200px;
}

.ask-empty {
    text-align: center;
    padding: 30px 20px;
    color: #6b7280;
}
.ask-empty p { margin: 0 0 16px; font-size: 0.95rem; }
.ask-suggestions {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}
.ask-suggestions li {
    background: #f3f4f6;
    padding: 8px 16px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    transition: background 0.15s;
    max-width: 100%;
}
.ask-suggestions li:hover { background: #e5e7eb; }

/* ============================================================
   BERICHTEN
   ============================================================ */
.ask-msg {
    display: flex;
    gap: 10px;
    max-width: 100%;
}
.ask-msg-user {
    justify-content: flex-end;
}
.ask-msg-user .ask-msg-bubble {
    background: var(--primary-color);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}
.ask-msg-ai .ask-msg-bubble {
    background: #f3f4f6;
    color: #1a1a1a;
    border-radius: 14px 14px 14px 4px;
    max-width: 100%;
    width: 100%;
}
.ask-msg-bubble {
    padding: 10px 14px;
    max-width: 80%;
    line-height: 1.55;
    font-size: 0.95rem;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ask-msg-topic-intro .ask-msg-bubble {
    background: #ecfdf5;
    color: #065f46;
    border-left: 3px solid var(--primary-color);
    font-style: italic;
    width: auto;
    max-width: 100%;
    display: inline-block;
}
html[dir="rtl"] .ask-msg-topic-intro .ask-msg-bubble {
    border-left: none;
    border-right: 3px solid var(--primary-color);
}

/* ============================================================
   INLINE BADGES — [n] en [n-m], puur visueel (geen link)
   ============================================================ */
.ask-inline-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin: 0 2px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
    cursor: default;
}

/* ============================================================
   BRONNEN — inklapbare secties
   ============================================================ */
.ask-sources-section {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
}
.ask-sources-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.ask-sources-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}
html[dir="rtl"] .ask-sources-toggle {
    text-align: right;
}
.ask-sources-toggle:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.ask-sources-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    background: var(--primary-color);
    color: #fff;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    transition: transform 0.2s;
}

.ask-sources-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}
.ask-sources-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: none;
    letter-spacing: normal;
}

.ask-sources-content {
    display: none;
    margin-top: 8px;
    padding-left: 6px;
}
html[dir="rtl"] .ask-sources-content {
    padding-left: 0;
    padding-right: 6px;
}
.ask-sources-section.is-open .ask-sources-content {
    display: block;
    animation: sourcesReveal 0.2s ease-out;
}
@keyframes sourcesReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   BADGES — [n]-nummer in bronkaartjes
   ============================================================ */
.ask-verse-ref,
.ask-source-num {
    position: absolute;
    top: 8px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 22px;
    padding: 0 8px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    box-sizing: border-box;
    z-index: 1;
}
html[dir="rtl"] .ask-verse-ref,
html[dir="rtl"] .ask-source-num {
    right: auto;
    left: 10px;
}

/* ============================================================
   VERZEN — als zoekresultaat
   ============================================================ */
.source-text-result {
    position: relative;
    display: block;
    padding-right: 52px;
    margin-bottom: 6px;
}
.source-text-result,
.source-text-result:hover,
.source-text-result:focus,
.source-text-result * {
    text-decoration: none !important;
}

.source-text-result-chapter {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.source-text-result-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.source-text-result-article-number {
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 6px;
    font-size: 0.82rem;
}

.source-text-result-content {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.5;
    font-weight: normal;
}

html[dir="rtl"] .source-text-result {
    padding-right: 20px;
    padding-left: 52px;
}

/* ============================================================
   ARTIKELEN EN SUBJECTS — kaartjes (klikbaar!)
   ============================================================ */
.ask-source-item {
    position: relative;
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 52px 10px 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    margin-bottom: 8px;
}
.ask-source-item:last-child { margin-bottom: 0; }
.ask-source-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.ask-source-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: nowrap;
    padding-right: 4px;
}

.ask-source-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.ask-source-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-width: 0;
    flex: 1 1 auto;
}

.ask-source-snippet {
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    margin-top: 2px;
}

html[dir="rtl"] .ask-source-item {
    padding: 10px 12px 10px 52px;
}

/* ============================================================
   THINKING INDICATOR
   ============================================================ */
.ask-thinking {
    display: flex;
    gap: 4px;
    padding: 10px 0;
}
.ask-thinking span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: ask-bounce 1.4s infinite ease-in-out both;
}
.ask-thinking span:nth-child(2) { animation-delay: 0.16s; }
.ask-thinking span:nth-child(3) { animation-delay: 0.32s; }
@keyframes ask-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ============================================================
   FORMULIER
   ============================================================ */
.ask-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ask-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-ring, rgba(13,74,58,0.15));
}
.ask-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    background: transparent;
    color: inherit;
    min-width: 0;
}
.ask-input::placeholder {
    color: #9ca3af;
}
.ask-send-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    flex-shrink: 0;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ask-send-btn:hover { filter: brightness(0.92); }
.ask-send-btn:active { transform: scale(0.96); }
.ask-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   ACTIES — Nieuw onderwerp + Wis alles
   ============================================================ */
.ask-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
html[dir="rtl"] .ask-actions { justify-content: flex-start; }

.ask-newtopic-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.ask-newtopic-btn:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}
.ask-newtopic-btn:active { transform: translateY(0); }
.ask-newtopic-btn svg { flex-shrink: 0; }

.ask-wipe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 20px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.ask-wipe-btn:hover {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(185,28,28,0.2);
}
.ask-wipe-btn:active { transform: translateY(0); }
.ask-wipe-btn svg { flex-shrink: 0; }

/* ============================================================
   DIVIDER — "Nieuw onderwerp"
   ============================================================ */
.ask-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    padding: 0 10px;
}
.ask-divider::before,
.ask-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #d1d5db;
}
.ask-divider-label {
    margin: 0 12px;
    padding: 4px 12px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 12px;
    white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .ask-container { padding: 14px; }
    .ask-msg-bubble { max-width: 100%; font-size: 0.9rem; }
    .ask-source-snippet { -webkit-line-clamp: 2; }
    .ask-actions { justify-content: stretch; }
    .ask-newtopic-btn,
    .ask-wipe-btn { flex: 1; justify-content: center; }
}