/**
 * Poma Edge Panel — Peek-and-Expand Pattern (Portal / Vanilla JS)
 * Consistent with React versions in Hub and PMS.
 */

/* ── Tab Bar ─────────────────────────────────────────── */

.poma-panel-tabs {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10000;
}

.poma-panel-tab {
  width: 44px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.poma-panel-tab:hover {
  background: #334155;
  color: rgba(255, 255, 255, 0.8);
}

.poma-panel-tab.active {
  background: #0f172a;
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.2);
}

.poma-panel-tab svg {
  width: 20px;
  height: 20px;
}

.poma-panel-tab span {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

.poma-panel-tab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #22c55e;
  color: white;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Messenger Body ───────────────────────────────── */

.poma-messenger-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Panel Drawer ───────────────────────────────────── */

.poma-edge-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: #0f172a;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.3);
}

.poma-edge-panel.peek {
  transform: translateX(calc(100% - 220px));
}

.poma-edge-panel.expanded {
  transform: translateX(0);
}

/* ── Header ─────────────────────────────────────────── */

.poma-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(30, 41, 59, 0.5);
  min-height: 56px;
}

.poma-panel-header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(167, 139, 250, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.poma-panel-header-title {
  flex: 1;
  min-width: 0;
}

.poma-panel-header-name {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.2;
}

.poma-panel-header-subtitle {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

.poma-panel-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 18px;
  transition: all 0.2s;
}

.poma-panel-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

/* ── AI Messages ────────────────────────────────────── */

.poma-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.poma-ai-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.poma-ai-msg.user {
  flex-direction: row-reverse;
}

.poma-ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.poma-ai-msg.assistant .poma-ai-msg-avatar {
  background: rgba(167, 139, 250, 0.15);
}

.poma-ai-msg.user .poma-ai-msg-avatar {
  background: #334155;
}

.poma-ai-msg-bubble {
  max-width: 85%;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
}

.poma-ai-msg.assistant .poma-ai-msg-bubble {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top-left-radius: 2px;
}

.poma-ai-msg.user .poma-ai-msg-bubble {
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-top-right-radius: 2px;
  color: #e2e8f0;
}

.poma-ai-msg-bubble.error {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.05);
  color: #fca5a5;
}

.poma-ai-msg-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
  color: #475569;
}

.poma-ai-share-btn {
  background: none;
  border: none;
  color: #475569;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  transition: all 0.15s;
}

.poma-ai-share-btn:hover {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
}

.poma-ai-share-btn.copied {
  color: #34d399;
}

/* ── Suggestions ────────────────────────────────────── */

.poma-ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.poma-ai-suggestion {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s;
}

.poma-ai-suggestion:hover {
  border-color: rgba(167, 139, 250, 0.3);
  color: #e2e8f0;
}

/* ── Thinking ───────────────────────────────────────── */

.poma-ai-thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
}

@keyframes poma-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.poma-ai-thinking .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #475569;
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: poma-spin 1s linear infinite;
}

/* ── Input ──────────────────────────────────────────── */

.poma-ai-input-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 23, 42, 0.8);
  display: flex;
  gap: 8px;
}

.poma-ai-input {
  flex: 1;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #e2e8f0;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.poma-ai-input::placeholder { color: #475569; }
.poma-ai-input:focus { border-color: rgba(167, 139, 250, 0.4); }

.poma-ai-send {
  padding: 10px 16px;
  border-radius: 10px;
  background: #7c3aed;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}

.poma-ai-send:hover { background: #6d28d9; }
.poma-ai-send:disabled { opacity: 0.4; cursor: default; }

/* ── Messenger Placeholder ──────────────────────────── */

.poma-messenger-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #475569;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}

/* ── Responsive ─────────────────────────────────────── */

@media (max-width: 600px) {
  .poma-edge-panel { width: 100vw; }
}
