/* Phantom Research Assistant — Apple-Minimal Glass UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ── Design tokens ──────────────────────────────────────────────── */
#pra-root {
  --pra-font:        'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;

  /* Glass / liquid */
  --pra-glass-bg:    rgba(255,255,255,0.72);
  --pra-glass-blur:  saturate(200%) blur(24px);
  --pra-glass-border:rgba(0,0,0,0.08);
  --pra-glass-shadow:0 8px 40px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);

  /* Surface layers */
  --pra-surface:     rgba(255,255,255,0.9);
  --pra-surface-2:   rgba(246,246,248,0.85);
  --pra-surface-3:   rgba(240,240,244,0.9);
  --pra-divider:     rgba(0,0,0,0.07);

  /* Typography */
  --pra-text-primary:  #1d1d1f;
  --pra-text-secondary:#6e6e73;
  --pra-text-tertiary: #aeaeb2;

  /* Accent — pure black, Apple-style */
  --pra-accent:       #1d1d1f;
  --pra-accent-hover: #3a3a3c;

  /* Status */
  --pra-status-on:    #34c759;
  --pra-status-off:   #ff3b30;

  /* Radius */
  --pra-r-lg:   20px;
  --pra-r-md:   12px;
  --pra-r-sm:   8px;
  --pra-r-pill: 100px;
}

/* ── Root wrapper ───────────────────────────────────────────────── */
#pra-root {
  font-family: var(--pra-font);
  -webkit-font-smoothing: antialiased;
  color: var(--pra-text-primary);
  /* inline block — fits inside page column */
  display: block;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* ── Main glass card ────────────────────────────────────────────── */
#pra-window {
  background: var(--pra-glass-bg);
  -webkit-backdrop-filter: var(--pra-glass-blur);
  backdrop-filter: var(--pra-glass-blur);
  border: 1px solid var(--pra-glass-border);
  border-radius: var(--pra-r-lg);
  box-shadow: var(--pra-glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* fixed height so messages scroll inside */
  height: 540px;
  position: relative;
}

/* subtle inner highlight — liquid glass top edge */
#pra-window::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--pra-r-lg);
  background: linear-gradient(
    160deg,
    rgba(255,255,255,0.55) 0%,
    rgba(255,255,255,0.0) 50%
  );
  pointer-events: none;
  z-index: 0;
}
#pra-window > * { position: relative; z-index: 1; }

/* ── Header ─────────────────────────────────────────────────────── */
.pra-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--pra-divider);
  background: rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.pra-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pra-header-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--pra-surface-3);
  border: 1px solid var(--pra-glass-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--pra-text-primary);
  flex-shrink: 0;
}
.pra-header-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--pra-text-primary);
  letter-spacing: -0.01em;
}
.pra-header-sub {
  font-size: 11px;
  color: var(--pra-text-tertiary);
  letter-spacing: 0.01em;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.pra-header-sub::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--pra-status-on);
  display: inline-block;
}
.pra-ruo-badge {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pra-text-tertiary);
  background: var(--pra-surface-3);
  border: 1px solid var(--pra-divider);
  border-radius: var(--pra-r-pill);
  padding: 3px 9px;
}

/* ── Messages area ──────────────────────────────────────────────── */
.pra-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.pra-messages::-webkit-scrollbar { width: 3px; }
.pra-messages::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}

/* ── Message rows ───────────────────────────────────────────────── */
.pra-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: pra-msg-in 0.2s ease;
}
.pra-msg-user { flex-direction: row-reverse; }

@keyframes pra-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pra-msg-av {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--pra-surface-3);
  border: 1px solid var(--pra-divider);
  display: flex; align-items: center; justify-content: center;
  font-size: 8px;
  font-weight: 600;
  color: var(--pra-text-secondary);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* Bubbles */
.pra-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

/* Bot bubble — glass */
.pra-msg-bot .pra-msg-bubble {
  background: rgba(255,255,255,0.75);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 16px 16px 16px 4px;
  color: var(--pra-text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* User bubble — dark fill */
.pra-msg-user .pra-msg-bubble {
  background: var(--pra-accent);
  border-radius: 16px 16px 4px 16px;
  color: #fff;
}

.pra-msg-bubble strong { font-weight: 600; }
.pra-msg-bubble em { color: var(--pra-text-secondary); font-style: normal; font-size: 12px; }
.pra-msg-bot .pra-msg-bubble a {
  color: var(--pra-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Status badges ──────────────────────────────────────────────── */
.pra-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: var(--pra-r-pill);
  letter-spacing: 0.02em;
}
.pra-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
}
.pra-badge-green {
  background: rgba(52,199,89,0.1);
  color: #248a3d;
  border: 1px solid rgba(52,199,89,0.2);
}
.pra-badge-green::before { background: var(--pra-status-on); }
.pra-badge-red {
  background: rgba(255,59,48,0.08);
  color: #c0392b;
  border: 1px solid rgba(255,59,48,0.15);
}
.pra-badge-red::before { background: var(--pra-status-off); }

/* ── Link button ────────────────────────────────────────────────── */
.pra-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 6px 14px;
  border-radius: var(--pra-r-pill);
  background: var(--pra-accent);
  color: #fff !important;
  text-decoration: none !important;
  transition: opacity 0.15s;
}
.pra-link-btn:hover { opacity: 0.82; }

/* ── Typing indicator ───────────────────────────────────────────── */
.pra-typing {
  display: flex;
  gap: 4px;
  padding: 4px 2px;
  align-items: center;
}
.pra-typing span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--pra-text-tertiary);
  animation: pra-bounce 1.3s ease-in-out infinite;
}
.pra-typing span:nth-child(2) { animation-delay: 0.18s; }
.pra-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pra-bounce {
  0%,60%,100% { transform: translateY(0);  opacity: 0.5; }
  30%         { transform: translateY(-5px); opacity: 1; }
}

/* ── Quick suggestion chips ─────────────────────────────────────── */
.pra-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.pra-suggest-btn {
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--pra-text-secondary);
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--pra-r-pill);
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}
.pra-suggest-btn:hover {
  background: rgba(255,255,255,0.95);
  color: var(--pra-text-primary);
  border-color: rgba(0,0,0,0.2);
}

/* ── Comparison card ────────────────────────────────────────────── */
.pra-compare-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--pra-r-md);
  overflow: hidden;
  margin-top: 4px;
  width: 100%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.pra-compare-head {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: rgba(246,246,248,0.8);
}
.pra-compare-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pra-text-tertiary);
  margin-bottom: 2px;
}
.pra-compare-title { font-size: 12px; color: var(--pra-text-secondary); }
.pra-compare-grid { display: grid; grid-template-columns: 1fr 1fr; }
.pra-compare-col {
  padding: 12px;
  border-right: 1px solid rgba(0,0,0,0.06);
}
.pra-compare-col:last-child { border-right: none; }
.pra-compare-col-name {
  font-size: 13px; font-weight: 600;
  color: var(--pra-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.pra-cf { border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 7px; margin-bottom: 7px; }
.pra-cf:last-child { border-bottom: none; margin-bottom: 0; }
.pra-cf-label {
  font-size: 8px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--pra-text-tertiary); margin-bottom: 2px;
}
.pra-cf-val { font-size: 11px; color: var(--pra-text-secondary); line-height: 1.45; }
.pra-cf-val strong { color: var(--pra-text-primary); font-weight: 500; }
.pra-compare-cta {
  padding: 10px 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: rgba(246,246,248,0.8);
  display: flex; gap: 8px;
}
.pra-cta-btn {
  flex: 1;
  background: var(--pra-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 7px 10px;
  border-radius: var(--pra-r-sm);
  text-align: center;
  cursor: pointer; border: none;
  text-decoration: none; display: block;
  transition: opacity 0.15s;
}
.pra-cta-btn:hover { opacity: 0.82; }
.pra-cta-btn.ghost {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--pra-text-secondary);
}
.pra-cta-btn.ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Recommendation card ────────────────────────────────────────── */
.pra-rec-card {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--pra-r-md);
  overflow: hidden;
  margin-top: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.pra-rec-head {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: rgba(246,246,248,0.8);
}
.pra-rec-stack-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--pra-text-primary);
  letter-spacing: -0.01em;
}
.pra-rec-reason {
  font-size: 11.5px;
  color: var(--pra-text-secondary);
  padding: 10px 14px;
  line-height: 1.55;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.pra-rec-items { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.pra-rec-item {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(246,246,248,0.7);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--pra-r-sm);
  padding: 8px 12px;
}
.pra-rec-item-name { font-size: 12px; font-weight: 500; color: var(--pra-text-primary); }
.pra-rec-item-right { display: flex; align-items: center; gap: 8px; }
.pra-rec-item a {
  font-size: 11px;
  font-weight: 500;
  color: var(--pra-text-secondary);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.pra-rec-item a:hover { color: var(--pra-accent); }

/* ── Input area ─────────────────────────────────────────────────── */
.pra-input-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--pra-divider);
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
  background: rgba(255,255,255,0.5);
}
.pra-input {
  flex: 1;
  background: var(--pra-surface-3);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--pra-r-md);
  padding: 9px 13px;
  font-family: var(--pra-font);
  font-size: 13.5px;
  color: var(--pra-text-primary);
  resize: none; outline: none;
  line-height: 1.5;
  max-height: 100px; min-height: 38px;
  transition: border-color 0.15s, background 0.15s;
}
.pra-input::placeholder { color: var(--pra-text-tertiary); }
.pra-input:focus {
  border-color: rgba(0,0,0,0.25);
  background: rgba(255,255,255,0.9);
}

.pra-send-btn {
  width: 36px; height: 36px;
  border-radius: var(--pra-r-sm);
  background: var(--pra-accent);
  color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
}
.pra-send-btn:hover { opacity: 0.82; }
.pra-send-btn:active { transform: scale(0.93); }
.pra-send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Disclaimer ─────────────────────────────────────────────────── */
.pra-disclaimer {
  padding: 8px 16px;
  border-top: 1px solid rgba(0,0,0,0.04);
  font-size: 10px;
  color: var(--pra-text-tertiary);
  text-align: center;
  letter-spacing: 0.01em;
  background: rgba(246,246,248,0.5);
  flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #pra-window { height: 480px; border-radius: var(--pra-r-md); }
  .pra-msg-bubble { max-width: 88%; font-size: 13px; }
}
