/* Full-page embedded Moodle dashboard + compact app bottom bar */
:root {
  --gtu-bottom-bar-height: 52px;
}

.gtu-live-dashboard {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #f3f3ff;
}

.moodle-dashboard-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: #f3f3ff;
}

.moodle-dashboard-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f3f3ff;
}

.moodle-dashboard-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #f3f3ff;
  color: #171844;
  font-family: 'FiraGo', sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.moodle-dashboard-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #d8ccff;
  border-top-color: #8462ff;
  border-radius: 50%;
  animation: moodle-dashboard-spin 0.8s linear infinite;
}

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

/* Rebuild-owned bottom bar. It lives below the viewport until the pointer
   reaches the bottom hover strip, then fades/slides in. */
.gtu-bottom-trigger {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  height: 16px;
}

.gtu-bottom-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: var(--gtu-bottom-bar-height);
  padding: 0 16px;
  background: #f7f7f7;
  box-shadow: 0 -8px 24px rgba(23, 24, 68, 0.08);
  font-family: 'FiraGo', sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(100%);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 0s linear 220ms;
}

.gtu-bottom-bar.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity 180ms ease,
    transform 220ms ease,
    visibility 0s;
}

@media (max-width: 575px) {
  .gtu-bottom-bar {
    padding: 0 12px;
  }
}

/* AI assistant */
.gtu-assistant {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  font-family: 'FiraGo', sans-serif;
}

.gtu-assistant-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 360px;
  min-width: 0;
}

.gtu-bottom-bar .gtu-assistant-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  height: 34px;
  line-height: 32px;
  padding: 0 11px;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  background: #fff;
  color: #171844;
  font-family: 'FiraGo', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.gtu-assistant-input::placeholder {
  color: #8b8b99;
}

.gtu-assistant-input:focus {
  border-color: #8462ff;
  box-shadow: 0 0 0 2px rgba(132, 98, 255, 0.14);
}

.gtu-assistant-send,
.gtu-assistant-icon-button {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  background: #fff;
  color: #171844;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.gtu-bottom-bar .gtu-assistant-send {
  border-color: #d5d5d5 !important;
  background: #fff !important;
  color: #6b6b78 !important;
}

.gtu-bottom-bar .gtu-assistant-send:hover:not(:disabled) {
  border-color: #b5b5b5 !important;
  background: #f1f1f1 !important;
  color: #4e4e4e !important;
}

.gtu-bottom-bar .gtu-assistant-send svg {
  stroke: #6b6b78 !important;
}

.gtu-assistant-send:disabled {
  opacity: 0.45;
  cursor: default;
}

.gtu-assistant-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gtu-assistant-icon-button:hover,
.gtu-assistant-icon-button.is-active {
  border-color: #b9a4ff;
  background: #f3f0ff;
  color: #5b3ae0;
}

.gtu-assistant-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gtu-assistant-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.gtuassistant-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: #4e4e4e;
  font-family: 'FiraGo', sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.gtuassistant-check input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #8462ff;
}

.gtu-assistant-settings-wrap {
  position: relative;
  flex: 0 0 auto;
}

.gtu-assistant-preview-wrap {
  position: relative;
  flex: 2 1 520px;
  min-width: 160px;
  max-width: none;
}

.gtu-assistant-preview {
  display: block;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #4e4e4e;
  font-family: 'FiraGo', sans-serif;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  text-overflow: clip;
  white-space: nowrap;
  cursor: pointer;
  scrollbar-width: none;
}

.gtu-assistant-preview::-webkit-scrollbar {
  display: none;
}

.gtu-assistant-preview:hover,
.gtu-assistant-preview:focus-visible {
  background: transparent !important;
  color: #5b3ae0;
}

.gtu-assistant-preview.is-error {
  color: #b42318;
}

/* popovers sit above the bar, not centered or fullscreen */
.gtu-assistant-settings,
.gtu-assistant-answer {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  z-index: 10001;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(23, 24, 68, 0.18);
  color: #171844;
}

.gtu-assistant-settings {
  width: 380px;
  max-height: min(70vh, 620px);
  overflow-y: auto;
  padding: 16px;
}

.gtu-assistant-answer {
  width: min(460px, calc(100vw - 24px));
  max-height: min(46vh, 420px);
  overflow-y: auto;
  padding: 12px 14px;
}

.gtuassistant-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.gtuassistant-panel-head h2 {
  margin: 1px 0 0;
  color: #171844;
  font-family: 'FiraGO-Bold', 'FiraGo', sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.gtuassistant-kicker {
  margin: 0;
  color: #8462ff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gtu-assistant-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: #f1f1f1;
  color: #4e4e4e;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.gtu-assistant-close:hover {
  background: #e6e6e6;
  color: #171844;
}

.gtuassistant-note {
  margin: 12px 0 14px;
  color: #6b6b78;
  font-size: 11px;
  line-height: 1.5;
}

.gtuassistant-field {
  display: block;
  margin: 0 0 9px;
}

.gtuassistant-field > span {
  display: block;
  margin-bottom: 4px;
  color: #4e4e4e;
  font-size: 11px;
  font-weight: 600;
}

.gtuassistant-field input,
.gtuassistant-field select {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid #d5d5d5;
  border-radius: 3px;
  background: #fff;
  color: #171844;
  font-family: 'FiraGo', sans-serif;
  font-size: 12px;
  outline: none;
}

.gtuassistant-field input:focus,
.gtuassistant-field select:focus {
  border-color: #8462ff;
  box-shadow: 0 0 0 2px rgba(132, 98, 255, 0.12);
}

.gtuassistant-provider {
  margin: 14px 0 0;
  padding: 11px 0 0;
  border: 0;
  border-top: 1px solid #e6e6e6;
}

.gtuassistant-provider legend {
  color: #171844;
  font-family: 'FiraGO-Bold', 'FiraGo', sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.gtuassistant-server-key {
  margin: 0 0 9px;
  padding: 8px 9px;
  border: 1px solid #cfe8d8;
  border-radius: 3px;
  background: #f4fbf6;
  color: #207a43;
  font-family: 'FiraGo', sans-serif;
  font-size: 11px;
  font-weight: 600;
}

.gtuassistant-hint {
  margin: -3px 0 9px;
  color: #6b6b78;
  font-size: 10px;
  line-height: 1.4;
}

.gtuassistant-key-link {
  display: inline-block;
  margin-top: 2px;
  color: #5b3ae0;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.gtuassistant-key-link:hover {
  text-decoration: underline;
}

.gtuassistant-context {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #e6e6e6;
}

.gtuassistant-context-title {
  display: block;
  margin-bottom: 8px;
  color: #171844;
  font-family: 'FiraGO-Bold', 'FiraGo', sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.gtuassistant-context .gtuassistant-check {
  display: flex;
  margin-bottom: 7px;
  font-size: 12px;
  white-space: normal;
}

.gtuassistant-done {
  width: 100%;
  text-transform: none;
  height: 33px;
  margin-top: 8px;
  border: 1px solid #8462ff;
  border-radius: 3px;
  background: #8462ff;
  color: #fff;
  font-family: 'FiraGo', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.gtuassistant-done:hover {
  border-color: #6d4df6;
  background: #6d4df6;
}

.gtuassistant-answer-title {
  color: #171844;
  font-family: 'FiraGO-Bold', 'FiraGo', sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.gtuassistant-answer-body {
  margin-top: 8px;
  color: #3c3f60;
  font-family: 'FiraGo', sans-serif;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gtuassistant-answer-error {
  margin: 0;
  color: #b42318;
}

.gtuassistant-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #6b6b78;
}

.gtuassistant-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d8ccff;
  border-top-color: #8462ff;
  border-radius: 50%;
  animation: gtuassistant-spin 0.8s linear infinite;
}

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

/* Hide the quick context toggles when the bar gets narrow; they remain in settings. */
@media (max-width: 980px) {
  .gtu-assistant-options {
    gap: 6px;
  }

  .gtu-assistant-options .gtuassistant-check {
    gap: 0;
  }

  .gtu-assistant-options .gtuassistant-check span {
    display: none;
  }

  .gtu-assistant-preview-wrap {
    flex: 1 1 320px;
    min-width: 120px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .gtu-assistant {
    gap: 6px;
  }

  .gtu-assistant-preview-wrap {
    flex: 0 1 120px;
    min-width: 80px;
    max-width: 120px;
  }

  .gtu-assistant-preview {
    font-size: 11px;
  }

  .gtu-assistant-settings {
    width: calc(100vw - 24px);
    max-height: 68vh;
  }

  .gtu-assistant-answer {
    width: calc(100vw - 24px);
    max-height: 52vh;
  }
}
