/* ==============================================================================
   CorpSec System AI Assistant (Google Gemini Telemetry & Performance Analyst)
   ============================================================================== */

.ai-assistant-panel {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  margin-bottom: 24px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.ai-assistant-header {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.ai-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.4);
}

.ai-header-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #FFFFFF;
}

.ai-header-subtitle {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
}

.ai-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.ai-badge-model {
  background: rgba(99, 102, 241, 0.2);
  color: #A5B4FC;
  border-color: rgba(99, 102, 241, 0.3);
}

.ai-badge-grounded {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

.ai-badge-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399;
  box-shadow: 0 0 8px #34D399;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.ai-btn-sm {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ai-btn-sm:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

/* Quick Starter Chips */
.ai-starter-chips-container {
  padding: 12px 18px;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.ai-chips-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chip-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #1E293B;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ai-chip-btn:hover {
  background: #EEF2FF;
  border-color: #6366F1;
  color: #4F46E5;
  transform: translateY(-1px);
}

/* Message Feed */
.ai-messages-container {
  padding: 20px;
  max-height: 480px;
  min-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #FFFFFF;
}

/* Welcome Hero Box */
.ai-welcome-box {
  background: linear-gradient(135deg, #F8FAFC 0%, #EEF2FF 100%);
  border: 1px solid #E0E7FF;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 8px 0;
}

.ai-welcome-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.ai-welcome-title {
  font-size: 15px;
  font-weight: 800;
  color: #1E293B;
  margin-bottom: 4px;
}

.ai-welcome-text {
  font-size: 12px;
  color: #64748B;
  max-width: 620px;
  margin: 0 auto 14px auto;
  line-height: 1.5;
}

/* Messages */
.ai-message {
  display: flex;
  gap: 12px;
  max-width: 100%;
}

.ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ai-avatar-user {
  background: #E2E8F0;
  color: #0F172A;
}

.ai-avatar-model {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.ai-message-bubble {
  flex: 1;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.ai-message-user .ai-message-bubble {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

.ai-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-message-author {
  font-size: 12px;
  font-weight: 800;
  color: #0F172A;
}

.ai-message-time {
  font-size: 10px;
  color: #94A3B8;
}

.ai-message-content {
  font-size: 14px;
  line-height: 1.65;
  color: #0F172A;
  word-break: break-word;
  letter-spacing: 0.15px;
}

/* Markdown Specific Styling */
.ai-md-h3 { font-size: 16px; font-weight: 800; color: #0F172A; margin: 14px 0 8px 0; }
.ai-md-h4 { font-size: 14.5px; font-weight: 700; color: #1E293B; margin: 12px 0 6px 0; }
.ai-md-h5 { font-size: 13px; font-weight: 700; color: #334155; margin: 10px 0 5px 0; }

.ai-p { margin-bottom: 10px; font-size: 14px; line-height: 1.65; color: #0F172A; }
.ai-p:last-child { margin-bottom: 0; }

.ai-bullet-list {
  padding-left: 22px;
  margin: 8px 0 12px 0;
}

.ai-bullet-item {
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.6;
  color: #1E293B;
}

.ai-inline-code {
  background: #EEF2FF;
  color: #4338CA;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.ai-code-block {
  background: #0F172A;
  color: #F8FAFC;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: Consolas, monospace;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.ai-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 10px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ai-table th {
  background: #F8FAFC;
  color: #334155;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #E2E8F0;
  white-space: nowrap;
}

.ai-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  color: #1E293B;
  vertical-align: middle;
}

.ai-table tr:last-child td {
  border-bottom: none;
}

.ai-table tr:hover td {
  background: #F8FAFC;
}

/* AI Status Badges inside Tables & Content */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.ai-badge-success {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.ai-badge-warning {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.ai-badge-danger {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.ai-badge-neutral {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.ai-hr {
  border: 0;
  height: 1px;
  background: #E2E8F0;
  margin: 12px 0;
}

.ai-alert {
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.5;
}

.ai-alert-note {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1E40AF;
}

.ai-alert-warning {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
}

.ai-alert-tip {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #166534;
}

.ai-alert-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* Loader Shimmer */
.ai-loader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  border-radius: 12px;
  color: #4338CA;
  font-size: 12px;
  font-weight: 700;
}

.ai-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #818CF8;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* Input Bar */
.ai-assistant-input-bar {
  padding: 14px 18px;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.ai-input-wrap {
  flex: 1;
  position: relative;
}

.ai-textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  font-size: 13px;
  border: 1.5px solid #CBD5E1;
  border-radius: 10px;
  background: #FFFFFF;
  color: #0F172A;
  resize: none;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color 0.15s ease;
}

.ai-textarea:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.ai-send-btn {
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  background: linear-gradient(135deg, #4338CA 0%, #3730A3 100%);
  transform: translateY(-1px);
}

.ai-send-btn:active {
  transform: translateY(0);
}

.ai-input-hint {
  font-size: 10px;
  color: #94A3B8;
  margin-top: 4px;
  padding-left: 2px;
}

/* ==============================================================================
   Persistent Floating Gemini AI Assistant Launcher Widget (Draggable Anywhere)
   ============================================================================== */
.ai-floating-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: inherit;
  touch-action: none;
}

.ai-floating-widget-container.is-dragging {
  user-select: none !important;
  -webkit-user-select: none !important;
}

.ai-floating-widget-container.is-dragging .ai-floating-widget-btn {
  transition: none !important;
  cursor: grabbing !important;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.55), 0 0 25px rgba(99, 102, 241, 0.45) !important;
}

/* Floating AI Pill */
.ai-floating-widget-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 100%);
  color: #FFFFFF;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.4), 0 0 16px rgba(99, 102, 241, 0.25);
  cursor: grab;
  border: 2px solid rgba(99, 102, 241, 0.6);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.ai-floating-widget-btn:active {
  cursor: grabbing;
}

.ai-floating-widget-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.5), 0 0 24px rgba(99, 102, 241, 0.4);
  border-color: #818CF8;
}

.ai-drag-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-size: 13px;
  cursor: grab;
  letter-spacing: -2px;
  margin-right: -2px;
  opacity: 0.7;
  user-select: none;
}

.ai-floating-widget-btn:hover .ai-drag-grip {
  opacity: 1;
  color: #E2E8F0;
}

.ai-floating-icon {
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.6));
  animation: ai-icon-pulse 3s infinite ease-in-out;
}

@keyframes ai-icon-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.4)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.8)); }
}

.ai-floating-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #FFFFFF;
}

.ai-floating-gemini-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Glowing animation when AI Assistant is activated by clicking widget */
.ai-panel-highlight {
  outline: 3px solid #6366F1 !important;
  box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.25), 0 20px 45px rgba(99, 102, 241, 0.2) !important;
  transition: all 0.3s ease !important;
}

.ai-input-focus-pulse {
  outline: 3px solid #7C3AED !important;
  box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.3) !important;
  transition: all 0.2s ease !important;
}

/* ==============================================================================
   Compact Dashboard AI Banner (1-line sleek launcher on Executive Dashboard)
   ============================================================================== */
.dash-ai-quick-banner {
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.12);
  transition: all 0.2s ease;
}

.dash-ai-quick-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px -2px rgba(99, 102, 241, 0.25);
  border-color: #818CF8;
}

.dash-ai-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-ai-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.4);
  flex-shrink: 0;
}

.dash-ai-banner-title {
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dash-ai-banner-badge {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.dash-ai-banner-badge-grounded {
  background: rgba(34, 197, 94, 0.18);
  color: #4ADE80;
  border: 1px solid rgba(74, 222, 128, 0.35);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.dash-ai-banner-sub {
  color: #94A3B8;
  font-size: 12px;
  margin-top: 3px;
}

.dash-ai-banner-btn {
  background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.dash-ai-banner-btn:hover {
  background: linear-gradient(135deg, #4338CA 0%, #4F46E5 100%);
  transform: translateX(2px);
}

/* ==============================================================================
   Dedicated AI Assistant & Telemetry Charts Page Styling
   ============================================================================== */
.ai-page-hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 100%);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.15);
}

.ai-hero-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ai-hero-icon-bubble {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.45);
  flex-shrink: 0;
}

.ai-hero-title {
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-hero-subtitle {
  font-size: 12px;
  color: #94A3B8;
  margin-top: 4px;
  max-width: 650px;
}

.ai-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* AI Telemetry & Health Charts Grid */
.ai-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.ai-chart-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.ai-chart-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.ai-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ai-chart-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ai-chart-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ai-chart-icon-box.cpu { background: #EEF2FF; color: #4F46E5; }
.ai-chart-icon-box.ram { background: #FAF5FF; color: #9333EA; }
.ai-chart-icon-box.db { background: #ECFDF5; color: #059669; }
.ai-chart-icon-box.alerts { background: #FEF2F2; color: #DC2626; }

.ai-chart-main-val {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ai-chart-main-val span:first-child {
  font-size: 26px;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
}

.ai-chart-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

.ai-chart-tag.ok {
  background: #DCFCE7;
  color: #15803D;
}

.ai-chart-tag.warn {
  background: #FEF3C7;
  color: #B45309;
}

.ai-chart-tag.danger {
  background: #FEE2E2;
  color: #B91C1C;
}

.ai-chart-progress-track {
  width: 100%;
  height: 8px;
  background: #F1F5F9;
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.ai-chart-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

.ai-chart-progress-fill.cpu { background: linear-gradient(90deg, #4F46E5, #818CF8); }
.ai-chart-progress-fill.ram { background: linear-gradient(90deg, #9333EA, #C084FC); }
.ai-chart-progress-fill.db { background: linear-gradient(90deg, #059669, #34D399); }

.ai-chart-footer {
  font-size: 11px;
  color: #64748B;
  font-weight: 500;
}

.ai-chart-details-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.ai-alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #475569;
}

.ai-alert-row strong {
  font-weight: 700;
  color: #0F172A;
}
