/* AI Mentor modal styles extracted from inline index styles */
.ai-assistant-modal-dialog {
  width: 96vw;
  max-width: 1240px;
  margin: 20px auto;
}

.ai-assistant-modal-dialog .modal-content {
  border: 1px solid #dbe6ff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(21, 31, 74, 0.22);
  overflow: hidden;
  background: #f6f9ff;
}

.ai-assistant-modal-header {
  background: linear-gradient(90deg, #4f46e5 0%, #6366f1 45%, #7c8cff 100%);
  color: #fff;
  border-bottom: none;
  padding: 12px 18px;
}

.ai-assistant-modal-header .close {
  color: #fff;
  opacity: 0.94;
  text-shadow: none;
}

.ai-assistant-modal-header .close:hover {
  opacity: 1;
}

.ai-assistant-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

.ai-assistant-title-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.ai-assistant-modal-content .modal-body {
  padding: 14px;
  background: linear-gradient(180deg, #f8faff 0%, #f1f6ff 100%);
}

.ai-mentor-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 10px;
  min-height: 460px;
}

.ai-mentor-sidebar {
  background: #ffffff;
  border: 1px solid #e1e8fb;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-mentor-sidebar h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.ai-mentor-sidebar p {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: #4b5563;
}

.ai-mentor-tips {
  margin: 0;
  padding-left: 16px;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
}

.ai-mentor-main {
  background: #ffffff;
  border: 1px solid #e1e8fb;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ai-chat-messages {
  flex: 1 1 auto;
  min-height: 320px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #d7e0f7;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fcfdff;
  box-shadow: inset 0 1px 2px rgba(12, 34, 80, 0.05);
  scrollbar-width: thin;
  scrollbar-color: #b7c5f0 #eef3ff;
}

#ai_assistant_messages::-webkit-scrollbar {
  width: 3px !important;
  height: 3px !important;
}

#ai_assistant_messages::-webkit-scrollbar-track {
  background: #eef3ff;
  border-radius: 4px;
}

#ai_assistant_messages::-webkit-scrollbar-thumb {
  background: #9fb0e9;
  border-radius: 4px;
}

#ai_assistant_messages::-webkit-scrollbar-thumb:hover {
  background: #6366f1;
}

.ai-chat-message {
  max-width: 88%;
  padding: 12px 14px;
  margin-bottom: 10px;
  border-radius: 12px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.07);
}

.ai-chat-message.user {
  margin-left: auto;
  background: linear-gradient(135deg, #5961f3 0%, #6c75ff 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-chat-message.assistant {
  margin-right: auto;
  background: #fff;
  color: #172033;
  border: 1px solid #e2e8f6;
  border-bottom-left-radius: 4px;
}

.ai-chat-message .role-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  margin-bottom: 5px;
  opacity: 0.95;
}

.ai-chat-message.user .role-label {
  color: rgba(255, 255, 255, 0.92);
}

.ai-chat-message.assistant .role-label {
  color: #64748b;
}

.ai-chat-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 6px;
}

.ai-chat-input-row input {
  border-radius: 10px;
  border: 2px solid #dbe3fb;
  padding: 10px 13px;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.ai-chat-input-row .btn-primary {
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border: none;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.32);
}

.ai-chat-input-row .btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
}

.ai-chat-quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.ai-chat-quick-prompts .ai-quick-prompt {
  width: 100%;
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid #dbe3fb;
  background: #ffffff;
  color: #334155;
  font-weight: 500;
  transition: all 0.18s;
}

.ai-chat-quick-prompts .ai-quick-prompt:hover {
  background: #f5f7ff;
  border-color: #b6c5fa;
  color: #312e81;
  transform: none;
}

.ai-chat-loading {
  font-style: italic;
  color: #64748b;
  font-size: 13px;
  padding: 6px 2px;
  min-height: 22px;
}

.ai-chat-loading::after {
  content: '';
  animation: ai-dots 1.2s steps(4, end) infinite;
}

@keyframes ai-dots {
  0%,
  20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%,
  100% {
    content: '...';
  }
}

.ai-assistant-modal-content .modal-footer {
  border-top: 1px solid #dce4f8;
  padding: 10px 14px;
  background: #f5f8ff;
}

.ai-assistant-modal-content .modal-footer .btn {
  border-radius: 10px;
  font-weight: 500;
}

.ai-assistant-modal-content .modal-footer .btn-default {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
}

.ai-assistant-modal-content .modal-footer .btn-default:hover {
  background: #eef3ff;
  border-color: #c7d5fb;
}

@media (max-width: 980px) {
  .ai-mentor-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .ai-mentor-main {
    order: 1;
  }
  .ai-mentor-sidebar {
    order: 2;
  }
  .ai-chat-quick-prompts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .ai-chat-quick-prompts .ai-quick-prompt {
    width: auto;
  }
}

/* Formatted assistant text: bold, code, partitions */
.ai-chat-message-body {
  word-wrap: break-word;
}

.ai-chat-message-body strong {
  font-weight: 700;
  color: inherit;
}

.ai-chat-message-body em {
  font-style: italic;
}

.ai-chat-message-body .ai-chat-inline-code,
.ai-chat-message-body code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.92em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-chat-message.user .ai-chat-message-body code {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.ai-chat-message-body .ai-chat-p {
  margin: 0 0 10px 0;
  line-height: 1.55;
}

.ai-chat-message-body .ai-chat-p:last-child {
  margin-bottom: 0;
}

.ai-chat-message-body .ai-chat-partition {
  margin-bottom: 12px;
  padding: 10px 12px 10px 14px;
  border-left: 4px solid #6366f1;
  border-radius: 0 8px 8px 0;
  background: rgba(99, 102, 241, 0.06);
  line-height: 1.5;
}

.ai-chat-message-body .ai-chat-partition:last-child {
  margin-bottom: 0;
}

.ai-chat-message-body .ai-chat-partition-num {
  font-weight: 700;
  color: #6366f1;
  margin-right: 4px;
}

/* Numbered steps: card + one row per sub-line */
.ai-chat-message-body .ai-chat-step {
  margin-bottom: 14px;
  padding: 12px 14px 12px 16px;
  border-left: 4px solid #6366f1;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.02) 55%, transparent 100%);
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.08);
}

.ai-chat-message-body .ai-chat-step:last-child {
  margin-bottom: 0;
}

.ai-chat-message-body .ai-chat-step-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 10px;
  line-height: 1.45;
  color: #1e293b;
}

.ai-chat-message-body .ai-chat-step-title .ai-chat-partition-num {
  font-weight: 800;
  color: #4f46e5;
  margin-right: 2px;
}

.ai-chat-message-body .ai-chat-substep-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-chat-message-body .ai-chat-substep {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  line-height: 1.55;
  color: #334155;
  font-size: 14px;
}

.ai-chat-message-body .ai-chat-substep:last-child {
  margin-bottom: 0;
}

.ai-chat-message-body .ai-chat-substep::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #818cf8, #6366f1);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
