@import '../../styles/global.less';

.mdxToolbar {
  background: var(--mdx-bg-toolbar);
  border-bottom: 1px solid var(--mdx-border);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
}

.mdxToolbarLeft {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.mdxToolbarRight {
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.mdxViewToggle {
  background: var(--mdx-bg-body);
  padding: 3px;
  border-radius: 8px;
  display: flex;
  border: 1px solid var(--mdx-border);
}

.mdxViewOpt {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--mdx-text-muted);
  user-select: none;
  line-height: 1;

  &:hover {
    background: rgba(0,0,0,0.05);
  }

  &.active {
    background: var(--mdx-bg-surface);
    color: var(--mdx-text-main);
    box-shadow: var(--mdx-shadow-sm);
    font-weight: 500;
  }
}

.mdxSeparator {
  width: 1px;
  height: 24px;
  background: var(--mdx-border);
  margin: 0 4px;
  flex-shrink: 0;
}

.mdxToolBtn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--mdx-text-muted);
  min-width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.15s ease;
  position: relative;

  &:hover {
    background: var(--mdx-bg-body);
    color: var(--mdx-text-main);
    border-color: var(--mdx-border);
  }
}

.mdxToolBtn.active {
  background: var(--mdx-active-bg, rgba(37, 99, 235, 0.1));
  color: var(--mdx-primary);
  border-color: var(--mdx-active-border, rgba(37, 99, 235, 0.2));
}

.mdxFileInput {
  display: none;
}

.linkModalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.linkModal {
  background: var(--mdx-bg-surface);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  width: 400px;
  max-width: 90vw;
  overflow: hidden;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.linkModalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--mdx-border);
  font-weight: 600;
  font-size: 15px;
  color: var(--mdx-text-main);
}

.linkModalClose {
  background: transparent;
  border: none;
  color: var(--mdx-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;

  &:hover {
    background: var(--mdx-bg-body);
    color: var(--mdx-text-main);
  }
}

.linkModalBody {
  padding: 20px;
}

.linkInput {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--mdx-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--mdx-text-main);
  background: var(--mdx-bg-body);
  outline: none;
  transition: all 0.2s;

  &::placeholder {
    color: var(--mdx-text-muted);
  }

  &:focus {
    border-color: var(--mdx-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }
}

.linkModalFooter {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--mdx-border);
  background: var(--mdx-bg-body);
}

.linkBtnCancel {
  padding: 8px 16px;
  border: 1px solid var(--mdx-border);
  border-radius: 6px;
  background: var(--mdx-bg-surface);
  color: var(--mdx-text-main);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;

  &:hover {
    background: var(--mdx-bg-body);
  }
}

.linkBtnConfirm {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: var(--mdx-primary);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;

  &:hover {
    background: var(--mdx-primary-hover);
  }
}