/* Agent Fox Client - Command Palette Mode
 * Spotlight-style command palette (Cmd/Ctrl+K)
 * ============================================= */

/* =========================================
   CSS Variables
   ========================================= */
:root {
  --palette-width: 640px;
  --palette-max-height: 480px;
  --palette-bg: #ffffff;
  --palette-border-radius: 16px;
  --palette-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --palette-backdrop: rgba(0, 0, 0, 0.5);
  --palette-input-height: 56px;
  --palette-transition: 200ms ease-out;
}

/* =========================================
   1. Backdrop Overlay
   ========================================= */
.agent-fox-palette-backdrop {
  position: fixed;
  inset: 0;
  background: var(--palette-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--palette-transition), visibility var(--palette-transition);
}

.agent-fox-palette-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* =========================================
   2. Palette Container
   ========================================= */
.agent-fox-palette {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  width: var(--palette-width);
  max-width: calc(100vw - 32px);
  max-height: var(--palette-max-height);
  background: var(--palette-bg);
  border-radius: var(--palette-border-radius);
  box-shadow: var(--palette-shadow);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--palette-transition),
              visibility var(--palette-transition),
              transform var(--palette-transition);
}

.agent-fox-palette.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* =========================================
   3. Input Area
   ========================================= */
.agent-fox-palette__input-wrapper {
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: var(--palette-input-height);
  border-bottom: 1px solid var(--border-color, #e9ecef);
  flex-shrink: 0;
}

.agent-fox-palette__icon {
  width: 24px;
  height: 24px;
  color: var(--muted-text, #6c757d);
  flex-shrink: 0;
  margin-right: 12px;
}

.agent-fox-palette__icon svg {
  width: 100%;
  height: 100%;
}

.agent-fox-palette__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 18px;
  font-weight: 400;
  background: transparent;
  color: var(--text-color, #333);
  padding: 0;
  height: 100%;
}

.agent-fox-palette__input::placeholder {
  color: var(--muted-text, #9ca3af);
}

.agent-fox-palette__kbd {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-text, #9ca3af);
  font-size: 12px;
  flex-shrink: 0;
}

.agent-fox-palette__kbd kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 11px;
  background: var(--background-color, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 4px;
}

/* =========================================
   4. Messages Container
   ========================================= */
.agent-fox-palette__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: none;
}

.agent-fox-palette__messages:not(:empty) {
  display: block;
}

.agent-fox-palette__messages .lafc-message {
  margin-bottom: 12px;
}

.agent-fox-palette__messages .lafc-user-message {
  background: var(--primary-color, #007bff);
  color: white;
  padding: 8px 12px;
  border-radius: 12px 12px 4px 12px;
  display: inline-block;
  max-width: 85%;
  margin-left: auto;
}

.agent-fox-palette__messages .lafc-assistant-message {
  background: var(--background-color, #f3f4f6);
  padding: 12px;
  border-radius: 12px;
}

.agent-fox-palette__messages .lafc-assistant-message .markdown-body {
  font-size: 14px;
  line-height: 1.6;
}

/* =========================================
   5. Loading State
   ========================================= */
.agent-fox-palette__loading {
  display: none;
  padding: 16px;
  text-align: center;
}

.agent-fox-palette.loading .agent-fox-palette__loading {
  display: block;
}

.agent-fox-palette__loading-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.agent-fox-palette__loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary-color, #007bff);
  border-radius: 50%;
  animation: palette-dot-bounce 1.4s infinite ease-in-out both;
}

.agent-fox-palette__loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.agent-fox-palette__loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes palette-dot-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* =========================================
   6. Footer / Hints
   ========================================= */
.agent-fox-palette__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid var(--border-color, #e9ecef);
  font-size: 12px;
  color: var(--muted-text, #9ca3af);
  flex-shrink: 0;
}

.agent-fox-palette__footer-hint {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-fox-palette__footer-hint span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =========================================
   7. Mobile Styles
   ========================================= */
@media screen and (max-width: 640px) {
  .agent-fox-palette {
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }

  .agent-fox-palette.active {
    transform: none;
  }

  .agent-fox-palette__input-wrapper {
    height: 60px;
  }

  .agent-fox-palette__input {
    font-size: 16px;
  }

  .agent-fox-palette__kbd {
    display: none;
  }

  .agent-fox-palette__messages {
    flex: 1;
    padding: 12px;
  }
}

/* =========================================
   8. Animations
   ========================================= */
@media (prefers-reduced-motion: reduce) {
  .agent-fox-palette,
  .agent-fox-palette-backdrop {
    transition: none;
  }
}
