/* Редактор АОСР — отдельное окно поверх чата / объекта */

.aosr-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.aosr-editor-modal[hidden] {
  display: none !important;
}

.aosr-editor-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(4px);
}

.aosr-editor-modal__shell {
  position: relative;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--haze-surface, #141a24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

body.light-theme .aosr-editor-modal__shell {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.1);
}

.aosr-editor__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.aosr-editor__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.aosr-editor__subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.72;
}

.aosr-editor__close {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
}

.aosr-editor__layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 720px) {
  .aosr-editor__layout {
    grid-template-columns: 1fr;
  }
  .aosr-editor__tutorial {
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    max-height: 140px;
    overflow-y: auto;
  }
}

.aosr-editor__tutorial {
  padding: 14px 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.15);
}

.aosr-editor__tutorial h4 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.65;
}

.aosr-editor__step {
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  line-height: 1.45;
}

.aosr-editor__step strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.aosr-editor__step--active {
  outline: 1px solid rgba(96, 165, 250, 0.5);
  background: rgba(59, 130, 246, 0.12);
}

.aosr-editor__body {
  overflow-y: auto;
  padding: 14px 18px 18px;
}

.aosr-editor__picker {
  display: grid;
  gap: 8px;
}

.aosr-editor__tpl-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
}

.aosr-editor__tpl-btn:hover {
  border-color: rgba(96, 165, 250, 0.45);
}

.aosr-editor__tpl-btn small {
  display: block;
  margin-top: 4px;
  opacity: 0.65;
  font-size: 11px;
}

.aosr-editor__section {
  margin-bottom: 18px;
}

.aosr-editor__section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.8;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.aosr-editor__field {
  margin-bottom: 12px;
}

.aosr-editor__label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  opacity: 0.75;
}

.aosr-editor__input,
.aosr-editor__textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font: inherit;
  font-size: 14px;
}

body.light-theme .aosr-editor__input,
body.light-theme .aosr-editor__textarea {
  background: #fff;
}

.aosr-editor__textarea {
  min-height: 72px;
  resize: vertical;
}

.aosr-editor__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.aosr-editor__btn {
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
}

.aosr-editor__btn--primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.aosr-editor__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aosr-editor__status {
  margin-right: auto;
  font-size: 13px;
  opacity: 0.8;
  align-self: center;
}

.aosr-editor__status--error {
  color: #f87171;
}

.aosr-tool-btn {
  width: 100%;
  margin-top: 8px;
}

.aosr-tool-btn .gw-tool__ico {
  color: #60a5fa;
}
