/* ============================================================
   Berea (베뢰아) — Web Chat Styles
   ============================================================ */

.berea-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    min-height: calc(100vh - 200px);
    max-width: 1400px;
    margin: 1rem auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

@media (max-width: 768px) {
    .berea-shell {
        grid-template-columns: 1fr;
        margin: 0;
        border-radius: 0;
        min-height: calc(100vh - 120px);
    }
    .berea-sidebar {
        display: none;
    }
}

/* ----- Sidebar ----- */
.berea-sidebar {
    background: linear-gradient(180deg, #f8f6fc 0%, #f0ebf8 100%);
    border-right: 1px solid #e9ecef;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.berea-sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(94, 53, 177, 0.12);
}

.berea-limit-card {
    background: #fff;
    border-radius: 12px;
    padding: 0.875rem 1rem;
    border: 1px solid #e9ecef;
}

.berea-limit-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: #5e35b1;
    line-height: 1;
}

.berea-suggestions {
    flex: 1;
    overflow-y: auto;
}

.berea-suggestion {
    display: block;
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(94, 53, 177, 0.15);
    border-radius: 10px;
    padding: 0.6rem 0.875rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
}

.berea-suggestion:hover {
    background: #fff;
    border-color: #5e35b1;
    color: #5e35b1;
    transform: translateX(2px);
}

.berea-sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(94, 53, 177, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.berea-sidebar-footer a {
    color: #6c757d;
}

.berea-sidebar-footer a:hover {
    color: #5e35b1;
}

/* ----- Main chat area ----- */
.berea-main {
    display: flex;
    flex-direction: column;
    background: #fafbfc;
}

.berea-topbar {
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.berea-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 300px;
}

.berea-empty {
    margin: auto;
    text-align: center;
    max-width: 480px;
    padding: 2rem;
}

/* ----- Answer card ----- */
.berea-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    animation: bereaFadeIn 0.3s ease-out;
}

.berea-card.blocked {
    background: #fff8e1;
    border-color: #ffe082;
}

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

.berea-question {
    background: #ede7f6;
    border-left: 3px solid #5e35b1;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: #311b92;
    font-weight: 500;
    white-space: pre-wrap;
    word-break: break-word;
}

.berea-mode-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.berea-mode-badge.bm-VerseServer { background: #e3f2fd; color: #1565c0; }
.berea-mode-badge.bm-BasicsTutor { background: #e8f5e9; color: #2e7d32; }
.berea-mode-badge.bm-WisdomCompanion { background: #fce4ec; color: #c2185b; }

.berea-answer {
    line-height: 1.7;
    color: #212529;
    white-space: pre-wrap;
    word-break: break-word;
}

.berea-answer p { margin-bottom: 0.75rem; }
.berea-answer p:last-child { margin-bottom: 0; }
.berea-answer strong { color: #5e35b1; }
.berea-answer blockquote {
    border-left: 3px solid #b39ddb;
    background: #f3eef9;
    padding: 0.5rem 1rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-style: italic;
}

/* Inline Bible-reference links inside answers — opens /Home/Search in a new tab. */
.berea-verse-link {
    display: inline-block;
    padding: 1px 8px 1px 6px;
    margin: 0 1px;
    background: #ede7f6;
    border: 1px solid #d1c4e9;
    border-radius: 12px;
    color: #4527a0;
    font-size: 0.92em;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.berea-verse-link i {
    font-size: 0.85em;
    margin-right: 2px;
    opacity: 0.7;
}

.berea-verse-link:hover {
    background: #5e35b1;
    border-color: #5e35b1;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(94, 53, 177, 0.25);
}

.berea-verse-link:hover i { opacity: 1; }

/* When inside a blockquote (typical "scripture quote" pattern), keep it readable. */
.berea-answer blockquote .berea-verse-link {
    background: #fff;
    border-color: #b39ddb;
}

.berea-seal {
    margin-top: 1.25rem;
    padding-top: 0.875rem;
    border-top: 1px dashed #dee2e6;
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.5;
}

.berea-handoff {
    margin-top: 1rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #b39ddb;
    border-radius: 12px;
    padding: 1rem;
}

.berea-handoff-title {
    font-weight: 600;
    color: #4527a0;
    margin-bottom: 0.5rem;
}

.berea-handoff-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.berea-handoff-actions a,
.berea-handoff-actions button {
    background: #fff;
    border: 1px solid #5e35b1;
    color: #5e35b1;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s;
}

.berea-handoff-actions a:hover,
.berea-handoff-actions button:hover {
    background: #5e35b1;
    color: #fff;
}

.berea-feedback {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f3f5;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.berea-fb-btn {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
}

.berea-fb-btn:hover { background: #f8f9fa; }
.berea-fb-btn.active.helpful { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.berea-fb-btn.active.unhelpful { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.berea-fb-btn[disabled] { cursor: not-allowed; opacity: 0.6; }

.berea-blocked-banner {
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    color: #664d03;
    font-size: 0.875rem;
    margin-bottom: 0.875rem;
}

/* ----- Typing indicator ----- */
.berea-typing {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem;
    background: #f1f3f5;
    border-radius: 16px;
    color: #6c757d;
    font-style: italic;
    font-size: 0.9rem;
    width: fit-content;
}

.berea-typing-dots {
    display: inline-flex;
    gap: 3px;
}

.berea-typing-dots span {
    width: 6px;
    height: 6px;
    background: #5e35b1;
    border-radius: 50%;
    animation: bereaDotPulse 1.4s infinite ease-in-out both;
}

.berea-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.berea-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bereaDotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* ----- Input bar ----- */
.berea-input-bar {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

#bereaInput {
    border-radius: 24px;
    padding: 0.75rem 1.125rem;
    resize: none;
    border: 1px solid #ced4da;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#bereaInput:focus {
    border-color: #5e35b1;
    box-shadow: 0 0 0 0.2rem rgba(94, 53, 177, 0.15);
}

.berea-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #5e35b1;
    border-color: #5e35b1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.berea-send-btn:hover:not(:disabled) {
    background: #4527a0;
    border-color: #4527a0;
}

.berea-send-btn:disabled {
    background: #b39ddb;
    border-color: #b39ddb;
    cursor: not-allowed;
}

/* ----- Crisis page ----- */
.berea-crisis-shell {
    max-width: 720px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(220, 53, 69, 0.12);
    border-top: 6px solid #dc3545;
}

.berea-crisis-shell h1 {
    color: #dc3545;
    font-weight: 700;
}

.berea-resource-card {
    background: #fff8f8;
    border: 1px solid #f5c2c7;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.berea-resource-card .label {
    font-weight: 600;
    color: #842029;
}

.berea-resource-card .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #dc3545;
}

.berea-resource-card a {
    color: #dc3545;
    text-decoration: none;
}

.berea-resource-card a:hover { text-decoration: underline; }

/* ----- Audit page ----- */
.berea-audit-row {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.berea-audit-row:hover {
    border-color: #5e35b1;
    box-shadow: 0 2px 8px rgba(94, 53, 177, 0.1);
}

.berea-audit-flag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 0.25rem;
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffe69c;
}

.berea-audit-flag.severity-Block { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.berea-audit-flag.severity-Caution { background: #fff3cd; color: #664d03; border-color: #ffe69c; }
.berea-audit-flag.severity-Info { background: #cfe2ff; color: #084298; border-color: #b6d4fe; }
