/* ==========================================================================
   BACKBENCHERS AI ACADEMIC ASSISTANT - STYLES
   Designed for JNTUH B.Tech Results Portal
   ========================================================================== */

/* ---------- Floating Trigger Button ---------- */
#bb-ai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99990;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #18181b 0%, #09090b 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  border-radius: 9999px;
  color: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.7), 0 0 20px -3px rgba(255, 215, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

#bb-ai-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: #ffd700;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.8), 0 0 28px rgba(255, 215, 0, 0.4);
}

#bb-ai-launcher:active {
  transform: translateY(1px) scale(0.98);
}

.bb-ai-pulse-dot {
  position: relative;
  width: 10px;
  height: 10px;
  background-color: #22c55e;
  border-radius: 50%;
}

.bb-ai-pulse-dot::after {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.4);
  animation: bb-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes bb-pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 0; }
}

.bb-ai-bot-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ffd700;
  color: #000000;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* ---------- Chat Container Window ---------- */
#bb-ai-window {
  position: fixed;
  bottom: 86px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 120px);
  z-index: 99995;
  display: flex;
  flex-direction: column;
  background: rgba(13, 13, 16, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid rgba(255, 215, 0, 0.25);
  border-radius: 24px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.12);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #f4f4f5;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(0.96);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#bb-ai-window.bb-ai-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ---------- Chat Header ---------- */
.bb-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(24, 24, 27, 0.9) 0%, rgba(13, 13, 16, 0.6) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.bb-ai-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.bb-ai-avatar .bb-ai-status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2px solid #0d0d10;
  border-radius: 50%;
}

.bb-ai-header-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bb-ai-header-title .bb-badge {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: #ffd700;
  color: #000;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.bb-ai-header-sub {
  font-size: 10px;
  font-weight: 600;
  color: #a1a1aa;
  margin-top: 2px;
}

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

.bb-ai-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a1a1aa;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bb-ai-action-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 215, 0, 0.4);
}

/* ---------- Student Context Banner ---------- */
.bb-ai-context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255, 215, 0, 0.08);
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  font-size: 11px;
}

.bb-ai-context-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fef08a;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bb-ai-context-change {
  font-size: 10px;
  font-weight: 800;
  color: #ffd700;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  flex-shrink: 0;
}

/* ---------- Quick Prompt Chips / Suggestions ---------- */
.bb-ai-quick-pills {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  white-space: nowrap;
  background: rgba(18, 18, 22, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  scrollbar-width: none;
}

.bb-ai-quick-pills::-webkit-scrollbar {
  display: none;
}

.bb-ai-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(39, 39, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: #e4e4e7;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.bb-ai-pill-btn:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.5);
  color: #ffd700;
  transform: translateY(-1px);
}

/* ---------- Messages Feed ---------- */
.bb-ai-messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.bb-ai-messages-feed::-webkit-scrollbar {
  width: 6px;
}

.bb-ai-messages-feed::-webkit-scrollbar-track {
  background: transparent;
}

.bb-ai-messages-feed::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

.bb-ai-message {
  display: flex;
  gap: 10px;
  max-width: 94%;
  animation: bb-fadeIn 0.25s ease-out;
}

@keyframes bb-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.bb-ai-message-user .bb-ai-bubble {
  background: linear-gradient(135deg, #27272a 0%, #1f1f23 100%);
  border: 1px solid rgba(255, 215, 0, 0.35);
  color: #ffffff;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.bb-ai-message-bot {
  align-self: flex-start;
}

.bb-ai-message-bot .bb-ai-bubble {
  background: rgba(24, 24, 27, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f4f4f5;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.bb-ai-bubble {
  padding: 12px 15px;
  font-size: 13px;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.bb-ai-bubble p {
  margin: 0 0 8px 0;
}

.bb-ai-bubble p:last-child {
  margin-bottom: 0;
}

.bb-ai-bubble strong {
  color: #ffffff;
}

.bb-ai-bubble ul, .bb-ai-bubble ol {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.bb-ai-bubble li {
  margin-bottom: 4px;
}

.bb-ai-time {
  font-size: 9px;
  color: #71717a;
  margin-top: 4px;
  text-align: right;
}

/* ---------- Structured Cards & Analytics Inside Messages ---------- */
.bb-ai-card {
  background: rgba(15, 15, 18, 0.95);
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 10px 0;
}

.bb-ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bb-ai-card-title {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffd700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bb-ai-card-badge {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.bb-badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.bb-badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.bb-badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.bb-badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Micro Table */
.bb-ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 8px 0;
}

.bb-ai-table th {
  background: rgba(255, 255, 255, 0.04);
  color: #a1a1aa;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 9px;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bb-ai-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #d4d4d8;
}

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

/* Progress bar */
.bb-ai-prog-wrap {
  margin: 10px 0 6px 0;
}

.bb-ai-prog-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 4px;
}

.bb-ai-prog-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.bb-ai-prog-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s ease;
}

/* Action button inside message */
.bb-ai-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.bb-ai-btn-sm {
  padding: 6px 11px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 8px;
  color: #ffd700;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bb-ai-btn-sm:hover {
  background: #ffd700;
  color: #000000;
  transform: translateY(-1px);
}

/* Highlight boxes */
.bb-ai-alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.45;
  margin: 8px 0;
}

.bb-ai-alert-tip {
  background: rgba(255, 215, 0, 0.08);
  border-left: 3px solid #ffd700;
  color: #fef08a;
}

.bb-ai-alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  color: #fca5a5;
}

.bb-ai-alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-left: 3px solid #22c55e;
  color: #86efac;
}

/* ---------- Typing Indicator ---------- */
.bb-ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(24, 24, 27, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px 18px 18px 18px;
  width: fit-content;
}

.bb-ai-dot {
  width: 6px;
  height: 6px;
  background: #ffd700;
  border-radius: 50%;
  animation: bb-bounce 1.4s infinite ease-in-out both;
}

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

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

/* ---------- Input Area ---------- */
.bb-ai-input-area {
  padding: 12px 16px 14px 16px;
  background: rgba(18, 18, 22, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bb-ai-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(28, 28, 32, 0.9);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 4px 6px 4px 14px;
  transition: all 0.2s ease;
}

.bb-ai-input-wrapper:focus-within {
  border-color: #ffd700;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.2);
}

#bb-ai-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: #ffffff;
  font-family: inherit;
}

#bb-ai-input::placeholder {
  color: #71717a;
  font-size: 12px;
}

.bb-ai-send-btn {
  width: 36px;
  height: 36px;
  background: #ffd700;
  border: none;
  border-radius: 12px;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bb-ai-send-btn:hover {
  transform: scale(1.06);
  background: #fde047;
}

.bb-ai-mic-btn {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.bb-ai-mic-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.4);
}

.bb-ai-mic-btn.bb-ai-mic-active {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #f87171 !important;
  animation: bb-pulse-red 1.2s infinite ease-in-out;
}

@keyframes bb-pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* What-If Simulator Styling */
.bb-ai-sim-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.bb-ai-sim-select {
  background: #18181b;
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}

.bb-ai-sim-output {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 215, 0, 0.05) 100%);
  border: 1.5px dashed rgba(255, 215, 0, 0.5);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  margin-top: 10px;
}

/* Placement Readiness Badges */
.bb-ai-placement-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.bb-ai-placement-card {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.bb-ai-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  padding: 0 4px;
  font-size: 9px;
  color: #71717a;
}

/* ---------- Responsive Mobile Styles ---------- */
@media (max-width: 640px) {
  #bb-ai-launcher {
    bottom: 18px;
    right: 18px;
    padding: 10px 14px;
    font-size: 11px;
  }
  
  #bb-ai-launcher .bb-ai-label {
    display: none;
  }

  #bb-ai-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 88vh;
    max-height: 88vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
  }
}

/* ---------- Hide during printing ---------- */
@media print {
  #bb-ai-launcher,
  #bb-ai-window {
    display: none !important;
  }
}
