/* ============================================================
   grade-advisor.css — Floating grade advisor chat widget
   ============================================================ */

/* ----------------------------------------------------------
   Widget host — fixed overlay anchor
   ---------------------------------------------------------- */

#grade-advisor-widget {
  position: fixed;
  z-index: 1000;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ----------------------------------------------------------
   FAB — floating action button
   ---------------------------------------------------------- */

.ga-fab {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35), 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1;
}

.ga-fab:hover {
  background: var(--color-primary-dark);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45), 0 2px 10px rgba(0, 0, 0, 0.45);
  transform: translateY(-1px);
}

.ga-fab:active {
  transform: translateY(0);
}

.ga-fab-label {
  /* inherits from .ga-fab; kept as a hook for JS show/hide */
}

/* ----------------------------------------------------------
   Chat panel
   ---------------------------------------------------------- */

.ga-panel {
  display: flex;
  flex-direction: column;
  width: 360px;
  max-height: 500px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 2px 12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  margin-bottom: 12px;
}

@media (max-width: 480px) {
  .ga-panel {
    width: calc(100vw - 48px);
  }
}

/* ----------------------------------------------------------
   Panel header
   ---------------------------------------------------------- */

.ga-panel-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  flex-shrink: 0;
}

.ga-panel-title {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 0.9375rem;
}

.ga-panel-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.ga-panel-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

/* ----------------------------------------------------------
   Icon button (clear, close, etc.)
   ---------------------------------------------------------- */

.ga-btn-icon {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.ga-btn-icon:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-elevated);
}

/* ----------------------------------------------------------
   Messages scrollable area
   ---------------------------------------------------------- */

.ga-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  /* Custom scrollbar for dark theme */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.ga-messages::-webkit-scrollbar {
  width: 4px;
}

.ga-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ga-messages::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

/* ----------------------------------------------------------
   Message row
   ---------------------------------------------------------- */

.ga-message {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
}

.ga-message--user {
  flex-direction: row-reverse;
}

/* ----------------------------------------------------------
   Message bubble
   ---------------------------------------------------------- */

.ga-message-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
}

.ga-message--assistant .ga-message-bubble {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  border-radius: 4px 16px 16px 16px;
}

.ga-message--user .ga-message-bubble {
  background: var(--color-primary);
  color: #ffffff;
  border-radius: 16px 4px 16px 16px;
}

/* ----------------------------------------------------------
   Loading indicator (three bouncing dots)
   ---------------------------------------------------------- */

.ga-loading {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.ga-loading span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
  animation: ga-bounce 1s infinite ease-in-out;
}

.ga-loading span:nth-child(2) {
  animation-delay: 0.15s;
}

.ga-loading span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ga-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
}

/* ----------------------------------------------------------
   Input row
   ---------------------------------------------------------- */

.ga-input-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--spacing-2);
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   Text input
   ---------------------------------------------------------- */

.ga-input {
  flex: 1;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  color: var(--color-text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
  line-height: 1.5;
  min-width: 0;
}

.ga-input::placeholder {
  color: var(--color-text-muted);
}

.ga-input:focus {
  border-color: var(--color-primary);
}

/* ----------------------------------------------------------
   Send button
   ---------------------------------------------------------- */

.ga-send-btn {
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, opacity 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}

.ga-send-btn:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.ga-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
