/**
 * GMP Custom Editor Styles
 * Version: 1.2.0
 */

/* Remove parent wrap border and shadow */
.question__answer-wrap {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: transparent !important;
}

/* Toolbar */
#gmp-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  background: #f8f9fa;
  border: 1.5px solid #e0e0e0;
  border-bottom: 1px solid #eee;
  border-radius: 10px 10px 0 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0 !important;
}

#gmp-editor-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  line-height: 1;
}

#gmp-editor-toolbar button:hover {
  background: #e8e8e8;
  color: #1d1d1f;
}

#gmp-editor-toolbar button.active {
  background: #00dffc22;
  color: #00b8d4;
}

#gmp-editor-toolbar button svg {
  width: 16px;
  height: 16px;
}

.gmp-toolbar-sep {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 4px;
}

/* Editor area */
.question__answer[contenteditable="true"] {
  border: 1.5px solid #e0e0e0 !important;
  border-top: none !important;
  border-radius: 0 0 10px 10px !important;
  padding: 16px !important;
  margin: 0 !important;
  min-height: 120px !important;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  color: #1d1d1f !important;
  outline: none !important;
  background: #fff !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  box-shadow: none !important;
  position: relative !important;
}

/* Focus state */
.question__answer-wrap:focus-within #gmp-editor-toolbar {
  border-color: #00dffc !important;
  border-bottom-color: #eee !important;
}

.question__answer-wrap:focus-within .question__answer[contenteditable="true"] {
  border-color: #00dffc !important;
  border-top: none !important;
  box-shadow: none !important;
}

/* Placeholder */
.question__answer.gmp-editor-empty::before {
  content: "Type your answer here...";
  color: #bbb;
  pointer-events: none;
  font-style: italic;
  position: absolute;
}

/* Images inside editor */
.question__answer img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 8px;
  margin: 12px 0;
}

/* Lists inside editor */
.question__answer ul,
.question__answer ol {
  padding-left: 24px !important;
  margin: 8px 0 !important;
}

.question__answer li {
  margin-bottom: 4px;
}

/* Upload placeholder / spinner */
.gmp-upload-placeholder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 8px;
  color: #666;
  font-size: 14px;
  margin: 8px 0;
}

.gmp-upload-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #e0e0e0;
  border-top-color: #00dffc;
  border-radius: 50%;
  animation: gmp-spin 0.7s linear infinite;
}

@keyframes gmp-spin {
  to { transform: rotate(360deg); }
}

/* Toast notification */
.gmp-editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1d1d1f;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.gmp-editor-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hide TinyMCE remnants */
.tox.tox-tinymce,
.tox-tinymce-aux,
.tox .tox-editor-header,
.tox-notifications-container,
.mce-content-body::before {
  display: none !important;
}

/* Fix: Hide rogue editor on area intro/landing pages */
.intro__wrapper .question__answer-wrap {
  display: none !important;
}