/* ═══════════════════════════════════════════════════════════════════
   Cepha App — extends CMUI-X for Sarmad AI platform
   ═══════════════════════════════════════════════════════════════════ */

/* ── Nav Brand ──────────────────────────────────────────────────── */
.cx-nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cx-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Nav Links ─────────────────────────────────────────────────── */
.cx-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.cx-nav-link {
  color: var(--cx-muted, #999);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all .25s ease;
  white-space: nowrap;
  position: relative;
}
.cx-nav-link:hover {
  color: var(--cx-text, #fff);
  background: rgba(255,255,255,.06);
}
.cx-nav-link.active {
  color: var(--cx-cyan) !important;
  background: rgba(0,200,255,.08);
  border-bottom: 2px solid var(--cx-cyan);
}

/* ── Nav Action Buttons (language, shield, persona) ─────────────── */
.cx-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px;
}
.cx-nav-action-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--cx-text);
  font-size: .85rem;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .3s ease;
  white-space: nowrap;
}
.cx-nav-action-btn:hover {
  background: rgba(255,255,255,.12);
  border-color: var(--cx-cyan);
}
.cx-shield-btn {
  font-size: 1.05rem;
  padding: 4px 8px;
  position: relative;
}
.cx-shield-btn.cx-shield-active {
  background: rgba(76,175,80,.15);
  border-color: #4caf50;
  box-shadow: 0 0 12px rgba(76,175,80,.3);
  animation: cx-shield-pulse 2s infinite;
}
@keyframes cx-shield-pulse {
  0%,100% { box-shadow: 0 0 8px rgba(76,175,80,.2); }
  50%     { box-shadow: 0 0 18px rgba(76,175,80,.5); }
}
.cx-persona-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 1rem;
  cursor: default;
  transition: all .5s ease;
}
.cx-persona-badge[style*="opacity: 1"] {
  border-color: var(--cx-violet);
  background: rgba(139,92,246,.1);
}

/* ── Mobile Nav Toggle ──────────────────────────────────────────── */
.cx-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--cx-border, #333);
  color: var(--cx-text);
  font-size: 1.3rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
@media (max-width: 768px) {
  .cx-nav-toggle { display: block; }
  .cx-nav-links { display: none; flex-direction: column; width: 100%; gap: 0; }
  .cx-nav-links.open { display: flex; }
  .cx-nav-link { padding: 12px 16px !important; border-bottom: 1px solid rgba(255,255,255,.05); }
  .cx-nav-actions { gap: 5px; margin: 0 6px; }
  .cx-nav-action-btn { padding: 4px 7px; font-size: .78rem; }
  .cx-persona-badge { width: 28px; height: 28px; font-size: .85rem; }
}

/* ── Main Content ───────────────────────────────────────────────── */
.cx-main {
  min-height: calc(100vh - 140px);
  padding: 2rem 0;
  position: relative;
  z-index: 1;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.cx-footer {
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255,255,255,.06);
  font-size: .8rem;
  color: var(--cx-muted, #666);
  position: relative;
  z-index: 1;
}

/* ── Stats Cards (Dashboard, Home) ──────────────────────────────── */
.stat-card {
  text-align: center;
  padding: 1.5rem;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cx-cyan), var(--cx-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-label {
  font-size: .85rem;
  color: var(--cx-muted, #888);
  margin-top: .25rem;
}

/* ── Chat UI ────────────────────────────────────────────────────── */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 200px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; scroll-behavior: smooth; }
.chat-input-row { display: flex; gap: .5rem; padding: 1rem; border-top: 1px solid rgba(255,255,255,.06); }
.chat-bubble {
  margin-bottom: .75rem;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.7;
  font-size: .9rem;
  word-break: break-word;
  max-width: 85%;
}
.chat-bubble--user {
  background: rgba(0,200,255,.06);
  border-right: 3px solid var(--cx-cyan);
  margin-left: auto;
}
.chat-bubble--ai {
  background: rgba(139,92,246,.06);
  border-right: 3px solid var(--cx-violet, #8b5cf6);
}
.chat-bubble--system {
  background: rgba(255,152,0,.06);
  border-right: 3px solid #ff9800;
  font-size: .82rem;
}
.chat-model-select {
  background: var(--cx-surface, #16162a);
  border: 1px solid var(--cx-border, #333);
  color: var(--cx-text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .85rem;
  outline: none;
}
.chat-model-select:focus { border-color: var(--cx-cyan); }

/* ── Memory Cards ───────────────────────────────────────────────── */
.memory-type-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.memory-type-chat { background: rgba(0,200,255,.15); }
.memory-type-error { background: rgba(244,67,54,.15); }
.memory-type-console { background: rgba(255,152,0,.15); }
.memory-type-pattern { background: rgba(139,92,246,.15); }

/* ── Progress Bars ──────────────────────────────────────────────── */
.success-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.success-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--cx-cyan), var(--cx-violet, #8b5cf6));
  transition: width .5s ease;
}

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--cx-muted, #666);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }

/* ── Section Headers ────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.section-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── Utilities ──────────────────────────────────────────────────── */
.fade-in { animation: cxFadeIn .5s ease; }
@keyframes cxFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-sm { font-size: .82rem; }
.text-xs { font-size: .72rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-sm { gap: .5rem; }
.w-full { width: 100%; }

/* ── RTL adjustments for chat ───────────────────────────────────── */
[dir="rtl"] .chat-bubble--user { margin-left: 0; margin-right: auto; border-right: none; border-left: 3px solid var(--cx-cyan); }
[dir="rtl"] .chat-bubble--ai { border-right: none; border-left: 3px solid var(--cx-violet, #8b5cf6); }
[dir="rtl"] .chat-bubble--system { border-right: none; border-left: 3px solid #ff9800; }

/* ── Markdown Rendering ─────────────────────────────────────── */
.cx-code-wrapper { position: relative; margin: 0.75rem 0; }
.cx-code-lang { position: absolute; top: 0; right: 0; padding: 2px 10px; font-size: 0.7rem; color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.05); border-radius: 0 8px 0 8px; }
.cx-code-block { background: #0a0a1a; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 1rem; overflow-x: auto; font-size: 0.82rem; line-height: 1.5; color: #a8e6cf; margin: 0; }
.cx-code-inline { background: rgba(102,126,234,0.15); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; color: #a8e6cf; font-family: 'Fira Code', monospace; }
.cx-md-h { color: var(--cx-primary, #667eea); margin: 0.75rem 0 0.25rem; font-weight: 700; }
h3.cx-md-h { font-size: 1.15rem; }
h4.cx-md-h { font-size: 1.05rem; }
h5.cx-md-h { font-size: 0.95rem; }
.cx-blockquote { border-left: 3px solid var(--cx-primary, #667eea); margin: 0.5rem 0; padding: 0.5rem 1rem; color: rgba(255,255,255,0.7); background: rgba(102,126,234,0.05); border-radius: 0 8px 8px 0; }
[dir="rtl"] .cx-blockquote { border-left: none; border-right: 3px solid var(--cx-primary, #667eea); border-radius: 8px 0 0 8px; }
.cx-md-list { margin: 0.5rem 0; padding-right: 1.5rem; }
[dir="ltr"] .cx-md-list { padding-left: 1.5rem; padding-right: 0; }
.cx-md-list li { margin: 0.25rem 0; line-height: 1.5; }
.cx-md-p { margin: 0.25rem 0; line-height: 1.6; }
.cx-md-link { color: #667eea; text-decoration: underline; text-underline-offset: 2px; }
.cx-md-link:hover { color: #8b5cf6; }
.cx-hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 0.75rem 0; }
