/* ============================================================
   memory-card.css — URBot Visible Memory Card
   Dark theme, bottom-right anchored, non-intrusive
   ============================================================ */

/* ---- Chip (minimized pill) -------------------------------- */

.urbot-memory-chip {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 9996;

  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 12px;
  font-weight: 600;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  /* Enter animation */
  opacity: 0;
  transform: translateY(10px) scale(0.92);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s, border-color 0.2s;
}

.urbot-memory-chip--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.urbot-memory-chip:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: rgba(139, 92, 246, 0.7);
  color: #ddd6fe;
}

.urbot-memory-chip:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* ---- Card container --------------------------------------- */

.urbot-memory-card {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 9996;
  width: 310px;
  max-width: calc(100vw - 32px);

  background: #0d1117;
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(139, 92, 246, 0.08);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;

  /* Enter animation */
  opacity: 0;
  transform: translateY(14px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.urbot-memory-card--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ---- Collapsed state: only header visible ---------------- */

.urbot-memory-card--collapsed .urbot-mc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Expanded state --------------------------------------- */

.urbot-memory-card--expanded .urbot-mc-body {
  max-height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Header ---------------------------------------------- */

.urbot-mc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.15s;
}

.urbot-memory-card--expanded .urbot-mc-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.urbot-mc-header:hover {
  background: rgba(139, 92, 246, 0.06);
}

.urbot-mc-header:focus-visible {
  outline: 2px solid #8b5cf6;
  outline-offset: -2px;
  border-radius: 14px 14px 0 0;
}

.urbot-mc-brain {
  font-size: 16px;
  flex-shrink: 0;
}

.urbot-mc-title {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: #c4b5fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.urbot-mc-strength-chip {
  font-size: 10px;
  font-weight: 700;
  border: 1px solid currentColor;
  border-radius: 10px;
  padding: 2px 6px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.urbot-mc-toggle {
  font-size: 9px;
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.25s;
  line-height: 1;
}

.urbot-memory-card--expanded .urbot-mc-toggle {
  transform: rotate(180deg);
}

/* ---- Body ------------------------------------------------- */

.urbot-mc-body {
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

.urbot-mc-body::-webkit-scrollbar { width: 4px; }
.urbot-mc-body::-webkit-scrollbar-track { background: transparent; }
.urbot-mc-body::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.3); border-radius: 2px; }

/* ---- Strength section ------------------------------------- */

.urbot-mc-strength-section {
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.urbot-mc-strength-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #64748b;
  margin-bottom: 5px;
  font-weight: 500;
}

.urbot-mc-strength-val {
  font-weight: 700;
  font-size: 11px;
}

.urbot-mc-strength-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  height: 5px;
  overflow: hidden;
}

.urbot-mc-strength-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.urbot-mc-strength-hint {
  font-size: 10px;
  color: #475569;
  margin-top: 5px;
  font-style: italic;
}

/* ---- Memory list ------------------------------------------ */

.urbot-mc-list-section {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.urbot-mc-list-label {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.urbot-mc-empty {
  font-size: 11px;
  color: #475569;
  text-align: center;
  padding: 8px 0;
  font-style: italic;
}

.urbot-mc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.urbot-mc-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 6px 4px;
  border-radius: 6px;
  transition: background 0.15s, opacity 0.25s, transform 0.25s;
}

.urbot-mc-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.urbot-mc-item--removing {
  opacity: 0;
  transform: translateX(20px);
}

.urbot-mc-item-icon {
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
  width: 16px;
  text-align: center;
}

.urbot-mc-item-text {
  flex: 1;
  min-width: 0;
}

.urbot-mc-item-subject {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.4;
  word-break: break-word;
}

.urbot-mc-item-meta {
  font-size: 9.5px;
  color: #475569;
  margin-top: 1px;
}

.urbot-mc-item-del {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #334155;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
  transition: color 0.15s;
  margin-top: 1px;
}

.urbot-mc-item-del:hover { color: #ef4444; }
.urbot-mc-item-del:focus-visible { outline: 1px solid #ef4444; }

.urbot-mc-more {
  font-size: 10.5px;
  color: #8b5cf6;
  text-align: center;
  padding: 4px 0 0;
  font-weight: 500;
}

/* ---- Add memory section ----------------------------------- */

.urbot-mc-add-section {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.urbot-mc-add-label {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.urbot-mc-add-row {
  display: flex;
  gap: 6px;
}

.urbot-mc-add-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 11px;
  padding: 6px 9px;
  font-family: inherit;
  transition: border-color 0.15s;
  min-width: 0;
}

.urbot-mc-add-input::placeholder { color: #334155; }

.urbot-mc-add-input:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.5);
}

.urbot-mc-add-btn {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.urbot-mc-add-btn:hover:not(:disabled) {
  background: rgba(139, 92, 246, 0.35);
  color: #ddd6fe;
}

.urbot-mc-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Footer ---------------------------------------------- */

.urbot-mc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
}

.urbot-mc-forget-btn {
  background: none;
  border: none;
  color: #475569;
  font-size: 10px;
  cursor: pointer;
  padding: 2px 0;
  font-family: inherit;
  transition: color 0.15s;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.urbot-mc-forget-btn:hover { color: #ef4444; }

.urbot-mc-close-btn {
  background: none;
  border: none;
  color: #475569;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
  border-radius: 4px;
  transition: color 0.15s;
}

.urbot-mc-close-btn:hover { color: #94a3b8; }
.urbot-mc-close-btn:focus-visible { outline: 1px solid #8b5cf6; }

/* ---- Reduced motion --------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .urbot-memory-card,
  .urbot-memory-chip,
  .urbot-mc-item,
  .urbot-mc-strength-fill {
    transition: none !important;
    animation: none !important;
  }
  .urbot-memory-card--collapsed .urbot-mc-body,
  .urbot-memory-card--expanded .urbot-mc-body {
    transition: none !important;
  }
}

/* ---- Mobile adjustments ----------------------------------- */

@media (max-width: 380px) {
  .urbot-memory-card {
    right: 8px;
    bottom: 70px;
    width: calc(100vw - 16px);
    max-width: 320px;
  }
  .urbot-memory-chip {
    right: 8px;
    bottom: 70px;
  }
}
