/* ==========================================================================
   AI SMART LOCAL AGENT — Full-Page LocalAI Chatbot Styles
   Midnight Navy · Electric Blue & Cyan · Glassmorphic Chat Interface
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.localai-workspace {
  margin-top: calc(var(--nav-height) + 18px);
  margin-bottom: 18px;
  height: calc(100vh - var(--nav-height) - 36px);
  min-height: 580px;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

/* ==========================================================================
   LEFT SIDEBAR
   ========================================================================== */

.localai-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  overflow-y: auto;
  background: rgba(10, 17, 34, 0.78);
  border-color: rgba(56, 189, 248, 0.2);
}

.localai-page-title {
  margin: 12px 0 8px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.localai-page-subtitle {
  margin: 0 0 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.localai-demo-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(124, 58, 237, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.24);
  font-size: 0.77rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.localai-demo-badge {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: rgba(34, 211, 238, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.36);
  color: var(--accent-cyan-bright);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.localai-block-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.localai-prompt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.68);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.prompt-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(30, 41, 59, 0.85);
  box-shadow: 0 8px 20px -10px rgba(6, 182, 212, 0.45);
}

.prompt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.prompt-dot--amber { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }
.prompt-dot--emerald { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
.prompt-dot--cyan { background: #22d3ee; box-shadow: 0 0 8px rgba(34, 211, 238, 0.6); }
.prompt-dot--violet { background: #a78bfa; box-shadow: 0 0 8px rgba(167, 139, 250, 0.6); }

.localai-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--glass-border);
}

.sidebar-action-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.52);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.sidebar-action-link:hover {
  border-color: var(--glass-border-hover);
  color: var(--accent-cyan-bright);
  background: rgba(34, 211, 238, 0.08);
}

.sidebar-action-link--subtle {
  color: var(--text-muted);
}

/* ==========================================================================
   MAIN CHAT PANEL
   ========================================================================== */

.localai-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: rgba(8, 14, 28, 0.82);
  border-color: rgba(56, 189, 248, 0.22);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(12, 20, 39, 0.65);
}

.chat-header-id {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(6, 182, 212, 0.24));
  border: 1px solid rgba(34, 211, 238, 0.42);
  color: var(--accent-cyan-bright);
  box-shadow: 0 0 20px -6px rgba(34, 211, 238, 0.55);
  flex-shrink: 0;
}

.chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chat-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--accent-cyan-bright);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22d3ee;
  box-shadow: 0 0 8px #22d3ee;
}

.chat-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-home-btn {
  display: none;
}

/* Message Feed */
.chat-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-feed::-webkit-scrollbar {
  width: 6px;
}

.chat-feed::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 82%;
  animation: msgSlideIn 220ms var(--ease-out);
}

.msg-row--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-row--ai {
  align-self: flex-start;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--accent-cyan-bright);
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.msg-row--user .msg-content {
  align-items: flex-end;
}

.msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.94rem;
  line-height: 1.55;
  white-space: pre-line;
}

.msg-row--user .msg-bubble {
  background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
  color: #ffffff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 10px 24px -12px rgba(6, 182, 212, 0.55);
}

.msg-row--ai .msg-bubble {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

.msg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.msg-tag {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: #7dd3fc;
  font-size: 0.72rem;
  font-weight: 600;
}

.msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.msg-action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
  font-size: 0.76rem;
  font-weight: 600;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.msg-action-link:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.55);
  color: #ffffff;
}

.msg-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
  padding: 0 4px;
}

/* Typing Indicator */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-cyan-bright);
  opacity: 0.4;
  animation: typingBounce 1.1s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

/* Mobile Prompts Strip */
.localai-mobile-prompts {
  display: none;
  gap: 8px;
  padding: 10px 16px 0;
  overflow-x: auto;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.localai-mobile-prompts .prompt-chip {
  width: auto;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 7px 12px;
  font-size: 0.8rem;
}

/* Bottom Composer */
.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px 16px;
  border-top: 1px solid var(--glass-border);
  background: rgba(10, 17, 34, 0.78);
}

.chat-input {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  resize: none;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  line-height: 1.45;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input::placeholder {
  color: var(--text-subtle);
}

.chat-input:focus {
  border-color: var(--accent-cyan-bright);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.14);
}

.chat-send-btn {
  flex-shrink: 0;
  padding: 11px 18px;
}

@keyframes msgSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ==========================================================================
   RESPONSIVE LAYOUT
   ========================================================================== */

@media (max-width: 920px) {
  .localai-workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - var(--nav-height) - 24px);
  }

  .localai-sidebar {
    display: none;
  }

  .localai-chat-panel {
    height: calc(100vh - var(--nav-height) - 28px);
    min-height: 520px;
  }

  .chat-home-btn {
    display: inline-flex;
  }

  .localai-mobile-prompts {
    display: flex;
  }
}

@media (max-width: 600px) {
  .localai-workspace {
    margin-top: calc(var(--nav-height) + 10px);
    margin-bottom: 10px;
  }

  .chat-header {
    padding: 12px 14px;
  }

  .chat-home-btn {
    display: none;
  }

  .chat-feed {
    padding: 14px;
  }

  .msg-row {
    max-width: 92%;
  }

  .chat-composer {
    padding: 10px 12px 12px;
  }

  .chat-send-btn span {
    display: none;
  }

  .chat-send-btn {
    padding: 11px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg-row,
  .typing-dot {
    animation: none;
  }
}
