/* ══════════════════════════════════════════════════════════════
   prompt-bar.css — Masri AI floating prompt bar
   Scoped to .masri-prompt-bar — zero global selector pollution.
   Layout helper: body.has-prompt-bar adds bottom space to .main
══════════════════════════════════════════════════════════════ */

body.has-prompt-bar .main { padding-bottom: 84px; }

/* ── Root / tokens ───────────────────────────────────────────── */
.masri-prompt-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar, 240px);
  right: 0;
  z-index: 900;

  --mpb-accent:    #00F0C8;
  --mpb-bg:        rgba(10, 17, 35, 0.97);
  --mpb-border:    rgba(255,255,255,0.07);
  --mpb-r:         11px;
  --mpb-t:         all 0.20s cubic-bezier(0.4,0,0.2,1);
}

/* ── Input row ───────────────────────────────────────────────── */
.masri-prompt-bar .mpb-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 18px 12px;
  background: var(--mpb-bg);
  border-top: 1px solid var(--mpb-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* ── Mascot button ───────────────────────────────────────────── */
.masri-prompt-bar .mpb-mascot-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(0,240,200,0.10);
  border: 1px solid rgba(0,240,200,0.20);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: var(--mpb-t);
  align-self: flex-end;
  margin-bottom: 1px;
  outline: none;
}
.masri-prompt-bar .mpb-mascot-btn:hover {
  background: rgba(0,240,200,0.18);
  border-color: rgba(0,240,200,0.35);
}
.masri-prompt-bar .mpb-mascot-btn.thinking {
  animation: mpbMascotPulse 1.1s ease-in-out infinite;
}

/* ── Textarea input ──────────────────────────────────────────── */
.masri-prompt-bar .mpb-input-wrap { flex: 1; }
.masri-prompt-bar .mpb-input {
  width: 100%;
  min-height: 40px;
  max-height: 160px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--mpb-border);
  border-radius: var(--mpb-r);
  color: var(--text, #e2e8f0);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color 0.18s, background 0.18s;
  overflow-y: auto;
  box-sizing: border-box;
  display: block;
}
.masri-prompt-bar .mpb-input:focus {
  border-color: rgba(0,240,200,0.35);
  background: rgba(0,240,200,0.03);
}
.masri-prompt-bar .mpb-input::placeholder { color: rgba(255,255,255,0.28); }

/* ── Send button ─────────────────────────────────────────────── */
.masri-prompt-bar .mpb-send {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--mpb-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--mpb-t);
  align-self: flex-end;
  margin-bottom: 1px;
  outline: none;
}
.masri-prompt-bar .mpb-send:hover:not(:disabled) {
  background: #00d4b0;
  transform: scale(1.06);
}
.masri-prompt-bar .mpb-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.masri-prompt-bar .mpb-send svg {
  width: 17px; height: 17px;
  color: #060d1f;
}

/* ── Result panel ────────────────────────────────────────────── */
.masri-prompt-bar .mpb-panel {
  position: absolute;
  bottom: 100%;
  left: 0; right: 0;
  max-height: 480px;
  background: rgba(9, 15, 30, 0.98);
  border-top: 1px solid rgba(0,240,200,0.14);
  display: none;
  flex-direction: column;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
}
.masri-prompt-bar .mpb-panel.open {
  display: flex;
  animation: mpbSlideUp 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* Panel header */
.masri-prompt-bar .mpb-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.masri-prompt-bar .mpb-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mpb-accent);
  letter-spacing: 0.3px;
}
.masri-prompt-bar .mpb-panel-close {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--mpb-t);
  padding: 0;
  outline: none;
  line-height: 1;
}
.masri-prompt-bar .mpb-panel-close:hover {
  color: white;
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
}
.masri-prompt-bar .mpb-panel-close svg { width:12px; height:12px; }

/* Panel body */
.masri-prompt-bar .mpb-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 16px;
  font-size: 14px;
  color: var(--text, #e2e8f0);
  line-height: 1.75;
}
.masri-prompt-bar .mpb-panel-body::-webkit-scrollbar { width: 4px; }
.masri-prompt-bar .mpb-panel-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.09);
  border-radius: 4px;
}

/* User message echo */
.masri-prompt-bar .mpb-user-msg {
  font-size: 11px;
  color: rgba(255,255,255,0.38);
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thinking dots */
.masri-prompt-bar .mpb-thinking {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.38);
  font-size: 13px;
}
.masri-prompt-bar .mpb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mpb-accent);
  opacity: 0.6;
  animation: mpbDot 1.4s ease-in-out infinite;
}
.masri-prompt-bar .mpb-dot:nth-child(2) { animation-delay: 0.2s; }
.masri-prompt-bar .mpb-dot:nth-child(3) { animation-delay: 0.4s; }

/* AI response */
.masri-prompt-bar .mpb-response {
  white-space: pre-wrap;
  word-break: break-word;
}
.masri-prompt-bar .mpb-response strong { color: #ffffff; font-weight: 700; }
.masri-prompt-bar .mpb-response code {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: rgba(0,240,200,0.09);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--mpb-accent);
}

/* ── Generated image ─────────────────────────────────────────── */
.masri-prompt-bar .mpb-img-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.masri-prompt-bar .mpb-img {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  border-radius: 10px;
  border: 1px solid rgba(0,240,200,0.15);
  display: block;
  object-fit: contain;
  background: rgba(255,255,255,0.03);
}
.masri-prompt-bar .mpb-img-actions {
  display: flex;
  gap: 8px;
}
.masri-prompt-bar .mpb-img-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  background: rgba(0,240,200,0.10);
  border: 1px solid rgba(0,240,200,0.22);
  border-radius: 7px;
  color: var(--mpb-accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--mpb-t);
  font-family: 'Outfit', system-ui, sans-serif;
}
.masri-prompt-bar .mpb-img-dl:hover { background: rgba(0,240,200,0.20); }
.masri-prompt-bar .mpb-img-dl svg { width:13px; height:13px; }
.masri-prompt-bar .mpb-revised-prompt {
  font-size: 11px;
  color: rgba(255,255,255,0.30);
  font-style: italic;
  line-height: 1.5;
  margin-top: 2px;
}

/* Quota exhausted / error */
.masri-prompt-bar .mpb-error {
  color: #ff6b6b;
  font-size: 13px;
}
.masri-prompt-bar .mpb-upgrade-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 6px 14px;
  background: rgba(0,240,200,0.10);
  border: 1px solid rgba(0,240,200,0.22);
  border-radius: 7px;
  color: var(--mpb-accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--mpb-t);
}
.masri-prompt-bar .mpb-upgrade-link:hover { background: rgba(0,240,200,0.18); }

/* ── Keyframes ───────────────────────────────────────────────── */
@keyframes mpbMascotPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,240,200,0.35); }
  50%      { box-shadow: 0 0 0 7px rgba(0,240,200,0); }
}
@keyframes mpbSlideUp {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes mpbDot {
  0%,80%,100% { transform:scale(0.55); opacity:0.35; }
  40%          { transform:scale(1);    opacity:1; }
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .masri-prompt-bar {
    left: 0;
  }
  body.has-prompt-bar .main {
    padding-bottom: 84px;
  }
}
