/* ===== AI Chat Page — page-specific styles ===== */
/* #325/T4: extracted from ai-chat.html <style> */

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

/* ── Chat Header ── */
.chat-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}
.ai-avatar {
    width: 56px; height: 56px;
    background: var(--glass-bg);
    border: 2px solid var(--gold);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.crescent-icon { width: 30px; height: 30px; fill: var(--gold); }
.ai-info h1 {
    font-family: 'Scheherazade New', serif;
    font-size: 1.6rem;
    color: var(--gold);
    line-height: 1.2;
}
.ai-subtitle { font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.status-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; color: #6EE7B7; margin-top: 0.25rem;
}
.status-dot {
    width: 7px; height: 7px;
    background: #22C55E; border-radius: 50%;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Scholar Badge ── */
.scholar-badge {
    display: inline-flex; align-items: center; gap: 0.6rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 1rem 0.4rem 0.75rem;
    border-radius: 999px;
    margin-top: 0.5rem;
    font-size: 0.82rem;
}
.scholar-badge .badge-color { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.scholar-badge .badge-title-ar { font-family:'Scheherazade New',serif; font-size:1rem; color:var(--gold); }
.scholar-badge .badge-name-tr { color:var(--muted); }
.scholar-badge .badge-level { color:var(--gold); font-size:0.75rem; }
.scholar-badge .badge-change { color:rgba(249,250,251,0.4); font-size:0.75rem; text-decoration:none; border-left:1px solid var(--glass-border); padding-left:0.6rem; transition:color 0.2s; }
.scholar-badge .badge-change:hover { color:var(--gold); }

/* ── Arabic RTL ── */
.arabic-text {
    font-family: 'Scheherazade New', serif;
    font-size: 1.15rem;
    line-height: 1.8;
    direction: rtl;
    text-align: right;
}

/* ── Chat Messages ── */
.chat-column { display: flex; flex-direction: column; gap: 1rem; }
.chat-messages {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    min-height: 460px;
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

.message { max-width: 82%; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.message.user { align-self: flex-end; }
.message.ai { align-self: flex-start; }

.message-bubble {
    padding: 0.875rem 1.125rem;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.925rem;
}
.message.user .message-bubble {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border-bottom-right-radius: 4px;
}
.message.ai .message-bubble {
    background: rgba(0,0,0,0.3);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
}
.message.ai .message-bubble strong { color: var(--gold); }
.message.ai .message-bubble ol,
.message.ai .message-bubble ul { padding-left: 1.25rem; margin: 0.5rem 0; }

.message-time { font-size: 0.7rem; color: rgba(249,250,251,0.4); margin-top: 0.3rem; }
.message.user .message-time { text-align: right; }
.message.ai .message-time { text-align: left; }

.source-badge {
    display: inline-block;
    background: rgba(245,158,11,0.12);
    border: 1px solid var(--glass-border);
    color: var(--gold);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    margin: 0.4rem 0.2rem 0 0;
}
.source-link { text-decoration: none; cursor: pointer; transition: opacity 0.15s; }
.source-link:hover { opacity: 0.75; text-decoration: underline; }

/* ── Suggestion Chips ── */
.suggestions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.suggestion-chip {
    background: transparent;
    color: var(--gold);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gold);
}
.suggestion-chip:hover { background: rgba(245,158,11,0.12); color: var(--text); }

/* ── Input Area ── */
.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--glass-bg);
    padding: 0.625rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    transition: border-color 0.2s;
}
.input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(16,185,129,0.4);
    border-color: var(--accent);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    padding: 0.5rem 0.25rem;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
}
.chat-input::placeholder { color: rgba(249,250,251,0.4); }

.send-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
}
.send-btn:hover { background: #059669; }
.send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Typing Indicator ── */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.875rem 1.125rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}
.typing-dot {
    width: 7px; height: 7px;
    background: var(--gold);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%,60%,100% { transform:translateY(0); opacity:0.3; }
    30% { transform:translateY(-5px); opacity:1; }
}

/* ── Sidebar ── */
.sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    align-self: start;
    position: sticky;
    top: 5rem;
}
.sidebar-section { margin-bottom: 1.75rem; }
.sidebar-section:last-child { margin-bottom: 0; }
.sidebar-title {
    font-family: 'Scheherazade New', serif;
    font-size: 1.05rem;
    color: var(--gold);
    margin-bottom: 0.875rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--glass-border);
}
.topic-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.topic-tag {
    background: rgba(245,158,11,0.12);
    color: var(--gold);
    border: 1px solid var(--glass-border);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}
.topic-tag:hover { background: rgba(245,158,11,0.2); }
.topic-tag .arabic { font-family:'Scheherazade New',serif; font-size:0.85rem; margin-right:0.25rem; }

.example-question {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    padding: 0.65rem 0.875rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.83rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--muted);
    line-height: 1.4;
}
.example-question:hover {
    border-color: var(--gold);
    color: var(--text);
    transform: translateX(3px);
}
.feature-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.65rem;
    font-size: 0.82rem;
    color: var(--muted);
}
.feature-dot { width:6px; height:6px; background:var(--gold); border-radius:50%; flex-shrink:0; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .app-container { grid-template-columns:1fr; padding:1rem; }
    .sidebar {
        display: none;
        position: fixed;
        top: 0; right: 0; bottom: 0;
        width: 280px;
        z-index: 200;
        overflow-y: auto;
        border-radius: 0;
        border: none;
        border-left: 1px solid var(--glass-border);
        background: #030712;
    }
    .sidebar.open { display: block; }
    #sidebarOverlay { display: none; position: fixed; inset:0; background:rgba(0,0,0,0.6); z-index:199; }
    #sidebarOverlay.open { display: block; }
    #sidebarToggle { display: flex !important; }
}
#sidebarToggle { display: none; }

.back-to-top {
    position: fixed; bottom: 2rem; right: 2rem;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 99;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: #059669; }

/* ── KG Warning Component ── */
.kg-warnings {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}
.kg-warning-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 0.8rem;
    line-height: 1.45;
    transition: opacity 200ms ease;
    font-family: var(--font-ui);
}
.kg-warning-item.bidat {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    color: #FCA5A5;
}
.kg-warning-item.zayif {
    background: rgba(245,158,11,0.10);
    border: 1px solid rgba(245,158,11,0.3);
    color: #FCD34D;
}
.kg-warning-item.kronoloji {
    background: rgba(249,115,22,0.10);
    border: 1px solid rgba(249,115,22,0.3);
    color: #FDBA74;
}
.kg-warning-icon { flex-shrink: 0; margin-top: 1px; }
@media (prefers-reduced-motion: reduce) {
    .kg-warning-item { transition: none; }
}

/* ── İsnad Graph Panel (#80) ── */
.isnad-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2);
    border-radius: 20px; padding: 5px 12px; font-size: 11px; color: #6EE7B7;
    cursor: pointer; transition: background 0.2s, border-color 0.2s;
    user-select: none; margin-top: 8px; margin-bottom: 6px;
}
.isnad-toggle:hover { background: rgba(16,185,129,0.14); border-color: rgba(16,185,129,0.35); }
.isnad-toggle .isnad-chevron { font-size: 9px; transition: transform 0.2s; }
.isnad-toggle.open .isnad-chevron { transform: rotate(180deg); }
.isnad-panel {
    display: none; background: rgba(16,185,129,0.04);
    border: 1px solid rgba(16,185,129,0.15); border-radius: 10px;
    padding: 12px 14px; margin-bottom: 6px;
}
.isnad-panel.open { display: block; animation: isnad-fade 0.15s ease; }
@keyframes isnad-fade { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }
.isnad-panel-header {
    font-size: 10px; color: rgba(249,250,251,0.35);
    text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px;
}
.isnad-rivayet {
    background: rgba(245,158,11,0.06); border: 1px solid rgba(245,158,11,0.15);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
}
.isnad-rivayet-arabic {
    font-family: 'Scheherazade New', serif; direction: rtl; text-align: right;
    color: #FCD34D; font-size: 14px; line-height: 1.8; margin-bottom: 4px;
}
.isnad-rivayet-source { font-size: 10px; color: rgba(249,250,251,0.4); }
.isnad-chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.isnad-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px; padding: 5px 10px; cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.isnad-badge:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.22); transform: translateY(-1px); }
.isnad-badge.bidati { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); }
.isnad-badge.active { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.08); }
.isnad-badge-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-ravi { background: #818CF8; } .dot-sahabi { background: #10B981; }
.dot-tabii { background: #60A5FA; } .dot-prophet { background: #F59E0B; }
.dot-bidati { background: #EF4444; }
.isnad-badge-name { font-size: 11px; color: rgba(249,250,251,0.85); }
.isnad-badge-type { font-size: 9px; color: rgba(249,250,251,0.4); }
.isnad-arrow { color: rgba(255,255,255,0.18); font-size: 13px; flex-shrink: 0; }
.isnad-node-info {
    display: none; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 8px 12px; font-size: 11px;
    color: rgba(249,250,251,0.7); margin-top: 6px; flex-wrap: wrap; gap: 16px;
}
.isnad-node-info.visible { display: flex; }
.isnad-info-item { display: flex; flex-direction: column; gap: 1px; }
.isnad-info-label { font-size: 9px; color: rgba(249,250,251,0.3); text-transform: uppercase; letter-spacing: 0.06em; }
.isnad-info-value { font-size: 11px; color: rgba(249,250,251,0.85); }
.isnad-info-value.menhec-selefi { color: #6EE7B7; }
.isnad-info-value.menhec-bidati { color: #FCA5A5; }
.isnad-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.isnad-legend-item { display: flex; align-items: center; gap: 4px; font-size: 9px; color: rgba(249,250,251,0.35); }
@media (prefers-reduced-motion: reduce) {
    .isnad-badge, .isnad-toggle { transition: none; }
    .isnad-panel.open { animation: none; }
}

/* === Phase 2: Inline-Style-Klassen (T21) === */
.chat-hidden { display: none; }
.chat-mt-half { margin-top: 0.5rem; }

/* ── Source Preview Card (#79) ── */
.source-preview-card {
    margin-top: 0.5rem;
    padding: 0.6rem 0.9rem;
    background: rgba(16,185,129,0.06);
    border-left: 3px solid var(--accent, #10B981);
    border-radius: 0 8px 8px 0;
    font-size: 0.82rem;
}
.source-preview-card .spc-title { font-weight: 600; color: var(--text, #F9FAFB); }
.source-preview-card .spc-page { color: var(--text-muted, rgba(249,250,251,0.5)); font-size: 0.76rem; margin-left: 0.4rem; display: inline; }
.source-preview-card .spc-snippet { color: var(--text-muted, rgba(249,250,251,0.65)); line-height: 1.5; margin-top: 0.3rem; font-style: italic; }
.source-preview-card .spc-action { color: var(--accent, #10B981); font-size: 0.74rem; margin-top: 0.4rem; display: inline-block; }
