/* ==========================================================================
   AI SchoSys Copilot - Modern Glassmorphism Design System
   ========================================================================== */

:root {
  --ai-primary: #6366f1;
  --ai-primary-hover: #4f46e5;
  --ai-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --ai-gradient-glow: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, rgba(168, 85, 247, 0) 70%);
  --ai-surface: rgba(255, 255, 255, 0.95);
  --ai-surface-dark: rgba(17, 24, 39, 0.95);
  --ai-border: rgba(226, 232, 240, 0.8);
  --ai-text-main: #0f172a;
  --ai-text-muted: #64748b;
  --ai-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04), 0 0 30px rgba(99, 102, 241, 0.2);
}

/* Floating Launcher Button */
.ai-copilot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--ai-gradient);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.ai-copilot-launcher:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 14px 32px rgba(168, 85, 247, 0.55);
}

.ai-copilot-launcher svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
  transition: transform 0.3s ease;
}

.ai-copilot-launcher.active svg {
  transform: rotate(90deg);
}

.ai-launcher-pulse {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: var(--ai-gradient);
  opacity: 0.5;
  animation: ai-pulse 2.5s infinite;
  z-index: -1;
}

@keyframes ai-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* AI Copilot Chat Panel */
.ai-copilot-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 440px;
  max-width: calc(100vw - 48px);
  height: 640px;
  max-height: calc(100vh - 120px);
  background: var(--ai-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--ai-border);
  border-radius: 20px;
  box-shadow: var(--ai-shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-copilot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.ai-panel-header {
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.95) 100%);
  border-bottom: 1px solid var(--ai-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--ai-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ai-text-main);
  line-height: 1.2;
}

.ai-header-subtitle {
  font-size: 11px;
  color: var(--ai-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.ai-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ai-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ai-text-main);
}

/* Tab Navigation Bar */
.ai-panel-tabs {
  display: flex;
  padding: 8px 16px;
  gap: 8px;
  background: rgba(241, 245, 249, 0.7);
  border-bottom: 1px solid var(--ai-border);
}

.ai-tab-btn {
  flex: 1;
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ai-text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-tab-btn:hover {
  color: var(--ai-text-main);
  background: rgba(255, 255, 255, 0.6);
}

.ai-tab-btn.active {
  background: #ffffff;
  color: var(--ai-primary);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

/* History Panel */
.ai-history-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.ai-history-panel.active {
  display: flex;
}

.ai-history-item {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid var(--ai-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-history-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.ai-history-item.active {
  border-color: var(--ai-primary);
  background: rgba(99, 102, 241, 0.04);
}

.ai-history-info {
  flex: 1;
  min-width: 0;
}

.ai-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ai-text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-history-meta {
  font-size: 11px;
  color: var(--ai-text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-history-delete {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.6;
}

.ai-history-delete:hover {
  background: #fee2e2;
  color: #ef4444;
  opacity: 1;
}

.ai-history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ai-text-muted);
  font-size: 13px;
}

.ai-history-empty svg {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  stroke: #cbd5e1;
}

/* Chat Messages Container */
.ai-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.ai-panel-messages.hidden {
  display: none;
}

/* Message Bubbles */
.ai-message {
  display: flex;
  gap: 10px;
  max-width: 92%;
  animation: ai-slide-in 0.25s ease-out;
}

@keyframes ai-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.ai-message.assistant .ai-msg-avatar {
  background: var(--ai-gradient);
  color: white;
}

.ai-message.user .ai-msg-avatar {
  background: #e2e8f0;
  color: #475569;
}

.ai-msg-content {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.ai-message.assistant .ai-msg-content {
  background: #ffffff;
  color: var(--ai-text-main);
  border: 1px solid var(--ai-border);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-message.user .ai-msg-content {
  background: var(--ai-primary);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Markdown Elements in Bubble */
.ai-msg-content h1, .ai-msg-content h2, .ai-msg-content h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 8px 0 4px 0;
}

.ai-msg-content ul, .ai-msg-content ol {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.ai-msg-content li {
  margin-bottom: 4px;
}

.ai-msg-content code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.ai-msg-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
}

.ai-msg-content th, .ai-msg-content td {
  padding: 6px 8px;
  border: 1px solid var(--ai-border);
  text-align: left;
}

.ai-msg-content th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
}

/* Tool execution cards and technical badges: Hidden from end-user UI */
.ai-tool-card,
.ai-local-badge {
  display: none !important;
}

.ai-voice-select {
  height: 28px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ai-text-main);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.22);
  border-radius: 8px;
  padding: 0 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-voice-select:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
}

.ai-speaking {
  animation: ai-speaking-pulse 1.2s infinite ease-in-out !important;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.75) !important;
}

@keyframes ai-speaking-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.25); }
}

.ai-btn-undo-clean {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #4f46e5;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
}

.ai-btn-undo-clean:hover {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(99, 102, 241, 0.4);
}

.ai-btn-undo {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.ai-btn-undo:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fca5a5;
}

.ai-btn-icon.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--ai-primary);
}

/* Premade Prompts Overlay Drawer */
.ai-prompts-drawer {
  position: absolute;
  bottom: 64px;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--ai-border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  border-radius: 20px 20px 0 0;
  max-height: 380px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-prompts-drawer.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.ai-prompts-header {
  padding: 12px 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--ai-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 20px 20px 0 0;
}

.ai-prompts-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-prompts-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--ai-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.ai-prompts-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ai-text-main);
  line-height: 1.2;
}

.ai-prompts-subtitle {
  font-size: 10.5px;
  color: var(--ai-text-muted);
}

.ai-prompts-close-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.ai-prompts-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.ai-prompts-body {
  padding: 12px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
}

.ai-prompt-category-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8b5cf6;
  margin-top: 4px;
}

.ai-prompt-category-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-prompts-body .ai-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.9);
  color: var(--ai-text-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  line-height: 1.35;
}

.ai-prompts-body .ai-chip svg {
  color: #6366f1;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ai-prompts-body .ai-chip:hover {
  background: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.12);
  transform: translateX(3px);
  color: #4f46e5;
}

.ai-prompts-body .ai-chip:hover svg {
  transform: translateX(2px);
}

/* Prompt Toggle Button in Footer */
.ai-btn-prompt-toggle {
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.06);
  color: var(--ai-primary);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.ai-btn-prompt-toggle:hover,
.ai-btn-prompt-toggle.active {
  background: var(--ai-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Input Area */
.ai-panel-footer {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid var(--ai-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

#ai-copilot-container .noticeboard-composer-header,
#aiFooter .noticeboard-composer-header {
  display: none !important;
}

.ai-input-box {
  flex: 1;
  min-height: 42px;
  height: 42px;
  max-height: 120px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--ai-border);
  border-radius: 14px;
  font-size: 13px;
  color: var(--ai-text-main);
  outline: none;
  resize: none !important;
  overflow: hidden;
  line-height: 1.4;
  font-family: inherit;
  transition: all 0.2s ease;
}

.ai-input-box:focus {
  border-color: var(--ai-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ai-btn-submit {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--ai-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  flex-shrink: 0;
}

.ai-btn-submit:hover:not(:disabled) {
  transform: scale(1.05);
}

.ai-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-btn-mic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: #f1f5f9;
  color: var(--ai-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.ai-btn-mic:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--ai-primary);
}

.ai-btn-mic.listening {
  background: #ef4444;
  color: white;
  animation: ai-pulse 1.5s infinite;
}

/* Loading Dots Animation */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ai-primary);
  animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* ==========================================================================
   Custom Glassmorphic Modal & Confirmation System (Global)
   ========================================================================== */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.ai-modal-card {
  width: 90%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 30px rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 24px;
  text-align: center;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-modal-overlay.active .ai-modal-card {
  transform: scale(1) translateY(0);
}

.ai-modal-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ai-modal-icon-wrapper.danger {
  background: #fee2e2;
  color: #ef4444;
}

.ai-modal-icon-wrapper.warning {
  background: #fef3c7;
  color: #f59e0b;
}

.ai-modal-icon-wrapper.info {
  background: #e0e7ff;
  color: #6366f1;
}

.ai-modal-icon-wrapper.success {
  background: #d1fae5;
  color: #10b981;
}

.ai-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
  line-height: 1.3;
}

.ai-modal-message {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 22px;
}

.ai-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ai-modal-btn {
  flex: 1;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ai-modal-btn.cancel {
  background: #f1f5f9;
  color: #475569;
}

.ai-modal-btn.cancel:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.ai-modal-btn.confirm-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.ai-modal-btn.confirm-danger:hover {
  background: #dc2626;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.ai-modal-btn.confirm-primary {
  background: var(--ai-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ai-modal-btn.confirm-primary:hover {
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

/* ==========================================================================
   Floating Education Tier & Role Switcher Bar
   ========================================================================== */

.ai-tier-role-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 50px;
  padding: 4px 8px;
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.12), 0 2px 6px -1px rgba(15, 23, 42, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease;
}

@media (max-width: 1024px) {
  .ai-tier-role-bar {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
  }
}

.ai-tier-role-bar:hover {
  box-shadow: 0 12px 32px -4px rgba(99, 102, 241, 0.15), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  border-color: rgba(199, 210, 254, 0.9);
}

.ai-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: #f8fafc;
  color: #334155;
  transition: all 0.2s ease;
  user-select: none;
}

.ai-quick-pill:hover {
  background: #ede9fe;
  color: #4f46e5;
  border-color: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}

.ai-quick-pill.tier-active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
  color: #4338ca;
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 700;
}

.ai-quick-pill.role-active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.12) 100%);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
  font-weight: 700;
}

/* Dark Mode Navigation Pills (Crystal Clear High Contrast) */
html.dark .ai-quick-pill,
.dark .ai-quick-pill {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

html.dark .ai-quick-pill:hover,
.dark .ai-quick-pill:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

html.dark .ai-quick-pill.tier-active,
.dark .ai-quick-pill.tier-active {
  background: rgba(99, 102, 241, 0.3) !important;
  color: #e0e7ff !important;
  border-color: rgba(165, 180, 252, 0.45) !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

html.dark .ai-quick-pill.role-active,
.dark .ai-quick-pill.role-active {
  background: rgba(16, 185, 129, 0.3) !important;
  color: #d1fae5 !important;
  border-color: rgba(110, 231, 183, 0.45) !important;
  font-weight: 700 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

.ai-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  transition: all 0.2s ease;
  animation: pulseWarning 2s infinite;
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.ai-exit-btn:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Dropdown Menu Container */
.ai-dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: auto;
  width: 380px;
  max-height: 480px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  padding: 14px;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.2), 0 8px 16px -4px rgba(15, 23, 42, 0.08);
  display: none;
  flex-direction: column;
  gap: 8px;
  animation: dropdownSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 10000;
}

#aiTierDropdown {
  left: 0;
  right: auto;
}

#aiRoleDropdown {
  right: 0;
  left: auto;
}

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-dropdown-panel.open {
  display: flex;
}

.ai-dropdown-header {
  padding: 4px 6px 10px 6px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}

.ai-dropdown-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-dropdown-subtitle {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

/* Tier Card inside Dropdown */
.ai-tier-card-option {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #f1f5f9;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ai-tier-card-option:hover {
  background: #f8fafc;
  border-color: #c7d2fe;
  transform: translateX(2px);
}

.ai-tier-card-option.selected {
  background: #eff6ff;
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.ai-tier-icon {
  font-size: 22px;
  line-height: 1;
  margin-top: 2px;
}

.ai-tier-info {
  flex: 1;
}

.ai-tier-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-tier-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: #ede9fe;
  color: #6366f1;
}

.ai-tier-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.35;
}

/* Role Card inside Dropdown */
.ai-role-card-option {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-role-card-option:hover {
  background: #f8fafc;
  border-color: #a7f3d0;
  transform: translateX(2px);
}

.ai-role-card-option.selected {
  background: #ecfdf5;
  border-color: #10b981;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
}

.ai-role-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.ai-role-info {
  flex: 1;
}

.ai-role-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
}

.ai-role-email {
  font-size: 10.5px;
  color: #64748b;
}

.ai-role-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: #ede9fe;
  color: #6366f1;
  white-space: nowrap;
}

.ai-role-hint {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.35;
  font-style: italic;
}

.dark .ai-role-hint {
  color: #94a3b8;
}

/* Toast Notifications */
.ai-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100000;
  pointer-events: none;
}

.ai-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
